## Match-the-Following

 Question 1

Match the following: A P→(ii), Q→(iv), R→(i), S→(iii) B P→(ii), Q→(i), R→(iv), S→(iii) C P→(ii), Q→(iv), R→(iii), S→(i) D P→(iii), Q→(iv), R→(i), S→(ii)
Programming       Match-the-Following       GATE 2017 [Set-2]       Video-Explanation
Question 1 Explanation:
Static char var:
⇾ 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)
```
 A P→(iii), Q→(iv), R→(i), S→(ii) B P→(iv), Q→(iii), R→(i), S→(ii) C P→(iii), Q→(iv), R→(ii), S→(i) D P→(iv), Q→(iii), R→(ii), S→(i)
Algorithms       Match-the-Following       GATE 2017 [Set-2]       Video-Explanation
Question 2 Explanation:
In this problem, we have to find Average case of different algorithms
→ 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: A E - P, F - R, G - Q, H - S B E - R, F - P, G - S, H - Q C E - R, F - P, G - Q, H - S D E - P, F - R, G - S, H - Q
Theory-of-Computation       Match-the-Following       GATE 2008
Question 3 Explanation:
The grammar in S {X →bXb | cXc | ϵ} derives all even length Palindromes, So H matches with S.
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```
 A P – 3 Q – 2 R – 1 B P – 1 Q – 2 R – 3 C P – 2 Q – 3 R – 1 D P – 1 Q – 3 R – 2
Operating-Systems       Match-the-Following       GATE 2007
Question 4 Explanation:
⇒ Gang scheduling is used for parallel system that schedules the threads.
⇒ 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```
 A P – 2 Q – 1 R – 3 S – 5 B P – 1 Q – 4 R – 2 S – 3 C P – 1 Q – 4 R – 2 S – 5 D P – 2 Q – 4 R – 1 S – 3
Computer-Networks       Match-the-Following       GATE 2007
Question 5 Explanation:
P) SMTP is used for email transmission.
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 = B[J];     (a) Indirect addressing
(2) while [*A++];    (b) Indexed addressing
(3) int temp = *x;   (c) Auto increment```
 A (1, c), (2, b), (3, a) B (1, a), (2, c), (3, b) C (1, b), (2, c), (3, a) D (1, a), (2, b), (3, c)
Computer-Organization       Match-the-Following       GATE 2005
Question 6 Explanation:
(a) A[i] = B[j]; Indexed, Addressing.
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
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```
 A P - 1, Q - 4, R - 3 B P - 2, Q - 4, R - 1 C P - 2, Q - 3, R - 1 D P - 1, Q - 3, R - 2
Computer-Networks       Match-the-Following       GATE 2004
Question 7 Explanation:
Data Link Layer :: Second layer of the OSI Model, Responsible for Hop to Hop connection or point to point connection.
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 ```
 A P - 2, Q - 3, R - 4, S - 1 B P - 4, Q - 3, R - 2, S - 1 C P - 3, Q - 4, R - 1, S - 2 D P - 3, Q - 4, R - 2, S - 1
Programming       Match-the-Following       GATE 2004
Question 8 Explanation:
P) Functional programming is declarative in nature, involves expression evaluation and side effect free.
Q) Logic is also declarative but involves theorem proving.
R) Object oriented is imperative statement based and have abstract data types.
 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 ```
 A (X, III) (Y, I) (Z, II) B (X, II) (Y, III) (Z, I) C (X, III) (Y, II) (Z, I) D (X, I) (Y, III) (Z, II)
Computer-Organization       Match-the-Following       GATE 2001
Question 9 Explanation:
⇒ Array implementation can be done by Indexed addressing.
⇒ 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

 A X – 3 Y – 2 Z - 1 B X – 1 Y – 3 Z - 2 C X – 2 Y – 3 Z - 1 D X – 3 Y – 1 Z - 2
Computer-Organization       Match-the-Following       GATE 2000
Question 10 Explanation:
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. 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:

 A X – 1 Y – 3 Z – 2 B X – 2 Y – 1 Z – 3 C X – 3 Y – 2 Z – 1 D X – 3 Y – 1 Z – 2
Programming       Match-the-Following       GATE 2000
Question 11 Explanation:
X → m = NULL will results the loss of memory.
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.
There are 11 questions to complete.

Register Now