wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Year 8 Python Programming

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

What is the definition of syntax?

a)

the arrangement of words and phrases to create well-formed sentences in a language

b)

the process of debugging code

c)

the act of opening Python IDLE

d)

the output of user input

2.

Why is it important to look for syntax errors in programming?

a)

To impress the teacher

b)

To avoid errors in the code

c)

To increase the length of the code

d)

To confuse the user

3.

What is Python?

a)

A language used by Google and YouTube

b)

A visual programming language

c)

A text based programming language

d)

A language used only in industry

4.

What is the purpose of the print command in Python?

a)

To create a new file

b)

To ask the user for input

c)

To save the program

d)

To display output to the user

5.

What is the term for the process of finding and fixing errors in code?

a)

Debugging

b)

Syntax error

c)

Output

d)

Programming

6.

What is the purpose of user input in programming?

a)

To allow interaction with the program

b)

To create syntax errors

c)

To impress the teacher

d)

To confuse the user

7.

What is the correct syntax for the input function in Python?

a)

answer = input("Enter your name"

b)

answer = input("Enter your name")

c)

answer = input(Enter your name")

d)

answer = Input("Enter your name")

8.

What is the result of a syntax error in programming?

a)

The program will output user input

b)

The program will crash

c)

The program will impress the teacher

d)

The program will run successfully

9.

What is the correct syntax for the print command in Python?

a)

Print("Hello World")

b)

print("Hello World");

c)

print"Hello World"

d)

print("Hel World")

10.
What will the output be from the following code?
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
11.
What will the output be from the following code?
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
12.
What will the output be from the following code?
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
13.
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
14.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
15.
Which is the most appropriate data type for: "13th December"
a)
Float
b)
Boolean
c)
Integer
d)
String
16.
Which function converts data to an integer
a)
print()
b)
int()
c)
input()
d)
def
17.
Which is the most appropriate data type for: 34.9
a)
Float
b)
Boolean
c)
Integer
d)
String
18.
Which is the most appropriate data type for: 8,405,334
a)
Float
b)
Boolean
c)
Integer
d)
String
19.
x = int(input("Enter a Number"))
print(X)
Why won't this work?
a)
Brackets are in the wrong place
b)
Print should have a capital letter
c)
It should have two equals
d)
both x variables should be lower case
20.
When would I use '=='?
a)
Checking if two values are equal
b)
Making a value equal to another
c)
Checking if a value is not equal to another value
d)
Check if a value exists or not
21.
Which of these is used for selection?
a)
if
b)
while
c)
for
d)
do
22.
How many elif's can you have in one statement?
a)
1
b)
2
c)
4
d)
infinite 
23.
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 
24.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
25.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
26.
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’
27.
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’
28.
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
29.
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
30.
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
31.
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)
32.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
33.
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.
34.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
35.

Which data type is used to store either True or False?

a)

integer

b)

real

c)

string

d)

boolean

36.

What is the output from the code shown?

a)

name

b)

"name"

c)

harry

d)

"harry"

37.

Look at the code shown - why will the name "harry" not be printed?

a)

name is spelt incorrectly

b)

it doesn't start with a capital letter

c)

the print statement has " " around name

d)

print needs to be in capital letters

38.

If the number entered is 10, what is the output from the program shown?

a)

10

b)

20

c)

number+number

d)

error

39.

When 10 is entered, the program does not output the expected answer of 20.....what is the issue?

a)

it should say print(20)

b)

it should say print(number+number) - no speech marks

c)

it should say print(twenty)

d)

the wrong number was entered

40.

when the number 5 is entered, what is the output?

a)

5

b)

10

c)

55

d)

number+number

41.

when the number 5 is entered, the program outputs 55 instead of 10...what is the error?

a)

incorrect data type used (should be int)

b)

it should say print(10)

c)

number+number needs to have " "

d)

number is spelt incorrectly

42.

look at the code shown - how many lines use selection?

a)

1

b)

3

c)

2

d)

4

43.

which 3 keywords do we look for when looking for selection?

a)

if

b)

elif

c)

else

d)

for

44.

If the height entered is 140, what is the message printed?

a)

cannot enter the ride

b)

please enter, have fun!

45.

If the height entered is 100, what is the message printed?

a)

cannot enter the ride

b)

please enter, have fun!

46.

how many times will this loop run?

a)

1

b)

5

c)

4

47.
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
48.
Which of these would work as a piece of code?
a)
IF answer == "Yes":
b)
if answer == "Yes"
c)
if answer == "Yes":
d)
if answer = "yes":
49.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
50.

What is a program?

a)

A series of step-by-step instructions that tell a computer how to solve a task

b)

A flowchart written on a computer

c)

A video that is watched on a computer