wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

IG CS P2 review

Total questions: 151

Worksheet time: 1hrs 24mins

Name
Class
Date
1.

Choose all the Boolean logic gates ...

a)

NOT

b)

AND

c)

BUT

d)

XOR

2.

Truth table for AND gate?

a)
b)
c)
d)
3.

Truth table for OR gate?

a)
b)
c)
d)
4.

Which logic gate is this truth table for?

a)

AND

b)

OR

c)

NOR

d)

XOR

5.

Which of these programming constructs make use of Boolean logic?

a)

if ... then ...

b)

while ... do ....

c)

repeat ... until ....

d)

repeat n times ....

6.

If x = 3 and y = 5, choose all the statements that evaluate to True.

a)

x < y

b)

y > x**2

c)

2 * x == y

d)

y % x == 3

7.

Evaluate: 2 < 3 And ( Not 3 > 2)

a)

True

b)

False

8.

Result of this Boolean expression?

a)

True

b)

False

9.

Which word best completes this sentence:


A logic gate is a tiny electronic component on a chip that has inputs and ______ to simulate a Boolean operation.

a)

output

b)

result

c)

data

d)

processing

10.

Which word best completes this sentence?


A combination of logic gates is known as a logic _______.

a)

circuit

b)

program

c)

array

d)

truth table

11.

Output for input of 150?

a)

Discount of 10% is 15.0

b)

Discount of 5% is 7.5

c)

No discount

d)

Invalid input

12.

Output for input of ""?

a)

Invalid password

b)

Password is too short

c)

Password is too long

d)

Password is Ok

13.

Output for inputs of 750 and 22900

a)

Sufficient profit made this week

b)

Income in line with attendance this week

c)

Attendance is very low this week

d)

Possible accounting error

14.

Inputs for output of "Sufficient profit made this week"

a)

income = 4501, attendance = 499

b)

income = 2500, attendance = 22500

c)

income = 1000, attendance = 1000

d)

income = 500, attendance = 2500

15.

A logic gate that outputs True only if both its inputs are also True?

a)

OR

b)

AND

c)

XOR

d)

NAND

16.

Which logic gate is the odd one out and for which reason?

a)

OR - because it's more likely to output True

b)

AND - because it has more than two inputs

c)

XOR - because the probability of it outputting True or False is equally likely

d)

NAND - because it is the inverse of AND

17.

Which of these are fundamental control structures in any computer program?

a)

branching

b)

sequence

c)

selection

d)

repetition

e)

iteration

18.

For which algorithm would it be best to use a conditional loop?

a)

Finding largest number in a list

b)

Calculating average of a list of numbers

c)

Counting occurrences of an item in a list

d)

Checking if an item is in a list

19.

What would the list [9, 6, 12, 7, 3, 16, 10] look like after one iteration of the Bubble sort algorithm (smallest to biggest)?

a)

[6, 9, 7, 3, 12, 10, 16]

b)

[3, 9, 6, 12, 7, 16, 10]

c)

[3, 6, 7, 9, 10, 12, 16]

d)

[9, 6, 12, 3, 7, 16, 10]

20.

Which is the correct flowchart symbol for input/output?

a)
b)
c)
d)
21.

This is the main loop from an algorithm (shown in Python.) Which algorithm is it?

a)

LInear search

b)

BInary search

c)

Bubble sort

d)

Count occurrences

22.

This is the main loop from an algorithm (shown in Python.) Which algorithm is it?

a)

Linear search

b)

Binary search

c)

Bubble sort

d)

Merge sort

23.

A classification of how data is stored and displayed, and of which operations that can be performed on the stored value

a)

data type

b)

data value

c)

data

d)

data packet

24.

A persistent structured collection of data that allows people to extract information in a way that meets their needs

a)

record

b)

table

c)

database

d)

basedata

25.

The values associated with each record in a database table

a)

table

b)

record

c)

primary key

d)

field

26.

