wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Y12 CS mmd PC2

Total questions: 111

Worksheet time: 1hrs 17mins

Name
Class
Date
1.
What Boolean operation is represented with ¬?
a)
NOT
b)
AND
c)
OR
d)
XOR
e)
NOR
2.
What Boolean operation is represented with ∧?
a)
AND
b)
OR
c)
XOR
d)
NOT
e)
NOR
3.
What Boolean operation is represented with ∨?
a)
OR
b)
XOR
c)
NOT
d)
NOR
e)
AND
4.
What Boolean operation is represented with ⊕?
a)
XOR
b)
NOT
c)
AND
d)
OR
e)
NOR
5.
Which has the highest order of precedence: AND, OR or NOT?
a)
NOT
b)
AND
c)
OR
d)
XOR
e)
NOR
6.
Complete the Boolean identity: C ∧ C =
a)
C
b)
C V C
c)
¬C
d)
¬C V C
e)
¬C ∧ ¬C
7.
Simplify the following Boolean expression: (C ∨ (B ∨ ¬B)) ∧ D
a)
D
b)
C
c)
B
d)
¬C
e)
¬D
8.
Complete the Boolean identity: B ∧ 1 =
a)
B
b)
¬B
c)
B ∧ B
d)
B V B
9.
Apply one of De Morgan’s Laws to the following Boolean expression: ¬A ∧ ¬B
a)
¬(A∨B)
b)
¬(A∧B)
c)
¬(A∨¬B)
d)
(¬A∨B)
e)
(A∨B)
10.
Apply a distributive rule to the following Boolean expression: B ∧ (A ∨ C)
a)
B ∧ A V B ∧ C
b)
(B V A) ∧ (B V C)
c)
B V A ∧ B V C
d)
B ∧ A
e)
B V C
11.
1.Which of the following statement is FALSE about logic gates?
a)
A.Logic gates are the building blocks of electronic circuits.
b)
B.It is used in computer components like memory.
c)
C.A combination of logic gates is called logic circuit.
d)
D.A logic gate understands binary language.
e)
E.None of the above
12.
2.What is a truth table?
a)
A.A table that denotes the different outputs of the logic gates or circuit with respect to different inputs.
b)
B.A table that represents how logic gates are combined to form a logic circuit.
c)
C.A table that shows the input combinations that result in a binary output 1 in a logic gate.
13.
3.A logic circuit has 4 inputs. How many output combinations are possible?
a)
A.8
b)
B.16
c)
C.32
d)
D.4
14.
4.A logic circuit has n inputs. How many output combinations are possible?
a)
A.2×n
b)
B.2n
c)
C.n÷2
15.
5.Which of the following is FALSE about the NOT gate?
a)
A.Output of NOT is complementary to the input
b)
B.When the input to NOT gate is 0, the output is 1.
c)
C.A NOT gate has two input signals and an output signal.
d)
D.None of the above
16.
6.When is the output for AND gate TRUE?
a)
A.When both inputs are TRUE.
b)
B.When at least one of the inputs is TRUE.
c)
C.When both inputs are FALSE
d)
D.When at least one of the inputs is FALSE.
17.
7.When is the output for OR gate TRUE?
a)
A.When both inputs are TRUE.
b)
B.When at least one of the inputs is TRUE.
c)
C.When both inputs are FALSE
d)
D.When at least one of the inputs is FALSE.
18.
8.An AND gate has two inputs A and B. What is the Boolean expression for this logic gate?
a)
A.A^B
b)
B.A˅B
c)
C.¬A^B
19.

9.What is the Boolean expression for this logic gate?

a)

A.X=A^B

b)

B.X=A˅B

c)

C.X=A*B

20.

10.What is the Boolean expression for this logic gate?

a)

A.X=˅A

b)

B.X=&A

c)

C.X=¬A

21.
11.What is a logic circuit?
a)
A.Combination of logic gates that performs a specific function.
b)
B.Combination of logic gates that understands both binary and decimal number systems.
c)
C.Combination of logic gates that understands decimal number system.
22.

