• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

GATE CS 2021 | Set 2

Question 41

​​​​​​Consider the following two statements about regular languages:
  • S1: Every infinite regular language contains an undecidable language as a subset.
  • S2: Every finite language is regular.
Which one of the following choices is correct?
  • Only S1 is true
  • Only S2 is true
  • Both S1 and S2 are true
  • Neither S1 nor S2 is true

Question 42

For two n-dimensional real vectors P and Q, the operation s(P,Q) is defined as follows: Let L be a set of 10-dimensional non-zero real vectors such that for every pair of distinct vectors P,Q∈L, s(P,Q)=0. What is the maximum cardinality possible for the set L?
  • 9
  • 10
  • 11
  • 100

Question 43

For a statement S in a program, in the context of liveness analysis, the following sets are defined:
  • USE(S) : the set of variables used in S
  • IN(S) : the set of variables that are live at the entry of S
  • OUT(S) : the set of variables that are live at the exit of S
Consider a basic block that consists of two statements, S1 followed by S2. Which one of the following statements is correct?
  • OUT(S1) = IN (S2)
  • OUT (S1) = IN (S1) ∪ USE (S1)
  • OUT (S1) = IN (S2) ∪ OUT (S2)
  • OUT (S1) = USE (S1) ∪ IN (S2)

Question 44

Suppose the following functional dependencies hold on a relation U with attributes P,Q,R,S, and T:
P → QR
RS → T 
Which of the following functional dependencies can be inferred from the above functional dependencies?
  • PS → T
  • R → T
  • P → R
  • PS → Q

Question 45

For a string w, we define wR to be the reverse of w. For example, if w = 01101 then wR = 10110. Which of the following languages is/are context-free?
  • {wxwRxR ∣ w,x∈{0,1}*}
  • {wwRxxR ∣ w,x∈{0,1}*}
  • {wxwR ∣ w,x∈{0,1}*}
  • {wxxRwR ∣ w,x∈{0,1}*}

Question 46

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?
  • Both P1 and P2 will print the value of x as 2.
  • At least of P1 and P2 will print the value of x as 4.
  • At least one of the threads will print the value of y as 2.
  • Both T1 and T2, in both the processes, will print the value of y as 1.

Question 47

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?
  • The scheme ensures that deadlocks will not occur
  • The scheme may lead to live-lock
  • The scheme may lead to starvation
  • The scheme violates the mutual exclusion property

Question 48

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?
  • 0x6665
  • 0x0001
  • 0x4243
  • 0x0100

Question 49

Consider a computer network using the distance vector routing algorithm in its network layer. The partial topology of the network is shown below. 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 neighbouring routers denoted as X, Y and Z. During one iteration, R measures its distance to its neighbours X, Y, and Z as 3, 2 and 5, respectively. Router R gets routing vectors from its neighbours 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?
  • The distance from R to P will be stored as 10
  • The distance from R to Q will be stored as 7
  • The next hop router for a packet from R to P is Y
  • The next hop router for a packet from R to Q is Z

Question 50

Consider the following directed graph: Which of the following is/are correct about the graph?
  • The graph does not have a topological order
  • A depth-first traversal starting at vertex S classifies three directed edges as back edges
  • The graph does not have a strongly connected component
  • For each pair of vertices u and v, there is a directed path from u to v

There are 65 questions to complete.

Last Updated :
Take a part in the ongoing discussion