Iteration Control Statements: Ans: A
Iteration Control Statements: Ans: A
Iteration Control Statements: Ans: A
print("executed")
A. 0
B. 5
C. 1
D. 4
ANS: A
if grade== "A+":
print("TPF")
else:
print("Not TPF")
A. 2
B. 3
C. 4
ANS: B
number=28
if(number>num):
print(num)
else:
print(num)
break
a. 28
b. 25
26
27
28.
C. 25
26
27
d. 25
26
27
28
29
A. a
B. b
C. c
D. d
ANS: B
if(num%5!=0):
continue
if(num%10==0):
continue
if(num%3==0):
print(num, end="")
A. 45 50 90
B. 45 50 65 90
C. 45 90
D. 23 76
ANS: A
print(number*counter, end="")
A. 10 20 15 30
B. 10 20 30 15 30 45
C.10 15 20 30 30 45
D. 10 15 20 30
ANS: A
6.What should be the value of the variables num1 and num2 in the code below if the
output expected is 4?
num1=?
num2=?
while(num1>=2):
if(num1>num2):
num1=num1/2
else:
print(num1)
break
A. 12, 5
B. 8, 2
C. 16, 6
D. 16, 2
ANS: C
counter=0
while(counter<=9):
if(counter%2==0):
pass
else:
print(counter, end="")
counter+=1
A. 1 3 5 7 9
B. 0 2 4 6 8
C. 0 1 3 5 7 9
4.1 3 5 7
ANS: A
8.What will be printed in the output after the executing the code below?
numbers_list=[98,45,60,71,90]
count=10
if number % 10 == 0:
count -= 1
continue
counter = 0
last_digit= number % 10
number=number // 10
if last_digit > 4:
count +=1
break
count += 1
counter += 1
print(count)
A. 12
B. 13
C. 11
ANS: A
9.How many **(stars)will be printed after executing the below Python code?
num1=5
num2=4
print ("*")
for index in range (1, num1+1):
print (“*")
num2 -= 1
print ("*")
A. 6
B. 5
C. infinity loop
D. 7
ANS: A
10.Consider the BUBBLE SORT algorithm given below which sorts the given input_list in DESCENDING
order.
temp=input_list[indexl]
Input_list: [2, 1, 6, 3, 7]
What would be the content of input list after second pass, if the input list is passed as a parameter to
the above function bubble_sort?
A. [6. 3. 7, 1, 2]
B. [6, 3, 7, 2, 1]
C. [3, 6, 7, 2, 1]
D. [6, 2, 7, 3, 1]
ANS: B
print (num)
A.2
B. 3
C. 23
D. 823
ANS: C
Input_ list=[0,2,1,3,0]
val=0
input_list.remove (input_list[0])
input_list.append (val+1)
val+=1
print (input_list)
A. [4]
B. [5]
C. [3]
ANS: A
10. What will be the content of prime_queue returned by the below function arrange_queue if
num_queue is passed as a parameter to it?
prime_queue=Queue (6)
count=0
count+=1
if count=2:
return prime_queue
C. Queue is empty
ANS: