GATE CSE 2023 — Previous Year Questions

Real questions from the 2023 paper with options and answers. Take a timed test →

WhatsApp

23 questions

  1. Q1 · Computer Science & IT

    Which one of the following sequences when stored in an array at locations A[1],...,A[10] forms a max-heap?
    • A.23, 17, 10, 6, 13, 14, 1, 5, 7, 12
    • B.23, 17, 14, 7, 13, 10, 1, 5, 6, 12
    • C.23, 17, 14, 6, 13, 10, 1, 5, 7, 15
    • D.23, 14, 17, 1, 10, 13, 16, 12, 7, 5 CS Page 2 of 83
    Show answer / उत्तर देखें

    Answer: B 23, 17, 14, 7, 13, 10, 1, 5, 6, 12

    Official GATE 2023 answer key: (B).
  2. Q2 · Computer Science & IT

    Let SLLdel be a function that deletes a node in a singly-linked list given a pointer to the node and a pointer to the head of the list. Similarly, let DLLdel be another function that deletes a node in a doubly-linked list given a pointer to the node and a pointer to the head of the list. Let n denote the number of nodes in each of the linked lists. Which one of the following choices is TRUE about the worst-case time complexity of SLLdel and DLLdel?
    • A.SLLdel is O(1) and DLLdel is O(n)
    • B.Both SLLdel and DLLdel are O(log(n))
    • C.Both SLLdel and DLLdel are O(1)
    • D.SLLdel is O(n)andDLLdel is O(1) CS Page 3 of 83
    Show answer / उत्तर देखें

    Answer: B Both SLLdel and DLLdel are O(log(n))

    Official GATE 2023 answer key: (B).
  3. Q3 · Computer Science & IT

    The Lucas sequence Ln is defined by the recurrence relation: Ln = Ln−1 +Ln−2, for n ≥ 3, with L1 =1andL2 =3. Which one of the options given is TRUE?
    • A.Ln = ( 1+ √ 5 2 )n + ( 1− √ 5 2 )n
    • B.Ln = ( 1+ √ 5 2 )n − ( 1− √ 5 3 )n
    • C.Ln = ( 1+ √ 5 2 )n + ( 1− √ 5 3 )n
    • D.Ln = ( 1+ √ 5 2 )n − ( 1− √ 5 2 )n CS Page 5 of 83
    Show answer / उत्तर देखें

    Answer: C Ln = ( 1+ √ 5 2 )n + ( 1− √ 5 3 )n

    Official GATE 2023 answer key: (C).
  4. Q4 · Computer Science & IT

    Suppose two hosts are connected by a point-to-point link and they are configured to use Stop-and-Wait protocol for reliable data transfer. Identify in which one of the following scenarios, the utilization of the link is the lowest.
    • A.Longer link length and lower transmission rate
    • B.Longer link length and higher transmission rate
    • C.Shorter link length and lower transmission rate
    • D.Shorter link length and higher transmission rate CS Page 7 of 83
    Show answer / उत्तर देखें

    Answer: A Longer link length and lower transmission rate

    Official GATE 2023 answer key: (A).
  5. Q5 · Computer Science & IT

    Consider the following definition of a lexical token id for an identifier in a program- ming language, using extended regular expressions: letter → [A-Za-z] digit → [0-9] id → letter (letter | digit)∗ Which one of the following Non-deterministic Finite-state Automata with ϵ- transitions accepts the set of valid identifiers? (A double-circle denotes a final state)
    • A.letter letter digit ϵ
    • B.letter letter digit ϵ ϵ
    • C.letter letter digit ϵ ϵ ϵ ϵ ϵ
    • D.letter letter digit ϵ CS Page 9 of 83
    Show answer / उत्तर देखें

    Answer: B letter letter digit ϵ ϵ

    Official GATE 2023 answer key: (B).
  6. Q6 · Computer Science & IT

    CS Page 10 of 83 An algorithm has to store several keys generated by an adversary in a hash table. The adversary is malicious who tries to maximize the number of collisions. Letk bethenumberofkeys,mbe the number of slots in the hash table, andk>m. Which one of the following is the best hashing strategy to counteract the adversary?
    • A.Division method, i.e., use the hash function h(k)=k mod m.
    • B.Multiplication method, i.e., use the hash function h(k)=⌊m(kA−⌊kA⌋)⌋,where A is a carefully chosen constant.
    • C.Universal hashing method.
    • D.Ifk isaprimenumber, useDivisionmethod. Otherwise, useMultiplicationmethod. CS Page 11 of 83
    Show answer / उत्तर देखें

    Answer: C Universal hashing method.

    Official GATE 2023 answer key: (C).
  7. Q7 · Computer Science & IT

    Which one or more of the following need to be saved on a context switch from one thread (T1) of a process to another thread (T2) of the same process?
    • A.Page table base register
    • B.Stack pointer
    • C.Program counter
    • D.General purpose registers CS Page 13 of 83
    Show answer / उत्तर देखें

    Answer: B Stack pointer

    Official GATE 2023 answer key: (B).
  8. Q8 · Computer Science & IT

    Consider the context-free grammar G below S → aSb | X X → aX | Xb| a | b, where S and X are non-terminals, and a and b are terminal symbols. The starting non-terminal is S. Which one of the following statements is CORRECT?
    • A.The language generated by G is (a+b)∗
    • B.The language generated by G is a∗(a+b)b∗
    • C.The language generated by G is a∗b∗(a+b)
    • D.The language generated by G is not a regular language CS Page 33 of 83
    Show answer / उत्तर देखें

    Answer: C The language generated by G is a∗b∗(a+b)

    Official GATE 2023 answer key: (C).
  9. Q9 · Computer Science & IT

    Consider the pushdown automaton (PDA) P below, which runs on the input alpha- bet {a,b}, has stack alphabet {⊥,A}, and has three states {s,p,q},withs being the start state. A transition from state u to state v, labelled c/X/γ,wherec is an input symbol or ϵ, X is a stack symbol, and γ is a string of stack symbols, represents the fact that in state u, the PDA can read c from the input, with X on the top of its stack, pop X from the stack, push in the string γ on the stack, and go to state v. In the initial configuration, the stack has only the symbol ⊥ in it. The PDA accepts by empty stack. s a/⊥/A⊥ a/A/AA pb/A/ϵ b/A/ϵ q ϵ/A/ϵ ϵ/⊥/ϵ ϵ/A/ϵ ϵ/A/ϵ Which one of the following options correctly describes the language accepted by P?
    • A.{ambn | 1 ≤ m and n<m}
    • B.{ambn | 0 ≤ n ≤ m}
    • C.{ambn | 0 ≤ m and 0 ≤ n}
    • D.{am | 0 ≤ m}∪{bn | 0 ≤ n} CS Page 34 of 83
    Show answer / उत्तर देखें

    Answer: B {ambn | 0 ≤ n ≤ m}

    Official GATE 2023 answer key: (B).
  10. Q10 · Computer Science & IT

    Consider the given C-code and its corresponding assembly code, with a few operands U1–U4 being unknown. Some useful information as well as the semantics of each unique assembly instruction is annotated as inline comments in the code. The memory is byte-addressable. //C-code int a[10], b[10], i; // int is 32-bit for (i=0; i<10;i++) a[i] = b[i] * 8; ;assembly-code (; indicates comments) ;r1-r5 are 32-bit integer registers ;initialize r1=0, r2=10 ;initialize r3, r4 with base address of a, b L01: jeq r1, r2, end ;if(r1==r2) goto end L02: lw r5, 0(r4) ;r5 <- Memory[r4+0] L03: shl r5, r5, U1 ;r5 <- r5 << U1 L04: sw r5, 0(r3) ;Memory[r3+0] <- r5 L05: add r3, r3, U2 ;r3 <- r3+U2 L06: add r4, r4, U3 L07: add r1, r1, 1 L08: jmp U4 ;goto U4 L09: end Which one of the following options is a CORRECT replacement for operands in the position (U1, U2, U3, U4) in the above assembly code?
    • A.(8, 4, 1, L02)
    • B.(3, 4, 4, L01)
    • C.(8, 1, 1, L02)
    • D.(3, 1, 1, L01) CS Page 35 of 83
    Show answer / उत्तर देखें

    Answer: A (8, 4, 1, L02)

    Official GATE 2023 answer key: (A).
  11. Q11 · Computer Science & IT

    CS Page 40 of 83 Consider the IEEE-754 single precision floating point numbers P=0xC1800000 and Q=0x3F5C2EF4. Which one of the following corresponds to the product of these numbers (i.e., P × Q), represented in the IEEE-754 single precision format?
    • A.0x404C2EF4
    • B.0x405C2EF4
    • C.0xC15C2EF4
    • D.0xC14C2EF4 CS Page 41 of 83
    Show answer / उत्तर देखें

    Answer: C 0xC15C2EF4

    Official GATE 2023 answer key: (C).
  12. Q12 · Computer Science & IT

    Let A be a priority queue for maintaining a set of elements. Suppose A is implemented using a max-heap data structure. The operation Extract-Max(A) extracts and deletes the maximum element from A. The operation Insert(A,key) inserts a new element key in A. The properties of a max-heap are preserved at the end of each of these operations. When Acontainsnelements, which one of the following statements about the worst case running time of these two operations is TRUE?
    • A.Both Extract-Max(A) and Insert(A,key) run in O(1).
    • B.Both Extract-Max(A) and Insert(A,key) run in O(log(n)).
    • C.Extract-Max(A) runs in O(1) whereas Insert(A,key) runs in O(n).
    • D.Extract-Max(A) runs in O(1) whereas Insert(A,key) runs in O(log(n)). CS Page 42 of 83
    Show answer / उत्तर देखें

    Answer: C Extract-Max(A) runs in O(1) whereas Insert(A,key) runs in O(n).

    Official GATE 2023 answer key: (C).
  13. Q13 · Computer Science & IT

    Consider the C function foo and the binary tree shown. typedef struct node { int val; struct node *left, *right; } node; int foo(node *p) { int retval; if (p == NULL) return 0; else { retval = p->val + foo(p->left) + foo(p->right); printf("%d ", retval); return retval; } } 10 5 38 11 13 When foo is called with a pointer to the root node of the given binary tree, what will it print?
    • A.385131110
    • B.358101113
    • C.3 8 16 13 24 50
    • D.3 16 8 50 24 13 CS Page 43 of 83
    Show answer / उत्तर देखें

    Answer: B 358101113

    Official GATE 2023 answer key: (B).
  14. Q14 · Computer Science & IT

    Let U = {1,2,...,n},wheren is a large positive integer greater than 1000. Let k be a positive integer less than n.LetA,B be subsets of U with |A| = |B| = k and A∩B = ∅. We say that a permutation of U separates A from B if one of the following is true. - All members of A appear in the permutation before any of the members of B. - All members of B appear in the permutation before any of the members of A. How many permutations of U separate A from B?
    • A.n!
    • B.( n 2k ) (n−2k)!
    • C.( n 2k ) (n−2k)! (k!)2
    • D.2 ( n 2k ) (n−2k)! (k!)2 CS Page 44 of 83
    Show answer / उत्तर देखें

    Answer: C ( n 2k ) (n−2k)! (k!)2

    Official GATE 2023 answer key: (C).
  15. Q15 · Computer Science & IT

    Let f : A → B be an onto (or surjective) function, where A and B are nonempty sets. Define an equivalence relation ∼ on the set A as a1 ∼ a2 if f(a1)=f(a2) , where a1,a2 ∈ A.LetE = {[x]:x ∈ A} be the set of all the equivalence classes under ∼. Define a new mapping F : E→B as F([x]) = f(x), for all the equivalence classes [x]inE. Which of the following statements is/are TRUE?
    • A.F is NOT well-defined.
    • B.F is an onto (or surjective) function.
    • C.F is a one-to-one (or injective) function.
    • D.F is a bijective function. CS Page 45 of 83
    Show answer / उत्तर देखें

    Answer: D F is a bijective function. CS Page 45 of 83

    Official GATE 2023 answer key: (D).
  16. Q16 · General Aptitude

    We reached the station late, and _______ missed the train.
    • A.near
    • B.nearly
    • C.utterly
    • D.mostly
    Show answer / उत्तर देखें

    Answer: B nearly

    Official GATE 2023 answer key: (B).
  17. Q17 · General Aptitude

    A series of natural numbers 𝐹1, 𝐹2, 𝐹3, 𝐹4, 𝐹5, 𝐹6, 𝐹7, … obeys 𝐹𝑛+1 = 𝐹𝑛 + 𝐹𝑛−1 for all integers 𝑛 ≥ 2 . If 𝐹6 = 37, and 𝐹7 = 60, then what is 𝐹1 ?
    • A.4
    • B.5
    • C.8
    • D.9
    Show answer / उत्तर देखें

    Answer: A 4

    Official GATE 2023 answer key: (A).
  18. Q18 · General Aptitude

    A survey for a certain year found that 90% of pregnant women received medical care at least once before giving birth. Of these women, 60% received medical care from doctors, while 40% received medical care from other healthcare providers. Given this information, which one of the following statements can be inferred with certainty?
    • A.More than half of the pregnant women received medical care at least once from a doctor.
    • B.Less than half of the pregnant women received medical care at least once from a doctor.
    • C.More than half of the pregnant women received medical care at most once from a doctor.
    • D.Less than half of the pregnant women received medical care at most once from a doctor.
    Show answer / उत्तर देखें

    Answer: A More than half of the pregnant women received medical care at least once from a doctor.

    Official GATE 2023 answer key: (A).
  19. Q19 · General Aptitude

    Looking at the surface of a smooth 3-dimensional object from the outside, which one of the following options is TRUE?
    • A.The surface of the object must be concave everywhere.
    • B.The surface of the object must be convex everywhere.
    • C.The surface of the object may be concave in some places and convex in other places.
    • D.The object can have edges, but no corners.
    Show answer / उत्तर देखें

    Answer: C The surface of the object may be concave in some places and convex in other places.

    Official GATE 2023 answer key: (C).
  20. Q20 · General Aptitude

    The country of Zombieland is in distress since more than 75% of its working population is suffering from serious health issues. Studies conducted by competent health experts concluded that a complete lack of physical exercise among its working population was one of the leading causes of their health issues. As one of the measures to address the problem, the Government of Zombieland has decided to provide monetary incentives to those who ride bicycles to work. Based only on the information provided above, which one of the following statements can be logically inferred with certainty?
    • A.All the working population of Zombieland will henceforth ride bicycles to work.
    • B.Riding bicycles will ensure that all of the working population of Zombieland is free of health issues.
    • C.The health experts suggested to the Government of Zombieland to declare riding bicycles as mandatory.
    • D.The Government of Zombieland believes that riding bicycles is a form of physical exercise.
    Show answer / उत्तर देखें

    Answer: D The Government of Zombieland believes that riding bicycles is a form of physical exercise.

    Official GATE 2023 answer key: (D).
  21. Q21 · General Aptitude

    Consider two functions of time (𝑡), 𝑓(𝑡) = 0.01 𝑡2 𝑔(𝑡) = 4 𝑡 where 0 < 𝑡 < ∞. Now consider the following two statements: (i) For some 𝑡 > 0, 𝑔(𝑡) > 𝑓(𝑡). (ii) There exists a 𝑇, such that 𝑓(𝑡) > 𝑔(𝑡) for all 𝑡 > 𝑇. Which one of the following options is TRUE?
    • A.only (i) is correct
    • B.only (ii) is correct
    • C.both (i) and (ii) are correct
    • D.neither (i) nor (ii) is correct
    Show answer / उत्तर देखें

    Answer: C both (i) and (ii) are correct

    Official GATE 2023 answer key: (C).
  22. Q22 · General Aptitude

    Which one of the following sentence sequences creates a coherent narrative? (i) Once on the terrace, on her way to her small room in the corner, she notices the man right away. (ii) She begins to pant by the time she has climbed all the stairs. (iii) Mina has bought vegetables and rice at the market, so her bags are heavy. (iv) He was leaning against the parapet, watching the traffic below.
    • A.(i), (ii), (iv), (iii)
    • B.(ii), (iii), (i), (iv)
    • C.(iv), (ii), (i), (iii)
    • D.(iii), (ii), (i), (iv)
    Show answer / उत्तर देखें

    Answer: D (iii), (ii), (i), (iv)

    Official GATE 2023 answer key: (D).
  23. Q23 · General Aptitude

    ( )fx and ( )gy are functions of x and y, respectively, and ( ) ( )f x g y= for all real values of 𝑥 and 𝑦. Which one of the following options is necessarily TRUE for all x and y?
    • A.( ) 0fx= and ( ) 0gy=
    • B.( ) ( ) constant f x g y==
    • C.( ) constantfx and ( ) constantgy
    • D.( ) ( ) ( ) ( )= f x g y f x g y+−
    Show answer / उत्तर देखें

    Answer: B ( ) ( ) constant f x g y==

    Official GATE 2023 answer key: (B).