wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Programming

Total questions: 42

Worksheet time: 17mins

Name
Class
Date
1.
Syntax errors are always spotted when the program is compiled or interpreted.
a)
True
b)
False
2.
Logic errors are detected by the programming IDE being used.
a)
False
b)
True
3.
Which of these pseudocode statements is an example of a logic error?
a)
FOR x=0 TO 10 STEP -1
b)
FOR x=0 TO 10 STEP 1
c)
FOR x=10 TO 0 STEP -1
d)
FOR x=0 TOO 10 STEP 1
4.
Syntax errors are caused by incorrectly typed source code.
a)
True
b)
False
5.
A program won't run if there is a logic error.
a)
False
b)
True
6.
Which of these pseudocode statements contains a syntax error?
a)
pounds = pence x 100
b)
pounds = pence * 100
c)
pounds = pence / 100
d)
pounds = 100 / pence
7.
Modern IDEs are able to spot syntax errors as the programmer types.
a)
True
b)
False
8.
A program may never contain both syntax and logic errors.
a)
False
b)
True
9.
Which statement best describes logic errors?
a)
An error in a program that causes it to produce incorrect ouputs but not a crash.
b)
An error in a program that causes it to crash.
c)
An error in the program caused by mis-spelt instructions.
d)
An error in a program caused by hardware failure.
10.
Which of these expressions will generate a logic error when the expected output is 10?
a)
answer = 2 + 3 * 2
b)
answer = (2 + 3) * 2
c)
answer = 2 + 3 x 2
d)
answer = {2 + 3} * 2
11.

What in the name of the variable in this Python code?

a)

name

b)

input

c)

print

d)

("What is your name")

12.

Why is it important that was use comments in our code?

a)

They help the program run smoothly

b)

So that when we come back to the code we can understand what it is doing

c)

To help other people understand what is going on in our code

d)

To add more colours into our code

13.

Which of these is not an arithmetic operator?

a)

+

b)

-

c)

*

d)

=

14.

What symbol is used for multiplication in Python coding?

a)

x

b)

+

c)

#

d)

*

15.

When coding in Python what two instructions would I use if I want the program to select a choice?

a)

IF

PRINT

b)

IF

COUNT

c)

IF

ELSE

d)

IF

INPUT

16.

In Python coding what does the instruction PRINT do?

a)

Instruct a printer to work

b)

Add together two numbers

c)

Print a statement on the screen

d)

Input a number

17.

What is missing from the Python code in the image?

a)

() [brackets]

b)

" " [speech marks]

c)

: [colon]

d)

; [semi-colon]

18.

What word is missing from the Python code in the image?

a)

print

b)

birth_year

c)

age

d)

input

19.
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
20.
What is python?
a)
a programming language 
b)
DTP software 
c)
Spreadsheet software
d)
Computer 
21.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
22.
Syntax errors are caused by incorrectly typed source code.
a)
True
b)
False
23.

What will:

answer = input("Give me a number")

print(answer * 5)

output?

a)

An error message

b)

The value of answer multiplied by 5

c)

answer * 5

d)

The value of answer repeated 5 times

24.

How do we change a user input from string to integer?

a)

Casing

b)

Flipping

c)

Casting

d)

Numerising

25.

What does == mean?

a)

Assign a value to a variable

b)

Nothing, it's an error caused by typing == instead of =

c)

Check that the value on the right of the == matches the value on the left

26.

What can a variable not start with?

a)

A special character

b)

A capital letter

c)

A number

d)

A lower case letter

27.

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

28.

Which of the following statements implement definite iteration?

a)

​STOP UNTIL

b)

FOR ENDFOR

c)

REPEAT UNTIL

d)

WHILE ENDWHILE

29.

What are the two possible results of testing a condition?

a)

YES and NO​

b)

POSITIVE and NEGATIVE

c)

​TRUE and FALSE​

d)

0 or 1

30.

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

a)

Manipulation

b)

Declaration

c)

addition

d)

Concatenation

31.

Which logical operator represents greater than?

a)

<

b)

>

c)

>=

d)

==

32.

Which of the following is a benefit of using local variables?

a)

Other programmers cannot use them

b)

They cannot accidentally be changed by other parts of a program

c)

They make all variable names unique

d)

They make selections work

33.

What is an array?

a)

A data structure that holds one or more items of data

b)

A variable with more than one data type

c)

A variable with more than one value

d)

Sorting data in a list 

34.

Which data type represents whole numbers?

a)

Real

b)

String

c)

Integer

d)

Float

35.

What is a constant?

a)

A value that does not usually change as a program is running

b)

A variable with more than one data type

c)

A named piece of memory that holds a value which usually changes as a program is running

d)

A named piece of memory that holds a value which cannot be changed as a program is running

36.

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 

37.

What is recorded in a test/trace table?

a)

Evidence of successful tests

b)

Evidence of failed tests

c)

Evidence of testing

d)

Evidence the program run

38.

What are two types of programming error?

a)

Syntax errors and logic errors

b)

Syntax errors and validation errors

c)

Logic errors and validation errors

d)

Error Erros 

39.

What is an algorithm?

a)

How to make a jam sandwich

b)

A way to solve a problem

c)

instructions

d)

Step by step instructions to solve a problem

40.

Code repeated / looped until a condition has been met or a set number of times.

a)

Iteration

b)

While...

c)

the end is never

the end is never

the end is never

the end is never

the end is never

the end is never

the end is never

the end is never

the end is never...

d)

For...

41.

people = ["jo", "maya", "jay"]​

print (people[1])​

what would this result be?

a)

maya

b)

jo

c)

jay

d)

error

42.

What is the % used for in Python?

a)

Integer division

b)

Give the whole number

c)

To give the remainder

d)

Give the decimal only