12.How many intermediate outputs do you require to realise the truth table of this logic circuit?

a)

A.1

b)

B.2

c)

C.3

d)

D.4

23.

13.What is the output of gate 1, when A=1 and B=0?

a)

A.0

b)

B.1

24.

14.What is the output of gate 2, when C=1 and D=0?

a)

A.0

b)

B.1

25.

15.What is the output (X) of gate 3, when A=1, B=1, C=1 and D=0?

a)

A.0

b)

B.1

26.

16.What is the output (X) of gate 3, when A=0, B=1, C=1 and D=1?

a)

A.1

b)

B.0

27.

17.When is the output (X) of gate 3 FALSE?

a)

A.A=1, B=0, C=1 and D=1

b)

B.A=1, B=1, C=0 and D=1

c)

C.A=1, B=1, C=0 and D=0

d)

D.A=1, B=0, C=0 and D=0

28.

18.What is the Boolean expression of the circuit shown?

a)

A.X = (A˅B) ^ (C^D)

b)

B.X = (A˅B) ^ (C˅D)

c)

C.X = (A^B) ˅ (C^D)

d)

D.X = (A^B) ˅ (C˅D)

29.
19.How many output bits are required for a two-bit binary adder?
a)
A.1
b)
B.2
c)
C.3
30.
20.Which of the following is the correct logical expression for sum of a 2-bit binary adder?
a)
A.Sum S = (A AND B) OR ((NOT A) AND (NOT B))
b)
B.Sum S = ((NOT A) AND B) OR (A AND (NOT B))
c)
C.Sum S = ((NOT A) OR B) AND (A OR (NOT B)).
31.

Which of the following logic statement holds good for this truth table?

a)

A.X= (A AND B) OR ((NOT A) AND (NOT B))

b)

B.X= (A OR B) AND ((NOT A) OR (NOT B))

c)

C.X= (A AND B) OR (NOT (A AND B))

32.

Which of the following logic statement holds good for this truth table?

a)

A.X= A˅B˅C

b)

B.X= (A^B^¬C) ˅ (A^¬B^C) ˅ (¬A^¬B^C)

c)

C.X= (A^B^C) ˅ (A^B^C) ˅ (A^B^C)

d)

D.X= (A^B^¬C) ˅ (A^¬B^C) ˅ (¬A^B^C)

33.

Simplify the following Boolean expression: ¬B∧¬A∨¬B

a)

¬B∧¬A

b)

¬A∧¬B

c)

¬B∨¬A

d)

¬A∨¬B

e)

¬B

34.

Apply one of De Morgan’s Laws to the following Boolean expression: ¬(A∧C)

a)

¬A ∨ ¬C

b)

¬(A∨C)

c)

¬(A∧C)

d)

¬(A∨¬C)

e)

(¬A∨C)

