The PYQ practice room

GATE CS 2017 Set 1

All 65 solved GATE CS 2017 Set 1 questions in exam order. Open a question, commit to an answer, and learn from the step-by-step solution. One question at a time.

Attempt before revealInstant answer feedbackExplore questions
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.

Questions

65

Paper marks

100

Question formats

2

MCQ · NAT

Revision mode

Self-paced

No timer. Focus on understanding.

Difficulty mixEasy 21Medium 42Hard 2

Explore the questions

65 of 65 questions

General Aptitude (GA)

10
  1. Think it through. Then check your answer.

    Question

    After Rajendra Chola returned from his voyage to Indonesia, he __________ to visit the temple in Thanjavur.
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  2. Think it through. Then check your answer.

    Question

    Research in the workplace reveals that people work for many reasons __________.
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  3. Think it through. Then check your answer.

    Question

    Rahul, Murali, Srinivas and Arul are seated around a square table. Rahul is sitting to the left of Murali. Srinivas is sitting to the right of Arul. Which of the following pairs are seated opposite each other?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  4. Think it through. Then check your answer.

    Question

    Find the smallest number yy such that y×162y \times 162 is a perfect cube.
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  5. Think it through. Then check your answer.

    Question

    The probability that a kk-digit number does NOT contain the digits 0, 5, or 9 is
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  6. Think it through. Then check your answer.

    Question

    "The hold of the nationalist imagination on our colonial past is such that anything inadequately or improperly nationalist is just not history."
    Which of the following statements best reflects the author's opinion?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  7. Think it through. Then check your answer.

    Question

    Six people are seated around a circular table. There are at least two men and two women. There are at least three right-handed persons. Every woman has a left-handed person to her immediate right. None of the women are right-handed. The number of women at the table is
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  8. Think it through. Then check your answer.

    Question

    The expression (x+y)xy2\frac{(x+y)-|x-y|}{2} is equal to
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  9. Think it through. Then check your answer.

    Question

    Arun, Gulab, Neel and Shweta must choose one shirt each from a pile of four shirts coloured red, pink, blue and white respectively. Arun dislikes the colour red and Shweta dislikes the colour white. Gulab and Neel like all the colours. In how many different ways can they choose the shirts so that no one has a shirt with a colour he or she dislikes?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  10. Think it through. Then check your answer.

    Question

    A contour line joins locations having the same height above the mean sea level. The following is a contour plot of a geographical region. Contour lines are shown at 25 m intervals in this plot. If in a flood, the water level rises to 525 m, which of the villages P, Q, R, S, T get submerged?
    Contour plot of a geographical region with villages P, Q, R, S, T
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page

Computer Science and Information Technology

55
  1. Think it through. Then check your answer.

    Question

    The statement (¬p)(¬q)(\neg p) \Rightarrow (\neg q) is logically equivalent to which of the statements below?
    I. pqp \Rightarrow q
    II. qpq \Rightarrow p
    III. (¬q)p(\neg q) \lor p
    IV. (¬p)q(\neg p) \lor q
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  2. Think it through. Then check your answer.

    Question

    Consider the first-order logic sentence F:x(yR(x,y))F: \forall x(\exists y R(x, y)). Assuming non-empty logical domains, which of the sentences below are implied by FF?
    I. y(xR(x,y))\exists y(\exists x R(x, y))
    II. y(xR(x,y))\exists y(\forall x R(x, y))
    III. y(xR(x,y))\forall y(\exists x R(x, y))
    IV. ¬x(y¬R(x,y))\neg \exists x(\forall y \neg R(x, y))
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  3. Think it through. Then check your answer.

    Question

    Let c1,,cnc_1, \dots, c_n be scalars, not all zero, such that i=1nciai=0\sum_{i=1}^n c_i a_i = 0 where aia_i are column vectors in Rn\mathbf{R}^n.
    Consider the set of linear equationsAx=bAx = bwhere A=[a1,,an]A=[a_1, \dots, a_n] and b=i=1naib = \sum_{i=1}^n a_i. The set of equations has
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  4. Think it through. Then check your answer.

    Question

    Consider the following functions from positive integers to real numbers:10,n,n,log2n,100n10, \sqrt{n}, n, \log_2 n, \frac{100}{n}The CORRECT arrangement of the above functions in increasing order of asymptotic complexity is:
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  5. Think it through. Then check your answer.

    Question

    Consider the following table:
    AlgorithmsDesign Paradigms
    (P) Kruskal(i) Divide and Conquer
    (Q) Quicksort(ii) Greedy
    (R) Floyd-Warshall(iii) Dynamic Programming
    Match the algorithms to the design paradigms they are based on.
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  6. Think it through. Then check your answer.

    Question

    Let TT be a binary search tree with 15 nodes. The minimum and maximum possible heights of TT are:
    Note: The height of a tree with a single node is 0.
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  7. Think it through. Then check your answer.

    Question

    The nn-bit fixed-point representation of an unsigned real number XX uses ff bits for the fraction part. Let i=nfi = n - f. The range of decimal values for XX in this representation is
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  8. Think it through. Then check your answer.

    Question

    Consider the C code fragment given below.
    typedef struct node {
      int data;
      node* next;
    } node;
    
    void join(node* m, node* n) {
      node* p = n;
      while (p->next != NULL) {
        p = p->next;
      }
      p->next = m;
    }
    
    Assuming that m and n point to valid NULL-terminated linked lists, invocation of join will
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  9. Think it through. Then check your answer.

    Question

    When two 8-bit numbers A7A0A_7 \cdots A_0 and B7B0B_7 \cdots B_0 in 2's complement representation (with A0A_0 and B0B_0 as the least significant bits) are added using a ripple-carry adder, the sum bits obtained are S7S0S_7 \cdots S_0 and the carry bits are C7C0C_7 \cdots C_0 . An overflow is said to have occurred if
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  10. Think it through. Then check your answer.

    Question

    Consider the following context-free grammar over the alphabet Σ={a,b,c}\Sigma = \{a, b, c\} with SS as the start symbol:
    SabScTabcTS \rightarrow abScT \mid abcT
    TbTbT \rightarrow bT \mid b
    Which one of the following represents the language generated by the above grammar?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  11. Think it through. Then check your answer.

    Question

    Consider the C struct defined below:
    struct data {
        int marks [100];
        char grade;
        int cnumber;
    };
    struct data student;
    

    The base address of student is available in register R1. The field student.grade can be accessed efficiently using
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  12. Think it through. Then check your answer.

    Question

    Consider the following intermediate program in three address code
    p = a - b
    q = p * c
    p = u * v
    q = p + q
    
    Which one of the following corresponds to a static single assignment form of the above code?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  13. Think it through. Then check your answer.

    Question

    Consider the following C code:
    #include <stdio.h>
    int *assignval(int *x, int val) {
        *x = val;
        return x;
    }
    
    void main () {
        int *x = malloc(sizeof(int));
        if(NULL == x) return;
        x = assignval(x,0);
        if(x) {
            x = (int *)malloc(sizeof(int));
            if (NULL == x) return;
            x = assignval(x, 10);
        }
        printf("%d\n", *x);
        free(x);
    }
    
    The code suffers from which one of the following problems:
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  14. Think it through. Then check your answer.

    Question

    Consider a TCP client and a TCP server running on two different machines. After completing data transfer, the TCP client calls close to terminate the connection and a FIN segment is sent to the TCP server. Server-side TCP responds by sending an ACK, which is received by the client-side TCP. As per the TCP connection state diagram (RFC 793), in which state does the client-side TCP connection wait for the FIN from the server-side TCP?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  15. Think it through. Then check your answer.

    Question

    A sender S sends a message mm to receiver R, which is digitally signed by S with its private key. In this scenario, one or more of the following security violations can take place.
    (I) S can launch a birthday attack to replace mm with a fraudulent message.
    (II) A third party attacker can launch a birthday attack to replace mm with a fraudulent message.
    (III) R can launch a birthday attack to replace mm with a fraudulent message.
    Which of the following are possible security violations?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  16. Think it through. Then check your answer.

    Question

    The following functional dependencies hold true for the relational schema R{V,W,X,Y,Z}R\{V, W, X, Y, Z\}:VWVWXYVXYZ\begin{aligned} V &\rightarrow W \\ VW &\rightarrow X \\ Y &\rightarrow VX \\ Y &\rightarrow Z \end{aligned}Which of the following is irreducible equivalent for this set of functional dependencies?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  17. Think it through. Then check your answer.

    Question

    Consider the following grammar:
    PxQRSP \rightarrow xQRS
    QyzzQ \rightarrow yz \mid z
    RwϵR \rightarrow w \mid \epsilon
    SyS \rightarrow y
    What is FOLLOW(Q)FOLLOW(Q)?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  18. Think it through. Then check your answer.

    Question

    Threads of a process share
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  19. Think it through. Then check your answer.

    Question

    Let XX be a Gaussian random variable with mean 0 and variance σ2\sigma^2. Let Y=max(X,0)Y = \max(X, 0) where max(a,b)\max(a, b) is the maximum of aa and bb. The median of YY is ________ .
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  20. Think it through. Then check your answer.

    Question

    Let TT be a tree with 10 vertices. The sum of the degrees of all the vertices in TT is ________ .
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  21. Think it through. Then check your answer.

    Question

    Consider the Karnaugh map given below, where X represents "don't care" and blank represents 0.
    Karnaugh map with variables ba on columns and dc on rows
    Assume for all inputs (a,b,c,d)(a, b, c, d), the respective complements (aˉ,bˉ,cˉ,dˉ)(\bar{a}, \bar{b}, \bar{c}, \bar{d}) are also available. The above logic is implemented using 2-input NOR gates only. The minimum number of gates required is ________ .
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  22. Think it through. Then check your answer.

    Question

    Consider the language LL given by the regular expression (a+b)b(a+b)(a+b)^*b(a+b) over the alphabet {a,b}\{a,b\}. The smallest number of states needed in a deterministic finite-state automaton (DFA) accepting LL is __________.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  23. Think it through. Then check your answer.

    Question

    Consider a database that has the relation schema EMP (EmpId, EmpName, and DeptName). An instance of the schema EMP and a SQL query on it are given below.
    EmpIdEmpNameDeptName
    1XYAAA
    2XYBAA
    3XYCAA
    4XYDAA
    5XYEAB
    6XYFAB
    7XYGAB
    8XYHAC
    9XYIAC
    10XYJAC
    11XYKAD
    12XYLAD
    13XYMAE
    SELECT AVG(EC.Num)
    FROM EC
    WHERE (DeptName, Num) IN
        (SELECT DeptName, COUNT(EmpId) AS
                            EC(DeptName, Num)
        FROM EMP
        GROUP BY DeptName)
    
    The output of executing the SQL query is _______.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  24. Think it through. Then check your answer.

    Question

    Consider the following CPU processes with arrival times (in milliseconds) and length of CPU bursts (in milliseconds) as given below :
    ProcessArrival timeBurst time
    P107
    P233
    P355
    P462
    If the pre-emptive shortest remaining time first scheduling algorithm is used to schedule the processes, then the average waiting time across all processes is _______ milliseconds.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  25. Think it through. Then check your answer.

    Question

    Consider a two-level cache hierarchy with L1 and L2 caches. An application incurs 1.4 memory accesses per instruction on average. For this application, the miss rate of L1 cache is 0.1; the L2 cache experiences, on average, 7 misses per 1000 instructions. The miss rate of L2 expressed correct to two decimal places is ________.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  26. Think it through. Then check your answer.

    Question

    Let G=(V,E)G = (V, E) be any connected undirected edge-weighted graph. The weights of the edges in EE are positive and distinct. Consider the following statements:
    (I) Minimum Spanning Tree of GG is always unique.
    (II) Shortest path between any two vertices of GG is always unique.
    Which of the above statements is/are necessarily true?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  27. Think it through. Then check your answer.

    Question

    A multithreaded program P executes with xx number of threads and uses yy number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e., if a thread holds a lock ll, then it cannot re-acquire lock ll without releasing it. If a thread is unable to acquire a lock, it blocks until the lock becomes available. The minimum value of xx and the minimum value of yy together for which execution of P can result in a deadlock are:
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  28. Think it through. Then check your answer.

    Question

    The value of limx1x72x5+1x33x2+2\lim_{x \to 1} \frac{x^7 - 2x^5 + 1}{x^3 - 3x^2 + 2}
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  29. Think it through. Then check your answer.

    Question

    Let p,q,p, q, and rr be propositions and the expression (pq)r(p \to q) \to r be a contradiction. Then, the expression (rp)q(r \to p) \to q is
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  30. Think it through. Then check your answer.

    Question

    Let uu and vv be two vectors in R2\mathbf{R}^2 whose Euclidean norms satisfy u=2v\|u\| = 2\|v\|. What is the value of α\alpha such that w=u+αvw = u + \alpha v bisects the angle between uu and vv?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  31. Think it through. Then check your answer.

    Question

    Let AA be n×nn \times n real valued square symmetric matrix of rank 2 with i=1nj=1nAij2=50\sum_{i=1}^{n} \sum_{j=1}^{n} A_{ij}^2 = 50. Consider the following statements.
    I. One eigenvalue must be in [5,5][-5, 5]
    II. The eigenvalue with the largest magnitude must be strictly greater than 5
    Which of the above statements about eigenvalues of AA is/are necessarily CORRECT?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  32. Think it through. Then check your answer.

    Question

    A computer network uses polynomials over GF(2)GF(2) for error checking with 8 bits as information bits and uses x3+x+1x^3 + x + 1 as the generator polynomial to generate the check bits. In this network, the message 01011011 is transmitted as
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  33. Think it through. Then check your answer.

    Question

    Consider a combination of T and D flip-flops connected as shown below. The output of the D flip-flop is connected to the input of the T flip-flop and the output of the T flip-flop is connected to the input of the D flip-flop.
    Initially, both Q0Q_0 and Q1Q_1 are set to 1 (before the 1st1^{st} clock cycle). The outputs
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  34. Think it through. Then check your answer.

    Question

    If GG is a grammar with productionsSSaSaSbbSaSSϵS \rightarrow SaS \mid aSb \mid bSa \mid SS \mid \epsilonwhere SS is the start variable, then which one of the following strings is not generated by GG?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  35. Think it through. Then check your answer.

    Question

    Consider the following two functions.
    void fun1(int n) {
        if(n == 0) return;
        printf("%d", n);
        fun2(n - 2);
        printf("%d", n);
    }
    
    void fun2(int n) {
        if(n == 0) return;
        printf("%d", n);
        fun1(++n);
        printf("%d", n);
    }
    
    The output printed when fun1(5) is called is
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  36. Think it through. Then check your answer.

    Question

    Consider the C functions foo and bar given below:
    int foo(int val) {
        int x = 0;
        while(val > 0) {
            x = x + foo(val--);
        }
        return val;
    }
    
    int bar(int val) {
        int x = 0;
        while(val > 0) {
            x = x + bar(val-1);
        }
        return val;
    }
    
    Invocations of foo(3) and bar(3) will result in :
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  37. Think it through. Then check your answer.

    Question

    Consider the context-free grammars over the alphabet {a,b,c}\{a, b, c\} given below. SS and TT are non-terminals.
    G1:SaSbT,TcTϵG_1: S \to aSb \mid T, T \to cT \mid \epsilon
    G2:SbSaT,TcTϵG_2: S \to bSa \mid T, T \to cT \mid \epsilon
    The language L(G1)L(G2)L(G_1) \cap L(G_2) is
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  38. Think it through. Then check your answer.

    Question

    Consider the following languages over the alphabet Σ={a,b,c}\Sigma = \{a, b, c\}.
    Let L1={anbncmm,n0}L_1 = \{ a^n b^n c^m \mid m, n \ge 0 \} and L2={ambncnm,n0}L_2 = \{ a^m b^n c^n \mid m, n \ge 0 \}.
    Which of the following are context-free languages?
    I. L1L2L_1 \cup L_2
    II. L1L2L_1 \cap L_2
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  39. Think it through. Then check your answer.

    Question

    Let AA and BB be finite alphabets and let #\# be a symbol outside both AA and BB. Let ff be a total function from AA^* to BB^*. We say ff is computable if there exists a Turing machine MM which given an input xx in AA^*, always halts with f(x)f(x) on its tape. Let LfL_f denote the language {x#f(x)xA}\{x \# f(x) \mid x \in A^*\}.
    Which of the following statements is true:
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  40. Think it through. Then check your answer.

    Question

    Recall that Belady's anomaly is that the page-fault rate may increase as the number of allocated frames increases. Now, consider the following statements:
    S1: Random page replacement algorithm (where a page chosen at random is replaced) suffers from Belady's anomaly
    S2: LRU page replacement algorithm suffers from Belady's anomaly
    Which of the following is CORRECT?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  41. Think it through. Then check your answer.

    Question

    Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus.
    (I) {tuEMP(t[EmpName]=u[EmpName]vDEPT(t[DeptId]v[DeptId]))}\{t \mid \exists u \in \text{EMP}(t[\text{EmpName}] = u[\text{EmpName}] \wedge \forall v \in \text{DEPT}(t[\text{DeptId}] \neq v[\text{DeptId}]))\}
    (II) {tuEMP(t[EmpName]=u[EmpName]vDEPT(t[DeptId]v[DeptId]))}\{t \mid \exists u \in \text{EMP}(t[\text{EmpName}] = u[\text{EmpName}] \wedge \exists v \in \text{DEPT}(t[\text{DeptId}] \neq v[\text{DeptId}]))\}
    (III) {tuEMP(t[EmpName]=u[EmpName]vDEPT(t[DeptId]=v[DeptId]))}\{t \mid \exists u \in \text{EMP}(t[\text{EmpName}] = u[\text{EmpName}] \wedge \exists v \in \text{DEPT}(t[\text{DeptId}] = v[\text{DeptId}]))\}Which of the above queries are safe?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  42. Think it through. Then check your answer.

    Question

    In a database system, unique timestamps are assigned to each transaction using Lamport's logical clock. Let TS(T1)TS(T_1) and TS(T2)TS(T_2) be the timestamps of transactions T1T_1 and T2T_2 respectively. Besides, T1T_1 holds a lock on the resource R, and T2T_2 has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
    if TS(T2)<TS(T1)TS(T_2) < TS(T_1) then
    T1T_1 is killed
    else T2T_2 waits.
    Assume any transaction that is not killed terminates eventually. Which of the following is TRUE about the database system that uses the above algorithm to prevent deadlocks?
    Your answer

    Choose one option, then check your answer.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  43. Think it through. Then check your answer.

    Question

    Consider the following grammar:
    stmt   -> if expr then expr else expr; stmt | ò
    expr   -> term relop term | term
    term   -> id | number
    id     -> a | b | c
    number -> [0-9]
    
    where relop is a relational operator (e.g., <, >, ...), ò refers to the empty statement, and if, then, else are terminals.
    Consider a program PP following the above grammar containing ten if terminals. The number of control flow paths in PP is _______. For example, the program
    if e1 then e2 else e3
    has 2 control flow paths, e1e2e_1 \to e_2 and e1e3e_1 \to e_3.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  44. Think it through. Then check your answer.

    Question

    In a RSA cryptosystem, a participant A uses two prime numbers p=13p = 13 and q=17q = 17 to generate her public and private keys. If the public key of A is 35, then the private key of A is _______.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  45. Think it through. Then check your answer.

    Question

    The values of parameters for the Stop-and-Wait ARQ protocol are as given below:
    Bit rate of the transmission channel = 1 Mbps.
    Propagation delay from sender to receiver = 0.75 ms.
    Time to process a frame = 0.25 ms.
    Number of bytes in the information frame = 1980.
    Number of bytes in the acknowledge frame = 20.
    Number of overhead bytes in the information frame = 20.
    Assume that there are no transmission errors. Then, the transmission efficiency (expressed in percentage) of the Stop-and-Wait ARQ protocol for the above parameters is ___________ (correct to 2 decimal places).
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  46. Think it through. Then check your answer.

    Question

    Consider a database that has the relation schema CR(StudentName, CourseName). An instance of the schema CR is as given below.
    StudentNameCourseName
    SACA
    SACB
    SACC
    SBCB
    SBCC
    SCCA
    SCCB
    SCCC
    SDCA
    SDCB
    SDCC
    SDCD
    SECD
    SECA
    SECB
    SFCA
    SFCB
    SFCC
    The following query is made on the database.T1πCourseName(σStudentName=SA(CR))T1 \leftarrow \pi_{CourseName}(\sigma_{StudentName='SA'}(CR))T2CR÷T1T2 \leftarrow CR \div T1The number of rows in T2T2 is ________.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  47. Think it through. Then check your answer.

    Question

    The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is ______.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  48. Think it through. Then check your answer.

    Question

    Let AA be an array of 31 numbers consisting of a sequence of 0's followed by a sequence of 1's. The problem is to find the smallest index ii such that A[i]A[i] is 1 by probing the minimum number of locations in AA. The worst case number of probes performed by an optimal algorithm is ______.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  49. Think it through. Then check your answer.

    Question

    Consider a RISC machine where each instruction is exactly 4 bytes long. Conditional and unconditional branch instructions use PC-relative addressing mode with Offset specified in bytes to the target location of the branch instruction. Further the Offset is always with respect to the address of the next instruction in the program sequence. Consider the following instruction sequence
    Instr. No.      Instruction
    i      :    add   R2, R3, R4
    i+1    :    sub   R5, R6, R7
    i+2    :    cmp   R1, R9, R10
    i+3    :    beq   R1, Offset
    
    If the target of the branch instruction is i, then the decimal value of the Offset is _______.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  50. Think it through. Then check your answer.

    Question

    Instruction execution in a processor is divided into 5 stages, Instruction Fetch (IF), Instruction Decode (ID), Operand Fetch (OF), Execute (EX), and Write Back (WB). These stages take 5, 4, 20, 10, and 3 nanoseconds (ns) respectively. A pipelined implementation of the processor requires buffering between each pair of consecutive stages with a delay of 2 ns. Two pipelined implementations of the processor are contemplated:
    (i) a naive pipeline implementation (NP) with 5 stages and
    (ii) an efficient pipeline (EP) where the OF stage is divided into stages OF1 and OF2 with execution times of 12 ns and 8 ns respectively.
    The speedup (correct to two decimal places) achieved by EP over NP in executing 20 independent instructions with no hazards is ________.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  51. Think it through. Then check your answer.

    Question

    Consider a 2-way set associative cache with 256 blocks and uses LRU replacement. Initially the cache is empty. Conflict misses are those misses which occur due to contention of multiple blocks for the same cache set. Compulsory misses occur due to first time access to the block. The following sequence of accesses to memory blocks
    (0, 128, 256, 128, 0, 128, 256, 128, 1, 129, 257, 129, 1, 129, 257, 129)
    is repeated 10 times. The number of conflict misses experienced by the cache is ________.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  52. Think it through. Then check your answer.

    Question

    Consider the expression (a1)(((b+c)/3)+d))(a-1)*(((b+c)/3)+d)). Let X be the minimum number of registers required by an optimal code generation (without any register spill) algorithm for a load/store architecture, in which (i) only load and store instructions can have memory operands and (ii) arithmetic instructions can have only register or immediate operands. The value of X is ________.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  53. Think it through. Then check your answer.

    Question

    Consider the following C program.
    #include <stdio.h>
    #include <string.h>
    
    void printlength(char *s, char *t) {
        unsigned int c = 0;
        int len = ((strlen(s) - strlen(t)) > c) ? strlen(s) : strlen(t);
        printf("%d\n", len);
    }
    
    void main() {
        char *x = "abc";
        char *y = "defgh";
        printlength(x, y);
    }
    
    Recall that strlen is defined in string.h as returning a value of type size_t, which is an unsigned int. The output of the program is ________.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  54. Think it through. Then check your answer.

    Question

    A cache memory unit with capacity of NN words and block size of BB words is to be designed. If it is designed as a direct mapped cache, the length of the TAG field is 10 bits. If the cache unit is now designed as a 16-way set-associative cache, the length of the TAG field is ________ bits.
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page
  55. Think it through. Then check your answer.

    Question

    The output of executing the following C program is __________.
    #include <stdio.h>
    
    int total(int v) {
        static int count = 0;
        while(v) {
            count += v&1;
            v >>= 1;
        }
        return count;
    }
    
    void main() {
        static int x = 0;
        int i = 5;
        for(; i > 0; i--) {
            x = x + total(i);
        }
        printf("%d\n", x);
    }
    
    Your answer

    Enter a number. Decimals, negative values and scientific notation are accepted.

    Restoring your progress…

    The solution stays hidden until you check.
    Open question page