Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

KS4 Programming - mmd

Total questions: 81

Worksheet time: 41mins

Name
Class
Date
1.

Which data type is used to store whole numbers only?

a)

Real

b)

Integer

c)

Boolean

d)

String

2.

What is the typical amount of memory taken up by a Boolean data type?

a)

1 byte

b)

2 bytes

c)

4 bytes

d)

1 bit

3.

Which function is used to convert a string to an integer in programming?

a)

float()

b)

bool()

c)

int()

d)

str()

4.

What is the result of the expression bool(1) in programming?

a)

0

b)

False

c)

True

d)

1

5.

Which data type is used to represent text, a collection of characters?

a)

Integer

b)

Real

c)

String

d)

Character

6.

What is the ASCII number for the character 'b'?

a)

97

b)

98

c)

99

d)

100

7.

Which data type should be used to store a person's height in meters?

a)

Integer

b)

Real

c)

Boolean

d)

String

8.

What is the result of the expression 4 * 8 using the multiplication operator?

a)

12

b)

32

c)

16

d)

24

9.

Which operator is used to raise a number to a power?

a)

+

b)

/

c)

^

d)

MOD

10.

What does the DIV operator return?

a)

The remainder of a division

b)

The whole number part of a division

c)

The sum of two numbers

d)

The product of two numbers

11.

Which rule should computers follow when using operators to ensure correct order of operations?

a)

PEMDAS

b)

BODMAS

c)

BEDMAS

d)

BOMDAS

12.

What is the purpose of the assignment operator "=" in programming?

a)

To compare two values

b)

To add two numbers

c)

To assign values to constants or variables

d)

To divide two numbers

13.

Which comparison operator checks if two values are not equal?

a)

==

b)

<>

c)

>

d)

<=

14.

What is a constant in programming?

a)

A value that can change during program execution

b)

A value that remains the same throughout program execution

c)

A variable that stores temporary data

d)

A function that performs calculations

15.

What is the purpose of declaring variables with data types?

a)

To make the program run faster

b)

To specify the kind of data a variable can hold

c)

To increase the size of the program

d)

To make the program more complex

16.

Why might you assign the values 5 and 2 to constants in a program?

a)

To allow them to change during program execution

b)

To make the program more difficult to understand

c)

To ensure they remain unchanged during program execution

d)

To increase the number of variables in the program

17.

What is the naming convention for constants and variables mentioned in the document?

a)

Upper case for the first letter, followed by numbers

b)

Lower case for the first letter, followed by a mixture of letters, numbers, and underscores

c)

All upper case letters

d)

All lower case letters

18.

What is the purpose of using double or single quotation marks in programming strings?

a)

To denote a comment

b)

To start a loop

c)

To define a string

d)

To declare a variable

19.

What does the '+' operator do when used with strings?

a)

Subtracts strings

b)

Multiplies strings

c)

Concatenates strings

d)

Divides strings

20.

What is the starting index number for characters in a string?

a)

1

b)

0

c)

2

d)

10

21.

Which function changes all characters in a string to uppercase?

a)

x.lower

b)

x.length

c)

x.upper

d)

x.subString

22.

How do you extract the first three characters from a string variable named 'town'?

a)

town.subString(0, 3).upper

b)

town.subString(3, 0).upper

c)

town.subString(0, 3).lower

d)

town.subString(3, 0).lower

23.

What is the effect of the x.length function on the string x = "Hello"?

a)

Returns 5

b)

Returns 4

c)

Returns 6

d)

Returns 0

24.

What is the main purpose of an IF statement in programming?

a)

To repeat a block of code multiple times

b)

To check if a condition is true or false

c)

To store data in a variable

d)

To define a function

25.

What should you do if there is nothing for the program to do when the condition is false in an IF statement?

a)

Include an 'else' part

b)

Leave out the 'else' part

c)

Add a 'while' loop

d)

Use a 'switch' statement

26.

What is a nested IF statement used for?

a)

To repeat a block of code

b)

To check more conditions once a previous condition is true

c)

To store multiple values

d)

To define a new function

27.

How are IF-ELSEIF statements different from nested IF statements?

a)

They check more conditions if the previous condition is true

