Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 (1 point) In a flow chart, the _________ symbol is used to indicate a test condition. a oval b rectangle c diamond d

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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago