wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

GCSE Python Legends

Total questions: 45

Worksheet time: 23mins

Name
Class
Date
1.

What has been created here?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

a)

An Array / List

b)

A Loop

c)

A Value

2.

How many elements exist in here?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

a)

5

b)

4

c)

6

3.

What is the highest index value here?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

a)

4

b)

5

c)

6

4.

What is the range of indexes for the elements here?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

a)

0 - 4

b)

1 - 5

c)

0 - 5

5.

How do we add another new sport in to here at the end?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

a)

Sport.append("Swimming")

b)

Sport = "Swimming"

c)

Sport[1] = "Swimming"

6.

How do we print "Tennis" to the display?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

a)

print(Sport[2])

b)

print(Sport[3])

c)

print(Sport)

7.

How do we print "Quidditch" to the display?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

a)

print (Sport[4])

b)

print (Sport[3])

c)

print (Sport[5])

8.

What will this code print to the display?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

Sport[0] = "Fishing"

Sport.append("Boxing")

print(Sport)

a)

"Fishing","Rugby","Tennis","Netball","Quidditch","Boxing"

b)

"Football","Rugby","Tennis","Netball","Quidditch"

c)

"Fishing","Football","Rugby","Tennis","Netball","Quidditch","Boxing"

9.

What will this code print to the display?


highscore = [125,63,35,12]

for counter in range(4):

print(highscore[counter])

a)

125

63

35

12

b)

63

35

12

c)

125,63,35,12

125,63,35,12

125,63,35,12

125,63,35,12

10.

What will this code print to the screen?


Sport = ["Football","Rugby","Tennis","Netball","Quidditch"]

print("My Favorite Sport is: ",Sport[4])

a)

My Favorite Sport is: Quidditch

b)

My Favorite Sport is: Netball

c)

My Favorite Sportis : Sport4

11.

What are the three main data types we use in programming?

a)

Integer, String, Float

b)

Integer, String, Word

c)

Integer, Character, Float

12.

What data type should this be stored as:


£100.00

a)

Float

b)

Int

c)

Str

13.

What data type should a password be saved as if you have to use a mix of letters, numbers and special characters?

a)

String

b)

Integer

c)

Float

14.

When we join strings together we call it?

a)

Concatenation

b)

Addition

c)

Merging

15.

NewNumber = int (Number)

a)

Casting

b)

Concatenation

c)

Inputting

16.

if choice.upper() == "I":

print("You smell funny")

elif choice.upper() == "C":

print("You look lovely today")

else:

print("Invalid response")


Why did the programmer use .Upper in this code?

a)

Just in case someone input a lower case letter it will still work

b)

Just in case someone input an upper case letter to make it work

17.

What will this program print to the display when it is Run?


for counter in range(5):

print(counter)

input("\nPress ENTER to exit program")

a)

0

1

2

3

4


Press ENTER to exit program

b)

0

1

2

3

c)

0

1

2

3

4

5


Press ENTER to exit program

18.

What is wrong with this IF statement when I enter 45 as my number?


Number = input("Enter a Number Please")


If Number > 5:

print ("Number is greater than 5")

If Number >10:

print ("Number is greater than 10")

else:

print("Number is less than 5")

a)

A number greater than 10 will still print "Number is greater than 5" because the condition comes first.

b)

A number greater than 10 will never print "Number is greater than 5" because the condition comes first.

19.

What is wrong with this IF statement looking at the syntax?


Number = input("Enter a Number Please")


If Number < 5:

print ("Number is less than 5")

If Number <10:

print ("Number is less than 10")

a)

There is no else statement for any other result that happens

b)

It will not print Number is less than 10 if I enter 8

20.

My program is supposed to add 2 and 2 to give 4. But it gives the answer 22. What type of error is this?

a)

Logic

b)

Syntax

c)

Runtime

21.

An IF statement is an example of ....

a)

Selection

b)

Iteration

c)

Sequence

22.

A FOR or WHILE loop statement is an example of ....

a)

Selection

b)

Iteration

c)

Sequence

23.

A list of instructions in order is an example of ....

a)

Selection

b)

Iteration

c)

Sequence

24.

What error prevents your program from even running?

a)

Syntax

b)

Logic

c)

Spelling

25.

What will this code produce?


Animal = "Fish"

FOR i in "Animal":

print("I am a", (Animal))

a)

I am a Fish

I am a Fish

I am a Fish

I am a Fish

b)

I am a Fish

c)

I am a Animal

26.
What will the output be from the following code?
print("Hello world!\nHello world!")
a)
Hello world! Hello world!
b)
Hello world!
Hello world!
c)
SyntaxError
d)
Hello world!
27.
What will the output be from the following code?
print("Hello" + str(2) + "world!")
a)
Hello world! Hello world!
b)
Hello2world!
c)
Hello Hello world! world!
d)
SyntaxError
28.
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 
29.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
30.
Code repeated / looped until a condition has been met or a set number of times.
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
31.

What does the following code do? myAge = int (myAge)

a)

Converts the var (variable) myAge to a string

b)

Converts the var (variable) myAge to a integer

c)

Converts the var (variable) myAge from a integer to a string

d)

Converts the var (variable) myAge to if statement

32.
What is python named after
a)
The snake
b)
Television show called Monty Python
33.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
34.
Decides if a string only contains numbers
a)
isalpha()
b)
isnumeric()
c)
int()
d)
string()
35.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
36.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
37.
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
38.
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
a)
/
b)
\n
c)
\l
d)
n
39.
What will the output be from the following code?
print("Hello world!" * 2)
a)
TypeError
b)
Hello world world!
c)
Hello world!Hello world!
d)
Hello world! * 2
40.
Joining elements together to make a string is called what?
a)
Combining
b)
Connecting
c)
Concatenation
d)
Stringing
41.
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
42.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
43.

people = ["John", "Rob", "Bob"]

print (people[1])

what would this result be?

a)
John
b)
Rob
c)
Bob
44.

people = ["John", "Rob", "Bob"]

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
45.

people = ["John", "Rob", "Bob"]

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error