Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

General Python year 10

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
2.

Choose the correct output of the following code.

for i in range(10,15):       

print(i)

a)

10

11

12

13

14

15

b)

10

11

12

13

14

c)

11

12

13

14

15

d)

11

12

13

14

3.

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]

4.

List items have an index number. In the following list, which item has the index number of 3?

["John", "Harry", "Jesse", "John", "Harry", "Harry"]

a)

"John"

b)

"Harry"

c)

"Jesse"

5.

How many different variables are in this program?

a)

2

b)

5

c)

3

d)

4

6.

The output of the program

x = 4

x = "Sally"

print(x)

a)

four

b)

Saly

c)

Sally

d)

4

7.
What will the output be from the following code?
print("Hello" + 2 + "world")
a)
Hello 2 world
b)
Hello2world
c)
TypeError
d)
HelloHelloworld
8.

What is the data type of this variable?

student = "Maria"

a)

List

b)

Integer

c)

String

d)

Dictionary

9.
What output will this code produce?
a)
blue
b)
green
c)
red
d)
error
10.

Consider this list, what will be the highest index the list can have:

li=[1,2,3,4,5]

a)

2

b)

3

c)

4

d)

5

11.

What is the output of this code?

a)

X

b)

Y

c)

Error

12.

Which of the following function is used to count the number of elements in a list ?

a)

count( )

b)

find( )

c)

len( )

d)

index( )

13.

What is the output of program below?


bicycles = ['trek', 'cannondale', 'redline', 'specialized']

print(bicycles[-1])

a)

trek

b)

cannondale

c)

redline

d)

specialized

14.

What is a Boolean?

a)

True or False statement

b)

Numerical Operator

c)

A cube that is used for a soup base.

d)

A Ghost on a tree

15.
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!
16.
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 
17.

What are the three basic programming constructs?

a)

Sequence, selection and iteration

b)

Sequence, selection and looping

c)

Sequence, iteration and looping

d)

Sequence, execution and selection

18.

What is the name given to the joining of strings?​

a)

Manipulation

b)

Declaration

c)

addition

d)

Concatenation

19.

Which logical operator represents greater than?

a)

<

b)

>

c)

>=

d)

==

20.

What is a function?

a)

A type of subroutine that calculates a value

b)

A type of subroutine that returns a value

c)

A type of subroutine that processes a value, but does not return it

d)

A type of subroutine that only runs when called