Font size
WorksheetsPython Revision Years 8&9 IGCSE
Total questions: 40
Worksheet time: 37mins
What is the error with the highlighted line?
The > is missed
The : is missed
The ( ) is missed
The > is missed
Choose the correct form of a list:
Students = ["Ahmed", "Ali", "Kareem"]
Students = ["Ahmed", "Ali", "Kareem"]:
Students = ("Ahmed", "Ali", "Kareem")
Students = {"Ahmed", "Ali", "Kareem"}
Choose the correct form of the 1st line of if statement:
if choice == (A)!
IF choice == "A":
if choice = "A":
if choice == "A":
To delete an item from the list we use the command:
students.delete(name)
students.remove(name)
students.erase(name)
students.append(name)
What is the usage of append command?
It adds an item to the middle of the list.
It adds an item to the beginning of the list.
It adds an item to the end of the list.
It replaces an item of the list.
What is the correct form of a module (procedure) 1st line?
def welcome() :
def welcome :
DEF welcome() :
def welcome()
What is the output of this program if N1 = 5?
What is a parameter in a function?
input value to a function for the function’s execution
a variable used to send information to a function
the name of the function
the name of the main program calling the function
What will happen when this code is run?
Nothing there is an error on line 5
It will print the following:
10
10
20
It will print the following:
13.3333334
It will print the following:
10
10
20
Average = 13.33333334
What will happen when this code is run and the user types in Finham Park?
The code will return:
Try again...
The code will return:
You bet it is, ", name, "is the best!
The code will return:
You bet it is, Finham Park is the best!
Nothing there is an error on
Line 5, missing a colon ( : )
What will happen when this code is run and the user types in yes?
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?
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?
It will print the following:
is it raining today?
yes
The code will return:
Better take a brolly
or you will get wet
It will print the following:
is it raining today?
yes
The code will return:
Better take a brolly
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?
The code will eventually print:
160
The code will eventually print:
80
The code will eventually print:
The total cost of the tickets would be: 80
The code will eventually print:
The total cost of the tickets would be: 82.5
Which of the following is the operator used in Python to say less than or equal to
==
<=
>=
<
What does the operator != on line 3 represent
Is exactly
Is an integer
Is a statement
Is not
Which of the following terms best describes the code above?
function call
function definition
What will happen when this code is run and the user inputs the number 3
The code will print:
Type in a number
The code will print:
Type in a number
User inputs 3
Code will print:
9
The code will print:
Type in a number
User inputs 3
Code will print:
Multiply it by 3
We now have the number 9
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
This is code to calculate the price of tickets charged to customers. On which line of code is there an error?
Line 4
Line 6
Line 7
Line 8
Where is there an error in this code?
Line 2
No need for white space
Line 3
No need for ==
Line 8
There is no print instruction
Line 3 missing a colon ( : )
What will be displayed when this code is run?
13
0
zero
Nothing will be displayed
Which of the following is the correct extension of the Python file?
.python
.pl
.py
.pyth
Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?
5
4
None
Error
