Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

A while loop that has a test condition that is always false. a is an infinite loop b is a program error c never executes d only executes the first...

A while loop that has a test condition that is always false.

 a

is an infinite loop

 b

is a program error

 c

never executes

 d

only executes the first statement in the body.

What is the output of the following code?

i1 = 1

while i1 < 20:

i2 = 4

while i2 <= 9:

print('%d%d' % (i1,i2), end=' ')

i2 = i2 + 3

i1 = i1 + 9

 a

13 16 19 113 116 119

 b

The larch

 c

14 17 104 107 194 197

 d

I hate spam!

Consider the following code snippet. If num_a is 24 and num_b is 72, then the output will be _____.

num_a = int(input('Enter first positive integer:n'))

num_b = int(input('Enter second positive integer:n'))

while num_a != num_b:

if num_b > num_a:

num_b = num_b - num_a

else:

num_a = num_a - num_b

print('GCD is %d' % num_a)

 a

The larch

 b

24

 c

12

 d

6

The second line printed out from the following code snippet will be ________.

fruits = ['banana','apple','mango']

for index in range(len(fruits)):

print 'Current fruit :', fruits[index]

 a

Current fruit: banana

 b

Current fruit: apple

 c

Current fruit: mango

 d

The larch!

The fourth line printed out from the following code snippet will be _________.

for i in range(100,0,-10):

print(i)

 a

80

 b

70

 c

60

 d

50

Fill in the blank to make the while loop iterate one million times.

i = 1

while ________ :

# loop body statements go here

i = i + 1

 a

i <= 1000001

 b

i <= 1000000

 c

i != 100000

 d

i is not a larch

Fill in the blank to make the while loop iterate one million times.

i = 1

while ________:

# loop body statements go here

i = i + 1

 a

i < 1000001

 b

i <= 1000000

 c

i != 100000

 d

i is spam

A break statement in a nested while loop _________:

 a

exits the inner most loop

 b

exits the outer most loop

 c

skips to the next statement

 d

causes a program error

Given the following code, how many times will the inner loop body execute?

for i in range(3):

for j in range(2):

# Inner loop body

~Correct! The inner loop body will execute six times.

 a

5

 b

4

 c

6

 d

7

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question