wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Revision Years 8&9 IGCSE

Total questions: 40

Worksheet time: 37mins

Name
Class
Date
1.
Choose the correct sign for greater than or equal in Python:
a)
>=
b)
=>
c)
=<
d)
<=
2.
Choose the correct sign for does not equal in Python:
a)
!=
b)
=!
c)
:=
d)
=:
3.
Choose the correct sign for equal to in Python:
a)
==
b)
=
c)
)=
d)
]=
4.
Is the following logical test true of false? 4 == 5 - 1
a)
True
b)
False
5.
Is the following logical test true of false? 55 >= 11 * 5
a)
True
b)
False
6.
Is the following logical test true of false? 22 != 23 - 1
a)
True
b)
False
7.
If the user entered the letter 'X'. What is the output of the program?
a)
You can make another menu choice
b)
Remember to log off
c)
Error message
d)
X
8.

What is the error with the highlighted line?

a)

The > is missed

b)

The : is missed

c)

The ( ) is missed

d)

The > is missed

9.
The counter loop is the other name of ..........
a)
while loop
b)
for loop
c)
conditional loop
10.
The conditional loop is the other name of ..........
a)
while loop
b)
for loop
c)
counter loop
11.
What does 'exit condition' mean?
a)
Its a condition used in the conditional loop when it is true or when the logical test matches it the loop stops.
b)
It is a condition to stop the program.
c)
It is a syntax condition to be followed while writing a Python program.
12.
Which of the following is the correct 1st line of a Python loop that repeats 100 times.
a)
for i in range (100) :
b)
For i in range (100) :
c)
for i in range of (100) :
d)
for i in range of (100)
13.
A Python program contains a variable called points. What is the command to increase points by 10.
a)
points = points + 10
b)
points = total + 10
c)
points = int + 10
d)
points = increase(10)
14.
When do we use a conditional loop?
a)
When you don't know the exact number of repeats
b)
When you know the exact number of repeats
15.
Here is a line from a Python program. What value of the variable username will cause the loop to stop? while username != "X" :
a)
x
b)
X
c)
username
d)
name
16.
Syntax errors stops the computer from translating the programs. what does 'translating the program' mean?
a)
The computer executes the machine code commands
b)
The computer turn the commands into machine code
c)
The Computer shows an error message
d)
The computer fix the commands errors
17.
Choose one place in Python that we must include a colon.
a)
By the end of the print command
b)
By the end of the 1st line of the conditional loop (while loop)
c)
By the end of the input command
d)
After assigning a variable directly
18.
What is the sign we use to add a comment in Python?
a)
&
b)
#
c)
@
d)
!
19.
What is the command we use to add a new line in Python?
a)
print(\n)
b)
print("\n")
c)
print(newline)
d)
!print(newline)
20.
What is the keyword we use to covert the data type into integers?
a)
integers()
b)
int()
c)
no()
d)
number()
21.

Choose the correct form of a list:

a)

Students = ["Ahmed", "Ali", "Kareem"]

b)

Students = ["Ahmed", "Ali", "Kareem"]:

c)

Students = ("Ahmed", "Ali", "Kareem")

d)

Students = {"Ahmed", "Ali", "Kareem"}

22.

Choose the correct form of the 1st line of if statement:

a)

if choice == (A)!

b)

IF choice == "A":

c)

if choice = "A":

d)

if choice == "A":

23.

To delete an item from the list we use the command:

a)

students.delete(name)

b)

students.remove(name)

c)

students.erase(name)

d)

students.append(name)

24.

What is the usage of append command?

a)

It adds an item to the middle of the list.

b)

It adds an item to the beginning of the list.

c)

It adds an item to the end of the list.

d)

It replaces an item of the list.

25.

What is the correct form of a module (procedure) 1st line?

a)

def welcome() :

b)

def welcome :

c)

DEF welcome() :

d)

def welcome()

26.

What is the output of this program if N1 = 5?

a)

b)

c)

d)

27.

What is a parameter in a function?

a)

input value to a function for the function’s execution

b)

a variable used to send information to a function

c)

the name of the function

d)

the name of the main program calling the function

28.

What will happen when this code is run?

a)

Nothing there is an error on line 5

b)

It will print the following:

10

10

20

c)

It will print the following:

13.3333334

d)

It will print the following:

10

10

20

Average = 13.33333334

29.

What will happen when this code is run and the user types in Finham Park?

a)

The code will return:

Try again...

b)

The code will return:

You bet it is, ", name, "is the best!

c)

The code will return:

You bet it is, Finham Park is the best!

d)

Nothing there is an error on

Line 5, missing a colon ( : )

30.

What will happen when this code is run and the user types in yes?

a)

It will print the following:

is it raining today?

yes

The code will return:

Better take a brolly

or you will get wet

Enjoy the weather

Is it windy today?

b)

It will print the following:

is it raining today?

yes

The code will return:

Better take a brolly

or you will get wet

Is it windy today?

c)

It will print the following:

is it raining today?

yes

The code will return:

Better take a brolly

or you will get wet

d)

It will print the following:

is it raining today?

yes

The code will return:

Better take a brolly

31.

What will happen when this code is run and the user inputs that the price of the ticket is 20 and the number needed is 4?

a)

The code will eventually print:

160

b)

The code will eventually print:

80

c)

The code will eventually print:

The total cost of the tickets would be: 80

d)

The code will eventually print:

The total cost of the tickets would be: 82.5

32.

Which of the following is the operator used in Python to say less than or equal to

a)

==

b)

<=

c)

>=

d)

<

33.

What does the operator != on line 3 represent

a)

Is exactly

b)

Is an integer

c)

Is a statement

d)

Is not

34.

Which of the following terms best describes the code above?

a)

function call

b)

function definition

35.

What will happen when this code is run and the user inputs the number 3

a)

The code will print:

Type in a number

b)

The code will print:

Type in a number

User inputs 3

Code will print:

9

c)

The code will print:

Type in a number

User inputs 3

Code will print:

Multiply it by 3

We now have the number 9

d)

The code will print:

Type in a number

User inputs 3

Code will print:

Multiply it by 3

We now have the number 9

Add 45 to your number

36.

This is code to calculate the price of tickets charged to customers. On which line of code is there an error?

a)

Line 4

b)

Line 6

c)

Line 7

d)

Line 8

37.

Where is there an error in this code?

a)

Line 2

No need for white space

b)

Line 3

No need for ==

c)

Line 8

There is no print instruction

d)

Line 3 missing a colon ( : )

38.

What will be displayed when this code is run?

a)

13

b)

0

c)

zero

d)

Nothing will be displayed

39.

Which of the following is the correct extension of the Python file?

a)

.python

b)

.pl

c)

.py

d)

.pyth

40.

Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?

a)

5

b)

4

c)

None

d)

Error