Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

IG1 U2L1-L5 Python

Total questions: 108

Worksheet time: 56mins

Name
Class
Date
1.
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
2.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
3.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

4.
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
5.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
6.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
7.
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
8.
What does the print function do in python?
a)
It's a variable.
b)
It can input data.
c)

It displays an output

d)
It loops the code.
9.
In the following code, "city" is an example of a what?
a)
List
b)
Loop
c)
Variable
d)
Array
10.

What is the output from the following code?

print ("hello world")

a)
Hello World
b)
hello world
c)
print hello world
11.

What is the Python built-in function used to display numbers and text on the screen?

a)

print

b)

input

c)

output

d)

command

12.

The punctuation requirements for printing a string in Python are:

a)

( ) , ! and " "

b)

( ) and !

c)

( ) and " "

d)

" " and !

13.

What will be the output?

name = "Dave"

print ("name")

a)

Dave

b)

"Dave"

c)

name

d)

"name"

14.

What is the name of the variable in this program?

a)

print

b)

colour

c)

input

d)

" "

15.

What will this code print?

a)

access denied

b)

access granted

c)

error

d)

password

16.

If the user enters 60, what is the output?

a)

You are old!

b)

You are middle-aged!

c)

You are young!

d)

Error message

17.
What does “==” represent in Python programming?
a)
less than
b)
equal to
c)
greater than
d)
not equal to
18.
Choose the correct Python code.
if age is less than 20 then
a)
if age > 20:
b)
if age < 20:
19.

What symbol must you place at the end of an if statement?

a)

)

b)

:

c)

;

d)

}

20.

What is an indentation in Python?

a)

A line of code that returns a value

b)

A subroutine

c)

A block of code that creates a variable

d)

A code block (body of a function, loop etc.) starts with indentation and ends with the first unintended line.

21.

1==0

a)

True

b)

False

22.

What will this code display?

a = 6

if a => 6:

print("pass")

else:

print("fail")

a)

pass

b)

fail

c)

nothing because there will be an error

d)

passfail

23.

what does != mean

a)

not

b)

swap value

c)

not equal

d)

equal

24.

What will this code print?

a)

access denied

b)

access granted

c)

error

d)

password

25.
Stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulus
26.
A line of text that Python won't try to run as code
a)
comment
b)
modulus
c)
variable
d)
boolean
27.

What will happen when this program is run?

a)

Syntax error

b)

One will be displayed

c)

Zero will be displayed

d)

One then Zero will be displayed

28.

What will this code print?

a)

access denied

b)

access granted

c)

error

d)

password

29.

The selection statements are used to select a part of the program to be executed based on a condition.

a)

True

b)

False

30.

In Python, we use the if statement to test a condition and decide the execution of a block of statements based on that condition result.

a)

True

b)

False

31.

In Python, When we want to test multiple conditions we use elif statement.

a)

True

b)

False

32.

If it is True, then the block of statements is executed and if it is False, then the block of statements is ignored.

a)

if statement

b)

if-else statement

c)

if-elif statement

33.

If the condition is True, then the true block of statements is executed and if it is False, then the false block of statements is executed.

a)

if statement

b)

if-else statement

c)

if-elif statement

34.

Which selection execution flow is given:

a)

if statement

b)

if-else statement

c)

if-elif statement

35.

Which selection execution flow is given:

a)

if statement

b)

if-else statement

c)

if-elif statement

36.
In programming, what is iteration?
a)
The repetition of steps within a program
b)
The order in which instructions are carried out
c)
A decision point in a program
d)
Testing a program to make sure it works
37.
Why is iteration important?
a)
It determines the order in which instructions are carried out
b)
It allows code to be simplified by removing duplicated steps
c)
It allows multiple paths through a program
d)
It ensures the code works correctly
38.
Which two statements are used to implement iteration?
a)
IF and WHILE
b)
ELSE and WHILE
c)
FOR and WHILE
d)
IF and ELSE
39.
The condition for a while loop to continue could include which of the following?
a)
While something equals something
b)
While something is greater than something
c)
While something is True
d)
All of these
40.
Which of the following symbols is used in Python to mean "Equal to"?
a)
=
b)
!=
c)
==
d)
>=
41.
Which of the following symbols is used in Python to mean "Not equal to"?
a)
==
b)
!=
c)
<>
d)
><
42.
Which of the following symbols is used in Python to mean "Greater than or equal to"?
a)
<=
b)
>>
c)
>=
d)
=>
43.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
44.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
45.
a)
5
4
3
2
1
b)
5  4  3  2  1
c)
4
3
2
1
0
d)
4  3  2  1  0
46.
a)
10  8  6  4  2
b)
10
8
6
4
2
c)
2  4  6  8  10
d)
10  9  8  7  6  5  4  3  2  1
47.
a)
12  9  6  3  0
b)
0  3  6  9  12
c)
9  6  3  0
d)
0  3  6  9
48.
a)
0  5  10
b)
5  10
c)
0  5  10  15  20  25  30  35  40  45  50  55  60  65  70  75  80  85  90  95  100  105  110  115  120  125  130  135  140......etc
d)
12  7  2
49.
a)
12  17   22
b)
5
c)
12
d)
5  10
50.
a)
Hello world!
b)
Hello world
c)
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
......(repeated continuously)
d)
Error
51.
a)
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
b)
Hello world!
c)
Hello world!
break              
d)
Error
52.
Which of the following symbols is used in Python to mean "Less than or equal to"?
a)
<<
b)
=<
c)
<=
d)
!=
53.
a)
Hello world!
b)
Error
c)
Hello world!
False
d)
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
54.
a)
Welcome
b)
Try again!
c)
Error
d)
Enter your password
55.

