Mixed practice
12 questions across all topics
Prefix/Infix/Postfix Notation
Q1
Evaluate the postfix expression:
Boolean Algebra
Q2
Simplify:
Computer Number Systems
Q3
What is the largest decimal value that can be represented with 6 binary digits?
WDTPD - Strings
Q4
What is the output?
S = "PROGRAM"
T = ""
FOR i = 0 TO len(S)-1
IF i MOD 2 == 0 THEN
T = T + S[i]
END IF
NEXT i
OUTPUT T Recursive Functions
Q5
If when , , and , what is ?
Bit-String Flicking
Q6
Evaluate: NOT (RCIRC-1 11010) XOR 10101
Graph Theory
Q7
A directed graph has vertices A, B, C, D and edges AB, BC, CA, BD. Is this graph a DAG (directed acyclic graph)?
Data Structures
Q8
Build a BST by inserting: 40, 20, 60, 10, 30, 50, 70. What is the preorder traversal?
WDTPD - Branching
Q9
What is the output?
a = 4
b = 6
c = 8
m = a
IF b > m THEN
m = b
END IF
IF c > m THEN
m = c
END IF
OUTPUT m - a Digital Electronics
Q10
A circuit has an OR gate with inputs A and B, followed by a NOT gate. What Boolean expression does it compute?
WDTPD - Arrays
Q11
What is the output?
A = [5, 2, 8, 1, 9]
max = A[0]
FOR i = 1 TO 4
IF A[i] > max THEN
max = A[i]
END IF
NEXT i
OUTPUT max WDTPD - Looping
Q12
What is the output?
n = 48
m = 18
WHILE m != 0
temp = m
m = n MOD m
n = temp
END WHILE
OUTPUT n