wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Programming

Total questions: 37

Worksheet time: 27mins

Name
Class
Date
1.

What is a program?

a)

A series of a step-by-step instructions that tell a computer how to solve a task

b)

A video that is watched on a computer

c)

A flowchart written on a computer

d)

The make and model of a computer

2.

What does the print command do?

a)

Outputs a hard copy of a program to a printer

b)

Outputs a message on screen

c)

Print a hard copy of a flow chart to a printer

d)

Prints out the the commands line by line on the screen

3.

How do we get user input from the keyboard?

a)

input = (What is your name?)

b)

input = What is your name?

c)

output = ("What is your name?")

d)

input("What is your name? ")

4.

Which data type is the most suited to store a telephone number in a variable?

a)

string

b)

integer

c)

float

d)

boolean

5.

Which data type would you use for the quantity of stock in a shop?

a)

integer

b)

float

c)

string

d)

boolean

6.

If you want to change the data type to an integer which line of code would you use?

a)

int ("How much pocket money do you have?")

b)

input("How much pocket money do you have?")

c)

int(input("How much pocket money do you have?"))

d)

int = ("How much pocket money do you have?")

7.

How many statements are in this line of code?

print("If I do well in computing, I will find most subjects easy")

a)

2 - print and if

b)

0 - there are no statements

c)

1 - print

8.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

name

c)

"Dave"

d)

(name)

9.

What is an input?

a)

To plug in something

b)

A function that allows us to ask the user to enter some data

c)

Data displayed on a screen

d)

A routine

10.

A variable must have been assigned (given) a value before that value is referenced (used).

a)

True

b)

False

11.

The correct way to convert user input is:

a)

birth_year = number(input())

b)

birth_year = int(input())

c)

birth_year = (input(int))

d)

birth_year = int(input)

12.

To display the following on screen Hello World! the following command should be used:

a)

print(Hello World!)

b)

print("Hello World" + !)

c)

print("Hello World!")

d)

print"(Hello World!)"

13.

You assign a value to a variable with which symbol

a)

@

b)

==

c)

=

d)

*

14.

The code you use to receive and input from the keyboard

a)

enter()

b)

add()

c)

receive()

d)

input()

15.

Program statements are executed in sequence, one after the other...

a)

True

b)

False

16.

If the coding steps are in the incorrect order, the computer can still execute the program.

a)

True

b)

False

17.

How many variables are there in this program?

a)

2

b)

3

c)

4

d)

5

18.

What would be the output of this program if the user input was 10?

a)

22.04

b)

220.4

c)

2204

d)

Error wrong data type

19.

What data type represents a whole number?

a)

Float

b)

Int

c)

Boolean

d)

String

20.

How many errors are there in this code?

a)

1

b)

2

c)

3

d)

4

21.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
22.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
23.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
24.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
25.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

26.
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly
a)
True
b)
False
27.
What Python command lets the user enter an answer to a question?
a)
answer()
b)
open()
c)
print()
d)
input()
28.

What commend is used to check if two values are the same

a)

==

b)

=

c)

+

d)

*

29.

This line of code will generate an error?


if x= 7:

a)

True

b)

False

30.

This line of code will generate an error


if x==7

a)

false

b)

true

31.

What will be printed on the screen when you run this program?


x=7

y=6

z=x+y

print (z)

a)

7

b)

6

c)

13

d)

error message

32.

What will be printed on the screen if the user enters the value Dave when asked to enter their name when this program is run?


x= 7

y= 6

name = input("Please enter your name")

print ("Hi, 6+7 =13")

a)

Hi Dave 6+7 = 13

b)

Hi Dave

c)

6+7 = 13

d)

Hi, 6+7 = 13

33.

What will be output if the user enters Fred

name = input("Please enter your name")

print ("Name")

a)

Fred

b)

Dave

c)

Error Message

d)

Name

34.

What will be output if the user enters Fred

name = input("Please enter your name")

print ("name)

a)

Fred

b)

Hi Fred

c)

Name

d)

Error Message

35.

What will be output if the user enters Fred

name = input("Please enter your name")

print (name)

a)

Name

b)

Fred

c)

Hi Fred

d)

Error Message

36.

In Scratch you cannot assign a value to a variable but you can in Python

a)

False

b)

True

37.

What will the program print out when this is run?


x= 1

while x<7:

if x == 5:

print (x)

x=x+1

a)

1,2,3,4,5,6,7

b)

7

c)

5

d)

Error Message