IAE Academy

PAPERS · GATE CS

GATE CSE 2018 question paper with solutions

All 65 questions of the GATE 2018 Computer Science and Information Technology paper, in order, with the official answer key from IIT Guwahati.

This paper numbers General Aptitude GA Q.1 to GA Q.10 and the subject questions Q.1 to Q.55: 65 questions in all.

Download the solved paper (PDF, 1.8 MB)
questions · 100 marks
65questions · 100 marks
official answer key
IIT Guwahatiofficial answer key
question types
41 MCQ · 24 NATquestion types

GATE CSE 2018 answer key

Official answers to every question of GATE CSE 2018
QuestionTypeMarksAnswer
GA Q.1MCQ1B
GA Q.2MCQ1A
GA Q.3MCQ1D
GA Q.4MCQ1C
GA Q.5MCQ1B
GA Q.6MCQ2B
GA Q.7MCQ2C
GA Q.8MCQ2B
GA Q.9MCQ2A
GA Q.10MCQ2C
Q.1MCQ1D
Q.2MCQ1A
Q.3MCQ1B
Q.4MCQ1D
Q.5MCQ1D
Q.6MCQ1D
Q.7MCQ1B
Q.8MCQ1B
Q.9MCQ1A
Q.10MCQ1B
Q.11MCQ1A
Q.12MCQ1D
Q.13MCQ1C
Q.14MCQ1C
Q.15NAT10.021 to 0.024
Q.16NAT10.27 to 0.30
Q.17NAT13
Q.18NAT13
Q.19NAT142
Q.20NAT14
Q.21NAT14
Q.22NAT12
Q.23NAT159.0 to 60.0
Q.24NAT12
Q.25NAT134 to 35
Q.26MCQ2D
Q.27MCQ2D
Q.28MCQ2A
Q.29MCQ2A
Q.30MCQ2A
Q.31MCQ2C
Q.32MCQ2B
Q.33MCQ2C
Q.34MCQ2B
Q.35MCQ2B
Q.36MCQ2D
Q.37MCQ2D
Q.38MCQ2A
Q.39MCQ2A
Q.40MCQ2C
Q.41MCQ2C
Q.42MCQ2B
Q.43NAT2109
Q.44NAT20.60 to 0.62
Q.45NAT210230
Q.46NAT280
Q.47NAT24
Q.48NAT216
Q.49NAT23
Q.50NAT2219
Q.51NAT232
Q.52NAT22
Q.53NAT285
Q.54NAT2144
Q.55NAT250

General Aptitude GA Q.1 to Q.10

  1. GA Q.1MCQ · 1 mark

    “From where are they bringing their books? ________ bringing _______ books from ______.”

    The words that best fill the blanks in the above sentence are

    1. (A)

      Their, they’re, there

    2. (B)

      They’re, their, there

    3. (C)

      There, their, they’re

    4. (D)

      They’re, there, there

    Official answer: B

  2. GA Q.2MCQ · 1 mark

    “A ______ investigation can sometimes yield new facts, but typically organized ones are more successful.”

    The word that best fills the blank in the above sentence is

    1. (A)

      meandering

    2. (B)

      timely

    3. (C)

      consistent

    4. (D)

      systematic

    Official answer: A

  3. GA Q.3MCQ · 1 mark

    The area of a square is . What is the area of the circle which has the diagonal of the square as its diameter?

    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: D

  4. GA Q.4MCQ · 1 mark

    What would be the smallest natural number which when divided either by 20 or by 42 or by 76 leaves a remainder of 7 in each case?

    1. (A)

      3047

    2. (B)

      6047

    3. (C)

      7987

    4. (D)

      63847

    Official answer: C

  5. GA Q.5MCQ · 1 mark

    What is the missing number in the following sequence?

    2, 12, 60, 240, 720, 1440, ______, 0

    1. (A)

      2880

    2. (B)

      1440

    3. (C)

      720

    4. (D)

      0

    Official answer: B

  6. GA Q.6MCQ · 2 marks

    In appreciation of the social improvements completed in a town, a wealthy philanthropist decided to gift Rs 750 to each male senior citizen in the town and Rs 1000 to each female senior citizen. Altogether, there were 300 senior citizens eligible for this gift. However, only 8/9th of the eligible men and 2/3rd of the eligible women claimed the gift. How much money (in Rupees) did the philanthropist give away in total?

    1. (A)

      1,50,000

    2. (B)

      2,00,000

    3. (C)

      1,75,000

    4. (D)

      1,51,000

    Official answer: B

  7. GA Q.7MCQ · 2 marks

    If and , , , what is the value of the product ?

    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: C

  8. GA Q.8MCQ · 2 marks

    In a party, 60% of the invited guests are male and 40% are female. If 80% of the invited guests attended the party and if all the invited female guests attended, what would be the ratio of males to females among the attendees in the party?

    1. (A)

      2:3

    2. (B)

      1:1

    3. (C)

      3:2

    4. (D)

      2:1

    Official answer: B

  9. GA Q.9MCQ · 2 marks

    In the figure below, is equal to ______ .

    GATE CSE 2018 GA Q.9 as printed in the question paper, with its figureTap to open full size
    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: A

  10. GA Q.10MCQ · 2 marks

    A six sided unbiased die with four green faces and two red faces is rolled seven times. Which of the following combinations is the most likely outcome of the experiment?

    1. (A)

      Three green faces and four red faces.

    2. (B)

      Four green faces and three red faces.

    3. (C)

      Five green faces and two red faces.

    4. (D)

      Six green faces and one red face.

    Official answer: C

