CCW CST308
CCW CST308
CCW CST308
Instructions: (1) Each question carries one mark. No negative marks for wrong answers
(2) Total number of questions: 50
(3) All questions are to be answered. Each question will be followed by 4 possible answers of
which only ONE is correct.
(4) If more than one option is chosen, it will not be considered for valuation.
1. Which data structure is used to store the undo history in a web browser?
a) Stack b) Queue c) Linked List d) Hash table
2. When a pop() operation is called on an empty queue, what is the condition called?
a) Overflow b) Underflow c) Syntax Error d) Garbage Value
3. Given a binary tree with the following elements: 50, 25, 75, 10, 30, 60, 90. Which traversal
technique will produce the following sequence? 10, 30, 25, 60, 90, 75, 50.
a) Pre-order b) In-order c) Post-order d) Level order
4. Which sorting algorithm has a time complexity of O(n log n) in the average and worst case?
a) Bubble sort b) Insertion sort c) Quick sort d) Selection sort
Page 1 of 6
1100CST308052301
9. Visiting root node after visiting left and right sub-trees is called
a) In-order b) Pre-order c) Post- d) Level order
Traversal Traversal order Traversal
10. How is the 2nd element in an array accessed based on pointer notation?
a) *a + 2 b) *(*a + 2) c) &(a + 2) d) *(a + 2)
16 Which memory management technique allows for efficient utilization of memory by allocating memory
in variable-sized blocks?
a) Paging b) Segmentation c) Swapping d) Fragmentation
Page 2 of 6
1100CST308052301
18 Consider a system with four processes: P1, P2, P3, and P4. The arrival times and burst times for each
process are given in the table below:
Process Arrival Time Burst Time
P1 0 4
P2 2 6
P3 4 8
P4 6 2
Assuming the scheduling algorithm is First-Come, First-Served (FCFS), what is the average waiting time
for these processes?
a) 6.5 b) 8.25 c) 9.75 d) 10.5
19 Consider a system with three resource types (A, B, and C) and four processes (P1, P2, P3, and P4). The
maximum resource allocation needs for each process are as follows:
Process Max Allocation (A, B, C)
P1 3, 1, 2
P2 2, 2, 3
P3 1, 3, 1
P4 4, 2, 1
The current resource allocation and the maximum available resources in the system are as follows:
Process Allocation (A, B, C) Available (A, B, C)
P1 1, 1, 0 2, 1, 1
P2 1, 0, 2
P3 1, 2, 1
P4 0, 1, 1
Using the Banker's algorithm, is the system in a safe safe?
a) Yes b) No c) Cannot d) None of these
Determine
20 Consider a system with five processes: P1, P2, P3, P4, and P5. The burst times for each process are given
in the table below:
Process Burst Time
P1 8
P2 4
P3 9
P4 5
P5 2
Assuming the scheduling algorithm is Round Robin with a time quantum of 3, what is the turnaround
time for process P3?
a) 10 b) 11 c) 12 d) 13
21 A processor has an instruction cache with a hit rate of 90% and an access time of 1 ns. If the cache miss
penalty is 20 ns, what is the average memory access time?
a) 1.1 ns b) 2 ns c) 2.2 ns d) 3 ns
22 A computer system uses a direct-mapped cache with a cache size of 8 KB and a block size of 32 bytes.
How many bits are needed for the cache index?
a) 5 bits b) 7 bits c) 9 bits d) 11 bits
23 Which memory type is the closest to the CPU and provides fast access to frequently used data?
a) Cache memory b) Main memory c) Virtual memory d) Secondary memory
(RAM) (Hard Disk)
Page 3 of 6
1100CST308052301
24 Which addressing mode uses a base register plus an offset to calculate the memory address?
a) Immediate b) Direct addressing c) Indirect d) Indexed addressing
addressing mode mode addressing mode mode
25 A computer system uses a 32-bit virtual address and a 4 KB page size. How many entries are there in the
page table?
a) 256 entries b) 512 entries c) 1024 entries d) 2048 entries
26 In a pipelined processor, which hazard occurs when the current instruction depends on the result of a
previous instruction that has not yet completed?
a) Data hazard b) Control hazard c) Structural hazard d) Pipeline hazard
27 Which cache mapping technique provides the fastest access time but has limited capacity?
a) Direct mapping b) Associative c) Set-associative d) Fully associative
mapping mapping mapping
28 Which technique is used to reduce the effect of memory latency in a pipelined processor?
a) Branch b) Instruction-level c) Out-of-order d) Loop unrolling
prediction parallelism execution
29 Which technique is used to minimize the impact of control hazards in a pipelined processor?
a) Branch b) Data forwarding c) Loop unrolling d) Out-of-order
prediction execution
30 Example of immediate addressing mode is:
a) MOV A, B b) ADD A, [B] c) SUB A, #10 d) JMP LABEL
31 Which of the following is NOT a component of a formal language?
a) Alphabet b) Syntax c) Semantics d) Compiler
32 Which type of automaton recognizes regular languages?
a) Pushdown b) Finite automaton c) Turing machine d) Linear-bounded
automaton (PDA) (FA) (TM) automaton (LBA)
33 The Chomsky hierarchy classifies formal languages into how many levels?
a) 2 b) 3 c) 4 d) 5
34 Which type of automaton has both a finite control unit and an unbounded tape?
a) Finite automaton b) Pushdown c) Turing machine d) Mealy machine
(FA) automaton (PDA) (TM)
35 The language accepted by a Turing machine with a halting state is known as:
a) Regular language b) Context-free c) Context-sensitive d) Recursive
language language enumerable language
Page 4 of 6
1100CST308052301
38 The Chomsky normal form (CNF) is a way to represent a context-free grammar (CFG) where:
a) All the b) The start symbol is c) There are no ε- d) All the production
production rules on the left-hand productions in rules have at most
are in the form A side of the the grammar two non-terminals on
-> Ab. production rules. the right-hand side
39 Which of the following is a regular expression for the language of all strings over {a, b} that contain at
least one “a”?
a) ab b) (ab)* c) (a+b)* d) (a+b)a(a+b)
40 Which type of automaton is used in lexical analysis for tokenizing source code?
a) Finite automaton b) Pushdown c) Turing machine ™ d) Linear-bounded
(FA) automaton (PDA) automaton (LBA)
42 Which of the following queries will retrieve students whose name has ‘p’ as the second letter ?
a) SELECT rollNo b) SELECT rollNo c) SELECT rollNo d) SELECT rollNo FROM
FROM student FROM student FROM student student
where name = where name LIKE where name LIKE where name IN ‘_p%’;
‘_p’; ‘_p’; ‘_p%’;
43 Consider a relation R(A, B, C, D, E) and a set of all FDs that hold on R as given below:
{A → BC, CD → E, B → D, E → A}
Choose the correct option:
a) R is in 1NF, not in b) R is in 2NF, not in c) R is in 3NF, not in d) R is in BCNF
2NF 3NF BCNF
Page 5 of 6
1100CST308052301
Page 6 of 6