35.
A binary search algorithm will only work on a list which is in order. True or False
a)
True
b)
False
36.
Which one of the following is an advantage of a linear search?
a)
It takes a long time to find the item.
b)
It is a simple algorithm to write.
c)
It is more efficient than a binary search.
d)
It is a complex algorithm to write.
37.
Using a binary search why will the number 9 never be found in the following list:
11, 8, 13, 9, 7, 3
a)
It does not work on numbers
b)
It only works on letters
c)
The list is not in order
38.
Which of the following descriptions best describes a linear search:
a)
Put the elements in order, check each item in turn
b)
Put the elements in order, compare with the middle value, split the list in order and repeat
c)
Elements do not need to be in order, check each item in turn.
d)
Elements do not need to be in order, compare to the middle value, split the list in order and repeat.
39.
Which of the following best describes a binary search:
a)
Put the elements in order, check each item in turn.
b)
Put the elements in order, compare with the middle value, split the list in order and repeat
c)
Elements do not need to be in order, check each item in turn.
d)
Elements do not need to be in order, compare to the middle value, split the list in order and repeat.
40.
A linear search is to be performed on the list:
12, 6, 8, 1, 3
How many searches would it take to find the number 1?
a)
1
b)
2
c)
3
d)
4
41.
A binary search is to be performed on the list:
3, 5, 9, 10, 23
How many comparisons would it take to find the number 9?
a)
0-1
b)
2-3
c)
4-5
d)
It can't be found
42.
What does a search algorithm do?
a)
Save data in a list
b)
Sort data in a list
c)
Write data to a list
d)
Search data in a list
43.
Which of the following is a search algorithm?
a)
A word search
b)
A binary search
c)
A number search
d)
A search engine
44.
Which of the following is a sort algorithm?
a)
A linear sort
b)
A bubble sort
c)
A ordered sort
d)
A binary sort
45.
A bubble sort goes through each pair in a list and swaps them if not in order.
a)
True
b)
False
46.
Which of the following describes a merge sort?
a)
Compares each pair and swaps
b)
List is split in two and merged together in order
c)
List is split into 2 and kept seperate
d)
None of the above
47.
Which of the following is NOT a sort algorithm?
a)
Bubble
b)
Merge
c)
Insertion
d)
Linear
48.
Which type of sort algorithm is this?
a)
Insertion
b)
Merge
c)
Bubble
49.
Which type of sort algorithm is this?
a)
Insertion
b)
Bubble
c)
Merge
50.
Which type of lists are linear search algorithms used for?
a)
Unsorted lists
b)
Sorted lists
51.
What is a trace table?
a)
A technique used to test algorithms for logical errors.
b)
A technique used for drawing in art.
c)
A type of sort algorithm
d)
A type of search algorithm
52.
What is pseudocode?
a)
Another way to write an algorithm. It is like 'fake' code.
b)
Uses symbols to represent an algorithm
53.
The following lists represent 3 passes of a sorting algorithm. Which algorithm is being used to sort the list?
 
4    5    9    6    2    7

4    5    6    2    7    9 
4    5    2    6    7    9
a)
Bubble Sort
b)
Selection Sort
c)
Insertion Sort
54.
Which type of sort algorithm is this?
a)
Bubble
b)
Merge
c)
Insertion
55.
Using a binary search why will the number 9 never be found in the following list:
11, 8, 13, 9, 7, 3
a)
It does not work on numbers
b)
It only works on letters
c)
The list is not in order
56.

How many searches will it take to find 10 in [1,3,5,7,10,12,15] using BINARY search?

a)

3

b)

4

c)

5

d)

6

57.

The complexity of Binary search algorithm is

a)

O(n)

b)

O(log n)

c)

O(n2)

d)

O(n log n)

58.

A linear function takes the form

a)

f(n) = an + b

b)

f(n) = an2 +bn + c

c)

f(n) = alog2n

d)

f(n) = a + b

59.

Find the slowest algorithm:

a)

O (n)

b)

O (n^2)

c)

O (n!)

d)

O (2^n)

60.

The number of executions grows extremely quickly as the size of the input increases

a)

Exponential Time

b)

Linear Time

c)

Polynomial Time

d)

Constant Time

61.
Consider this list of numbers: 3 4 6 7 8 9. If the number 9 was to be found using a linear search, how many comparisons need to be made?
a)
6
b)
3
c)
8
d)
4
62.
What is the main disadvantage of a binary search compared to a linear search?
a)
It requires the data to be in order
b)
It requires more memory
c)
It does not execute as quickly with larger data sets
d)
Not all CPUs are capable of executing the algorithm
63.

What is the worst case running time of the above pseudo code?

a)

O(n)

b)

O(n log n)

c)

O(n2)

d)

O(n3)

64.
What is the worst case running time of the above pseudo code?
a)
O(n)
b)
O(n log n)
c)
O(n2)
d)
O(n3)
65.

How do bubble sorts work?

a)

They split the list to single elements before piecing them back together, one sublist at a time.

b)

Each item in the list is compared with the following item starting with the last value till the first.

c)

