Question 1 of 25
Hints left: 3
Q1
What will be the output of the following Python code? string = "my name is x" for i in string.split(): print (i, end=", ")
-
A
-
B
-
C
-
D
Q2
What will be the output of the following Python code? for i in range(5): if i == 5: break else: print(i) else: print("Here")
Q3
What is the output of the following code snippet: for i in range(1, 5, 2): print(i)
Q4
What will be the output of the following Python code? x = 123 for i in x: print(i)
Q5
What is the output of the following code snippet: count = 0 while count < 3: print("Hello") count += 1
Q6
What will be the output of the following Python code? for i in range(int(2.0)): print(i)
Q7
What will be the output of the following Python code snippet? for i in ''.join(reversed(list('abcd'))): print (i)
Q8
What will be the output of the following Python code snippet? a = [0, 1, 2, 3] for a[-1] in a: print(a[-1])
Q9
What will be the output of the following Python code? x = (i for i in range(3)) for i in x: print(i)
Q10
What will be the output of the following Python code snippet? for i in 'abcd'[::-1]: print (i)
Q11
What will be the output of the following Python code snippet? string = "my name is x" for i in ' '.join(string.split()): print (i, end=", ")
-
A
-
B
-
C
-
D
Q12
What will be the output of the following Python code? for i in range(10): if i == 5: break else: print(i) else: print("Here")
Q13
What will be the output of the following Python code snippet? for i in '': print (i)
Q14
What will be the output of the following Python code snippet? for i in [1, 2, 3, 4][::-1]: print (i)
Q15
What will be the output of the following Python code snippet? a = [0, 1, 2, 3] for a[0] in a: print(a[0])
Q16
What will be the output of the following Python code? string = "my name is x" for i in string: print (i, end=", ")
-
A
-
B
-
C
-
D
Q17
What will be the output of the following Python code snippet? a = [0, 1, 2, 3] i = -2 for i not in a: print(i) i += 1
Q18
What will be the output of the following Python code? for i in range(2.0): print(i)
Q19
What will be the output of the following Python code snippet? x = 2 for i in range(x): x -= 2 print (x)
Q20
What will be the output of the following Python code? x = (i for i in range(3)) for i in x: print(i) for i in x: print(i)
Q21
In Python, which loop is suitable for cases where you need to execute a block of code multiple times until a condition is met?
Q22
What will the following loop print: for i in range(3): print(i)
Q23
What will be the output of the following Python code? for i in range(int(float('inf'))): print (i)
Q24
What will be the output of the following Python code? for i in range(float('inf')): print (i)
Q25
What will be the output of the following Python code snippet? x = 2 for i in range(x): x += 1 print (x)