wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

J277/02 Computational thinking, algorithms and programming

Total questions: 56

Worksheet time: 28mins

Name
Class
Date
1.

Which of the following is not a data type?

a)

Boolean

b)

Print

c)

Integer

d)

String

2.

Which of the following code is used to cast a string to an integer?

a)

bool("False")

b)

str("False")

c)

integer("123")

d)

int("123")

3.

One of the following terms is not associated with programming construct

a)

Selection

b)

Iteration

c)

Loop

d)

Sequence

4.

Identify the code which outputs 10 numbers correctly

a)

for i in range(0,11)

b)

for i in range(0,10)

c)

for i in range(1,9)

d)

for i in range(1,10)

5.

Substring is used to?

a)

Extract a portion of characters from a string

b)

Print out a portion of a string

c)

Remove the left characters by a certain amount

d)

Allow you to change the upper case

6.

Which of the following is an iteration?

a)

IF (num > 3)

b)

For i in range(0, 5)

c)

age = int("21")

d)

students = ["Harry", "Ryan", "Ibrahim"]

7.

What is the purpose of an array?

a)

To store a value

b)

To store multiple values of any type

c)

To store programming code

d)

To store multiple values of the same data type

8.

Which of the following is the correct code to create an array to store some integers?

a)

age = (2, 3, 1)

b)

age = ["2", "3", "1"]

c)

age = ["2" "3" "1"]

d)

age = [2, 3, 1]

9.

What is the correct value after this calculation? 5 mod 2

a)

1

b)

2

c)

2.5

d)

3

10.

What is the correct value after this calculation? 5 div 2

a)

1

b)

2

c)

2.5

d)

3

11.

What is the purpose of the following code?

Hide Answers

a)

Opens a file for you to write into it

b)

Opens a file for you to read the first line

c)

Opens a file called name to store in an array

d)

Opens a file called name to store in an array

12.

Which of the following is not string manipulation?

a)

name.upper()

b)

name.lower()

c)

name.substring()

d)

name.remove()

13.

Describe what a function is?

a)

A block a code that does not return a value

b)

A block a code that returns a value

c)

A block of code to store multiple values in

d)

A type of iteration

14.

In the following code how many parameters are used?

a)

1

b)

2

c)

3

d)

4

15.

In the following code how many parameters are used?

a)

1

b)

2

c)

3

d)

4

16.

What is the most suitable data type to store someone's name?

a)

String

b)

Character

c)

Integer

d)

Boolean

17.

What is the most suitable data type to store the cost of an item?

a)

String

b)

Real/Float

c)

Integer

d)

Boolean

18.

What is the following value that will be extracted using the code?

a)

Mr

b)

Liu

c)

Com

d)

Sci

19.

Which of the following best describes a constant?

a)

A memory store that store data that can be changed during the program

b)

A memory store that store data that cannot be changed during the program

c)

A memory store to store the value of an integer

d)

A memory store to store the value of a string

20.

What type of error is in the following code?

a)

Syntax

b)

Logical

c)

Data Type error

d)

Sequence program

21.

What type of error is in the following code?

a)

Syntax

b)

Logical

c)

Data Type Error

d)

Sequence problem

22.

What name will be printed?

a)

Messi

b)

Salah

c)

Mbappe

d)

Ronaldo

23.

What type of subprogram is the following?

a)

Function

b)

Array

c)

Iteration

d)

Procedure

24.

What type of subprogram is the following?

a)

Function

b)

Array

c)

Iteration

d)

Procedure

25.

What is the correct value that will be extracted from the following code?

a)

Salah

b)

Liverpool

c)

Ronaldo

d)

Man Utd

26.

What type of data structure is the following?

a)

Constant

b)

Variable

c)

1D Array

d)

2D Array

27.

The IF STATEMENT belongs to which programming construct?

a)

Selection

b)

Sequencing

c)

Iteration

d)

Data Structure

28.

The WHILE STATEMENT belongs to which programming construct?

a)

Selection

b)

Squencing