Computer Science and Information Technology Q.1 to Q.55

  1. Q.1MCQ · 1 mark

    Which one of the following is a closed form expression for the generating function of the sequence , where for all ?

    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: D

  2. Q.2MCQ · 1 mark

    Consider the following C program.

    #include<stdio.h>
    struct Ournode{
        char x,y,z;
    };
    
    int main(){
        struct Ournode p = {'1', '0', 'a'+2};
        struct Ournode *q = &p;
        printf ("%c, %c", *((char*)q+1), *((char*)q+2));
        return 0;
    }

    The output of this program is:

    1. (A)

      0, c

    2. (B)

      0, a+2

    3. (C)

      '0', 'a+2'

    4. (D)

      '0', 'c'

    Official answer: A

  3. Q.3MCQ · 1 mark

    A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let denote the number of nodes in the queue. Let enqueue be implemented by inserting a new node at the head, and dequeue be implemented by deletion of a node from the tail.

    [Figure: a singly linked list of nodes drawn left to right, each node a two-cell box with a right-pointing arrow to the next node. The first (leftmost) node is labelled by an upward arrow from the word "head". A row of dots indicates further nodes in between. The last (rightmost) node is labelled by an upward arrow from the word "tail", and its next-pointer cell points to a ground symbol (null terminator).]

    Which one of the following is the time complexity of the most time-efficient implementation of enqueue and dequeue, respectively, for this data structure?

    GATE CSE 2018 Q.3 as printed in the question paper, with its figureTap to open full size
    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: B

  4. Q.4MCQ · 1 mark

    Let and denote the Exclusive OR and Exclusive NOR operations, respectively. Which one of the following is NOT CORRECT?

    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: D

  5. Q.5MCQ · 1 mark

    Consider the following processor design characteristics.

    I. Register-to-register arithmetic operations only
    II. Fixed-length instruction format
    III. Hardwired control unit

    Which of the characteristics above are used in the design of a RISC processor?

    1. (A)

      I and II only

    2. (B)

      II and III only

    3. (C)

      I and III only

    4. (D)

      I, II and III

    Official answer: D

  6. Q.6MCQ · 1 mark

    Let be an NFA with states. Let be the number of states of a minimal DFA which is equivalent to . Which one of the following is necessarily true?

    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: D

  7. Q.7MCQ · 1 mark

    The set of all recursively enumerable languages is

    1. (A)

      closed under complementation.

    2. (B)

      closed under intersection.

    3. (C)

      a subset of the set of all recursive languages.

    4. (D)

      an uncountable set.

    Official answer: B

  8. Q.8MCQ · 1 mark

    Which one of the following statements is FALSE?

    1. (A)

      Context-free grammar can be used to specify both lexical and syntax rules.

    2. (B)

      Type checking is done before parsing.

    3. (C)

      High-level language programs can be translated to different Intermediate Representations.

    4. (D)

      Arguments to a function can be passed using the program stack.

    Official answer: B

  9. Q.9MCQ · 1 mark

    The following are some events that occur after a device controller issues an interrupt while process is under execution.

    (P) The processor pushes the process status of onto the control stack.
    (Q) The processor finishes the execution of the current instruction.
    (R) The processor executes the interrupt service routine.
    (S) The processor pops the process status of from the control stack.
    (T) The processor loads the new PC value based on the interrupt.

    Which one of the following is the correct order in which the events above occur?

    1. (A)

      QPTRS

    2. (B)

      PTRSQ

    3. (C)

      TRPQS

    4. (D)

      QTPRS

    Official answer: A

  10. Q.10MCQ · 1 mark

    Consider a process executing on an operating system that uses demand paging. The average time for a memory access in the system is M units if the corresponding memory page is available in memory, and D units if the memory access causes a page fault. It has been experimentally measured that the average time taken for a memory access in the process is X units.

    Which one of the following is the correct expression for the page fault rate experienced by the process?

    1. (A)

      (D - M) / (X - M)

    2. (B)

      (X - M) / (D - M)

    3. (C)

      (D - X) / (D - M)

    4. (D)

      (X - M) / (D - X)

    Official answer: B

  11. Q.11MCQ · 1 mark

    In an Entity-Relationship (ER) model, suppose is a many-to-one relationship from entity set E1 to entity set E2. Assume that E1 and E2 participate totally in and that the cardinality of E1 is greater than the cardinality of E2.

    Which one of the following is true about ?

    1. (A)

      Every entity in E1 is associated with exactly one entity in E2.

    2. (B)

      Some entity in E1 is associated with more than one entity in E2.

    3. (C)

      Every entity in E2 is associated with exactly one entity in E1.

    4. (D)

      Every entity in E2 is associated with at most one entity in E1.

    Official answer: A

  12. Q.12MCQ · 1 mark

    Consider the following two tables and four queries in SQL.

    Book (, bname), Stock (, copies)

    Query 1: SELECT B.isbn, S.copies
    FROM Book B INNER JOIN Stock S
    ON B.isbn = S.isbn;
    
    Query 2: SELECT B.isbn, S.copies
    FROM Book B LEFT OUTER JOIN Stock S
    ON B.isbn = S.isbn;
    
    Query 3: SELECT B.isbn, S.copies
    FROM Book B RIGHT OUTER JOIN Stock S
    ON B.isbn = S.isbn;
    
    Query 4: SELECT B.isbn, S.copies
    FROM Book B FULL OUTER JOIN Stock S
    ON B.isbn = S.isbn;

    Which one of the queries above is certain to have an output that is a superset of the outputs of the other three queries?

    1. (A)

      Query 1

    2. (B)

      Query 2

    3. (C)

      Query 3

    4. (D)

      Query 4

    Official answer: D

  13. Q.13MCQ · 1 mark

    Match the following:

    1. (A)

      P-III, Q-IV, R-II, S-I

    2. (B)

      P-II, Q-I, R-IV, S-III

    3. (C)

      P-IV, Q-I, R-II, S-III

    4. (D)

      P-IV, Q-I, R-III, S-II

    Official answer: C

  14. Q.14MCQ · 1 mark

    Consider the following statements regarding the slow start phase of the TCP congestion control algorithm. Note that cwnd stands for the TCP congestion window and MSS denotes the Maximum Segment Size.

    (i) The cwnd increases by 2 MSS on every successful acknowledgment.
    (ii) The cwnd approximately doubles on every successful acknowledgement.
    (iii) The cwnd increases by 1 MSS every round trip time.
    (iv) The cwnd approximately doubles every round trip time.

    Which one of the following is correct?

    1. (A)

      Only (ii) and (iii) are true

    2. (B)

      Only (i) and (iii) are true

    3. (C)

      Only (iv) is true

    4. (D)

      Only (i) and (iv) are true

    Official answer: C

  15. Q.15NAT · 1 mark

    Two people, P and Q, decide to independently roll two identical dice, each with 6 faces, numbered 1 to 6. The person with the lower number wins. In case of a tie, they roll the dice repeatedly until there is no tie. Define a trial as a throw of the dice by P and Q. Assume that all 6 numbers on each dice are equi-probable and that all trials are independent. The probability (rounded to 3 decimal places) that one of them wins on the third trial is _____.

    Official answer: 0.021 to 0.024

  16. Q.16NAT · 1 mark

    The value of correct to three decimal places (assuming that ) is ______.

    Official answer: 0.27 to 0.30

  17. Q.17NAT · 1 mark

    Consider a matrix where , . Note that denotes the transpose of . The largest eigenvalue of is ______.

    Official answer: 3

  18. Q.18NAT · 1 mark

    The chromatic number of the following graph is ________.

    GATE CSE 2018 Q.18 as printed in the question paper, with its figureTap to open full size

    Official answer: 3

  19. Q.19NAT · 1 mark

    Let be a finite group on 84 elements. The size of a largest possible proper subgroup of is ______.

    Official answer: 42

  20. Q.20NAT · 1 mark

    The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The inorder traversal of the same tree is 8,6,9,4,7,2,5,1,3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is ______.

    Official answer: 4

  21. Q.21NAT · 1 mark

    Consider the following C program:

    #include <stdio.h>
    
    int counter = 0;
    
    int calc (int a, int b) {
        int c;
    
        counter++;
        if (b==3) return (a*a*a);
        else {
            c = calc(a, b/3);
            return (c*c*c);
        }
    }
    
    int main (){
        calc(4, 81);
        printf ("%d", counter);
    }

    The output of this program is _____.

    Official answer: 4

  22. Q.22NAT · 1 mark

    Consider the sequential circuit shown in the figure, where both flip-flops used are positive edge-triggered D flip-flops. The number of states in the state transition diagram of this circuit that have a transition back to the same state on some value of "in" is ______.

    GATE CSE 2018 Q.22 as printed in the question paper, with its figureTap to open full size

    Official answer: 2

  23. Q.23NAT · 1 mark

    A 32-bit wide main memory unit with a capacity of 1 GB is built using 256M × 4-bit DRAM chips. The number of rows of memory cells in the DRAM chip is . The time taken to perform one refresh operation is 50 nanoseconds. The refresh period is 2 milliseconds. The percentage (rounded to the closest integer) of the time available for performing the memory read/write operations in the main memory unit is ____________.

    Official answer: 59.0 to 60.0

  24. Q.24NAT · 1 mark

    Consider a system with 3 processes that share 4 instances of the same resource type. Each process can request a maximum of instances. Resource instances can be requested and released only one at a time. The largest value of that will always avoid deadlock is ____.

    Official answer: 2

  25. Q.25NAT · 1 mark

    Consider a long-lived TCP session with an end-to-end bandwidth of 1 Gbps (= bits-per-second). The session starts with a sequence number of 1234. The minimum time (in seconds, rounded to the closest integer) before this sequence number can be used again is ______.

    Official answer: 34 to 35

  26. Q.26MCQ · 2 marks

    Consider a matrix whose only eigenvectors are the multiples of .

    Consider the following statements.

    (I) does not have an inverse
    (II) has a repeated eigenvalue
    (III) cannot be diagonalized

    Which one of the following options is correct?

    1. (A)

      Only I and III are necessarily true

    2. (B)

      Only II is necessarily true

    3. (C)

      Only I and II are necessarily true

    4. (D)

      Only II and III are necessarily true

    Official answer: D

  27. Q.27MCQ · 2 marks

    Let be the set of natural numbers. Consider the following sets.

    : Set of Rational numbers (positive and negative)
    : Set of functions from to
    : Set of functions from to
    : Set of finite subsets of .

    Which of the sets above are countable?

    1. (A)

      and only

    2. (B)

      and only

    3. (C)

      and only

    4. (D)

      , and only

    Official answer: D

  28. Q.28MCQ · 2 marks

    Consider the first-order logic sentence , where is a quantifier-free first-order logic formula using only predicate symbols, and possibly equality, but no function symbols. Suppose has a model with a universe containing 7 elements. Which one of the following statements is necessarily true?

    1. (A)

      There exists at least one model of with universe of size less than or equal to 3.

    2. (B)

      There exists no model of with universe of size less than or equal to 3.

    3. (C)

      There exists no model of with universe of size greater than 7.

    4. (D)

      Every model of has a universe of size equal to 7.

    Official answer: A

  29. Q.29MCQ · 2 marks

    Consider the following C program:

    #include<stdio.h>
    
    void fun1(char *s1, char *s2){
    	char *tmp;
    	tmp = s1;
    	s1 = s2;
    	s2 = tmp;
    }
    void fun2(char **s1, char **s2){
    	char *tmp;
    	tmp = *s1;
    	*s1 = *s2;
    	*s2 = tmp;
    }
    int main(){
    	char *str1 = "Hi", *str2 = "Bye";
    	fun1(str1, str2);  printf("%s %s ", str1, str2);
    	fun2(&str1, &str2); printf("%s %s", str1, str2);
    	return 0;
    }

    The output of the program above is

    1. (A)

      Hi Bye Bye Hi

    2. (B)

      Hi Bye Hi Bye

    3. (C)

      Bye Hi Hi Bye

    4. (D)

      Bye Hi Bye Hi

    Official answer: A

  30. Q.30MCQ · 2 marks

    Let be a simple undirected graph. Let be a depth first search tree of . Let be a breadth first search tree of . Consider the following statements.

    (I) No edge of is a cross edge with respect to . (A cross edge in is between two nodes neither of which is an ancestor of the other in .)

    (II) For every edge of , if is at depth and is at depth in , then .

    Which of the statements above must necessarily be true?

    1. (A)

      I only

    2. (B)

      II only

    3. (C)

      Both I and II

    4. (D)

      Neither I nor II

    Official answer: A

  31. Q.31MCQ · 2 marks

    Assume that multiplying a matrix of dimension with another matrix of dimension requires scalar multiplications. Computing the product of matrices can be done by parenthesizing in different ways. Define as an explicitly computed pair for a given paranthesization if they are directly multiplied. For example, in the matrix multiplication chain using parenthesization , and are the only explicitly computed pairs.

    Consider a matrix multiplication chain , where matrices and are of dimensions , , , and , respectively. In the parenthesization of that minimizes the total number of scalar multiplications, the explicitly computed pairs is/are

    1. (A)

      F1F2 and F3F4 only

    2. (B)

      F2F3 only

    3. (C)

      F3F4 only

    4. (D)

      F1F2 and F4F5 only

    Official answer: C

  32. Q.32MCQ · 2 marks

    Consider the following C code. Assume that unsigned long int type length is 64 bits.

    unsigned long int fun(unsigned long int n){
        unsigned long int i, j = 0, sum = 0;
        for (i = n; i > 1; i = i/2) j++;
        for ( ; j > 1; j = j/2) sum++;
        return(sum);
    }

    The value returned when we call fun with the input is

    1. (A)

      4

    2. (B)

      5

    3. (C)

      6

    4. (D)

      40

    Official answer: B

  33. Q.33MCQ · 2 marks

    Consider the unsigned 8-bit fixed point binary number representation below,

    where the position of the binary point is between and . Assume is the most significant bit. Some of the decimal numbers listed below cannot be represented exactly in the above representation:

    (i) 31.500 (ii) 0.875 (iii) 12.100 (iv) 3.001

    Which one of the following statements is true?

    1. (A)

      None of (i), (ii), (iii), (iv) can be exactly represented

    2. (B)

      Only (ii) cannot be exactly represented

    3. (C)

      Only (iii) and (iv) cannot be exactly represented

    4. (D)

      Only (i) and (ii) cannot be exactly represented

    Official answer: C

  34. Q.34MCQ · 2 marks

    The size of the physical address space of a processor is bytes. The word length is bytes. The capacity of cache memory is bytes. The size of each cache block is words. For a -way set-associative cache memory, the length (in number of bits) of the tag field is

    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: B

  35. Q.35MCQ · 2 marks

    Consider the following languages:
    I.
    II.
    III.
    IV.
    Which of the languages above are context-free?

    1. (A)

      I and IV only

    2. (B)

      I and II only

    3. (C)

      II and III only

    4. (D)

      II and IV only

    Official answer: B

  36. Q.36MCQ · 2 marks

    Consider the following problems. denotes the language generated by a grammar . denotes the language accepted by a machine .

    (I) For an unrestricted grammar and a string , whether
    (II) Given a Turing machine , whether is regular
    (III) Given two grammars and , whether
    (IV) Given an NFA , whether there is a deterministic PDA such that and accept the same language.

    Which one of the following statements is correct?

    1. (A)

      Only I and II are undecidable

    2. (B)

      Only III is undecidable

    3. (C)

      Only II and IV are undecidable

    4. (D)

      Only I, II and III are undecidable

    Official answer: D

  37. Q.37MCQ · 2 marks

    A lexical analyzer uses the following patterns to recognize three tokens , , and over the alphabet .

    : a? (b|c)* a
    : b? (a|c)* b
    : c? (b|a)* c

    Note that 'x?' means 0 or 1 occurrence of the symbol x. Note also that the analyzer outputs the token that matches the longest possible prefix.

    If the string bbaacabc is processed by the analyzer, which one of the following is the sequence of tokens it outputs?

    1. (A)

    2. (B)

    3. (C)

    4. (D)

    Official answer: D

  38. Q.38MCQ · 2 marks

    Consider the following parse tree for the expression a#b$c$d#e#f, involving two binary operators $ and #.

    Which one of the following is correct for the given parse tree?

    GATE CSE 2018 Q.38 as printed in the question paper, with its figureTap to open full size
    1. (A)

      $ has higher precedence and is left associative; # is right associative

    2. (B)

      # has higher precedence and is left associative; $ is right associative

    3. (C)

      $ has higher precedence and is left associative; # is left associative

    4. (D)

      # has higher precedence and is right associative; $ is left associative

    Official answer: A

  39. Q.39MCQ · 2 marks

    In a system, there are three types of resources: , and . Four processes and execute concurrently. At the outset, the processes have declared their maximum resource requirements using a matrix named Max as given below. For example, is the maximum number of instances of that would require. The number of instances of the resources allocated to the various processes at any given state is given by a matrix named Allocation.

    Consider a state of the system with the Allocation matrix as shown below, and in which 3 instances of and 3 instances of are the only resources available.

    Allocation:

    Max:

    From the perspective of deadlock avoidance, which one of the following is true?

    GATE CSE 2018 Q.39 as printed in the question paper, with its figureTap to open full size
    1. (A)

      The system is in safe state.

    2. (B)

      The system is not in safe state, but would be safe if one more instance of were available

    3. (C)

      The system is not in safe state, but would be safe if one more instance of were available

    4. (D)

      The system is not in safe state, but would be safe if one more instance of were available

    Official answer: A

  40. Q.40MCQ · 2 marks

    Consider the following solution to the producer-consumer synchronization problem. The shared buffer size is . Three semaphores , and mutex are defined with respective initial values of 0, and 1. Semaphore denotes the number of available slots in the buffer, for the consumer to read from. Semaphore denotes the number of available slots in the buffer, for the producer to write to. The placeholder variables, denoted by P, Q, R, and S, in the code below can be assigned either or . The valid semaphore operations are: wait() and signal().

    Producer:

    do{
        wait(P);
        wait(mutex);
        //Add item to buffer
        signal(mutex);
        signal(Q);
    }while(1);

    Consumer:

    do{
        wait(R);
        wait(mutex);
        //Consume item from buffer
        signal(mutex);
        signal(S);
    }while(1);

    Which one of the following assignments to P, Q, R and S will yield the correct solution?

    1. (A)

      P: full, Q: full, R: empty, S: empty

    2. (B)

      P: empty, Q: empty, R: full, S: full

    3. (C)

      P: full, Q: empty, R: empty, S: full

    4. (D)

      P: empty, Q: full, R: full, S: empty

    Official answer: C

  41. Q.41MCQ · 2 marks

    Consider the relations r(A, B) and s(B, C), where s.B is a primary key and r.B is a foreign key referencing s.B. Consider the query

    Q: r ⋈ (σ_{B<5}(s))

    Let LOJ denote the natural left outer-join operation. Assume that r and s contain no null values.

    Which one of the following queries is NOT equivalent to Q?

    1. (A)

      σ_{B<5}(r ⋈ s)

    2. (B)

      σ_{B<5}(r LOJ s)

    3. (C)

      r LOJ (σ_{B<5}(s))

    4. (D)

      σ_{B<5}(r) LOJ s

    Official answer: C

  42. Q.42MCQ · 2 marks

    Consider the following four relational schemas. For each schema, all non-trivial functional dependencies are listed. The underlined attributes are the respective primary keys.

    Schema I: Registration(rollno, courses). Primary key: rollno. Field 'courses' is a set-valued attribute containing the set of courses a student has registered for. Non-trivial FD: rollno -> courses.

    Schema II: Registration(rollno, courseid, email). Primary key: (rollno, courseid). Non-trivial FDs: rollno, courseid -> email; email -> rollno.

    Schema III: Registration(rollno, courseid, marks, grade). Primary key: (rollno, courseid). Non-trivial FDs: rollno, courseid -> marks, grade; marks -> grade.

    Schema IV: Registration(rollno, courseid, credit). Primary key: (rollno, courseid). Non-trivial FDs: rollno, courseid -> credit; courseid -> credit.

    Which one of the relational schemas above is in 3NF but not in BCNF?

    1. (A)

      Schema I

    2. (B)

      Schema II

    3. (C)

      Schema III

    4. (D)

      Schema IV

    Official answer: B

  43. Q.43NAT · 2 marks

    Let be a graph with vertices, with each vertex labelled by a distinct permutation of the numbers . There is an edge between vertices and if and only if the label of can be obtained by swapping two adjacent numbers in the label of . Let denote the degree of a vertex in , and denote the number of connected components in . Then, ______.

    Official answer: 109

  44. Q.44NAT · 2 marks

    Consider Guwahati (G) and Delhi (D) whose temperatures can be classified as high (H), medium (M) and low (L). Let P(H_G) denote the probability that Guwahati has high temperature. Similarly, P(M_G) and P(L_G) denote the probability of Guwahati having medium and low temperatures respectively. Similarly, we use P(H_D), P(M_D) and P(L_D) for Delhi.

    The following table gives the conditional probabilities for Delhi's temperature given Guwahati's temperature.

    Consider the first row in the table above. The first entry denotes that if Guwahati has high temperature (H_G) then the probability of Delhi also having a high temperature (H_D) is 0.40; i.e., P(H_D | H_G) = 0.40. Similarly, the next two entries are P(M_D | H_G) = 0.48 and P(L_D | H_G) = 0.12. Similarly for the other rows.

    If it is known that P(H_G) = 0.2, P(M_G) = 0.5, and P(L_G) = 0.3, then the probability (correct to two decimal places) that Guwahati has high temperature given that Delhi has high temperature is ________.

    Official answer: 0.60 to 0.62

  45. Q.45NAT · 2 marks

    Consider the following program written in pseudo-code. Assume that x and y are integers.

    Count(x,y) {
        if (y != 1) {
            if (x != 1) {
                print("*");
                Count(x/2, y);
            }
            else {
                y = y-1;
                Count(1024, y);
            }
        }
    }

    The number of times that the print statement is executed by the call Count(1024,1024) is _____.

    Official answer: 10230

  46. Q.46NAT · 2 marks

    The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is ____.

    Official answer: 80

  47. Q.47NAT · 2 marks

    Consider the following undirected graph G. Choose a value for x that will maximize the number of minimum weight spanning trees (MWSTs) of G. The number of MWSTs of G for this value of x is ______.

    GATE CSE 2018 Q.47 as printed in the question paper, with its figureTap to open full size

    Official answer: 4

  48. Q.48NAT · 2 marks

    Consider the weights and values of items listed below. Note that there is only one unit of each item.

    Item numberWeight (in Kgs)Value (in Rupees)
    11060
    2728
    3420
    4224

    The task is to pick a subset of these items such that their total weight is no more than 11 Kgs and their total value is maximized. Moreover, no item may be split. The total value of items picked by an optimal algorithm is denoted by . A greedy algorithm sorts the items by their value-to-weight ratios in descending order and packs them greedily, starting from the first item in the ordered list. The total value of items picked by the greedy algorithm is denoted by .

    The value of is ____________.

    Official answer: 16

  49. Q.49NAT · 2 marks

    Consider the minterm list form of a Boolean function given below.

    Here, denotes a minterm and denotes a don't care term. The number of essential prime implicants of the function is ______.

    Official answer: 3

  50. Q.50NAT · 2 marks

    The instruction pipeline of a RISC processor has the following stages: Instruction Fetch (IF), Instruction Decode (ID), Operand Fetch (OF), Perform Operation (PO) and Writeback (WB). The IF, ID, OF and WB stages take 1 clock cycle each for every instruction. Consider a sequence of 100 instructions. In the PO stage, 40 instructions take 3 clock cycles each, 35 instructions take 2 clock cycles each, and the remaining 25 instructions take 1 clock cycle each. Assume that there are no data hazards and no control hazards.

    The number of clock cycles required for completion of execution of the sequence of instructions is ______.

    Official answer: 219

  51. Q.51NAT · 2 marks

    A processor has 16 integer registers (R0, R1, .. , R15) and 64 floating point registers (F0, F1,… , F63). It uses a 2-byte instruction format. There are four categories of instructions: Type-1, Type-2, Type-3, and Type-4. Type-1 category consists of four instructions, each with 3 integer register operands (3Rs). Type-2 category consists of eight instructions, each with 2 floating point register operands (2Fs). Type-3 category consists of fourteen instructions, each with one integer register operand and one floating point register operand (1R+1F). Type-4 category consists of N instructions, each with a floating point register operand (1F).

    The maximum value of N is ______.

    Official answer: 32

  52. Q.52NAT · 2 marks

    Given a language , define as follows:


    The order of a language is defined as the smallest such that . Consider the language (over alphabet 0) accepted by the following automaton. The order of is ______.

    GATE CSE 2018 Q.52 as printed in the question paper, with its figureTap to open full size

    Official answer: 2

  53. Q.53NAT · 2 marks

    Consider a storage disk with 4 platters (numbered as 0, 1, 2 and 3), 200 cylinders (numbered as 0, 1, ... , 199), and 256 sectors per track (numbered as 0, 1, ... , 255). The following 6 disk requests of the form [sector number, cylinder number, platter number] are received by the disk controller at the same time:

    [120, 72, 2], [180, 134, 1], [60, 20, 0], [212, 86, 3], [56, 116, 2], [118, 16, 1]

    Currently the head is positioned at sector number 100 of cylinder 80, and is moving towards higher cylinder numbers. The average power dissipation in moving the head over 100 cylinders is 20 milliwatts and for reversing the direction of the head movement once is 15 milliwatts. Power dissipation associated with rotational latency and switching of head between different platters is negligible.

    The total power consumption in milliwatts to satisfy all of the above disk requests using the Shortest Seek Time First disk scheduling algorithm is ______.

    Official answer: 85

  54. Q.54NAT · 2 marks

    Consider an IP packet with a length of 4,500 bytes that includes a 20-byte IPv4 header and a 40-byte TCP header. The packet is forwarded to an IPv4 router that supports a Maximum Transmission Unit (MTU) of 600 bytes. Assume that the length of the IP header in all the outgoing fragments of this packet is 20 bytes. Assume that the fragmentation offset value stored in the first fragment is 0.

    The fragmentation offset value stored in the third fragment is ________.

    Official answer: 144

  55. Q.55NAT · 2 marks

    Consider a simple communication system where multiple nodes are connected by a shared broadcast medium (like Ethernet or wireless). The nodes in the system use the following carrier-sense based medium access protocol. A node that receives a packet to transmit will carrier-sense the medium for 5 units of time. If the node does not detect any other transmission in this duration, it starts transmitting its packet in the next time unit. If the node detects another transmission, it waits until this other transmission finishes, and then begins to carrier-sense for 5 time units again. Once they start to transmit, nodes do not perform any collision detection and continue transmission even if a collision occurs. All transmissions last for 20 units of time. Assume that the transmission signal travels at the speed of 10 meters per unit time in the medium.

    Assume that the system has two nodes P and Q, located at a distance d meters from each other. P starts transmitting a packet at time t=0 after successfully completing its carrier-sense phase. Node Q has a packet to transmit at time t=0 and begins to carrier-sense the medium.

    The maximum distance d (in meters, rounded to the closest integer) that allows Q to successfully avoid a collision between its proposed transmission and P's ongoing transmission is ______.

    Official answer: 50