Mixed practice
12 questions across all topics
Graph Theory
Q1
Given the adjacency matrix below, how many edges does the graph have?
A B C D A [ 0, 1, 1, 0 ] B [ 1, 0, 1, 1 ] C [ 1, 1, 0, 1 ] D [ 0, 1, 1, 0 ]
Recursive Functions
Q2
If when , and otherwise, find .
WDTPD - Strings
Q3
What is the output?
S = "ABCDEFGH" OUTPUT S[2:5]
Bit-String Flicking
Q4
Evaluate: LCIRC-7 10110 (the string has 5 bits)
Prefix/Infix/Postfix Notation
Q5
Evaluate the postfix expression:
WDTPD - Arrays
Q6
What is the output?
A = [1, 2, 3, 4, 5]
B = [0, 0, 0, 0, 0]
FOR i = 0 TO 4
B[4-i] = A[i]
NEXT i
OUTPUT B[1] + B[3] Computer Number Systems
Q7
Subtract the binary number from . Give your answer in binary.
WDTPD - Branching
Q8
What is the output?
x = 8
y = 3
IF x MOD y == 0 THEN
OUTPUT "divisible"
ELSE IF x MOD y == 1 THEN
OUTPUT "remainder 1"
ELSE
OUTPUT "remainder " + (x MOD y)
END IF Data Structures
Q9
A stack is initially empty. What is the output?
PUSH(1)
PUSH(2)
PUSH(3)
A = POP()
B = POP()
PUSH(A + B)
OUTPUT: POP()
Boolean Algebra
Q10
What is simplified using DeMorgan's?
WDTPD - Looping
Q11
What is the output?
s = 0
FOR i = 1 TO 6
IF i MOD 2 == 0 THEN
s = s + i
END IF
NEXT i
OUTPUT s Digital Electronics
Q12
How many input combinations (out of 4 possible for 2 inputs) make a NOR gate output 1?