c)

Iteration

d)

Data Structure

29.

The FOR STATEMENT belongs to which programming construct?

a)

Selection

b)

Sequencing

c)

Iteration

d)

Data Structure

30.

Which of the following is classed as a counter controlled loop?

a)

for loop

b)

while loop

c)

do until loop

d)

If statement

31.

Which of the following is classed as a condition based loop?

a)

for loop

b)

while loop

c)

else statement

d)

if statement

32.

Which of the following is an algorithm for searching?

a)

Binary

b)

Bubble

c)

Merge

d)

Insertion

33.

Which of the following is an algorithm for searching?

a)

Linear

b)

Bubble

c)

Merge

d)

Insertion

34.

Which of the following is an algorithm for sorting?

a)

Linear

b)

Binary

c)

Merge

d)

Selection

35.

Which of the following is an algorithm for sorting?

a)

Linear

b)

Binary

c)

Bubble

d)

Selection

36.

Which of the following is an algorithm for sorting?

a)

Linear

b)

Binary

c)

Insertion

d)

Selection

37.

Which of the following can be used to help with maintainability?

a)

Use of sub programs

b)

Input validation

c)

Authentication

d)

Iterative Testing

38.

Which of the following can be used to help with maintainability?

a)

Naming conventions for variables

b)

Input validation

c)

Authentication

d)

Iterative Testing

39.

Which of the following can be used to help with maintainability?

a)

Commenting

b)

Input validation

c)

Authentication

d)

Iterative Testing

40.

Which of the following can be used to help with maintainability

a)

Indentation

b)

Input validation

c)

Authentication

d)

Iterative Testing

41.

What best describes the following? Testing while developing your program.

a)

Iterative Testing

b)

Use of sub programs

c)

Authentication

d)

Anticipating Misuse

42.

What best describes the following? Testing at the end of development.

a)

Final Testing

b)

Use of sub programs

c)

Authentication

d)

Anticipating Misuse

43.

Which of the following data would be classed as normal test data?

a)

17

b)

abc

c)

-1

d)

15

44.

Which of the following data would be classed as boundary test data?

a)

17

b)

abc

c)

-1

d)

15

45.

Which of the following data would be classed as invalid/erroneous test data?

a)

17

b)

abc

c)

-1

d)

15

46.

Which is the meaning of input validation?

a)

Checking whether the user can log in or not

b)

Checking if an input value fits in with the rules

c)

Checking if the input is maintainable

d)

Checking if the input is correct for test data

47.

Which is the purpose of a translator?

a)

To convert one language to another

b)

To validate data that has been entered

c)

To provide an environment for you to program

d)

Checking for authentication

48.

Compilers will....

a)

Convert source code in one go

b)

Convert source code line by line

c)

Convert source code so that it is maintainable

d)

Check for authentication

49.

IDE stands for?

a)

Information Development Environment

b)

Integrated Development Environment

c)

Integrated Design Environment

d)

Information Design Environment

50.

Editors are provided within an IDE what are they used for?

a)

To input source code

b)

To check for errors

c)

To compile your program

d)

To provide tools such as variable tracing and breakpoints

51.

Translators are provided within an IDE what are they used for?

a)

To input source code

b)

To check for errors

c)

To compile your program

d)

To provide tools such as variable tracing and breakpoints

52.

Error diagnostics are provided within an IDE what are they used for?

a)

To input source code

b)

To check for errors

c)

To compile your program

d)

To provide tools such as variable tracing and breakpoints

53.

Run time environment is provided within an IDE what are they used for?

a)

To input source code

b)

To check for errors

c)

To compile your program

d)

To provide tools such as variable tracing and breakpoints

54.

What type of algorithm is the following?

a)

Bubble

b)

Merge

c)

Insertion

d)

Binary

55.

What type of algorithm is the following?

a)

Bubble

b)

Merge

c)

Insertion

d)

Binary

56.

What type of algorithm is the following?

a)

Bubble

b)

Merge

c)

Insertion

d)

Binary