wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Review - Input, Output, and Math

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

Which of the following is NOT a mathematical operator of Python

a)
*
b)
//
c)
**
d)
#
2.
Which datatype categorizes the value 5.0?
a)
int
b)
float
c)
complex
d)
string
3.
The escape sequence '\n' does:
a)
Prints a '\n' in the output.
b)
Creates a blank space for the output.
c)
Moves output to the next line.
d)
Creates 4 blank spaces in the output.
4.
What output would be produced by the following code?
a)
1 + 2
b)
3
c)
12
d)
Nothing would be outputted. A syntax error would be generated
5.
What output would be produced by the following code?
a)
1 + 2
b)
3
c)
12
d)
'1 + 2'
6.
Which is used to display information on the computer’s output screen?
a)
parenthesis
b)
double quotation marks
c)
print()
d)
Opening and closing braces
7.
What effect does “\t” have when included in a string?
a)
Output is moved to the next line.
b)
A \n is displayed in the output.
c)
A tab (move five spaces) is displayed in the output.
d)
An n is displayed in the output.
8.
In programming terms, a group of characters inside a set of quotation marks is called a:
a)
string literal
b)
programming statement
c)
escape sequence
d)
reserved word
9.
Source code is:
a)
the original code of a program in Python.
b)
the list of reserved words in Python.
c)
the origin of data for a stream.
d)
the result of running a program
10.
Which of the following is not true of a syntax error?
a)
They stop the compilation of a program.
b)
They are caused by a violation of the rules of Python.
c)
They indicate that a statement in a program will work.
d)
They must be corrected and the program recompiled before it will run.
11.
What output is produced by the following segment of code?
a)
5
b)
12
c)
13
d)
8
12.
What output is produced by the following segment of code?
a)
6
b)
14
c)
15
d)
8
13.
What output is produced by the following segment of code?
a)
2
b)
2.4
c)
3
d)
An Syntax error is generated
14.
What output is produced by the following segment of code?
a)
2
b)
2.4
c)
3
d)
An Syntax error is generated
15.
What output is produced by the following segment of code?
a)
2
b)
2.4
c)
4
d)
An Syntax error is generated
16.
What output is produced by the following segment of code?
a)
5.0
b)
10.0
c)
15.0
d)
20.0
17.
What output is produced by the following segment of code?
a)
5.0
b)
10.0
c)
15.0
d)
20.0
18.
What output is produced by the following segment of code?
a)
5
b)
6
c)
8
d)
9
19.
What output is produced by the following segment of code?
a)
5
b)
6
c)
8
d)
9
20.
What output is produced by the following segment of code?
a)
HelloWorld
b)
Hello World
c)
WorldHello
d)
World Hello
21.
Which of the following is an invalid name for a variable?
a)
apples = 1
b)
name = “Miller”
c)
36mafia = 36
d)
three = 3
22.
What output is produced by the following segment of code?
a)

<class 'int'>

b)

<class 'float'>

c)

<class 'str'>

d)

None of the above

23.
Which of the following is the mathematical operator for "Modulus" division?
a)
*
b)
//
c)
**
d)
%
24.
Which datatype categorizes the value 5.0?
a)
int
b)
float
c)
complex
d)
string
25.
Which datatype categorizes the value 5?
a)
int
b)
float
c)
complex
d)
string