wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PYTHON QUIZ 3.1

Total questions: 40

Worksheet time: 20mins

Name
Class
Date
1.
In python the ' INTEGER data type' can be defined as...?
a)
holds alphanumeric data as text
b)
holds whole numbers
c)
holds numbers with a decimal point
d)
holds either ‘true’ or ‘false’
2.
In python the ' FLOAT data type' can be defined as...?
a)
holds alphanumerical data
b)

holds whole numbers

c)

holds a decimal point in a number

d)
hold either true or false
3.
What is the correct definition for a VARIABLE?
a)
a changeable value, such as a score in a computer game.
b)
a value that cannot be changed
4.

What data type would be used for storing someone's telephone numbers?

a)

Float (using a decimal point)

b)

Integer (just whole numbers)

c)

String (alphanumerical data)

d)

Boolean (true or false)

5.

If we needed to store information such as a POSTCODE in PYTHON, what data type would we use?

a)

String (alphanumerical)

b)

Float (decimal point)

c)

Boolean (true or false)

d)

Integer (just whole numbers)

6.
What is the correct definition for 'pseudo code?'
a)
a notation resembling a complex programming language, used in program design.
b)
a notation resembling a simplified programming language, used in program design.
7.

What is the function of the code: amount = int(input("Enter a conversion into pounds:)) currency = input ("press 1 for Philippine peso, 2 for US dollar or 0 to exit:")

a)

to find the total amount of currency altogether

b)

to calculate and convert the exchange rates.

8.

what is the code for a STRING in python?

a)

str

b)

stri

c)

stg

9.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
10.

What is the output from the following code? print ("hello world")

a)

Hello World

b)

hello world

c)

print hello world

d)

"hello world"

11.
What best defines an IF statement in python?
a)
Is an embedded string with a variable
b)
An IF statement checks to see if a statement is true or false and then does one of two things depending on the result.
12.
In python the ' STRING data type' can be defined as...?
a)
holds alphanumeric text
b)
hold whole numbers
c)
holds numbers with a decimal point
d)
holds either a true or false value
13.
Stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulus
14.
A line of text that Python won't try to run as code
a)
comment
b)
modulus
c)
variable
d)
boolean
15.
Used to make comments
a)
#
b)
%
c)
**
d)
()
16.
The correct way to write a variable in Python?
a)
myVariable = 10
b)
my Variable = 10
c)
myVariable is 10
d)
myVariable: 10
17.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
18.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
19.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
20.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
21.
What will the output be from the following code?
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
22.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
23.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
24.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
25.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
26.
What is python named after
a)
The snake
b)
Television show called Monty Python
27.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
28.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
29.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)
It displays something like a string or integer
d)
It loops the code.
30.
What will the output be from the following code?
print("Hello" + "world" + "today")
a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
31.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
32.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information 
33.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
34.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
35.
When you have an error in your code what is the term to summarise finding and fixing that error?
a)
Error checking
b)
Debugging
c)
Syntax finder
d)
Error finder
36.

A procedure to follow, especially using iteration and conditionals

a)

For Loop

b)

Algorithm

c)

Return Value

d)

Concatenation

37.

A(n) relational operator is:

a)

An expression that can be evaluted as TRUE or FALSE. Often used in CONDITIONAL STATEMENTS, such as IF (condition) THEN (action1) ELSE (action2)

b)

A symbol that represents a compare action for a computer to take. Examples are: ">" (greater than), "<" (less than) and "=" (equal)

c)

Operators that are used to combine or change Boolean Expressions. The 3 standard operators are AND, OR, and NOT.

d)

Control block that looks for events to then perform action

38.
To create a newline at the end of prompt, you can use which of the following expressions?
a)
\new
b)
\n
c)
\break
d)
\return
39.
What does “input()” represent in this code?

colour = input(“Enter a colour”)
a)
prompts the user to enter an input
b)
it gives the user a colour
c)
it turns the text that colour
40.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()