What does print("hello) display?

a)

hello

b)

gives you an error

c)

"hello"

d)

"hello

56.

How do you ask an input from a user?

a)

name = int("what is your name")

b)

name = input(what is your name?)

c)

input = name("what is your name?")

d)

name = input("what is your name?")

57.
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 
58.

____________ is information the user sends to the computer

a)

Software

b)

Input

c)

Secondary Memory

d)

Program

59.

How will the following code look on the screen?

print ("I love programming.")

print ("I love programming.")

a)

"I love programming."

"I love programming."

b)

I love programming.

I love programming.

c)

I love programming. I love programming.

d)

I LOVE PROGRAMMING

I LOVE PROGRAMMING

60.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
61.
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
62.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
63.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

64.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
65.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language
66.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
67.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
d)
name = input("Tanner")
68.

Match the following values with their Python data types

a)

7.3

1.

float (decimal)

b)

4

2.

int (integer)

c)

"Hello"

3.

str (string)

d)

True

4.

bool (boolean)

69.

Order the below into the correct order for an assignment statement in Python. Not all options are used.

​ (a)   ​ (b)   ​ (c)  

Choose from the below words
x
=
7.3
/
@
70.

What is the result of the following Python print statement?

print(4 + 2 * 3 - 6)

71.

What will this code output?

print("confusion")

a)

Confusion

b)

confusion

c)

Syntax Error

d)

print

72.

In the following code, what is happening?

foo = "bar"

a)

A variable named foo is being created, with a value of "bar"

b)

A variable named bar is being created, with a value of "foo"

73.

If foo is equal to 3 and x is equal to 4, what is the value of foo after this operation?


foo = foo + x

a)

4

b)

12

c)

7

d)

34

74.

What will the following code output?

biff = 3.4

print(biff)

a)

An error because 3.4 is not a string

b)

3.4

c)

"3.4"

d)

3

75.

Reorder the following to create a valid Python statement

a)

myVariable

b)

=

c)

"

d)

Hello World

e)

"

1)
2)
3)
4)
5)
76.

What is type casting?

a)

It allows a piece of data to have it's data type changed, e.g. an integer could be changed to a string.

b)

It allows the program to display the value of a variable on the screen.

c)

It allows the program to collect data from the keyboard.

d)

It allows the programmer to display the value of a variable while the program is running.

77.

Which of the following input commands would allow the user to receive and store a string from the keyboard?

a)

string = input("Please enter a string:")

b)

string = int(input("Please enter a string:"))

c)

string = float(input("Please enter a string:"))

d)

string = bool(input("Please enter a string:"))

78.

What is printed by the following code?

x = int(6.8)

print(x)

a)

Nothing, it's a syntax error.

b)

6

c)

7

d)

6.8

79.

A variable is a named value that can be changed in the program.

a)

False

b)

True

80.

Which value is a String?

a)

64

b)

"cat"

c)

True

d)

0.5

81.

What is a String?

a)

A data type that contains whole numbers. eg: 3, 45, 124

b)

Numbers with decimal point. eg: 0.5, 2.45, 56.04

c)

Group of characters between quotation marks. eg: "dog"

d)

Data type that can only be True or False.

82.

Which writes a message for the user?

a)

input()

b)

myVar="Hi"

c)

print("Hello!")

d)

max=100

83.
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
84.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
85.
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
86.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
87.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
88.
What will the output be from the following code?
Print("Hello world!")
a)
NameError
b)
Hello world!
c)
"Hello world"
d)
Print(Hello world!)
89.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
90.
What will the output be from the following code?
print(3*4)
a)
34
b)
7
c)
12
d)
3*4
91.
What will the output be from the following code?
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
92.
What will the output be from the following code?
print(9/3)
a)
3
b)
3.0
c)
9/3
d)
SyntaxError
93.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
94.

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

95.
An algorithm is..
a)
A series of steps that is followed in order
b)
A type of logic gate
c)
PowerPoint
d)
A binary number 
96.
Comments help the programmer make ________ within the program without affecting the code.
a)
notes
b)
changes
c)
revisions
d)
a mess
97.
The Python IDLE is basically a _______ editor that lets you execute Python code.
a)
image
b)
code
c)
file
d)
text
98.
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
99.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
100.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
101.

​ (a)   are special built-in routines that do a specific job unique.

Choose from the below words
Functions
Variables
Parameters
String
102.

What is the default data type in Python?

a)

Real

b)

String

c)

Integer

d)

Number

103.

What is the Python code needed to display a word on the screen?

a)

print"hello"

b)

"hello"

c)

print("hello")

d)

print="hello"

104.

What is the Python code needed to ask a user for input?

a)

input("what is your name?")

b)

input="what is your name?"

c)

(input)=what is your name?

d)

input=what is your name?

105.

Which is the correct way to store an input as a variable in Python?

a)

answer("what is your name?")

b)

input = "answer"(what is your name?)

c)

answer = input("what is your name?")

d)

input=(what is your name?)

106.

Which character represents a comment in Python code?

a)

*

b)

#

c)

&

d)

$

107.

Choose the TWO correct data types from the list below

a)

Integer

b)

Real

c)

Fake

d)

Short

108.

Why do we need to convert data types in Python?

a)

Because Python doesn't know about data types

b)

Because Python stores data types as String by default