Taking one item at a time from an unsorted list, each new item is compared with the previous until its place is found.

d)

Each item in the list is individually compared with the following item starting with the first value till the last.

66.

What is an advantage of a bubble sort?

a)

It is difficult to implement.

b)

It is fast.

c)

It uses less memory.

d)

It is easier to implement and follow.

67.

The following list is to be sorted using a bubble sort:

12 6 8 1 3

What will the list look like after the first iteration/run through the list?

a)

6 8 1 3 12

b)

6 12 1 8 3

c)

1 3 6 8 12

d)

6 8 1 12 3

68.

Why does a bubble sort do a final pass even when the data is in the correct order?

a)

To save the data.

b)

It does not recognise that the data is in order until the final pass requires no changes.

c)

It needs to do this to put the data back in to a list.

d)

To annoy the user.

69.

What is a disadvantage of a bubble sort?

a)

It takes a long time to implement.

b)

It is difficult to follow and understand.

c)

It uses less memory.

d)

It requires many operations to complete.

70.

How do merge sorts work?

a)

They split the list to single elements before piecing them back together, one sublist at a time.

b)

Each item in the list is compared with the following item starting with the last value till the first.

c)

Taking one item at a time from an unsorted list, each new item is compared with the previous until its place is found.

d)

Each item in the list is individually compared with the following item starting with the first value till the last.

71.

The following two lists are to be merged, which element first goes into the new merged list?

List 1

2 4 7 9

List 2

1 6 8 12

a)

0

b)

1

c)

2

d)

3

72.

The following two lists are to be merged, which element will be in position 5 in the new merged list?

List 1

2 4 7 9

List 2

1 6 8 12

a)

8

b)

7

c)

6

d)

4

73.

For which of the problems would the bubble sort algorithm provide an appropriate solution. Choose all that apply.

a)

Arranging a deck of cards from the lowest to the highest value cards.

b)

Looking up a name in the phone book.

c)

Sorting a stack of paper money into denominations -- i.e., £5, £10, £20 etc.

d)

Sorting a basket of laundry into socks, shirts, shorts, and sheets.

e)

Arranging books on a bookshelf by author's last name.

74.

For what purpose would a merge sort algorithm be used?

a)

To list items alphabetically.

b)

To reorder a single list.

c)

To combine identical lists together.

d)

To reorder multiple lists into a singular ordered list.

75.

Where would a merge sort be used?

a)

To arrange files in a cupboard.

b)

To arrange data in a computer folder.

c)

To sort data on the fly.

d)

To sort data that is too large to store in memory.

76.

What is a disadvantage of merge sort?

a)

It can take up to half the amount of memory than that of the original list.

b)

It is the best for sorting data that is normally accessed sequentially.

c)

It can take up to double the amount of memory than that of the original list.

d)

It is the worst at sorting data that is normally accessed sequentially.

77.
What does an insertion sort do?
a)
Separates a list of data into different collections of data which are sorted and gathered back into a list
b)
Goes through a list of data a number of times and compares two items that are side by side to each other to see which is out of order
c)
Goes through a list, comparing two items that are side by side, and continues to move one value until it is in the correct place.
78.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

name

c)

"Dave"

d)

(name)

79.

What is a input?

a)

To plug in something

b)

A function that allows us to ask the user to enter some data

c)

Data displayed on a screen

d)

A routine

80.

A variable must have been assigned (given) a value before that value is referenced (used).

a)

True

b)

False

81.

The correct way to convert user input is:

a)

birth_year = number(input())

b)

birth_year = int(input())

c)

birth_year = (input(int))

d)

birth_year = int(input)

82.

To display the following on screen Hello World! the following command should be used:

a)

print(Hello World!)

b)

print("Hello World" + !)

c)

print("Hello World!")

d)

print"(Hello World!)"

83.

You assign a value to a variable with which symbol

a)

@

b)

==

c)

=

d)

*

84.

The code you use to receive and input from the keyboard

a)

enter()

b)

add()

c)

receive()

d)

input()

85.