An SQL command that identifies the table to use

a)

SELECT

b)

FROM

c)

WHERE

d)

ORDER BY

27.

An SQL command that sorts the results from a query by a given column either alphabetically or numerically

a)

SUM

b)

WHERE

c)

COUNT

d)

ORDER BY

28.

A field in a database that uniquely identifies a record

a)

public key

b)

private key

c)

primary key

d)

secondary key

29.

A collection of fields that describe one item

a)

table

b)

record

c)

field

d)

database

30.

An SQL command that fetches specified fields (columns) from a table

a)

SELECT

b)

FROM

c)

WHERE

d)

ORDER BY

31.

A list of SQL commands that perform a given task, often stored in a file so it can be reused

a)

original scripts

b)

SQL Scripts

c)

storyboard scripts

d)

screenplay scripts

32.

The standard query language for writing scripts to obtain useful information from a relational database

a)

Hypertext Markup Language (HTML)

b)

Data Manipulation Language (DML)

c)

Data Definition Language (DDL)

d)

Standard Query Language (SQL)

33.

Decomposition describes the process of...

a)

Explaining how your program works

b)

Code becoming difficult to test as it gets larger

c)

Breaking a large problem into smaller pieces

d)

Testing a program

34.

Which of these is not a method used in the design stage of the program lifecycle?

a)

Python

b)

Pseudocode

c)

Structure Diagram

d)

Flowchart

35.

What is a variable?

a)

A special character or word in a programming language that identifies an action to be performed

b)

A positive or negative whole number that can be used with mathematical operators

c)

A named data store that contains a value that does not change during the execution of a program

d)

A named data store that contains a value that may change during the execution of a program

36.

What is a constant?

a)

A named data store that contains a value that does not change during the execution of a program

b)

A special symbol or word in a programming language that identifies an action to be performed

c)

A named data store that contains a value that may change during the execution of a program

d)

A positive or negative whole number that can be used with mathematical operators

37.

What is an array?

a)

A set of programming statements grouped together under a single name that can be called to perform a task in a program

b)

A positive or negative whole number that can be used with mathematical operators

c)

A data structure containing several elements of the same data type

d)

A variable or constant that is several characters in length

38.

What does the DIV operator do in programming?

a)

To generate a random number

b)

To round a value to a given number of decimal places

c)

To return the quotient (whole number part) of a division

d)

To return the remainder of a division

39.

What is the purpose of the ROUND library routine in programming?

a)

To generate a random number

b)

To return the quotient (whole number part) of a division

c)

To return the remainder of a division

d)

To round a value to a given number of decimal places

40.

What is the purpose of the RANDOM library routine in programming?

a)

To return the remainder of a division

b)

To generate a random number

c)

To return the quotient (whole number part) of a division

d)

To round a value to a given number of decimal places

41.

What is the purpose of the AND operator in programming?

a)

To perform logical AND operation on two boolean values

b)

To combine two numbers together

c)

To multiply two numbers

d)

To divide two numbers

42.

What is the purpose of a loop in programming?

a)

To store data in a file and retrieve data from a file

b)

To repeat a set of instructions multiple times

c)

To declare, use, identify appropriate data types for, read and write arrays with one and two dimensions

d)

To group programming statements together under a single name that can be called to perform a task in a program

43.

What is the purpose of the NOT operator in programming?

a)

To reverse the value of a boolean variable

b)

To perform addition of two numbers

c)

To perform division of two numbers

d)

To perform multiplication of two numbers

44.

What is the purpose of the XOR operator in programming?

a)

To perform exclusive OR operation on two boolean values

b)

To combine two numbers together

c)

To multiply two numbers

d)

To divide two numbers

45.

What is the main purpose of a subroutine in programming?

a)

To group programming statements together under a single name that can be called to perform a task in a program

b)

To declare, use, identify appropriate data types for, read and write arrays with one and two dimensions

c)

To perform calculations using arithmetic operators

d)

