wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming in Python

Total questions: 25

Worksheet time: 17mins

Name
Class
Date
1.

What is a program?

a)

A set of instructions carried out by a computer to perform a specific task.

b)

A program is a recipe for a dish.

c)

A type of machine.

d)

A type of mobile device.

2.

What is a an algorithm?

a)

It is a type of programming language.

b)

Step by step instructions to follow in a specific order in order to solve a problem.

c)

It is the steps that must be followed but the order does not matter.

d)

A type of computer hardware.

3.

All programs are made up of three basic building block (programming constructs). What are these?

a)

Python, Java and HTML

b)

Software, Hardware and Computers

c)

Sequence, Selection and Iteration

d)

Google, Amazon and Apple

4.

What does syntax mean?

a)

The name of the programming language.

b)

It is a special command.

c)

It is a step by step guide.

d)

It is the rules of the programming language that must be followed.

5.

Match the following data to the correct data type.

String

Integer

Boolean

11.5

Float

"I love coding"

20

True / False

6.

The code shown contains two syntax errors. Which of the options below shows the correct code without any syntax errors.

a)

print(Hello MCA)

b)

print("Hello MCA")

c)

Print("Hello MCA")

d)

PRINT("Hello MCA")

7.

Which of the following codes will produce the output shown in the picture on multiple lines?

a)

print("John Smith")

b)

print("John" + "Smith")

c)

print("John")

print("Smith")

d)

print(John Smith)

8.

What output will this code produce?

a)

name = Mr Abbas

b)

My name is name

c)

My name is Ben

d)

My name is Mr Abbas

9.

Which name will this code output?

a)

Mr Ali

b)

Mr Abbas

c)

Mr Jalloh

d)

Mr Mooney

10.

How many variables are used in the code shown?

a)

1

b)

2

c)

3

d)

4

11.

What is the value stored in the variable postcode?

a)

James

b)

85.5

c)

12

d)

LU3 0SG

12.

What is the value stored in the variable age?

a)

85.5

b)

James

c)

LU3 0SG

d)

12

13.

What is the data type stored in the variable name?

a)

Integer

b)

Float

c)

String

d)

Boolean

14.

What is the data type stored in the variable testscore?

a)

Float

b)

Integer

c)

String

d)

Boolean

15.

What are the names of the variables in this code? Type each variable name below.

4 lines
16.

What will be the output from this code?

a)

10

b)

100

c)

20

d)

200

17.

What will be the output from the code shown?

a)

10

b)

22

c)

18

d)

40

18.

What will be the output from the code shown?

a)

10

b)

0

c)

25

d)

1

19.

What will be the output from the code shown?

a)

20

b)

100

c)

1000

d)

1010

20.

How many variables are there in this code?

a)

3

b)

1

c)

2

d)

0

21.

What will be the value of the variable number3 when this code is run?

a)

35

b)

250

c)

3

d)

15

22.

What is the value of the variable number2?

a)

25

b)

10

c)

15

d)

5

23.

What will be the output from the code shown?

a)

1

b)

2

c)

3

d)

4

24.

What is the name of the function that is used to output text or numbers?

a)

input

b)

print

c)

output

d)

variable

25.

What is the purpose of the input() function in Python?

a)

It allows you to output text.

b)

It allows you to enter data.

c)

It is a variable that stores data.

d)

It does not do anything.