# InfyTQ Control Structures (Python) Quiz 2

Question 1

Time: 00:00:00
el = 'abcd'

for z in range(len(el)):

el = 'a'

print(el,end=" ")

. The output of the following code will be:

a a a a

a a a a

a b c d

a b c d

aaaa

aaaa

abcd

abcd

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

Start

Question 2

Time: 00:00:00
dictionary = {0: 'a', 1: 'b', 2: 'c'}

for z in dictionary:

print(z,end=" ")

0 1 2

0 1 2

a b c

a b c

0 a, 1 b, 2 c

0 a, 1 b, 2 c

Error

Error

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

Start

Question 3

Time: 00:00:00
```dictionary = {11: 'x', 12: 'y', 13: 'z'}
for a, b in dictionary.items():
print(a, b,end=" ")```

Predict output of the following code

11 12 13

11 12 13

11 x 12 y 13 z

11 x 12 y 13 z

11: x, 12: y, 13: z

11: x, 12: y, 13: z

x y z

x y z

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

Start

Question 4

Time: 00:00:00
dictionary = {0, 1, 2}

for z in dictionary.values():

print(z,end=” “)

Predict the output!

0 1 2

0 1 2

0 0 0

0 0 0

Error

Error

Null

Null

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

Start

Question 5

Time: 00:00:00
The output of the following code will be:

for z in range(0):

print(z)

1

1

No output

No output

Error

Error

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

Start

Question 6

Time: 00:00:00
What will be the output of the following code:

for sli in [1, 2, 3, 4][::-1]:

print(sli,end=" ")

1 2 3 4

1 2 3 4

4 3 2 1

4 3 2 1

Error

Error

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

Start

Question 7

Time: 00:00:00
Predict the Output of the following code:

for z in ''.join(reversed(list('abcd'))):

print (z, end=" ")

a b c d

a b c d

d c b a

d c b a

Error

Error

None of the above

None of the above

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

Start

Question 8

Time: 00:00:00
For the following code what will be the output:

for z in 'abcd'[::-1]:

print (z,end=” “)

abcd

abcd

dcba

dcba

a b c d

a b c d

d c b a

d c b a

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

Start

Question 9

Time: 00:00:00
Predict the output of the following code:

num = 2

for z in range(num):

num += 1

print (num, end=" ")

3 4 5

3 4 5

3 4

3 4

3

3

Error.

Error.

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

Start

Question 10

Time: 00:00:00
The output of the code will be

arr = [0, 1, 2, 3]

for arr[-1] in arr:

print(arr[-1],end=" ")

3 3 3

3 3 3

3 2 1

3 2 1

0 1 2 2

0 1 2 2

3 2 1 0

3 2 1 0

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

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%