To store data in a file and retrieve data from a file

46.
a loop which repeats a set number of times
a)
counter-controlled
b)
flowchart
c)
logical test
d)
loop
47.
a diagram which sets out an algorithm
a)
flowchart
b)
logical test
c)
loop
d)
pseudocode
48.
a named area of computer memory which can be used to store a value while a computer program is running
a)
variable
b)
indentation
c)
increment
d)
iterate
49.
the order in which commands in a program are carried out
a)
sequence
b)
selection
c)
exit condition
d)
algorithm
50.
enables a program to produce different outputs depending on the results of a logical test
a)
selection
b)
exit condition
c)
algorithm
d)
arithmetic operator
51.

Which of the following is a correct way to declare a variable in Python?

a)

int number = 5

b)

number = 5

c)

var number: 5

d)

let number = 5

52.

What data type is used to represent true or false values in Python?

a)

Integer

b)

String

c)

Boolean

d)

Float

53.

What will be the output of the following code? print(10 - 2 * 3)

a)

4

b)

1

c)

16

d)

8

54.

Which of the following operators is used for integer division in Python?

a)

/

b)

//

c)

%

d)

**

55.

How can you read user input in Python?

a)

input("Enter something: ")

b)

read("Enter something: ")

c)

get("Enter something: ")

d)

scan("Enter something: ")

56.

Which of the following statements is true about the following code? age = 16 if age >= 18: print("Adult") else: print("Minor")

a)

It will print "Adult".

b)

It will print "Minor".

c)

It will cause an error.

d)

It will print nothing.

57.

How many times will the following loop run? for i in range(4): print(i)

a)

4 times

b)

3 times

c)

5 times

d)

Infinite

58.

What is the purpose of the else statement in a conditional structure?

a)

To execute code when the condition is true

b)

To execute code when the condition is false

c)

To terminate the program

d)

To handle errors

59.

Which of the following is a valid way to define a function in Python?

a)

function greet():

b)

def greet[]:

c)

def greet():

d)

function greet():

60.

What is the output of the following code? string = "Hello" print(string.lower())

a)

hello

b)

Hello

c)

HELLO

d)

Error

61.

Which of the following statements correctly checks if x is equal to 5?

a)

if x = 5:

b)

if x == 5:

c)

if (x = 5):

d)

if x === 5:

62.

What will the following code output? x = 3 while x < 6: print(x) x += 1

a)

3, 4, 5

b)

3, 4, 5, 6

c)

3, 4, 5, 6, 7

d)

3, 4

63.

Which of the following is a valid Boolean expression?

a)

5 + 5

b)

x > y

c)

x and y

d)

Both B and C

64.

What will be the output of the following code? for i in range(1, 5): print(i)

a)

1, 2, 3, 4

b)

1, 2, 3, 4, 5

c)

0, 1, 2, 3, 4

d)

1, 2, 3, 4, 5

65.

Which statement is used to define a constant in Python?

a)

const PI = 3.14

b)

define PI 3.14

c)

PI = 3.14

d)

#PI = 3.14

66.

Which of these is not a code data type

a)

integer

b)

boolean

c)

text

d)

character

67.

Which of these is not a database data type

a)

string

b)

number

c)

yes/no

d)

currency

e)

text

68.

Which line of pseudocode has a logical error when inputting 50 numbers and totalling/outputting the sum of those numbers that were under 100.


total <- 0

FOR count <- 1 TO 50

PRINT "next number?"

INPUT num

IF num <= 100

THEN

total <- total + num

ENDIF

NEXT count

OUTPUT "The total of matching numbers was:", total

a)

total <- 0

b)

FOR count <- 1 TO 50

c)

IF num <= 100

d)

total <- total + num

e)

OUTPUT "The total of matching numbers was:", total

69.

What would the fifth entry in the total column be in a trace table on a dry-run of the pseudocode shown below if the inputted numbers started with 64, 36, 103, 24, 102, 107, 15, 23, 84, …


