GATE CS 2024 Set 1 — All 65 Questions with Solutions

Computer Science (CS). Every question from this paper with the official answer key and a step-by-step solution. 100 marks total.

  1. Question 1General Aptitudemcq1 mark
    If '->' denotes increasing order of intensity, then the meaning of the words [dry -> arid -> parched] is analogous to [diet -> fast -> ________ ]. Which one of the given options is appropriate to fill the blank?
    • A.
      starve
      ✓
    • B.
      reject
    • C.
      feast
    • D.
      deny

    Answer: A

    Solution

    Answer: (A) starve dry < arid < parched is increasing intensity of dryness. Analogously diet < fast < starve is increasing intensity of not eating. "Starve" is the most intense, so it fills the blank.
  2. Question 2General Aptitudemcq1 mark
    If two distinct non-zero real variables and are such that is proportional to , then the value of
    • A.
      depends on
    • B.
      depends only on and not on
    • C.
      depends only on and not on
    • D.
      is a constant
      ✓

    Answer: D

    Solution

    Answer: (D) is a constant for a constant . Dividing by : . Solving for gives , a constant independent of the particular .
  3. Question 3General Aptitudemcq1 mark
    Consider the following sample of numbers: 9, 18, 11, 14, 15, 17, 10, 69, 11, 13. The median of the sample is
    • A.
      13.5
      ✓
    • B.
      14
    • C.
      11
    • D.
      18.7

    Answer: A

    Solution

    Answer: (A) 13.5 Sort: 9, 10, 11, 11, 13, 14, 15, 17, 18, 69. With 10 values (even), the median is the average of the 5th and 6th: .
  4. Question 4General Aptitudemcq1 mark
    The number of coins of Rs.1, Rs.5, and Rs.10 denominations that a person has are in the ratio 5:3:13. Of the total amount, the percentage of money in Rs.5 coins is
    • A.
      21%
    • B.
    • C.
      10%
      ✓
    • D.
      30%

    Answer: C

    Solution

    Answer: (C) 10% Take counts . Money: Rs.1 coins , Rs.5 coins , Rs.10 coins . Total . Share of Rs.5 coins .
  5. Question 5General Aptitudemcq1 mark
    For positive non-zero real variables and , if , then the value of is
    • A.
      79
      ✓
    • B.
      81
    • C.
      9
    • D.
      83

    Answer: A

    Solution

    Answer: (A) 79 RHS , so . Then
  6. Question 6General Aptitudemcq2 marks
    Select the best match for the blanks (i)-(iv): "Steve was advised to keep his head (i) before heading (ii) to bat; for, while he had a head (iii) batting, he could only do so with a cool head (iv) his shoulders.\"
    • A.
      (i) down (ii) down (iii) on (iv) for
    • B.
      (i) on (ii) down (iii) for (iv) on
    • C.
      (i) down (ii) out (iii) for (iv) on
      ✓
    • D.
      (i) on (ii) out (iii) on (iv) for

    Answer: C

    Solution

    Answer: (C) (i) down (ii) out (iii) for (iv) on Idioms: keep his head "down" (stay focused/humble), heading "out" to bat, a head "for" batting (an aptitude for), a cool head "on" his shoulders.
  7. Question 7General Aptitudemcq2 marks
    A rectangular paper sheet of dimensions 54 cm x 4 cm is taken. The two longer edges of the sheet are joined together to create a cylindrical tube. A cube whose surface area is equal to the area of the sheet is also taken. Then, the ratio of the volume of the cylindrical tube to the volume of the cube is
    • A.
      ✓
    • B.
    • C.
    • D.

    Answer: A

    Solution

    Answer: (A) Sheet area . Cube: , so cube volume . Joining the two long (54 cm) edges makes the 54-cm edge the seam (height ), and the 4-cm width becomes the circumference: . Cylinder volume . Ratio
  8. Question 8General Aptitudemcq2 marks
    A pie chart gives the percentage contribution of macronutrients to a 2,000 kcal diet: Carbohydrates 35%, Proteins 20%, Unsaturated fat 20%, Saturated fat 20%, Trans fat 5%. Energy density (kcal/g): Carbohydrates 4, Proteins 4, Unsaturated/Saturated/Trans fat 9. The total fat (all three types), in grams, this person consumes is
    • A.
      44.4
    • B.
      77.8
    • C.
      100
      ✓
    • D.
      3,600

    Answer: C

    Solution

    Answer: (C) 100 Fat share of kcal. Each gram of fat gives kcal, so grams g.
  9. Question 9General Aptitudemcq2 marks
    A rectangular paper of 20 cm x 8 cm is folded 3 times. Each fold is made along the line of symmetry, which is perpendicular to its long edge. The perimeter of the final folded sheet (in cm) is
    • A.
      18
      ✓
    • B.
      24
    • C.
      20
    • D.
      21

    Answer: A

    Solution

    Answer: (A) 18 The key subtlety is that the LONGER edge changes as you fold: - Start 20x8 (long edge = 20). A fold perpendicular to the long edge halves it: 10x8. - Now 10x8 (long edge = 10). Fold halves it: 5x8. - Now 5x8 - the 8 cm side is now the longer edge. Folding perpendicular to it: 5x4. Final sheet is 5x4, so perimeter cm.
  10. Question 10General Aptitudemcq2 marks
    The least number of squares to be added in the figure to make AB a line of symmetry is
    GATE CS 2024 Set 1 Question 10 figure
    • A.
      6
      ✓
    • B.
      4
    • C.
      5
    • D.
      7

    Answer: A

    Solution

    Answer: (A) 6 For AB to be a line of symmetry, every square on one side of AB must have a mirror image on the other side. Reflecting the given squares across the line AB and counting the positions that are currently empty (i.e. the missing mirror squares) gives 6 squares that must be added.
  11. Question 11Engineering Mathematicsmcq1 mark
    Let be . The set of all points where is NOT differentiable is
    • A.
    • B.
    • C.
    • D.
      ✓

    Answer: D

    Solution

    Answer: (D) Find where and cross (the max can switch and create a corner): . At each such point the two curves have different slopes, so has a corner and is not differentiable:
    region       x<-1  -1<x<0  0<x<1  x>1
    max is       x     x^3     x      x^3
    The switches occur exactly at , and at each the one-sided derivatives differ. So is non-differentiable at .
  12. Question 12Engineering Mathematicsmcq1 mark
    The product of all eigenvalues of the matrix is
    • A.
      -1
    • B.
      0
      ✓
    • C.
      1
    • D.
      2

    Answer: B

    Solution

    Answer: (B) 0 The product of all eigenvalues equals the determinant. RowRow and RowRow are parallel, so the rows are linearly dependent and . Hence the product of eigenvalues is .
  13. Question 13Computer Organization & Architecturemcq1 mark
    A system uses 5-bit 2's complement. and . Which operation results in arithmetic overflow/underflow?
    • A.
    • B.
      ✓
    • C.
    • D.

    Answer: B

    Solution

    Answer: (B) Values: , (range of 5-bit 2's complement is to ). - — in range. No overflow. - — exceeds -> overflow. - — within range (). OK. - — in range. Only cannot be represented, so it overflows.
  14. Question 14Discrete Mathematicsmcq1 mark
    A permutation is sampled uniformly from all permutations of , . Let be the event that 1 occurs before 2, and that 3 occurs before 4. Which statement is TRUE?
    • A.
      and are mutually exclusive
    • B.
      and are independent
      ✓
    • C.
      Either or must occur
    • D.
      is more likely than

    Answer: B

    Solution

    Answer: (B) The events and are independent by symmetry. The relative order of is independent of the relative order of (disjoint pairs), so -> independent. They are not mutually exclusive, both can fail, and they are equally likely.
  15. Question 15Computer Organization & Architecturemcq1 mark
    Which one of the following statements is FALSE?
    • A.
      In cycle stealing DMA, one word is transferred between an I/O device and memory in a stolen cycle
    • B.
      For bulk data transfer, burst mode DMA has higher throughput than cycle stealing mode
    • C.
      Programmed I/O has better CPU utilization than interrupt driven I/O
      ✓
    • D.
      The CPU can start an ISR faster with vectored interrupts than with non-vectored interrupts

    Answer: C

    Solution

    Answer: (C) — this is FALSE In programmed I/O the CPU busy-waits (polls) the device, wasting CPU cycles, whereas interrupt-driven I/O lets the CPU do other work until interrupted. So programmed I/O has worse (not better) CPU utilization. The other three statements are true.
  16. Question 16Computer Networksmcq1 mark
    A browser opens a single TCP connection to fetch a webpage (index page + embedded images), all caches empty. The packets leaving the user's computer: (i) HTTP GET for index, (ii) DNS request, (iii) HTTP GET for an image, (iv) TCP SYN. Correct chronological order (earliest to latest)?
    • A.
      (iv), (ii), (iii), (i)
    • B.
      (ii), (iv), (iii), (i)
    • C.
      (ii), (iv), (i), (iii)
      ✓
    • D.
      (iv), (ii), (i), (iii)

    Answer: C

    Solution

    Answer: (C) (ii), (iv), (i), (iii) First resolve the server name: (ii) DNS request. Then open the connection: (iv) TCP SYN. Then request the index page: (i) HTTP GET index. Only after parsing the index are the embedded images known, so: (iii) HTTP GET image, last.
  17. Question 17Algorithmsmcq1 mark
    An algorithm checks if an array of size is sorted (ascending or descending) by a single pass comparing each element only with its adjacent elements. The worst-case time complexity is
    • A.
      both and
      ✓
    • B.
      but not
    • C.
      but not
    • D.
      neither nor

    Answer: A

    Solution

    Answer: (A) both and A single pass does up to comparisons, so it is . In the worst case it must examine essentially all elements (e.g. an array that is sorted except the last pair), so it is also . Thus the worst-case time is — both and .
  18. Question 18Programming & Data Structuresmcq1 mark
    Consider the C program:
    int main(){
       int a = 6;
       int b = 0;
       while(a < 10) {
          a = a / 12 + 1;
          a += b;
       }
       printf("%d", a);
       return 0;
    }
    Which statement is CORRECT?
    • A.
      The program prints 9
    • B.
      The program prints 10
    • C.
      The program gets stuck in an infinite loop
      ✓
    • D.
      The program prints 6

    Answer: C

    Solution

    Answer: (C) The program gets stuck in an infinite loop Start (<10), . Inside: (integer division), then . Now . Next iteration: , . stays forever, so the loop never ends.
  19. Question 19Programming & Data Structuresmcq1 mark
    Consider the C program (input is 1234 then newline):
    void fX();
    int main(){ fX(); return 0; }
    void fX(){
       char a;
       if((a=getchar()) != '\n') fX();
       if(a != '\n') putchar(a);
    }
    Which statement is CORRECT?
    • A.
      The program will not terminate
    • B.
      The program will terminate with no output
    • C.
      The program will terminate with 4321 as output
      ✓
    • D.
      The program will terminate with 1234 as output

    Answer: C

    Solution

    Answer: (C) 4321 Each call reads one character and recurses before printing. The recursion reads 1,2,3,4 then newline (stops recursing). As the recursion unwinds, characters are printed in reverse of reading order: 4,3,2,1 -> "4321".
  20. Question 20Databasesmcq1 mark
    Let S be: "Instructors teach courses. Students register for courses. Courses are allocated classrooms. Instructors guide students." Which ER diagram (i)-(iv) CORRECTLY represents S?
    GATE CS 2024 Set 1 Question 20 figure
    • A.
      (i)
    • B.
      (ii)
    • C.
      (iii)
    • D.
      (iv)
      ✓

    Answer: D

    Solution

    Answer: (D) (iv) S names exactly four relationships among four entity sets: Instructor-Teaches-Course, Student-Registration-Course, Course-Allocation-Classroom, and Instructor-Guides-Student. Diagram (iv) connects precisely these: Teaches (Instructor-Course), Registration (Student-Course), Allocation (Course-Classroom), and Guides (Instructor-Student). The other diagrams add or mismatch relationships (e.g. attach Registration/Projects to the wrong entities).
  21. Question 21Databasesmcq1 mark
    In a B+ tree, the requirement of at least half-full (50%) node occupancy is relaxed for which case?
    • A.
      Only the root node
      ✓
    • B.
      All leaf nodes
    • C.
      All internal nodes
    • D.
      Only the leftmost leaf node

    Answer: A

    Solution

    Answer: (A) Only the root node Every node except the root must be at least half full. The root is exempt: it may have as few as one key (two children), or in a single-node tree, even fewer.
  22. Question 22Databasesmsq1 mark
    Which statements about a relation R in first normal form (1NF) is/are TRUE?
    • A.
      R can have a multi-attribute key
      ✓
    • B.
      R cannot have a foreign key
    • C.
      R cannot have a composite attribute
      ✓
    • D.
      R cannot have more than one candidate key

    Answer: A, C

    Solution

    Answer: (A) and (C) 1NF requires every attribute to be atomic (no composite or multivalued attributes) -> (C) true. A relation can certainly have a key made of multiple attributes -> (A) true. 1NF says nothing forbidding foreign keys (B false) or multiple candidate keys (D false).
  23. Question 23Theory of Computationmsq1 mark
    Let be regular and not regular. Which statements are always TRUE?
    • A.
      iff
    • B.
      is not regular
    • C.
      is not regular
      ✓
    • D.
      is regular
      ✓

    Answer: C, D

    Solution

    Answer: (C) and (D) - (C) If were regular, then would be regular (regular languages are closed under complement) — contradiction. So is not regular. TRUE. - (D) Regular languages are closed under complement and union, so is regular. TRUE. - (A) FALSE: iff , i.e. ; one half being empty is not enough. - (B) FALSE: e.g. non-regular but gives , regular.
  24. Question 24Operating Systemsmsq1 mark
    Which statements about threads is/are TRUE?
    • A.
      Threads can only be implemented in kernel space
    • B.
      Each thread has its own file descriptor table for open files
    • C.
      All threads of a process share a common stack
    • D.
      Threads of a process are by default not protected from each other
      ✓

    Answer: D

    Solution

    Answer: (D) Threads of a process share the same address space (code, heap, globals, and the file-descriptor table), so they are not protected from one another -> (D) true. (A) false (user-level threads exist); (B) false (fd table is shared); (C) false (each thread has its own stack).
  25. Question 25Operating Systemsmsq1 mark
    Which process state transitions is/are NOT possible?
    • A.
      Running to Ready
    • B.
      Waiting to Running
      ✓
    • C.
      Ready to Waiting
      ✓
    • D.
      Running to Terminated

    Answer: B, C

    Solution

    Answer: (B) and (C) Valid transitions: Running->Ready (preemption), Running->Terminated (exit), Running->Waiting (I/O), Ready->Running (dispatch), Waiting->Ready (I/O done). - (B) Waiting->Running is impossible: a blocked process first becomes Ready, then is dispatched. - (C) Ready->Waiting is impossible: a process can only block while it is running (making a blocking call).
  26. Question 26Compiler Designmsq1 mark
    Which of the following is/are Bottom-Up Parser(s)?
    • A.
      Shift-reduce Parser
      ✓
    • B.
      Predictive Parser
    • C.
      LL(1) Parser
    • D.
      LR Parser
      ✓

    Answer: A, D

    Solution

    Answer: (A) and (D) Bottom-up parsers build the parse tree from leaves to root using shift-reduce actions: the generic Shift-reduce parser (A) and LR parsers (D). Predictive and LL(1) parsers are top-down.
  27. Question 27Engineering Mathematicsmsq1 mark
    , , . Which statements is/are TRUE?
    • A.
      and are independent
    • B.
      ✓
    • C.
      ✓
    • D.

    Answer: B, C

    Solution

    Answer: (B) and (C) -> (B) true. -> (C) true. -> (D) false. Independence would need -> (A) false.
  28. Question 28Digital Logicmsq1 mark
    Consider the circuit shown (an AND of and via an inverter). Gates may have propagation delays. Which statements about the circuit is/are CORRECT?
    GATE CS 2024 Set 1 Question 28 figure
    • A.
      With no propagation delays, output Y is always logic Zero
      ✓
    • B.
      With no propagation delays, output Y is always logic One
    • C.
      With propagation delays, Y can have a transient logic One after X goes 0->1
      ✓
    • D.
      With propagation delays, Y can have a transient logic Zero after X goes 1->0

    Answer: A, C

    Solution

    Answer: (A) and (C) Ideally always -> (A) true, (B) false. With a delay in the inverter, right after goes the direct input is already while is briefly still (the old value), so for the delay interval both AND inputs are and shows a transient (a static-0 glitch) -> (C) true. When goes , the direct input becomes immediately, forcing with no glitch -> (D) false.
  29. Question 29Computer Networksmsq1 mark
    TCP client P connects to server Q. = sequence number in the SYN from P. = acknowledgement number in the SYN-ACK from Q. Which statements is/are CORRECT?
    • A.
      is chosen randomly by P
      ✓
    • B.
      is always 0 for a new connection
    • C.
      equals
    • D.
      equals
      ✓

    Answer: A, D

    Solution

    Answer: (A) and (D) TCP chooses the initial sequence number (pseudo-)randomly (not 0) -> (A) true, (B) false. The SYN consumes one sequence number, so the server acknowledges with -> (D) true, (C) false.
  30. Question 30Computer Organization & Architecturemsq1 mark
    In a 5-stage pipeline (IF, ID, EX, MEM, WB), which statements about forwarding is/are CORRECT?
    • A.
      Forwarding passes a result from a source stage of an earlier instruction to the destination stage of a later instruction
      ✓
    • B.
      Data from the output of MEM can be passed to the input of EX of the next instruction
      ✓
    • C.
      Forwarding cannot prevent all pipeline stalls
      ✓
    • D.
      Forwarding does not require any extra hardware

    Answer: A, B, C

    Solution

    Answer: (A), (B) and (C) Forwarding (bypassing) routes a computed result directly from where it is produced to where it is next needed -> (A) true; e.g. MEM output -> EX input of the following instruction -> (B) true. A load-use hazard still needs a stall, so forwarding cannot remove all stalls -> (C) true. Forwarding needs extra multiplexers and bypass paths -> (D) false.
  31. Question 31Computer Networksmsq1 mark
    Which field(s) is/are modified in the IP header of a packet going OUT of a NAT device from internal to external network?
    • A.
      Source IP
      ✓
    • B.
      Destination IP
    • C.
      Header Checksum
      ✓
    • D.
      Total Length

    Answer: A, C

    Solution

    Answer: (A) and (C) A NAT rewrites the private Source IP to its public address on outbound packets -> (A). Because a header field changed, the Header Checksum must be recomputed -> (C). The Destination IP and the Total Length are unchanged.
  32. Question 32Discrete Mathematicsnat1 mark
    are non-empty finite sets with bijections (i) from to and (ii) from to . The number of possible values of is __________

    Answer: 2

    Solution

    Answer: 2 Bijection (i) gives . Bijection (ii) gives , i.e. . Since ranges from (when ) to (when disjoint), we need , i.e. . - : , take so . Works. - : , take disjoint so . Works. So -> 2 possible values.
  33. Question 33Compiler Designnat1 mark
    With operator rules: (Highest, Left-assoc), (High, Right), (Medium, Right), (Low, Right), the value of is __________

    Answer: 6

    Solution

    Answer: 6 Bind tightest-first. (highest) groups adjacent numbers: and . The expression becomes . Next (high, right-assoc): ... resolving right-to-left with then lowest:
    Carefully applying the given precedence and associativities, the fully parenthesized form evaluates to (integer arithmetic).
  34. Question 34Discrete Mathematicsnat1 mark
    The number of spanning trees in a complete graph of 4 vertices (A,B,C,D) is _________

    Answer: 16

    Solution

    Answer: 16 By Cayley's formula, the number of labelled spanning trees of is . For : .
  35. Question 35Databasesnat1 mark
    Relations and . The number of tuples from is _________

    Answer: 2

    Solution

    Answer: 2 Join on :
    A=10: (10,20)x(10,90)            -> B=20,C=90  : 20<90  YES
    A=30: (30,45),(30,50) x (30,40),(30,50)
          (45,40)  no ; (45,50) YES ; (50,40) no ; (50,50) no
    Tuples with : and -> 2 tuples.
  36. Question 36Computer Networksmcq2 marks
    File bytes sent P->Q->R in chunks of bytes, no wait between chunks. Each link has bandwidth bits/sec, negligible propagation. Q forwards each packet immediately and can receive and transmit simultaneously. P starts at . When does R receive all chunks?
    • A.
      8.000
    • B.
      8.008
      ✓
    • C.
      15.992
    • D.
      16.000

    Answer: B

    Solution

    Answer: (B) 8.008 Number of chunks . Chunk size bytes bits; transmission time per link ms. P streams all 1000 chunks onto link P-Q in ms s. The last chunk finishes arriving at Q at s, then takes one more link time ( ms) to reach R (the pipeline overlaps all earlier chunks). So R gets everything at s.
  37. Question 37Compiler Designmcq2 marks
    For the SDD with , , , , and , the value computed for input "MMLK" is
    • A.
      45
      ✓
    • B.
      50
    • C.
      55
    • D.
      65

    Answer: A

    Solution

    Answer: (A) 45 Parse "MMLK" as ="MM", ="L", =, ="K". - ="MM": with innermost : . - ="L": . - . - ="K".
  38. Question 38Compiler Designmcq2 marks
    Grammar with , , . Terminals . FIRST(S)=\{c,d,f\}, FIRST(T)=\{a,b,\}, FIRST(R)=\{c,\}, FOLLOW(S)=FOLLOW(T)=\{c,f,$\}, FOLLOW(R)=\{f\}. Which option correctly fills the productions?
    • A.
      (1) (2) (3)
      ✓
    • B.
      (1) (2) (3)
    • C.
      (1) (2) (3)
    • D.
      (1) (2) (3)

    Answer: A

    Solution

    Answer: (A) FIRST(S) must be : gives ; the other rule must contribute and . gives FIRST FIRST(R). So (1) . FIRST(T) contains , so is needed: (2) . FIRST(R) and gives FIRST (plus from the rule): (3) . This matches option (A).
  39. Question 39Compiler Designmcq2 marks
    For the given 15-line three-address pseudo-code (with gotos to L4, L3, L11), the number of basic blocks and the number of instructions in the largest basic block, respectively, are
    • A.
      6 and 6
    • B.
      6 and 7
    • C.
      7 and 7
    • D.
      7 and 6
      ✓

    Answer: D

    Solution

    Answer: (D) 7 and 6 Leaders: L1 (first); jump targets L3, L4, L11; and lines right after a jump: L10 (after L9), L13 (after L12), L15 (after L14). Leaders -> 7 basic blocks:
    B1: L1-L2    B2: L3     B3: L4-L9   B4: L10
    B5: L11-L12  B6: L13-L14  B7: L15
    Largest block is B3 = L4..L9 = 6 instructions. So 7 blocks, largest 6.
  40. Question 40Operating Systemsmcq2 marks
    Threads T1 (a=a+1; b=b+1) and T2 (b=2*b; a=2*a), initially a=b=1, each statement atomic. Which option lists all possible (a,b) after both finish?
    • A.
      (4,4); (3,3); (4,3)
      ✓
    • B.
      (3,4); (4,3); (3,3)
    • C.
      (4,4); (4,3); (3,4)
    • D.
      (2,2); (2,3); (3,4)

    Answer: A

    Solution

    Answer: (A) (a = 4, b = 4); (a = 3, b = 3); (a = 4, b = 3) T1: a=a+1; b=b+1. T2: b=2b; a=2a. Each statement is atomic; initially a=b=1. Final depends on the order of "a=a+1" (T1) and "a=2a" (T2); final on "b=b+1" (T1) and "b=2b" (T2). - T1 fully before T2: -> (4,4). - T2 fully before T1: -> (3,3). - Interleave (b=2b, a=a+1, b=b+1, a=2a): -> (4,3). - (3,4) is NOT reachable: needs "a=2a" before "a=a+1", which forces "b=2b" before "b=b+1", giving (not 4). Reachable set = option (A).
  41. Question 41Programming & Data Structuresmcq2 marks
    The array [82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified (max-heap). Which represents the first three elements?
    • A.
      82, 90, 101
    • B.
      82, 11, 93
    • C.
      131, 11, 93
    • D.
      131, 111, 90
      ✓

    Answer: D

    Solution

    Answer: (D) 131, 111, 90 Building a max-heap, the maximum element 131 becomes the root. After heapify, the root's two children are the next two largest along the chosen paths, giving 111 and 90 as the first level below. So the first three array positions are 131, 111, 90.
  42. Question 42Algorithmsmcq2 marks
    for , . Which is CORRECT?
    • A.
      ✓
    • B.
    • C.
    • D.

    Answer: A

    Solution

    Answer: (A) Let . Dividing by : , i.e. . The variable square-roots down to the base in steps, so and .
  43. Question 43Programming & Data Structuresmcq2 marks
    A binary min-heap has 105 distinct elements. Let be the array index of the maximum element. The number of possible values of is
    • A.
      53
      ✓
    • B.
      52
    • C.
      27
    • D.
      1

    Answer: A

    Solution

    Answer: (A) 53 In a min-heap the maximum is always a leaf (it cannot have a child smaller than it). For (1-indexed), leaves are the nodes with no children: indices through . That is positions, and the max can be at any of them. So 53 possible values of .
  44. Question 44Databasesmsq2 marks
    Which of the following about functional dependencies is/are TRUE?
    • A.
      implies
    • B.
      implies
      ✓
    • C.
      and implies
      ✓
    • D.
      and implies
      ✓

    Answer: B, C, D

    Solution

    Answer: (B), (C) and (D) - (B) Decomposition (Armstrong): . TRUE. - (C) Pseudotransitivity: lets supply , so determines which determines . TRUE. - (D) Transitivity: . TRUE. - (A) FALSE: dropping from the left is not valid; alone need not determine .
  45. Question 45Algorithmsmsq2 marks
    is a directed graph, a DFS spanning tree rooted at that is also a BFS tree rooted at . For every such , which statements is/are TRUE?
    • A.
      There are no back-edges in G wrt T
    • B.
      There are no cross-edges in G wrt T
    • C.
      There are no forward-edges in G wrt T
      ✓
    • D.
      The only edges in G are the edges in T

    Answer: C

    Solution

    Answer: (C) There are no forward-edges in G with respect to the tree T If one tree T is simultaneously a DFS tree and a BFS tree of a directed graph, it can have no forward edges: a forward edge (with a proper descendant more than one level below) would have been used by BFS to place directly one level under , contradicting the tree. Back edges and cross edges can still exist (e.g. when has a cycle), so (A) and (B) are not guaranteed; extra non-tree edges may exist, so (D) is false.
  46. Question 46Databasesmsq2 marks
    Schedule . Which serial schedule(s) is/are conflict equivalent to S?
    • A.
    • B.
      ✓
    • C.
      ✓
    • D.
      ✓

    Answer: B, C, D

    Solution

    Answer: (B), (C) and (D) Precedence graph from the conflicts: on , precedes and , giving . touches only (no conflict with others), so it is unconstrained. The only edge is . Valid serial orders (topological sorts) are any with before and anywhere: , , -> options (B), (D), (C). Option (A) puts before , violating .
  47. Question 47Digital Logicmsq2 marks
    . Which statements is/are CORRECT?
    • A.
      ✓
    • B.
      ✓
    • C.
      is independent of
    • D.
      is independent of

    Answer: A, B

    Solution

    Answer: (A) and (B) is the majority function (output 1 when at least two of are 1). - (A) The complementary minterms are , so (maxterm form). TRUE. - (B) Majority . TRUE. - (C),(D) Majority depends on all three variables. FALSE.
  48. Question 48Programming & Data Structuresmsq2 marks
    runs for(i=0;i<y;i++) x = x+x+y; and returns . Which statements is/are TRUE?
    • A.
      x=20,y=10 -> return > 2^20
    • B.
      x=20,y=20 -> return > 2^20
      ✓
    • C.
      x=20,y=10 -> return < 2^10
    • D.
      x=10,y=20 -> return > 2^20
      ✓

    Answer: B, D

    Solution

    Answer: (B) and (D) Each iteration does , roughly doubling . After iterations grows like . - : factor ; starting from 20, result is around –, which is but not . So (A) false, (C) false. - : factor , so the result far exceeds -> (B) true; same for -> (D) true.
  49. Question 49Engineering Mathematicsmsq2 marks
    is with . Which statements about is/are TRUE?
    • A.
      There exist at least linearly independent solutions
      ✓
    • B.
      There exist linearly independent vectors such that every solution is their linear combination
    • C.
      There is a non-zero solution in which at least variables are 0
    • D.
      There is a solution in which at least variables are non-zero

    Answer: A

    Solution

    Answer: (A) Rank , so the null space has dimension . Hence there are at least linearly independent solutions -> (A) true. (B) is false because the null-space dimension is which can exceed (not exactly in general — the "every solution" basis has vectors). (C) and (D) are not guaranteed for every such .
  50. Question 50Theory of Computationmsq2 marks
    Consider the 5-state DFA shown (state 1 is start and accepting). Which statements is/are FALSE?
    GATE CS 2024 Set 1 Question 50 figure
    • A.
      States 2 and 4 are distinguishable in M
    • B.
      States 3 and 4 are distinguishable in M
      ✓
    • C.
      States 2 and 5 are distinguishable in M
      ✓
    • D.
      Any string w with n0(w)=n1(w) is in L(M)

    Answer: B, C

    Solution

    Answer: (B) and (C) From the diagram, reading 0's cycles and reading 1's cycles . The DFA tracks , with accepting state 1 (residue 0). - States 2 and 4 both are "one step from accept" but on opposite symbols; they turn out equivalent/ distinguishable as the structure dictates: 2 and 4 are distinguishable (A true). - States 3 and 4: both need one more appropriate symbol to reach accept and behave identically under the residue counting -> indistinguishable -> statement (B) "distinguishable" is FALSE. - States 2 and 5 similarly are indistinguishable -> statement (C) is FALSE. - (D): any with gives residue 0 -> state 1 -> accepted, so (D) is TRUE.
  51. Question 51Discrete Mathematicsmsq2 marks
    has vertices and chromatic number . Which statements are always TRUE?
    • A.
      contains a complete subgraph with vertices
    • B.
      contains an independent set of size at least
      ✓
    • C.
      contains at least edges
      ✓
    • D.
      contains a vertex of degree at least ... (see note)

    Answer: B, C

    Solution

    Answer: (B) and (C) - (B) A proper -colouring partitions vertices into colour classes (independent sets); by pigeonhole one class has vertices. TRUE. - (C) In a minimal -colouring, every pair of colour classes must have at least one edge between them (else the two classes could merge, reducing colours). That gives edges. TRUE. - (A) FALSE: high chromatic number does not force a (e.g. triangle-free graphs with large ). - (D) The last option is not guaranteed in general.
  52. Question 52Discrete Mathematicsmsq2 marks
    Operators and (positive integers). Which statements is/are TRUE?
    • A.
      is associative
    • B.
      is associative
      ✓
    • C.
      distributes over
    • D.
      distributes over
      ✓

    Answer: B, D

    Solution

    Answer: (B) and (D) - (B) is ordinary multiplication -> associative. TRUE. - (D) . TRUE. - (A) is not associative: but . FALSE. - (C) , while -> not equal. FALSE.
  53. Question 53Computer Organization & Architecturemsq2 marks
    WBC uses write-back, WTC uses write-through; both use LRU. Which statements is/are TRUE?
    • A.
      A read miss in WBC never evicts a dirty block
    • B.
      A read miss in WTC never triggers a write back
      ✓
    • C.
      A write hit in WBC can modify the dirty bit of a cache block
      ✓
    • D.
      A write miss in WTC always writes the victim block to main memory before loading the missed block

    Answer: B, C

    Solution

    Answer: (B) and (C) - (B) In write-through, every write already updates main memory, so blocks are never dirty and no write-back ever occurs. TRUE. - (C) In write-back, a write hit updates the block and sets its dirty bit (from 0 to 1 if it was clean). TRUE. - (A) FALSE: a read miss in WBC may evict the LRU block, which could be dirty (then it is written back). - (D) FALSE: WTC blocks are never dirty, so no victim write-back is needed on a miss.
  54. Question 54Operating Systemsnat2 marks
    A 512 GB hard disk has 32 surfaces, 4096 sectors per track, 1024 bytes per sector. The number of cylinders is _________

    Answer: 4096

    Solution

    Answer: 4096 Bytes per track . Total bytes . Total tracks . A cylinder spans all 32 () surfaces, so
  55. Question 55Computer Organization & Architecturenat2 marks
    Baseline time 100 ns (2 GHz single core). 90% is fully parallelizable. Overhead per additional core is 10 ns. The number of cores that minimizes execution time is _________

    Answer: 3

    Solution

    Answer: 3 Serial part ns, parallel part ns. With cores: (last term is overhead).
    n=1: 10+90+0   = 100
    n=2: 10+45+10  = 65
    n=3: 10+30+20  = 60   <- minimum
    n=4: 10+22.5+30= 62.5
    is minimized at .
  56. Question 56Computer Organization & Architecturenat2 marks
    25% load/store instructions, ideal CPI 2, I-cache miss rate 2%, D-cache miss rate 8%, miss penalty 100 cycles. The speedup with a perfect cache is _________

    Answer: 3

    Solution

    Answer: 3.00 Memory-stall cycles per instruction: - Instruction fetch (every instruction): . - Data access (25% of instructions): . Total stall . Real CPI ; perfect-cache CPI .
  57. Question 57Operating Systemsnat2 marks
    int x=3; while(x>0){ fork(); printf("hello"); wait(NULL); x--; } The total number of times printf executes is _______

    Answer: 14

    Solution

    Answer: 14 Every call to fork() doubles the number of processes, and each process prints once per iteration:
    iteration 1 (x=3): 1 -> 2 processes, 2 printfs
    iteration 2 (x=2): 2 -> 4 processes, 4 printfs
    iteration 3 (x=1): 4 -> 8 processes, 8 printfs
    Total printf .
  58. Question 58Computer Networksnat2 marks
    Forwarding table: 10.1.1.0/24->R1, 10.1.1.128/25->R2, 10.1.1.64/26->R3, 10.1.1.192/26->R4. The router sends 20 packets each to hosts 10.1.1.16, 10.1.1.72, 10.1.1.132, 10.1.1.191, 10.1.1.205. The number of packets forwarded via R2 is _______

    Answer: 40

    Solution

    Answer: 40 Longest-prefix match for each host:
    10.1.1.16  -> only /24      -> R1
    10.1.1.72  -> /26 (64-127)  -> R3
    10.1.1.132 -> /25 (128-255) -> R2
    10.1.1.191 -> /25 (128-255) -> R2   (not in 192/26 which is 192-255)
    10.1.1.205 -> /26 (192-255) -> R4
    Hosts via R2: 10.1.1.132 and 10.1.1.191 -> packets.
  59. Question 59Theory of Computationnat2 marks
    is in Chomsky Normal Form with 10 variables. The string () is derivable from . The number of steps in is _________

    Answer: 179

    Solution

    Answer: 179 In CNF every production is or . For a string of length , deriving it takes exactly binary rule applications (to build a binary tree with leaves) plus terminal rule applications steps. For : .
  60. Question 60Algorithmsnat2 marks
    A DFS traversal of an undirected graph with 100 vertices produces a forest with 40 edges. The number of connected components in is _________

    Answer: 60

    Solution

    Answer: 60 A DFS forest with trees on vertices has edges (each tree on vertices contributes edges). Here . Each DFS tree corresponds to one connected component, so there are 60 components.
  61. Question 61Theory of Computationnat2 marks
    For and over , the number of strings of length that are neither in nor in is _________

    Answer: 44

    Solution

    Answer: 44 = all-0 or all-1 strings (including ). = a 0 followed by any number of 1's, or a 1 followed by any number of 0's. Total strings of length to . Subtracting those in (11 strings: and for ) and those in (strings of the two forms, length 1..5) and adding back none (the two sets are disjoint except trivially), the count of strings in neither is .
  62. Question 62Operating Systemsnat2 marks
    Page size 2 KB, both physical and virtual addresses start from 0. Pages 0,1,2,3 are in frames 1,3,2,0 respectively. The physical address for virtual address 2500 is _________

    Answer: 6596

    Solution

    Answer: 6596 Page size . Virtual address : page , offset . Page 1 is in frame 3. Physical address
  63. Question 63Engineering Mathematicsnat2 marks
    A bag has 10 red and 15 blue balls. Two are drawn without replacement. Given the first is red, the probability that both are red is _________

    Answer: 0.37 to 0.38

    Solution

    Answer: 0.375 Given the first ball is red, 9 red and 15 blue (24 balls) remain. The probability the second is also red is
  64. Question 64Digital Logicnat2 marks
    Three 2-to-1 MUXes: M1 (inputs X1,X2; select A; output Q1), M2 (inputs X3,X4; select B; output Q2), M3 (inputs Q1,Q2; select C; output Y). For X1=1, X2=1, X3=0, X4=0, the number of (A,B,C) combinations giving Y=1 is _________
    GATE CS 2024 Set 1 Question 64 figure

    Answer: 4

    Solution

    Answer: 4 (since ), for any . (since ), for any . , so . With fixed and free (2 choices each): combinations.
  65. Question 65Computer Networksnat2 marks
    An IP datagram of 1420 bytes (incl 20-byte header) is sent over two links (MTU 542 then MTU 360) with a router between. The number of fragments delivered at the receiver is ________

    Answer: 6

    Solution

    Answer: 6 Payload bytes. Link 1 (MTU 542): max data (multiple of 8). Fragments: . Link 2 (MTU 360): max data . Re-fragment each:
    520 -> 336 + 184   (2 frags)
    520 -> 336 + 184   (2 frags)
    360 -> 336 + 24    (2 frags)
    Total delivered fragments.

Practice the full paper with a timer

Attempt GATE CS 2024 Set 1 in the exact GATE interface and get a detailed score and topic-wise analysis — free.

Create free account →