Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 (1 point) In a flow chart, the _________ symbol is used to indicate a

ID: 3902517 • Letter: Q

Question

Question 1 (1 point)

In a flow chart, the _________ symbol is used to indicate a test condition.

a

oval

b

rectangle

c

diamond

d

parallelepiped

Question 2 (1 point)

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

Question 3 (1 point)

Fill in the blank to make the while loop iterate one million times.
i = 0
while ________:
# loop body statements go here
i = i + 1

a

i <= 1000000

b

i < 1000000

c

i != 100000

d

i is not a larch

Question 4 (1 point)

What is the output of the following code is z is -1?

x = 0

y = 5

z = -1

while x < y:

   if x == z:

       print('x == z')

       break

   x += 1

else:

   print('x == y')

a

x == z

b

x == y

c

0

d

The program is an infinite loop

Question 5 (1 point)

The last statement to be printed from the following code segment will be _______.
for i in range(6):
print(i)

a

0

b

3

c

4
*d.5

Question 6 (1 point)

The second to last statement printed by the following code snippet will be ________.

letter1 = 'a'

letter2 = '?'

while letter1 <= 'z': # Outer loop

   letter2 = 'a'

   while letter2 <= 'z': # Inner loop

       print('%s%s.com' % (letter1, letter2))

       letter2 = chr(ord(letter2) + 1)

   letter1 = chr(ord(letter1) + 1)

a

zy.com

b

zz.com

c

zx.com

d

yz.com

Question 7 (1 point)

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: '))

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

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

Question 8 (1 point)

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!

Question 9 (1 point)

The sequence of numbers generated by range(5,0,-2) will be _________:

a

-2,-1,0,1,2,3,4

b

0,1,2,3,4

c

5,3,1

d

5,3,1,-1

Question 10 (1 point)

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.

a

oval

b

rectangle

c

diamond

d

parallelepiped

Explanation / Answer

We are instructed to provide the answer to 4 parts of any given question. Please do not downvote the answer for that reason. If the answer has helped you, kindly give a positive rating.

1. C. Diamond

The diamond shape is used to test a condition.

2. B. i <= 1000000

This will be the case because i will need to be less than or equal to 1 million in order to iterate the loop 1 million time.

3. (the question is the same as question 2)

4. B. x == y

This is because in the while loop, if x==z would never be a true condition, therefore, the loop would print the else statement instead.

5. D. 5

Since we will be printing the range till 6, it will start from 0 to 1,2,3,4,5 making 5 the last statement to be printed.