total <- 0

FOR count <- 1 TO 50

PRINT "next number?"

INPUT num

IF num <= 100

THEN

total <- total + num

ENDIF

NEXT count

OUTPUT "The total of matching numbers was:", total

a)

124

b)

226

c)

231

d)

139

e)

15

70.

Which of these statement type match ups is incorrect?

a)

Iteration: FOR count <- 1 TO 100 …. NEXT COUNT

b)

Totalling: x <- x + 1

c)

Assignment: name <- "Fred"

d)

Output: PRINT total

e)

Selection: CASE OF x …. OTHERWISE… ENDCASE

71.

Tabitha wants to find the largest number in an array of 30 integers called Nums. On what line has she made a mistake?


maxIndex <- 1

FOR i <- 1 TO 30

IF Nums[i] > Nums[maxIndex]

THEN

maxIndex <- Nums[i]

ENDIF

NEXT i

PRINT "The maximum number was: ", Nums[maxIndex]

a)

Line 1

b)

Line 2

c)

Line 3

d)

Line 5

e)

Line 8

72.

Which two validation checks would be most suitable to check someone's AGE

a)

Length check

b)

Check digit

c)

type check

d)

range check

73.

What is happening to the 'positives' variable here?


positives = 0

FOR I <- 1 TO 10 DO

INPUT num

IF num > 0

THEN

positives = positives + 1

ENDIF

NEXT I

OUTPUT "there were", positives, "positive numbers"

a)

totalling

b)

iteration

c)

counting

d)

sequencing

e)

selection

74.

How would you declare an array of 10 items?

a)

pointless(1:10)

b)

pointless(1-10)

c)

pointless[1:10]

d)

pointless[1-10]

e)

pointless <- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

75.

Which principles is being used here?


INPUT Grade

CASE OF Grade

9: PRINT "Well done, great job"

8: PRINT "Well done, great job"

7: PRINT "Got to still feel pleased"

6: PRINT "Room for improvement"

OTHERWISE: PRINT "summer hols soon"

ENDCASE

a)

iteration

b)

selection

c)

sequencing

d)

totalling

e)

counting

76.

Which data type is for decimal numbers in coding?

a)

integer

b)

boolean

c)

real

d)

unreal

77.

Which of these two extracts could use more effective code?


IF num > 12 OR num < 6

THEN

PRINT "valid"

ELSE

PRINT "invalid"

ENDIF


----------


num = 1

REPEAT

PRINT num * 2

num = num + 1

UNTIL num = 20

a)

extract 1

b)

extract 2

78.

What uniquely identifies a record in a table?

a)

A field

b)

A primary key

c)

A query

d)

A criteria

79.

Verification is done ...

a)

so that it is the correct data type

b)

so that data entered exactly matches the original source

80.

Define ABSTRACTION

a)

Breaking a task into smaller tasks.

b)

Drawing a map to show how to reach a destination.

c)

Creating step by step instructions.

d)

Focusing on what is important and ignoring what is unnecessary.

81.

What is abstraction?

a)

The process of filtering out unnecessary detail

b)

The process of filtering out irrelevant characteristics

c)

The process of filtering out irrelevant characteristics and unnecessary detail

82.

What is decomposition?

a)

Breaking down a complex problem or system into smaller, more manageable parts

b)

Adding detail to make a problem more complex

c)

When you ignore the unnecessary detail in a problem

83.

Why do we decompose a complex problem?

a)

To make it more difficult to solve

b)

To change the problem we have

c)

To make it easier to solve

84.

Which of these is an example of decomposition?

a)

Watching a mechanic repair a bicycle

b)

Looking at different bicycles for similarities between them

c)

Finding out how a bicycle works by looking in detail at the different parts that make up the bicycle

85.

A boolean is...

a)

A whole number

b)

A number with a decimal part

c)

Letters, numbers or punctuation

d)

True or False

86.

