# InfyTQ Control Structures (Python) Quiz 1

Question 1

Time: 00:00:00
```arr = ['pq', 'rs']
for z in arr:
z.upper()
print(arr)

Predict the output of the following code.```

['pq', 'rs']

['pq', 'rs']

['PQ', 'RS']

['PQ', 'RS']

['PQ', 'rs']

['PQ', 'rs']

None of these

None of these

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

Start

Question 2

Time: 00:00:00
```string="hello"
count=0
for z in string:
if(z!="l"):
count=count+1
else:
pass
print(count)

What is the output of the following code?```

2

2

3

3

4

4

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

Start

Question 3

Time: 00:00:00
num = 1

while True:

if num%4 == 0:

break

print(num,end=" ")

num+=1

What is the output?

1 2 3

1 2 3

1 3

1 3

0

0

0 3

0 3

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

Start

Question 4

Time: 00:00:00
How many times the loop will run, for z in range(-3)?

1

1

2

2

Infinite

Infinite

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

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.

Start

Question 6

Time: 00:00:00
num = 1

while True:

if num%0O5 == 0:

break

print(num, end=" ")

num += 1

The output of the code will be:

1 2 3 4

1 2 3 4

0 1 2 3

0 1 2 3

None of these.

None of these.

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

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.

Start

Question 8

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

While z in string:

print(z, end=" ")

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.

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.

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.

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%