Match-the-Following
Question 1 |
Match the following:
P→(ii), Q→(iv), R→(i), S→(iii) | |
P→(ii), Q→(i), R→(iv), S→(iii) | |
P→(ii), Q→(iv), R→(iii), S→(i) | |
P→(iii), Q→(iv), R→(i), S→(ii) |
⇾ A variable located in Data Section of memory

P→(ii), Q→(iv), R→(i), S→(iii)
Question 2 |
Match the algorithms with their time complexities:
Algorithm Time complexity (P) Towers of Hanoi with n disks (i) Θ(n2) (Q) Binary search given n stored numbers (ii) Θ(n log n) (R) Heap sort given n numbers at the worst case (iii) Θ(2n) (S) Addition of two n×n matrices (iv) Θ(log n)
P→(iii), Q→(iv), R→(i), S→(ii) | |
P→(iv), Q→(iii), R→(i), S→(ii) | |
P→(iii), Q→(iv), R→(ii), S→(i) | |
P→(iv), Q→(iii), R→(ii), S→(i) |
→ Tower of Hanoi with n disks takes θ(2n) time
It is a mathematical game or puzzle.
It consists of three rods and a number of disks of different sizes, which can slide onto any rod.
The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape.
The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules:
1. Only one disk can be moved at a time.
2. Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack.
3. No disk may be placed on top of a smaller disk.
With 3 disks, the puzzle can be solved in 7 moves.
The minimal number of moves required to solve a Tower of Hanoi puzzle is 2n-1, where n is the number of disks.
→ Binary Search given n sorted numbers takes Ɵ(log2 n)
→ Heap sort given n numbers of the worst case takes Ɵ(n log n)
→ Addition of two n×n matrices takes Ɵ(n2)
Question 3 |
Match the following:

E - P, F - R, G - Q, H - S | |
E - R, F - P, G - S, H - Q | |
E - R, F - P, G - Q, H - S | |
E - P, F - R, G - S, H - Q |
F matches with P, Number of formal parameters in the declaration…. matches with {L = { an bm c n dm | m,n >=1}
Since, an bm corresponds to formal parameter (if n=2 and m=1, and “a” is int type and “b”is float type, then it means (int,int,float)) and cn dm corresponds to actual parameter used in function.
Similarly other two can also be argued by their reasons, but with F matches with P and H matches with S implies that option C is the only correct option.
Question 4 |
Group 1 contains some CPU scheduling algorithms and Group 2 contains some applications. Match entries in Group 1 to entries in Group 2.
Group I Group II (P) Gang Scheduling (1) Guaranteed Scheduling (Q) Rate Monotonic Scheduling (2) Real-time Scheduling (R) Fair Share Scheduling (3) Thread Scheduling
P – 3 Q – 2 R – 1 | |
P – 1 Q – 2 R – 3 | |
P – 2 Q – 3 R – 1 | |
P – 1 Q – 3 R – 2 |
⇒ Rate monotonic scheduling is used in Real-time operating system.
⇒ Fair share scheduling distributes the CPU equally among users due to which it generates scheduling process.
Question 5 |
Match the following:
(P) SMTP (1) Application layer (Q) BGP (2) Transport layer (R) TCP (3) Data link layer (S) PPP (4) Network layer (5) Physical layer
P – 2 Q – 1 R – 3 S – 5 | |
P – 1 Q – 4 R – 2 S – 3 | |
P – 1 Q – 4 R – 2 S – 5 | |
P – 2 Q – 4 R – 1 S – 3 |
Q) BGP is network layer protocol that manages low packets are routed across the network.
R) TCP is a transport layer protocol.
S) PPP is a data link layer protocol.
Question 6 |
Match each of the high level language statements given on the left hand side with the most natural addressing mode from those listed on the right hand side.
(1) A[1] = B[J]; (a) Indirect addressing (2) while [*A++]; (b) Indexed addressing (3) int temp = *x; (c) Auto increment
(1, c), (2, b), (3, a) | |
(1, a), (2, c), (3, b) | |
(1, b), (2, c), (3, a) | |
(1, a), (2, b), (3, c) |
Here using the Index.
(b) while [*A++]; Auto increment.
The memory is increments automatically.
(c) int temp = *x; Indirect Addressing.
Here temp is assigned to integer type of Address contained in x.
Question 7 |
Choose the best matching between Group 1 and Group 2.
Group-1 Group-2 P. Data link 1. Ensures reliable transport of data over a physical point-to-point link Q. Network layer 2. Encoder/decodes data for physical transmission R. Transport layer 3. Allows end-to-end communication between two processes 4. Routes data from one network node to the next
P - 1, Q - 4, R - 3 | |
P - 2, Q - 4, R - 1
| |
P - 2, Q - 3, R - 1 | |
P - 1, Q - 3, R - 2 |
Transport Layer :: Fourth layer of the OSI Model, Responsible for Service point addressing/Socket to socket connection or end to end connection with full reliability.
Network Layer :: Third layer of the OSI Model, Responsible for Host to Host.
Question 8 |
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.
Question 9 |
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 10 |
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 11 |
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.