An integer is...

a)

A whole number

b)

A number with a decimal part

c)

Letters, numbers or punctuation

d)

True or False

87.

A real is...

a)

A whole number

b)

A number with a decimal part

c)

Letters, numbers or punctuation

d)

True or False

88.

A string is...

a)

A whole number

b)

A number with a decimal part

c)

Letters, numbers or punctuation

d)

True or False

89.

The best data type for an age is...

a)

integer

b)

real

c)

string

d)

boolean

90.

The best data type for a name is...

a)

integer

b)

real

c)

string

d)

boolean

91.

The best data type for an average is...

a)

integer

b)

real

c)

string

d)

boolean

92.

The best data type for a counter is...

a)

integer

b)

real

c)

string

d)

boolean

93.

8.2 is a...

a)

integer

b)

real

c)

string

d)

boolean

94.

"Hello" is a...

a)

integer

b)

real

c)

string

d)

boolean

95.

If a grade of 98 was inputted, what would be the output?

a)

Passed

b)

Failed

c)

Else

96.

If the grade of 60 was input, what would be the output?

a)

Passed

b)

Failed

c)

Else

97.

If the grade of 12 was input, what would be the output?

a)

Passed

b)

Failed

c)

Else

98.

What would the program output with the following inputs?

Payrate - 12

Hours Worked - 10

a)

12

b)

Final pay

c)

OUTPUT

d)

120

99.

This program is meant display the phrase "Coding is cool" multiple times.


Fill in the blank.

a)

INPUT

b)

WHILE

c)

OUTPUT

d)

LOOP

100.

Fill in the blank

a)

OUTPUT

b)

ENDIF

c)

THEN

d)

INPUT

101.

Complete the blank:


" (a)   is the process of repeating an action multiple times."

102.

What is missing?


____ i = 1 To 10

OUTPUT: "String"

ENDFOR

a)

FOR

b)

FOUR

c)

WHILE

103.

Fill in the missing blank:


_______ variable <> "Hi"

OUTPUT: "Hi to you!"

ENDWHILE

a)

WHILST

b)

WHILE

c)

FOR

d)

IF

104.

Which of the following will run 10 times? (Choose all that apply.)

a)

FOR i = 1 TO 10

OUTPUT: "Number " + i

ENDFOR

b)

FOR i = 0 To 10

OUTPUT: "Number: " + i

ENDFOR

c)

input = 10

count = 1

WHILE count <= input

OUTPUT: count

count = count + 1

ENDWHILE

105.

Which index is label C pointing to?

a)

7

b)

8

c)

9

106.

What field is best validated using a format DD/MM/YYYY

a)

Customer ID

b)

Date of Birth

c)

Post code

d)

Email

107.

This is an example of a

a)

Range check

b)

Lookup check

c)

Format check

d)

Presence check

108.

An error message saying "The pupil must be aged between 11 and 16" is an example of a

a)

Range check

b)

Lookup check

c)

Format check

d)

Presence check

109.

What validation type checks a minimum number of characters have been entered?

a)

Format check

b)

Length check

c)

Range check

110.

What is a primary key?

a)

A field that links to another table

b)

A filed that has values from multiple tables

c)

A field that holds unique values

d)

A filed that has repeating values

111.
What is an automatic computer check to make sure data entered is sensible and reasonable known as?
a)
Double entry
b)
Verification
c)
Validation
112.

What would this out put? print(users[2][1])

a)

error

b)

16

c)

brown

d)

smith

113.

What would this out put? print(users[0][0])

a)

smith

b)

ben

c)

sam

d)

james

114.

What is considered erroneous data?

a)

No data being given when one is expected

b)

Data of the incorrect data type

c)

Data of the correct type but outside the accepted validation checks

d)

Data which should be accepted by a program without causing errors

115.

What type of data should be rejected by a computer system?

a)

Boundary data

b)

Normal data

c)

Invalid data

d)

Erroneous data

116.

