
control statments quiz

Quiz
•
Computers
•
University
•
Hard
jaya mulimani
Used 3+ times
FREE Resource
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the below code snippet?
num1=100
num2=200
num3=6
if(5>=num3):
if(num1>100 or num2>150):
print("1")
elif(num1>=100 and num2>150):
print("2")
else:
print("3")
1
2
3
None of the above
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What should be the value of num1 and num2 to get the output as "1"?
if((num1/num2==5) and (num1+num2)>5):
print("1")
elif((num1-num2)<=1 or (num1%num2)==0):
print("2")
else:
print("3")
num1=11, num2=2
num1=0, num2=5
num1=5, num2=1
num1=-10,num2=2
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the output of the code given below?
a = -10
b = -200
c = 2000
d = 4000
if( a*b >=d):
if(d>c):
if(d%c!=0):
print(11)
else:
print(22)
else:
if(b/a >0):
if(a<b or d%c!=0):
print(33)
else:
print(44)
11
22
44
33
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How many times "executed" will be printed in the output?
for variable_1 in range(1,5,-1):
print("executed")
0
5
1
4
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Predict the output of the following code snippet.
number=28
for num in range(25,30):
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
b
c
d
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Predict the output of the following code snippet.
for num in 23, 45, 50, 65, 76, 90:
if(num%5!=0):
continue
if(num%10==0):
print(num, end=" ")
continue
if(num%3==0):
print(num, end=" ")
45 50 90
45 50 65 90
45 90
23 76
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Predict the output of the following code snippet.
for number in 10,15:
for counter in range(1,3):
print(number*counter, end=" ")
10 20 15 30
10 20 30 15 30 45
10 15 20 30 30 45
10 15 20 30
8.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
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
12, 5
8, 2
16, 6
16, 2
9.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Which among the following codes have equivalent logic?
Code 1:
if(value3>1000 and value3<1006):
if(value1=="ABC"):
if(value2=="A"):
value4=10
else:
value4=8
elif(value1=="XYZ"):
if(value2=="A"):
value4=8
else:
value4=6
print(value4)
Code 2:
if(value3>=1001 and value3<=1005 and value1=="ABC"):
if(value2=="A"):
value4=10
else:
value4=8
elif(value3>1000 and value3<1006 and value1=="XYZ"):
if(value2=="A"):
value4=8
else:
value4=6
print(value4)
Code 3:
if(value3>1000 and value3<1006 or value1=="ABC"):
if(value2=="A"):
value4=10
else:
value4=8
elif(value3>1000 and value3<1006 or value1=="XYZ"):
if(value2=="A"):
value4=8
else:
value4=6
print(value4)
Code 2, Code 3
Code 1, Code 3
Code 1, Code 2
None
Similar Resources on Wayground
12 questions
Python: Strings and Lists

Quiz
•
University
11 questions
Control Structures - Selection in Python

Quiz
•
8th Grade - University
14 questions
Computing Revision JCG

Quiz
•
KG - University
10 questions
Basic C Knowledge Exercise

Quiz
•
University
10 questions
Estrutura de Dados

Quiz
•
University
5 questions
2_python_input

Quiz
•
University
10 questions
Quiz6

Quiz
•
University
5 questions
Python Programming

Quiz
•
University
Popular Resources on Wayground
12 questions
Unit Zero lesson 2 cafeteria

Lesson
•
9th - 12th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
20 questions
Lab Safety and Equipment

Quiz
•
8th Grade
13 questions
25-26 Behavior Expectations Matrix

Quiz
•
9th - 12th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
15 questions
Let's Take a Poll...

Quiz
•
9th Grade - University
2 questions
Pronouncing Names Correctly

Quiz
•
University
12 questions
Civil War

Quiz
•
8th Grade - University
18 questions
Parent Functions

Quiz
•
9th Grade - University
21 questions
Mapa países hispanohablantes

Quiz
•
1st Grade - University
19 questions
Primary v. Secondary Sources

Quiz
•
6th Grade - University
25 questions
Identifying Parts of Speech

Quiz
•
8th Grade - University
20 questions
Disney Trivia

Quiz
•
University