NEW
Font size
WorksheetsQuiz 3 - Python coding
Total questions: 20
Worksheet time: 12mins
Which one of the following is correct way of declaring and initializing a variable, x with value 5?
int x
x=5
int x=5
x=5
declare x=5
Which of the following is not valid variable name in Python?
_var
var_name
var11
11var
Which of the following statement is False?
Variable names can be arbitrarily long.
They can contain both letters and numbers.
Variable name can begin with underscore.
Variable name can begin with number.
Which of the operator means less than equal to ?
>
<
>=
<=
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 does this code do?
print("Hello world!")
Displays 'Hello world!' in the shell window.
Sends 'Hello world!' to the printer.
Waits for the user to type in 'Hello world!'
Displays 'hello, world.' in the shell window.
What is an integer?
A number with a decimal point.
A whole number.
An array of characters.
A single character.
In this code, how much does an apple cost?
£1
50p
20p
25p
True or False:
There are no symbols which can be used in a variable name.
True
False
What function converts the data in a variable into a 'float'?
int()
flt()
bool()
float()
Comments are used to make code easier to read.
True
False
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.
True or False:
Python can be used to make games and phone apps.
True
False
write the output of the program
Thinley is in class 9A
Thinley is in 9A
Thinleyisin9A
error
