WorksheetsPython - Coding Interpretation
Total questions: 35
Worksheet time: 24mins
What is the output?
more than 7
more than 23
spam
7
What is syntax?
a catch-all for every other situation besides true.
pieces of code that direct the program to run in different ways depending on what else is happening.
a set of rules for how a language is written.
English, Chinese, or Spanish.
Which symbol means "not equal to"?
==
<=
>=
!=
Which character must be at the end of the line for if?
:
;
.
{
8. If, else and elif is used for…..
Selection
Indentation
printing
iteration
what is the variable name in this code?
if
secret
password
else: is used
to give an extra condition
to provide an output when the other conditions are false
because it is required
if we do not use it, it gives error
What is the output of the program
4
2
5
0
Which lines are having an error in the shown code
Line 1 and 2
Line 2 and 3
Line 3 and 4
line 5 and 6
what is the correct output
Welcome wangchuk
WelcomWangchuk
Welcom Wangchuk
WelcomeWangchuk
write the output of the program
Thinley is in class 9A
Thinley is in 9A
Thinleyisin9A
error
Data type for a whole number
boolean
string
integer
float
What is the output of the following code: print 10//3
3.5
3
1
Error
Which of the operator means less than equal to ?
>
<
>=
<=
what is the variable name in this code?
if
secret
password
Is this true or false?
"winter" == "Winter"
False
True
Which of the following is an integer?
8
4.5
What is the result of the expression 5 * 3 - 2?
13
15
17
14
Which keyword is used to define a function in Python?
def
function
func
define
What will be the output of the following code: print(2 ** 3)
None
6
8
9
Which of the following correctly stores 'price' as a decimal number?
price = int ( input ("Price: ")
price = str( input ("Price: ")
price = float ( input ("Price: ")
price = input ("Price: ")
Put this code into the right order
age = int (input ("Enter age: "))
nextYear = age + 1
print ("Your age next year is: " + str(nextYear))
What would the program display if you ran this code and entered 2 and then 3 when prompted?
The total is 5.
The total is 23.
The total is 6.
An error.
Which lines are having an error in the shown code
Line 1 and 2
Line 2 and 3
Line 3 and 4
line 5 and 6
What is the primary purpose of a for loop in Python as described in the text?
To execute a block of code a limited number of times based on a condition
To generate random numbers
To define functions
To import libraries
what is the name of the variable used in the following code?
counter
for
#
What is the output of the program above
10
15
18
17
16
A while loop equivalent of the for loop above is
What does this program print
2 + 2 = 4
4 + 4 = 8
8 + 8 = 16
16 + 16 = 32
32 + 32 = 64
2 + 2 = 4
2 + 2 = 4
2 + 2 = 4
2 + 2 = 4
2 + 2 = 4
2 + 2 = 4
2 + 4 = 6
2 + 6 = 8
2 + 8 = 10
2 + 10 = 12
2 + 2 = 4
2 + 2 = 4
2 + 2 = 4
2 + 2 = 4
2 + 2 = 4
2 + 4 = 6
2 + 6 = 8
2 + 8 = 10
for i in 100 :
print ( i )
Syntax error
prints numbers 0 to 100
prints numbers 1 to 100
prints numbers 0 to 99
prints numbers 1 to 99
How many times will 1 be printed
3
4
5
6
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
break