Program statements are executed in sequence, one after the other...

a)

True

b)

False

86.

if you receive a NameError when you run your program it means....

a)

A variable has been assigned before it has been referred to

b)

An incorrect name has been chosen

c)

A variable has been referred to before it has been assigned

d)

A language key word has been used

87.

If the coding steps are in the incorrect order, the computer can still execute the program.

a)

True

b)

False

88.
What is another word for 'iteration'?
a)
Selection
b)
Variable Assignment
c)
Repetition
d)
Sequencing
89.
Which python operator means 'less than or equal to'?
a)
>
b)
<
c)
>=
d)
<=
90.
How many times will this loop run?
a)
10
b)
9
c)
4
d)
5
91.
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()
92.

Which word completes this sentence: "Iteration makes code more ___________"

a)

Complex

b)

Efficient

c)

Simple

d)

Straightforward

93.

A FOR loop is....

a)

A COUNT controlled loop

b)

A CONDITION controlled loop

94.

A WHILE loop is....

a)

A COUNT controlled loop

b)

A CONDITION controlled loop

95.

What will the output be for the code shown here?

a)

3,2,1,0

b)

0,1,2,3

c)

3,2,1

d)

1,2,3

96.

What would the output be for the code shown here?

a)

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

b)

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

c)

0,2,4,6,8,10

d)

0,2,4,6,8

97.

Anil is writing a "rock, scissors, paper" program. He wants the game to repeat until the user doesn't want to play anymore. What loop should he use?

a)

a FOR loop

b)

a WHILE loop

98.

Clara is writing a program that will print out the first ten numbers of a times table (chosen by the user). Should she use....

a)

a FOR loop

b)

a WHILE loop

99.

Tara has written a "Hide and Seek Simulator" - what will happen when she runs it?

a)

It will print "1,2,3,4,5,6,7,8,9,10 Coming ready or not!"

b)

The program will not run

c)

It will print "1,2,3,4,5,6,7,8,9,11 Coming ready or not!"

d)

It will print ("10 Coming ready or not!")

100.
How do you correctly call this function
a)
def(1)
b)
x=square( )
c)
defSquare(4)
d)
x=square(5)
101.
Which of the following best describes the order in which these lines are processed in Python?
a)
4, 1, 2
b)
4, 2, 1
c)
1, 2, 3, 4
d)
3, 1, 2
102.

Which of the following is an advantage of using local variables?

a)

They allow the variable to be used throughout the whole program

b)

They allow variable identifiers to be reused each time

c)

They are easier to program than global variables

d)

A wider range of data types can be used

103.

What term is used to describe data passed into/out of a program?

a)

Variable

b)

Loop

c)

Constant

d)

Parameter

104.

Leo wants to create a subroutine that will roll a dice. Which syntax is correct?

a)

def dice roll ():

b)

def diceroll ()

c)

def diceroll ():

d)

def diceroll []:

105.

What would the output be from the program shown here? (assuming that the user enters "John" and "Smith"

a)

John

b)

Smith

c)

John Smith

d)

Error

106.

What would the output be from this program?

a)

Error

b)

Hello

c)

Hello, World

d)

World

107.

What is the difference between a subroutine and a function?

a)

They are the same thing

b)

A subroutine passes values back out to the program, a function does not

c)

A function passes values back out to the program, a subroutine does not

d)

A function can run without being called

108.

What will the output of this program be when it is run?

a)

Nothing

b)

Hello, world

c)

It will generate an error

109.

What will be the output of this program if the user enters "Han" and then "Solo"?

a)

An error

b)

Nothing

c)

first surname

d)

Han Solo

110.

Which of the following statements is not true?

a)

Functions/subroutines are examples of reusable code

b)

Functions and subroutines are always appropriate in programs

c)

Using functions/subroutines make it easier to "deconstruct" a problem into smaller pieces

d)

They can make programs easier to read and understand

111.

What would the output be for the following program if the user enters 4 and 6?

a)

10

b)

14

c)

16

d)

error