GATE 2021 (Session 2) Computer Science and Information Technology (CS) Questions with Solutions

GATE 2021 (Session 2)

64 questions

MCQ 33 · MSQ 13 · NAT 181-mark 29 · 2-mark 35

Questions 51–55 of 64

Q52Thread2 marksMSQ
Consider the following multi-threaded code segment (in a mix of C and pseudo-code), invoked by two processes P1 and P2, and each of the processes spawns two threads T1 and T2:
int x = 0;  // global
Lock L1;    // global
main () { 
    create a thread to execute foo( ); // Thread T1
    create a thread to execute foo( ); // Thread T2
    wait for the two threads to finish execution;
    print(x);}
    
    
foo() {
    int y = 0;
    Acquire L1;
    x = x + 1;
    y = y + 1;
    Release L1;
    print (y);} 
Which of the following statement(s) is/are correct?

One or more options are correct.

Q53Process Synchronization2 marksMSQ
Consider a computer system with multiple shared resource types, with one instance per resource type. Each instance can be owned by only one process at a time. Owning and freeing of resources are done by holding a global lock (L). The following scheme is used to own a resource instance:
 function OWNRESOURCE(Resource R) 
    Acquire lock L // a global lock 
    if R is available then 
        Acquire R        
        Release lock L 
    else
        if R is owned by another process P then        
        Terminate P, after releasing all resources owned by P        
        Acquire R        
        Restart P        
        Release lock L        
        end if
    end if    
end function
Which of the following choice(s) about the above scheme is/are correct?

One or more options are correct.

Q54Number System2 marksMSQ
If the numerical value of a 2-byte unsigned integer on a little endian computer is 255 more than that on a big endian computer, which of the following choices represent(s) the unsigned integer on a little endian computer?

One or more options are correct.

Q55Network Layer Protocol2 marksMSQ
Consider a computer network using the distance vector routing algorithm in its network layer. The partial topology of the network is shown below.
RXYZ ......... QP
The objective is to find the shortest-cost path from the router R to routers P and Q. Assume that R does not initially know the shortest routes to P and Q. Assume that R has three neighboring routers denoted as X, Y and Z. During one iteration, R measures its distance to its neighbors X, Y, and Z as 3, 2 and 5, respectively. Router R gets routing vectors from its neighbors that indicate that the distance to router P from routers X, Y and Z are 7, 6 and 5, respectively. The routing vector also indicates that the distance to router Q from routers X, Y and Z are 4, 6 and 8 respectively. Which of the following statement(s) is/are correct with respect to the new routing table o R, after updation during this iteration?

One or more options are correct.

Q56Graph Theory2 marksMSQ
Consider the following directed graph:
s
Which of the following is/are correct about the graph?

One or more options are correct.