b)

They check more conditions if the previous condition is false

c)

They are used to repeat code

d)

They store data in arrays

28.

Flow diagram showing IF-THEN-ELSE structure

a)

A flowchart with decision nodes and branches

b)

A sequence of steps without any decision points

c)

A diagram showing only linear steps

d)

A chart with only start and end points

29.

What is the primary purpose of SWITCH-CASE statements in programming?

a)

To check if a statement is true or false.

b)

To perform different actions for different values of the same variable.

c)

To repeat a block of code a fixed number of times.

d)

To check multiple conditions at once.

30.

What is a drawback of SWITCH-CASE statements compared to IF-ELSEIF statements?

a)

They are more complex to maintain.

b)

They can only check the value of one variable.

c)

They require more memory.

d)

They cannot be used in loops.

31.

In the context of FOR loops, what does the 'step count' refer to?

a)

The number of times the loop will execute.

b)

The initial value of the loop.

c)

The increment by which the loop variable is increased each time.

d)

The final value of the loop.

32.

How can the number of times a FOR loop repeats be set?

a)

By using a SWITCH-CASE statement.

b)

By setting the program to run indefinitely.

c)

By defining the loop with an initial value, end value, and step count.

d)

By using a default case.

33.

Diagram illustrating the flow of a SWITCH-CASE statement used to count votes in an election.

a)

A flowchart showing the decision-making process for counting votes using SWITCH-CASE.

b)

A diagram depicting the use of IF-ELSE statements in vote counting.

c)

An illustration of a FOR loop used in the election vote counting process.

d)

A diagram showing the use of a WHILE loop in counting votes.

34.

Which type of loop is controlled by a condition at the end of the loop and always runs the code inside at least once?

a)

WHILE loop

b)

FOR loop

c)

DO UNTIL loop

d)

IF statement

35.

In a WHILE loop, when does the loop stop executing?

a)

When the condition is true

b)

When the condition is false

c)

After a fixed number of iterations

d)

When the loop counter is zero

36.

What happens if the condition in a DO WHILE loop is always true?

a)

The loop runs once

b)

The loop never runs

c)

The loop runs infinitely

d)

The loop runs twice

37.

Which loop checks the condition at the start of the loop?

a)

DO UNTIL loop

b)

WHILE loop

c)

FOR loop

d)

SWITCH statement

38.

Which Boolean operators are essential for working with Boolean values?

a)

ADD, SUBTRACT, MULTIPLY

b)

AND, OR, NOT

c)

PLUS, MINUS, DIVIDE

d)

IF, ELSE, SWITCH

39.

In Boolean expressions, which order should operations be carried out?

a)

OR, AND, NOT

b)

NOT, OR, AND

c)

Brackets, NOT, AND, OR

d)

AND, OR, NOT, Brackets

40.

What is the purpose of using brackets in Boolean expressions?

a)

To increase the speed of computation

b)

To make the expression look complex

c)

To indicate which part to do first

d)

To eliminate the need for NOT operator

41.

In a computer game, a character's status depends on which three variables?

a)

Speed, strength, intelligence

b)

Hunger, hydration, comfort

c)

Health, mana, stamina

d)

Agility, power, defense

42.

What is an array in programming?

a)

A single data value

b)

A collection of data values under one name

c)

A type of loop

d)

A function for sorting data

43.

What is each piece of data in an array called?

a)

Node

b)

Element

c)

Variable

d)

Function

44.

How are positions in an array numbered?

a)

Starting at 1

b)

Starting at 0

c)

Starting at 2

d)

Starting at -1

45.

What is the size of the array 'rowers' in the example?

a)

3

b)

4

c)

5

d)

6

46.

What happens when you reassign an array position to a different data value?

a)

The array size increases

b)

The original value is replaced

c)

The array becomes a list

d)

The array is deleted

47.

What is a two-dimensional array often compared to?

a)

A list of lists

b)

A single list

c)

A string of characters

d)

A single number

48.

How is the position of an element in a two-dimensional array usually written?

a)

[a, b] or [a][b]

b)

(a, b) or (a)(b)

c)

{a, b} or {a}{b}

d)

or