wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.2 Programming techniques

Total questions: 24

Worksheet time: 12mins

Name
Class
Date
1.

Which of the following is a valid keyword for output? (1-4)

a)

PRINT

b)

SHOW

c)

DISPLAY

d)

INPUT

2.

Which of the following is not a valid data type? (1-4)

a)

Real

b)

String

c)

Character

d)

Fraction

3.

Quotation marks around a variable’s identifier imply (1-4)

a)

It is an integer

b)

It is a string

c)

It is a Boolean

d)

It is a real

4.

The multiplication table is best displayed using this data type (4-6)

a)

Boolean

b)

Character

c)

Integer

d)

Real

5.

This variable type can only have True or False values (1-4)

a)

Boolean

b)

Integer

c)

String

d)

Character

6.

Casting refers to: (4-6)

a)

Boolean algebra

b)

Rounding of reals

c)

Converting between variable data types

d)

Printing out of the program’s results

7.

The operator used to find if a number is divisible by another number: (4-6)

a)

Integer division

b)

MOD

c)

Division

d)

Subtraction

8.

This function calculates the length of a string (4-6)

a)

UBOUND

b)

INDEX

c)

LEN

d)

COUNT

9.

The main difference between procedures & functions is

a)

Procedures are usually longer & have more instructions

b)

Functions use parameter passing, while procedures don’t

c)

Functions are more difficult to debug

d)

Functions return values, while procedures don’t

10.

The flowchart shape for selection is

a)

Parallelogram

b)

Square

c)

Diamond

d)

Rounded rectangle

11.
Variables cannot be changed.
a)
False
b)
True
12.

5.23 would be stored as:

a)

Integer

b)

Real Number

c)

String

d)

Character

e)

Boolean

13.

ELSE IF keyword is used when

a)

Our selection needs to work with more than three choices

b)

Our selection needs to work with more than two choices

c)

SELECT CASE/SWITCH statement is not available

d)

Using conditional loops

14.

The most appropriate file mode for creating a logbook

a)

Read

b)

Write

c)

Append

d)

Close

15.

What is Python?

a)

A programming language

b)

A binary language

c)

Machine code

16.

What is Python?

a)

A programming language

b)

A binary language

c)

Machine code

17.

What does the keyword "import" mean

a)

Add an additional library to our program

b)

Create a random number

c)

Output a string

d)

Create a subroutine

18.

Which loop requires a condition to be met before running?

a)

WHILE

b)

FOR

c)

AND

d)

IF

19.

What is decomposition?

a)

Breaking a problem down into smaller problems to make it easier to solve

b)

Removing unnecessary details from a problem

c)

Creating a list of steps to help solve a problem

d)

Using an if, elif, else loop in our code

20.

What is the name of the parameter?

a)

say_my_name

b)

my_name

c)

name

d)

def

e)

There are none

21.

What is the name of the sub-routine?

a)

say_my_name

b)

my_name

c)

name

d)

def

22.

What is the name of the list?

a)

my_name

b)

correct

c)

names

d)

item

23.

Which of the following is not a method of opening a file?

a)

f = open("file.txt", a)

b)

f = open("file.txt", r)

c)

f = open("file.txt", w)

d)

f = open("file.txt", p)

24.

What does the code do?

a)

Creates a random number between 1 and 100 and prints to the user

b)

Prints the number 100

c)

Nothing, there is an error

d)

Asks the user to guess a random number