wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Basics

Total questions: 80

Worksheet time: 1hrs 14mins

Name
Class
Date
1.
What is Print()?
a)
Text
b)
Console
c)
Function
d)
Decoder
2.
What does an IF statement do?
a)
Closes the program
b)
Makes a decision
c)
Asks a question
3.
What function is used to let the user answer a question?
a)
Open
b)
Print
c)
Answer
d)
Input
4.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
5.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
6.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
7.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
8.
What will be the output?
name = 'Dave'
greeting = "Good morning" + name
print (greeting)
a)
Good moning 'Dave'
b)
Good morning Dave
c)
Good morning name
d)
Good morning + Dave
9.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
10.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
11.
There are three logical operators in Python:
and, or, ____
a)
in
b)
else
c)
not
d)
true
12.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
13.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
14.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
15.
runs code line by line and checks for errors
a)
interpreter
b)
variable
c)
modulo
d)
boolean
16.
stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulo
17.
returns the remainder from division
a)
modulo
b)
exponments
c)
boolean
d)
variables
18.
a line of text that Python won't try to run as code
a)
comment
b)
modulo
c)
variable
d)
boolean
19.
symbol used for modulo
a)
%
b)
&
c)
#
d)
**
20.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
21.
Used to make comments
a)
#
b)
%
c)
**
d)
()
22.
The correct way to write a variable in Python?
a)
my_variable = 10
b)
my variable = 10
c)
my_variable is 10
d)
my_variable: 10
23.
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
24.
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)
25.
Look at this code, what shape will it make?
a)
Square
b)
Triangle
c)
Rectangle
d)
Hexagon 
26.
What will the following code do? 
name = "Bob"
If (name == "Bob"): 
           print ("Hello" + name") 
else: 
print ("I dont know you") 
a)
nothing 
b)
display bob 
c)
display I do not know you 
d)
display BOB
27.
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
28.
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
29.
Why is it called 'Python'?
a)
The guy who created it loves snakes
b)
The guy who created it loves Monty Python films
c)
You can create a game on python called snake
d)
It was created by someone called Mr Python
30.
Python is an example of a....
a)
Text-based programming language
b)
Object orientated programming language
c)
language written in java script
d)
Visual-based programming language
31.
Data type that can only be true or false
a)
int
b)
string
c)
bool
d)
float
32.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
33.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
34.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
35.
What will the output be from the following code?
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
36.
What will the output be from the following code?
Print("Hello world!")
a)
NameError
b)
Hello world!
c)
"Hello world"
d)
Print(Hello world!)
37.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
38.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
39.
What will the output be from the following code?
print(3*4)
a)
34
b)
7
c)
12
d)
3*4
40.
What will the output be from the following code?
print("Hello" + "world!")
a)
Hello world!
b)
Helloworld!
c)
SyntaxError
d)
"Hello" "world!"
41.
What will the output be from the following code?
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
42.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
43.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
44.
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 
45.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
46.

A data type consisting of numbers, letters and symbols.

a)

String

b)

Integer

c)

Float

d)

Boolean

47.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
48.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
49.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
50.
Which command is needed to convert a string to capital letters?
a)
.lower()
b)
.caps()
c)
.capitals()
d)
.upper()
51.
Python's _________ mode makes it easy to test short snippets of code
a)
interactive shell
b)
edit
c)
command
d)
program
52.
Python runs on many different computers as well as _____________ 
a)
mobile devices
b)
operating systems
c)
URLs
d)
browsers
53.
The Python IDLE is basically a _______ editor that lets you execute Python code.
a)
image
b)
code
c)
file
d)
text
54.
Comments help the programmer make ________ within the program without affecting the code.
a)
notes
b)
changes
c)
revisions
d)
a mess
55.
What will the following lines of code print?
a)
A
b)
B C
c)
A C
d)
Nothing, it will return an error.
56.
What will the following lines of code do? 
a)
A
b)
B C
c)
A C
d)
Nothing, it will return an error
57.
Like every programming language Python has __________ which help to carry out math functions.
a)
syntax
b)
codes
c)
operators
d)
symbols
58.
Python is a free software and can be modified and ________ because it's an open source.
a)
corrected
b)
changed
c)
deleted
d)
re-distributed
59.
The result of this program:
Friday = False
if Friday:

    print "Jeans day!"
else:
    print "Dress code"
a)
Jeans Day
b)
Jeans day
c)
Dress code
d)
Dress Code
60.
<
a)
greater than
b)
less than
c)
equal to
d)
less than or equal to
61.
>
a)
less than
b)
not equal to
c)
less than or equal to
d)
greater than
62.
<=
a)
less than
b)
less than or equal to
63.
>=
a)
greater than
b)
greater than or equal to
c)
not greater than
d)
not equal to
64.
==
a)
equal to
b)
assign a variable
c)
not equal to
d)
less than
65.
! =
a)
greater than variable
b)
less than variable
c)
equal to
d)
not equal to
66.
6 > 5
a)
TRUE
b)
FALSE
67.
3<=4
a)
TRUE
b)
FALSE
68.
2 = = 3
a)
TRUE
b)
FALSE
69.
4 < 5
a)
TRUE
b)
FALSE
70.
45 ! = 2
a)
TRUE
b)
FALSE
71.
3 == 3.0
a)
TRUE
b)
FALSE
72.
30 == 3.0
a)
TRUE
b)
FALSE
73.
Choose the correct Python code.
Display: Welcome to the quiz!
a)
print ("Welcome to the quiz!")
b)
print (Welcome to the quiz!)
74.
Choose the correct Python code.
if age is less than 20 then
a)
if age > 20:
b)
if age < 20:
75.
Choose the correct Python code.
if age is less than 20 and greater than equal or equal to 15 then
a)
if age <20 and age >=15:
b)
if age <20>=15 :
76.
Choose the correct Python code.
else if jellybean guess is less than 15, then
a)
elif JBGuess <15
b)
elif JBGuess <15:
77.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
78.

Name the different types of Iteration

a)

Sequence

b)

IF..THEN..ENDIF, CASE..ENDCASE

c)

IF..THEN..ENDIF

d)

FOR..TO..NEXT, WHILE..DO..ENDWHILE, REPEAT UNTIL

79.

Name the different types of Selection

a)

Sequence

b)

IF..THEN..ENDIF, CASE..ENDCASE

c)

IF..THEN..ENDIF

d)

FOR..TO..NEXT, WHILE..DO..ENDWHILE, REPEAT UNTIL

80.

What is sequencing

a)

providing the computer with multiple paths to follow

b)

repeating coding a specified number of times

c)

repeating coding until a condition has been met

d)

following a program one step after another in order