wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Computer Science - Programming PLC

Total questions: 62

Worksheet time: 45mins

Name
Class
Date
1.

_________________ is a collection of elements used to store the same type of data.

a)

Array

b)

Switch

c)

Case

d)

Loop

2.

What is returned by values[5]?

a)

9

b)

12

c)

6

d)

8

3.

Arrays are declared using _______.

a)

Square brackets [ and ]

b)

Parentheses ( and )

c)

Quotation marks " and "

d)

Curly Braces { and }

4.

______ are ordered collection of data items of the same type referred to collectively by a single name.

a)

Index

b)

Variables

c)

Arrays

d)

Elements

5.

_____ are each variable or cell in an Array.

a)

Array

b)

Variable

c)

Element

d)

Index

6.

_______ are individual data / items in an array.

a)

Index

b)

Element

c)

Type

d)

Value

7.

The _____ of an Array are indicated by the number of square brackets beside it.

a)

Index

b)

Elements

c)

Array

d)

Dimension

8.

______ is an operation in arrays that allows us to add an element from the array.

a)

Delete

b)

Edit

c)

Insert

d)

Search

9.

______ is an operation in arrays that allows us to query for an element from the array.

a)

Search

b)

Delete

c)

Edit

d)

Insert

10.

Instructions (such as a recipe) are written so that each step is performed one at a time, from top to bottom, until the task is completed. This type of instruction process is called:

a)

Sequential

b)

Scripting

c)

Pseudocode

d)

Programs

11.

To focus on the logic and make refinements to a program before translating it into a programming language, a programmer often creates an outline of the program’s algorithm. What is the term for this type of outline?

a)

Pseudocode

b)

Sketch

c)

Compiler

d)

Interpreter

12.

Which Data Type is used to store characters?

a)

String

b)

Integer

c)

Double/Real

d)

Boolean

13.

Which Data Type is used to store decimal numbers?

a)

String

b)

Integer

c)

Double/Real

d)

Boolean

14.

Which Data Type is used to store data with only 2 possible answers?

a)

String

b)

Integer

c)

Double/Real

d)

Boolean

15.

What is a Character?

a)

Words

b)

Letters, numbers and symbols

16.

Which data type would you use to store:

Someone's age

a)

String

b)

Integer

c)

Double/Real

d)

Boolean

17.

Which data type would you use to store:

Someone's name

a)

String

b)

Integer

c)

Double/Real

d)

Boolean

18.

Which data type would you use to store:

Someone's postcode

a)

String

b)

Integer

c)

Double/Real

d)

Boolean

19.

Which data type would you use to store:

Your year group

a)

String

b)

Integer

c)

Double/Real

d)

Boolean

20.

An Integer stores decimal numbers

a)

True

b)

False

21.

A String stores whole numbers

a)

True

b)

False

22.

True/False would be stored as a Boolean

a)

True

b)

False

23.

Variables cannot be changed.

a)

False

b)

True

24.

Constants cannot be changed.

a)

True

b)

False

25.

Which of these values would be useful as a constant?

a)

Pi

b)

Di

c)

Ni

d)

Pie

26.

The value of a constant can be changed using an expression.

a)

False

b)

True

27.

Variable names can include spaces.

a)

False

b)

True

28.

Some specific words can't be used as variables.

a)

True

b)

False

29.

What is another word for 'iteration'?

a)

Selection

b)

Variable Assignment

c)

Repetition

d)

Sequencing

30.

Which python operator means 'less than or equal to'?

a)

>

b)

<

c)

>=

d)

<=

31.

What is the output of the following code?

a)

0,1,2,3,4,5,6,7,8,9,10

b)

0,1,2,3,4,5,6,7,8,9

c)

1,2,3,4,5,6,7,8,9,10

d)

1,2,3,4,5,6,7,8,9

32.

Which code will successfully print the value of x exactly 5 times?

a)

for x in range(0,4):

print(x)

b)

for x in range(0,5):

print(x)

c)

for x in range 5:

print(x)

d)

for x in range[0,5]:

print(x)

33.

How many times will this loop run?

a)

10

b)

9

c)

4

d)

5

34.

I want to allow the program to repeatedly ask the user to enter their guess if it does not equal the answer...Which option do I use?

a)

while guess == answer:

guess=input()

b)

while answer != guess:

guess=input()

c)

while answer =! guess:

guess=input()

d)

while guess != answer:

guess=input()

35.

How many times will 'hello' be printed using this code?

a)

3

b)

6

c)

9

d)

27

36.

Which loop is most appropriate to use if I need to continuously check for a correct password?

a)

FOR loop

b)

WHILE LOOP

37.

I want to print "Password matched" if the user enters the correct password, otherwise allow them to try again. What is wrong with the code above?

a)

last line should be OUTSIDE the loop

b)

wrong operator used

c)

wrong password

d)

for loop needed to be used

38.

What is the advantage of using a while loop versus a for loop?

a)

continuous repetition of instructions

b)

pre-defined number of iterations

39.

What do we do when we need to break down a large complex problem into smaller, more manageable tasks?

a)

Abstract the problem

b)

Fragment the problem

c)

Compile the problem

d)

Decompose the problem

40.

Selection in a program is controlled by...

a)

IF statements

b)

WHILE loops

c)

REPEAT loops

d)

Arrays

41.

An IF statement is triggered by....

a)

Conditions

b)

Comments

c)

Loops

d)

Time

42.

Which of the following statements can be used to extend selection from a single IF statement?

a)

ELSE

b)

DO

c)

CHOICE

d)

ELK

43.

Selection statements in programs can change the flow of control.

a)

True

b)

False

44.

Selection in programs is useful to repeat blocks of code.

a)

False

b)

True

45.

Which of the following is an example of selection in pseudocode?

a)

IF x < 10 THEN

b)

WHEN x < 10

c)

(x < 10) IF TRUE THEN

d)

FOR x=0 TO 10

46.

Which of the following shows a logical error?

a)

while x>2 AND x<1:

b)

for index in range(:

c)

print(Hello")

47.

Which of the following contains syntax errors?

a)

for index in range(1, 5, -1):

b)

While x > 3

c)

if fred == name:

48.

400 is the...

a)

Parameter

b)

Argument

c)

Name

d)

Variable

49.

length is an example of a...

a)

Argument

b)

Parameter

c)

Variable

d)

Procedure call

50.

A function...

a)

Never has parameters

b)

Always returns a value

c)

Must has parameters

d)

Does not return a value

51.

The drawSquare subprogram is an example of a...

a)

Function

b)

Procedure

52.

A While Loop is?

a)

Definite Iteration

b)

Indefinite Iteration

53.

A For Loop is?

a)

Definite Iteration

b)

Indefinite Iteration

54.

NOT AND OR in Selection are examples of ?

a)

Boolean Algebra

b)

Relational Applications

c)

Boolean Operations

d)

Relational Operations

55.

Parameters allow us to pass information or instructions into functionsand procedures.

a)

True

b)

False

56.

Benefits of using Subroutines are?

a)

Reducing duplicate code within a program.

b)

Code can be reused - simply by calling the subroutine

c)

Help programmer to decompose the problem into smaller parts

d)

All

57.

A local variable is inside of a subroutine or function?

a)

True

b)

False

58.

Global variables are declared outside any function

a)

True

b)

False

59.

Structured programming is basically the use of subroutines in your code?

a)

True

b)

False

60.

Python is an example of a high level programming language?

a)

True

b)

False

61.

When translating using an interpreter, each line of source code will be translated to machine code one line at a time.

a)

True

b)

False

62.

100101010101 is an example of what?

a)

High level program code

b)

Low Level program code