Which operator tells you the remainder of a division?

a)

/

b)

MOD

c)

DIV

d)

//

117.

Which operator gives the whole number from a division?

a)

MOD

b)

DIV

c)

//

d)

/

118.

Which operator means "equal to" in Pseduocode?

a)

==

b)

=

c)

<--

d)

<>

119.

22 MOD 5

a)

1

b)

2

c)

3

d)

4

120.

17 DIV 7

a)

2

b)

3

c)

4

d)

1

121.

20 _ _ _ 5 = 0

a)

MOD

b)

DIV

c)

=

d)

ADD

122.

(15 NOT 7) OR (6 DIV 2 = 3)

a)

TRUE

b)

FALSE

123.

What does the round function in Python do?

a)

The round function in Python rounds a number to a specified number of decimal places or to the nearest whole number.

b)

The round function in Python returns the square root of a number.

c)

The round function in Python generates a random number between two given numbers.

d)

The round function in Python converts a number to a string.

124.

What is the result of round(3.14159, 2)?

a)

3.13

b)

3.15

c)

3.14

d)

3.1

125.

numbers = [1,2,3,4,5]

What is the result of len([numbers])?

a)

1

b)

10

c)

5

d)

15

126.
Which of the following gives suitable names to locations in memory
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
d)
Functions and Procedures
127.
Which of these describes maintainability
a)
Making the program easier to use for the user
b)
Making the code easier to read for the user
c)
Making the code easier to read for the programmer
d)
Making the program easier to use for the programmer
128.
In order to explain what you mean to another programmer, you use
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
d)
Functions and Procedures
129.
Which of the following explain key features of what a program does
a)
Comments
b)
Indentations
c)
Meaningful Variable Names
d)
Functions and Procedures
130.
In a database table, rows are called __________
a)
Field
b)
Record
c)
Primary Key
131.
Tables are set up to contain columns and rows of information. In a database table, the columns are called __________.
a)
Cell
b)
Field
c)
Column
d)
Record
132.

Data type for '12/4/16'

a)

Text

b)

Date

c)

Long text

d)

Number

133.

Data type for 'Bob'

a)

Number

b)

Memo

c)

Text

d)

Currency

134.

Data type for 'male/female'

a)

Yes/No

b)

Text

c)

Number

d)

Currency

135.

Data type for 'CV34 5TR'

a)

Text

b)

Number

c)

Date

d)

Autonumber

136.
What is the output of an OR gate if the inputs are 1 and 0?
a)
0
b)
1
c)
OFF
d)
2
137.
What is the output of an AND gate if the inputs are 1 and 0?
a)
ON
b)
2
c)
1
d)
0
138.
What is the output of a NOT gate if the inputs is 0?
a)
1
b)
0
c)
OFF
d)
2
139.
What gate is this table for?
a)
AND
b)
OR
c)
NOT
d)
NOR
140.
What gate is this truth table for?
a)
AND
b)
OR
c)
NOT
d)
THE 
141.
What gate is this table for?
a)
AND
b)
XOR
c)
OR 
d)
NOT
142.

Name that logic gate! (Use all CAPS)

(a)  

143.

Name that logic gate! (Use all CAPS)

(a)  

144.

Name that logic gate! (Use all CAPS)

(a)  

145.

Which logic gate is this truth table for?

a)

NOR

b)

NAND

c)

XOR

d)

AND

146.

What is the truth table of

AND gate?

a)

b)

c)

d)

e)

147.

What is the truth table of

OR gate?

a)
b)
c)
d)
e)
148.

What is this logic gate?

a)

AND

b)

OR

c)

NOT

d)

XOR

149.

What is this logic gate?

a)

AND

b)

OR

c)

NOT

d)

XOR

150.

What would the OUTPUT(x) be in the following scenario:

A = 1

B = 0

C= 0

a)

0

b)

1

151.

What is the OUTPUT in the logic diagram?

a)

0

b)

1