Match-the-following
Question 1 |
The correct matching for the following pairs is
A. Activation record 1. Linking loader B. Location counter 2. Garbage collection C. Reference counts 3. Subroutine call D. Address relocation 4. Assembler
A – 3 B – 4 C – 1 D – 2 | |
A – 4 B – 3 C – 1 D – 2 | |
A – 4 B – 3 C – 2 D – 1 | |
A – 3 B – 4 C – 2 D – 1 |
An assembler uses location counter value to give address to each instruction which is needed for relative addressing as well as for jump labels.
Reference count is used by garbage collector to clear the memory whose reference count be comes 0.
Linker loader is a loader which can load several compiled codes and link them together into a single executable. Thus it needs to do relocation of the object codes.
Question 2 |
The correct matching for the following pairs is
(A) Disk Scheduling (1) Round robin (B) Batch Processing (2) SCAN (C) Time sharing (3) LIFO (D) Interrupt processing (4) FIFO
A – 3 B – 4 C – 2 D – 1 | |
A – 4 B – 3 C – 2 D – 1 | |
A – 2 B – 4 C – 1 D – 3 | |
A – 3 B – 4 C – 3 D – 2 |
Batch processing - FIFO
Time sharing - Round Robin
Interrupt processing - LIFO
Question 3 |
The correct matching for the following pairs is
(A) DMA I/O (1) High speed RAM (B) Cache (2) Disk (C) Interrupt I/O (3) Printer (D) Condition Code Register (4) ALU
A – 4 B – 3 C – 1 D – 2 | |
A – 2 B – 1 C – 3 D – 4
| |
A – 4 B – 3 C – 2 D – 1 | |
A – 2 B – 3 C – 4 D – 1 |
Cache → High speed RAM
Interrupt I/O → Printer
Condition code register → ALU
Question 4 |
The correct matching for the following pairs is
(A) All pairs shortest path (1) Greedy (B) Quick Sort (2) Depth-First search (C) Minimum weight spanning tree (3) Dynamic Programming (D) Connected Components (4) Divide and and Conquer
A – 2 B – 4 C – 1 D – 3 | |
A – 3 B – 4 C – 1 D – 2 | |
A – 3 B – 4 C – 2 D – 1 | |
A – 4 B – 1 C – 2 D – 3 |
Quick sort - Divide and Conquer
Minimum weight Spanning tree - Greedy
Connected components - Depth-First search
Question 5 |
Give the correct matching for the following pairs:
A. O(log n) 1. Selection sort B. O(n) 2. Insertion sort C. O(nlog n) 3. Binary search D. O(n2) 4. Merge sort
A – R B – P C – Q D – S | |
A – R B – P C – S D – Q | |
A – P B – R C – S D – Q | |
A – P B – S C – R D – Q |
Selection = O(n)
Merge sort = O(n log n)
Insertion sort = O(n2)
Question 6 |
Listed below are some operating system abstractions (in the left column) and the hardware components or mechanism (in the right column) that they are abstractions of. Which of the following matching of pairs is correct?
A. Thread 1. Interrupt B. Virtual address space 2. Memory C. File system 3. CPU D. Signal 4. Disk
(A) – 2 (B) – 4 (C) – 3 (D) - 1 | |
(A) – 1 (B) – 2 (C) – 3 (D) – 4 | |
(A) – 3 (B) – 2 (C) – 4 (D) - 1 | |
(A) – 4 (B) – 1 (C) – 2 (D) – 3 |
⇒ Threads are handled by CPU.
⇒ Virtual address is a memory type.
⇒ File system is used to manage the disk.
⇒ Interrupt is a signal.
Question 7 |
The most appropriate matching for the following pairs
X: Indirect addressing 1 : Loops Y: Immediate addressing 2 : Pointers Z: Auto decrement addressing 3: Constants
is
X – 3 Y – 2 Z - 1 | |
X – 1 Y – 3 Z - 2 | |
X – 2 Y – 3 Z - 1 | |
X – 3 Y – 1 Z - 2 |
Indirect addressing means that the address of the data is held in an intermediate location so that the address is first 'looked up' and then used to locate the data itself.
Immediate addressing:
Immediate Addressing. An immediate operand has a constant value or an expression. When an instruction with two operands uses immediate addressing, the first operand may be a register or memory location, and the second operand is an immediate constant.
Auto increment or decrements can be one by using loops.
Question 8 |
The most appropriate matching for the following pairs
X: m=malloc(5); m= NULL; 1: using dangling pointers Y: free(n); n->value=5; 2: using uninitialized pointers Z: char *p; *p = ’a’; 3. lost memory
is:
X – 1 Y – 3 Z – 2 | |
X – 2 Y – 1 Z – 3 | |
X – 3 Y – 2 Z – 1 | |
X – 3 Y – 1 Z – 2 |
Y → n is pointer to invalid memory, a making it as a dangling pointer.
Z → p is not initialized.
p = malloc (size of(char))p = malloc (size of(char)); should have been used before assigning 'aa' to ∗p.
Question 9 |
The most appropriate matching for the following pairs
X: depth first search 1: heap Y: breadth-first search 2: queue Z: sorting 3: stack
is
X – 1 Y – 2 Z – 3 | |
X – 3 Y – 1 Z – 2 | |
X – 3 Y – 2 Z – 1 | |
X – 2 Y – 3 Z – 1 |
Queue is used in breadth-first search.
Heap is used in heap.
Question 10 |
Which is the most appropriate match for the items in the first column with the items in the second column
X. Indirect Addressing I. Array implementation Y. Indexed Addressing II. Writing re-locatable code Z. Base Register Addressing III. Passing array as parameter
(X, III) (Y, I) (Z, II) | |
(X, II) (Y, III) (Z, I) | |
(X, III) (Y, II) (Z, I) | |
(X, I) (Y, III) (Z, II) |
⇒ Writing relocatable code can be done by Base Register addressing by changing the value of Base Register.
⇒ While passing an array as parameter we use pointer and hence can use Indirect addressing.
Question 11 |
Choose the best matching between the programming styles in Group 1 and their characteristics in Group 2.
Group-1 Group-2 P. Functional 1. Command-based, procedural Q. Logic 2. Imperative, abstract data type R. Object-oriented 3. Side-effect free, declarative, expression evaluation S. Imperative 4. Declarative, clausal representation, theorem proving
P - 2, Q - 3, R - 4, S - 1 | |
P - 4, Q - 3, R - 2, S - 1 | |
P - 3, Q - 4, R - 1, S - 2 | |
P - 3, Q - 4, R - 2, S - 1 |
Q) Logic is also declarative but involves theorem proving.
R) Object oriented is imperative statement based and have abstract data types.
S) Imperative programs are made giving commands and follow definite procedure.