wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Y10

Total questions: 29

Worksheet time: 21mins

Name
Class
Date
1.
What will the output be from the following code?
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
2.
What will the output be from the following code?
print(3*4+5)
a)
27
b)
17
c)
12
d)
SyntaxError
3.

What symbol is used in python to assign values to a variable?

a)

=

b)

+

c)

/

d)

==

4.

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

print (people[-1])

what would this result be?

a)
John
b)
Rob
c)
Bob
5.

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

print (people[4])

what would this result be?

a)
John
b)
Rob
c)
Bob
d)
Error
6.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
7.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
8.
telephone = "02079876032" What is the data type of telephone?
a)
string
b)
int
c)
real
d)
float
e)
boolean
9.
which one is the "concatenation operator"?
a)
+
b)
-
c)
*
d)
/
e)
=
10.
Which one is NOT a arithmetic operator?
a)
+
b)
-
c)
*
d)
/
e)
=
11.
Which one is the list of RELATIONAL operators?
a)
+, -, *, /, **, %, //
b)
<, >, <=, >=, ==, !=
c)
and, or, not
d)
+=, -=, *=, /=, %=, //=
e)
(), {}, :, \n, \t
12.
Which one is the list of LOGICAL operators?
a)
+, -, *, /, **, %, //
b)
<, >, <=, >=, ==, !=
c)
and, or, not
d)
+=, -=, *=, /=, %=, //=
e)
(), {}, :, \n, \t
13.
What will print?
a)
nothing
b)
5
c)
6
d)
an error message
14.
How many times does the following program print the word ‘computer’:

word= "computer"  
for num in range(1,6):
 
    print(word)
a)
5
b)
6
c)
1
d)
0
15.
Look at the code below and identify which of the statements below are true:

for loopCounter in range(10,101,10):
               
     print(loopCounter)
a)
Starts at 10, goes up to 100, increases by 10
b)
Starts at 10, goes upto 101, increases by 10
c)
Starts at 1, goes upto 100, increases by 1
d)
Starts at 10, goes upto 10, increases by 10
16.
a)
5
4
3
2
1
b)
4
3
2
1
0
c)
5  4  3  2  1
d)
4  3  2  1  0
17.
a)
5
4
3
2
1
b)
5  4  3  2  1
c)
4
3
2
1
0
d)
4  3  2  1  0
18.
What will print?
a)
1
2
11
b)
1
2
21
c)
1
2
3
11
d)
1
2
3
21
19.

Which of these is the correct code for creating a list of names?

a)

nameList = John, Harry, Jesse, John, Harry, Harry

b)

nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")

c)

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

d)

nameList = [John, Harry, Jesse, John, Harry, Harry]

20.

The list needs one more name added to the end - "Felipe". Which piece of code below would do this?

nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

nameList.append(Felipe)

b)

append(nameList,"Felipe")

c)

nameList.append["Felipe",7]

d)

nameList.append("Felipe")

21.

To insert an the string "strawberries" in the first position of a list we use

a)

fruit.append("strawberries, 1")

b)

fruit.insert("strawberries",0)

c)

fruit.insert(1, "strawberries")

d)

fruit.insert(0, "strawberries")

22.

randItem = random.choice(["gold", "silver", "platinum"])

a)

could select either gold, silver or platinum

b)

will select gold

c)

will select silver

d)

will select platinum

23.

Leo wants to create a subroutine that will roll a dice. Which syntax is correct?

a)

def dice roll ():

b)

def diceroll ()

c)

def diceroll ():

d)

def diceroll []:

24.

What is a function?

a)

A section of code that will return a value

b)

A section of code that will return nothing

c)

A section of code that will return a command

d)

None of the above

25.

What is a Procedure?

a)

A section of code that will return a value

b)

A section of code that will return nothing

c)

A section of code that will return a command

d)

None of the above

26.

What is a benefit of using Subroutines?

a)

More efficient

b)

Takes longer to write

c)

The code looks better

d)

The program executes better

27.

Parameter

a)

A named block of code designed to carry out a specific task.

b)

A named block of code that returns a value.

c)

Identifies data being passed into a subroutine.

d)

An item of data being passed to a subroutine.

28.

Argument

a)

A named block of code designed to carry out a specific task.

b)

A named block of code that returns a value.

c)

Identifies data being passed into a subroutine.

d)

An item of data being passed to a subroutine.

29.

How many parameters are being passed into the function add?

a)

0

b)

1

c)

2

d)

3