InfyTQ Control Structures (Python) Quiz 1

Question 1

Time: 00:00:00
A loop becomes infinite loop if a condition never becomes ________

False

False

True

True

True or NULL

True or NULL

Null

Null

Question 2

Time: 00:00:00
Python programming language allows to use one loop inside another loop known as?

switch

switch

nested

nested

foreach

foreach

forall

forall

Question 3

Time: 00:00:00
Does python have switch case statement?

False

False

True

True

Python has switch statement but we can not use it.

Python has switch statement but we can not use it.

None of the mentioned

None of the mentioned

Question 4

Time: 00:00:00
Can we write if/else into one line in python?

Yes

Yes

No

No

if/else not used in python

if/else not used in python

None

None

Question 5

Time: 00:00:00
What is an iteration in programming?

Variable

Variable

Steps counter

Steps counter

Fixed value

Fixed value

Random value

Random value

Question 6

Time: 00:00:00
What will be output of this expression:
'p' + 'q' if '12'.isdigit() else 'r' + 's'

pq

pq

rs

rs

pqrs

pqrs

pq12

pq12

Question 7

Time: 00:00:00
False = True
while True:
    print(False)
    True = False
   break

Predict the output:

True

True

False

False

1

1

None of these.

None of these.

Question 8

Time: 00:00:00
string = "abcdef"
While z in string:
    print(z, end=" ")

Guess the output :

a b c d e f

a b c d e f

abcdef

abcdef

Error

Error

None of these

None of these

Question 9

Time: 00:00:00
string = "abcdef"

z = "a"
while z in string:
    print(z, end = " ")

The output of the code will be:

z z z z ……

z z z z ……

a a a a a……..

a a a a a……..

a b c d e f  

a b c d e f  

abcdef

abcdef

Question 10

Time: 00:00:00
string = 'abcd'

for z in range(string):

    print(z)

Predict the output.

abcd

abcd

a b c d

a b c d

Error

Error

None of these

None of these

null
null