MQ 1st Semester

¡Supera tus tareas y exámenes ahora con Quizwiz!

The name of the function partially shown below is user_name. def log_user_in(user_name): True False

False

What does the following program print? for i in range(2): for j in range(2): print i + j 0 1 1 2 0112 0 1 0 1 0101

a. 0 1 1 2

What does the following program print? for i in range(2): for j in range(2): print(i + j) a. 0 1 1 2 b. 0112 c. 0 1 0 1 d. 0101

a. 0 1 1 2

What does this function do? def mystery_function(): for i in range(10): color("green") forward(100) Draws a green line that is longer than 100 units long. Draws a green line that is less than 100 units long. Draws a green line that is 100 units long Draws a black line that is longer than 100 units long.

a. Draws a green line that is longer than 100 units long.

Which of the following statements is true about for loops? I. By default, the range function starts at 0II. Using for i in range(4) will result in i taking the values 0, 1, 2, 3, 4III. For loops let you repeat something any number of timesIV. Statements in a for loop do not need to be indented I, III II, III III only I, II, III, IV

a. I, III

What does the following program print? for i in range(2): for j in range(2): print(i + j) 0 1 1 2 0112 0 1 0 1 0101

a. The program turns Tracy completely around twice.

What does the following Python program do? for i in range(8): left(90) The program turns Tracy completely around twice. The program turns Tracy completely around once. The program turns Tracy completely around eight times. The program turns Tracy completely around four times.

a. The program turns Tracy two full circles.

What does this program print? for i in range(10): if i == 3: continue print i 0 1 2 0 1 2 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3

b. 0 1 2 4 5 6 7 8 9

What is the value of sum when this loop completes? sum = 0 for i in range(3): sum = sum + 5 for j in range(2): sum = sum - 1 8 9 20 0

b. 9

Which of the following statements about compression are true?I. Compression is only useful when transferring files over a network.II. After a file is compressed, it can never be restored to its original state without some loss of information or quality.III. In some situations it is more appropriate to use lossy data compression rather than lossless data compression. I only I and II only III only II and III only Answered

c.

What does this code display? for i in range(4):print("*") 0123 **** (4 asterisks) **** 0123

c. ****

In the following code block, assume that the variables Rainy and tooCold are boolean. IF (NOT (Rainy OR tooCold)) { DISPLAY("It's a good beach day") } Which of the following are equivalent to the above code block? IF (( NOT rainy) OR (NOT tooCold)) { DISPLAY("It's a good beach day") } IF (( NOT rainy) AND tooCold) { DISPLAY("It's a good beach day") } IF (( NOT rainy) AND (NOT tooCold)) { DISPLAY("It's a good beach day") } IF (rainy AND tooCold) { DISPLAY("It's a good beach day") }

c. IF (( NOT rainy) AND (NOT tooCold)) { DISPLAY("It's a good beach day") }

How many lines does the following program print? for i in range(3): for j in range(5): print "hi" 3 5 8 15

d. 15

What would this program print? def mystery(num, pattern): result = "" for i in range(num): result = result + pattern return result print mystery(3, "<>") It doesn't print anything <> <><><><> <><><>

d. <><><>

Which of the following is a true statement about data compression? Data compression is only useful for files being transmitted over the Internet. Regardless of the compression technique used, once a data file is compressed, it cannot be restored to its original state. Sending a compressed version of a file ensures that the contents of the file cannot be intercepted by an unauthorized user. There are trade-offs involved in choosing a compression techniques for storing and transmitting data.

d. There are trade-offs involved in choosing a compression techniques for storing and transmitting data.

What value of A would make the output of the logic circuit false? true false The output will be false no matter what the value of A is There is no value of A such that the output of the logic circuit will be false

d. There is no value of A such that the output of the logic circuit will be false

In the process of digging, a landscaping company cuts a fiber line. Transmission of Internet traffic is still possible through additional pathways that provide alternate routes between the source and destination. The additional pathways describe a concept known as: bandwidth hierarchy latency redundancy

d. redundancy


Conjuntos de estudio relacionados

Molecular Biology of the Cell Chapter 15 Part 1

View Set

Operations Management - Chapter 3

View Set

NUR 212 EAQ - Chapter 34: Heart Failure

View Set

Listening Activity - What did you do on the weekend

View Set

Biomechanics - Force, impulse and linear momentum

View Set

Exercise 7 - separating organic compounds

View Set

Planning 3: Comprehensive Planning Process

View Set

Chapter 9 Recording and Reporting

View Set

Human Growth and Development Chapter 5&6

View Set

Invitation to Computer Science Chapter-12

View Set

Reduction of Risk/Physiological Adaptation (Week 3)

View Set

Micro 1113 more practice questions

View Set