wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Techniques

Total questions: 30

Worksheet time: 14mins

Name
Class
Date
1.
Which of the following statements are false about variable names:
a)
They must always be in capital letters
b)
They should be descriptive
c)
They should not start with numbers or contain spaces
d)
They point to memory locations
2.
Which of the following is not a valid data type?
a)
Fraction
b)
Float
c)
String
d)
Integer
3.
Quotation marks around a variable’s identifier imply that it is a:
a)
String
b)
Integer
c)
Character
d)
List
4.
This variable data type can only have True or False values:
a)
Boolean
b)
Integer
c)
True/False
d)
String
5.
The statement A OR B implies that A and B are:
a)
Booleans
b)
Integers
c)
Strings
d)
Constants
6.
Casting refers to:
a)
Converting between variable data types
b)
Boolean algebra
c)
Printing out of the program’s results
d)
Sending values to a function or procedure
7.
The programming keywords ELSE IF or ELIF are best used when our selection needs to work with:
a)
More than two choices
b)
More than three choices
c)
More than one choice
d)
A conditional loop
8.
Identify the error in the pictured line of Python code
num1 * Num2 = total
a)
The variable assigned must be on the left
b)
Multiplication  symbol should be 'x' not '*'
c)
The variable Num2 can't have a capital letter
d)
'total' needs to be casted as an integer
9.
Which of the following lines of Python code will allow a user to input their username as a variable?
a)
user = input("Input your name: ")
b)
username == input("What is your username?")
c)
print("Input your username")
d)
input("Please enter your username") = userID
10.
Which of these lines of Python code will output the third item from a list called 'games'?
a)
print(games[2])
b)
print games(3)
c)
print(games[3])
d)
print (games(2))
11.

Which arithmetic operator is used in the sum 5 * 5 = 25?

a)

Plus

b)

Minus

c)

Multiply

d)

Modulus

12.

Which of the following would you use to find the remainder in a sum?

a)

=

b)

%

c)

>

d)

//

13.

Which of the following is the assignment operator that is used to assign a value to a variable or constant?

a)

==

b)

<

c)

=

14.

If X = 6 and Y = 3


C = X + Y

What is C?

a)

9

b)

8

c)

7

15.

What does IDE stand for?

a)

Integer Divide Element

b)

Intelligent Device Environment

c)

Integrated Development Environment

16.

Which one of these best describes a constant?

a)

A value that does not change whilst the code is running.

b)

A value that changes.

c)

A location in memory to store / a value that may change

d)

A value that cannot change

17.
Which two categories of loop is iteration split up into?
a)
Count-controlled
b)
Condition-controlled
c)
Temperature-Controlled
d)
Time-Controlled
18.

Identify the programming constructs

a)

Sequence

b)

branching

c)

Iteration

d)

Cooking

e)

Dancing

19.

Which of the following is an example of a count controlled loop?

a)

While.... do

b)

Repeat.... until

c)

For..... next

d)

For....then

20.
A function...
a)
Never has parameters
b)
Always returns a value
c)
Must has parameters
d)
Does not return a value
21.

Which one of these best describes a variable?

a)

A value that does not change whilst the code is running.

b)

A value that changes.

c)

A location in memory to store a value that may change

d)

A value that cannot change

22.

Which of the following would you use to find a divided value without a remainder?

a)

=

b)

%

c)

>

d)

//

23.

a = 26 mod 5

What is the value of a?

a)

1

b)

2

c)

5

d)

10

24.

a = 165 mod 16

What is the value of a?

a)

10

b)

5

c)

1

d)

16

25.

a = 165 div 16

What is the value of a?

a)

10

b)

5

c)

1

d)

16

26.

(5 % 2) > (10 // 2)

a)

True

b)

False

27.

"4" + "26" =

a)

30

b)

22

c)

426

d)

"426"

28.

4 + 26 =

a)

30

b)

22

c)

426

d)

"426"

29.

What data type would hold the value 64?

a)

Integer

b)

Boolean

c)

String

d)

Float

e)

Character

30.

What data type holds a decimal value?

a)

Integer

b)

Boolean

c)

String

d)

Float / Real

e)

Character