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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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.

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

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

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%

Comments