GATE CSE 2023 question paper with solutions
All 65 questions of the GATE 2023 Computer Science and Information Technology paper, in order, with the official answer key from IIT Kanpur. 17 have a full solution.
- questions · 100 marks
- 65questions · 100 marks
- with a full solution
- 17with a full solution
- question types
- 34 MCQ · 15 MSQ · 16 NATquestion types
GATE CSE 2023 answer key
| Question | Type | Marks | Answer |
|---|---|---|---|
| Q.1 | MCQ | 1 | B |
| Q.2 | MCQ | 1 | Marks to all |
| Q.3 | MCQ | 1 | A |
| Q.4 | MCQ | 1 | A |
| Q.5 | MCQ | 1 | C |
| Q.6 | MCQ | 2 | D |
| Q.7 | MCQ | 2 | C |
| Q.8 | MCQ | 2 | D |
| Q.9 | MCQ | 2 | B |
| Q.10 | MCQ | 2 | A |
| Q.11 | MCQ | 1 | B |
| Q.12 | MCQ | 1 | B |
| Q.13 | MCQ | 1 | D |
| Q.14 | MCQ | 1 | C |
| Q.15 | MCQ | 1 | A |
| Q.16 | MCQ | 1 | A |
| Q.17 | MCQ | 1 | B |
| Q.18 | MCQ | 1 | B |
| Q.19 | MCQ | 1 | C |
| Q.20 | MCQ | 1 | C |
| Q.21 | MCQ | 1 | B |
| Q.22 | MSQ | 1 | B, C, D |
| Q.23 | MSQ | 1 | C, D |
| Q.24 | MSQ | 1 | A, C, D |
| Q.25 | MSQ | 1 | A, C |
| Q.26 | MSQ | 1 | B, C |
| Q.27 | MSQ | 1 | A, C, D or C, D |
| Q.28 | MSQ | 1 | B, D |
| Q.29 | MSQ | 1 | A, C |
| Q.30 | NAT | 1 | 2, or 4 |
| Q.31 | NAT | 1 | 0 |
| Q.32 | NAT | 1 | 110 |
| Q.33 | NAT | 1 | 2040 |
| Q.34 | NAT | 1 | 10.2 |
| Q.35 | NAT | 1 | 7 |
| Q.36 | MCQ | 2 | A |
| Q.37 | MCQ | 2 | D |
| Q.38 | MCQ | 2 | C |
| Q.39 | MCQ | 2 | B |
| Q.40 | MCQ | 2 | A |
| Q.41 | MCQ | 2 | B |
| Q.42 | MCQ | 2 | C |
| Q.43 | MCQ | 2 | A |
| Q.44 | MCQ | 2 | C |
| Q.45 | MCQ | 2 | C |
| Q.46 | MCQ | 2 | B |
| Q.47 | MCQ | 2 | C |
| Q.48 | MCQ | 2 | D |
| Q.49 | MSQ | 2 | B, C, D |
| Q.50 | MSQ | 2 | B, C, D |
| Q.51 | MSQ | 2 | A, D |
| Q.52 | MSQ | 2 | C, D |
| Q.53 | MSQ | 2 | C, D |
| Q.54 | MSQ | 2 | A, D |
| Q.55 | MSQ | 2 | A, B |
| Q.56 | NAT | 2 | 5040 |
| Q.57 | NAT | 2 | 4096 |
| Q.58 | NAT | 2 | 5 |
| Q.59 | NAT | 2 | 8 |
| Q.60 | NAT | 2 | 2.374 to 2.376 |
| Q.61 | NAT | 2 | 2 |
| Q.62 | NAT | 2 | 6 |
| Q.63 | NAT | 2 | 4 |
| Q.64 | NAT | 2 | 19 |
| Q.65 | NAT | 2 | 3 |
General Aptitude Q.1 to Q.10
- Q.1MCQ · 1 markOfficial answer: B
- Q.2MCQ · 1 markOfficial answer: Marks to all
- Q.3MCQ · 1 markOfficial answer: A
- Q.4MCQ · 1 markOfficial answer: A
- Q.5MCQ · 1 markOfficial answer: C
- Q.6MCQ · 2 marksOfficial answer: D
- Q.7MCQ · 2 marksOfficial answer: C
- Q.8MCQ · 2 marksOfficial answer: D
- Q.9MCQ · 2 marksOfficial answer: B
- Q.10MCQ · 2 marksOfficial answer: A
Computer Science and Information Technology Q.11 to Q.65
- Q.11MCQ · 1 markOfficial answer: B
- Q.12MCQ · 1 markOfficial answer: B
Data Structures and Algorithms › Trees & heaps
In a 1-indexed array max-heap, node 's children sit at and , and the heap property requires every parent's value to be greater than or equal to both of its children's values, everywhere in the array — checking this level by level (or bottom-up from the last internal node) is enough to rule options in or out.
WATCH OUT FORFull solutionTreating the array as 0-indexed (children at ) instead of 1-indexed, which shifts every parent-child pair and can make a genuine violation look fine, or a valid heap look broken.
- Q.13MCQ · 1 markOfficial answer: D
Data Structures and Algorithms › Linear structures
To unlink a node from a linked list you must update the predecessor's link field. A singly-linked node stores no back-pointer, so given only the node itself, finding its predecessor forces a scan from the head — O(n) worst case. A doubly-linked node already stores
prev, so the predecessor is known instantly and unlinking (fixingprev->nextandnext->prev) is O(1).WATCH OUT FORFull solutionAssuming that since we're "given a pointer to the node," deletion can always be done in O(1) by copying the next node's data into the given node and deleting the next node (a common trick for other problems) — but here it must actually delete the node given (e.g., if it's the last node in an SLL, that trick fails, and worst case still requires finding the predecessor via head traversal since a plain singly-linked node has no back-link).
- Q.14MCQ · 1 markOfficial answer: C
- Q.15MCQ · 1 markOfficial answer: A
- Q.16MCQ · 1 markOfficial answer: A
- Q.17MCQ · 1 markOfficial answer: B
- Q.18MCQ · 1 markOfficial answer: B
- Q.19MCQ · 1 markOfficial answer: C
- Q.20MCQ · 1 markOfficial answer: C
Data Structures and Algorithms › Sorting & hashing
Any fixed (deterministic) hash function can be defeated by an adversary who knows it in advance: since , by pigeonhole the adversary can always choose keys that all map to the same slot under a known fixed function, forcing worst-case collisions. Universal hashing defeats this by choosing the hash function randomly at run time from a well-designed family, independent of and unknown to the adversary when the keys are chosen — giving a provable expected-collision guarantee no matter what keys are picked.
WATCH OUT FORFull solutionAssuming that any single, fixed hash function (division method, multiplication method, or a rule like option D that just switches between two fixed functions based on a property of k) is safe merely because it "spreads keys well on average" — an adversary who knows the fixed function in advance can always construct k > m keys that collide, regardless of how good the function looks statistically.
- Q.21MCQ · 1 markOfficial answer: B
- Q.22MSQ · 1 markOfficial answer: B, C, D
- Q.23MSQ · 1 markOfficial answer: C, D
- Q.24MSQ · 1 markOfficial answer: A, C, D
- Q.25MSQ · 1 markOfficial answer: A, C
- Q.26MSQ · 1 markOfficial answer: B, C
- Q.27MSQ · 1 markOfficial answer: A, C, D or C, D
- Q.28MSQ · 1 markOfficial answer: B, D
- Q.29MSQ · 1 markOfficial answer: A, C
Data Structures and Algorithms › Complexity
Compare growth rates of and using the formal definitions of , , , and : since grows strictly slower than , is an upper-bounded-by (in fact strictly dominated, i.e. little-o) function of , but not a lower bound, so and fail.
WATCH OUT FORFull solutionAssuming that because holds, must also hold (treating as if it already implied a tight bound), or forgetting that (strict, limit-zero domination) is a stronger and still-true statement here, not something mutually exclusive with .
- Q.30NAT · 1 markOfficial answer: 2, or 4
- Q.31NAT · 1 markOfficial answer: 0
- Q.32NAT · 1 markOfficial answer: 110
- Q.33NAT · 1 markOfficial answer: 2040
Computer Organization and Architecture › Pipelining
In a k-stage pipeline with no hazards, the cycle time is set by the slowest stage, and n instructions (one issued per cycle) finish in (k + n − 1) cycles — k−1 cycles to fill the pipeline plus n cycles for the n issues.
WATCH OUT FORFull solutionUsing the sum of all stage delays (10+20+14 = 44 ns) as the cycle time instead of the maximum stage delay (20 ns) — a pipelined cycle time is bounded by the slowest single stage, not the total latency of one instruction.
- Q.34NAT · 1 markOfficial answer: 10.2
Computer Organization and Architecture › I/O, interrupts & DMA
Compute the total time spent per second under each scheme (polling overhead + one keystroke-processing event per second, versus one interrupt-service event per second), express each as a fraction of a second, and take the ratio.
WATCH OUT FORFull solutionForgetting to add the 200 μs keystroke-processing time to the polling cost (giving T1 = 0.01, ratio 10.0), or forgetting that the 200 μs is added only once per second (since only one keystroke occurs per second), not per poll.
- Q.35NAT · 1 markOfficial answer: 7
Programming in C › Functions & scope
A
staticlocal variable inside a function keeps its value across calls (initialized only once, at first entry) and is completely distinct from any same-named variable in the calling function; only reads (never a write) of a variable elsewhere in the same full expression are safe to reason about without worrying about C's unsequenced evaluation order.WATCH OUT FORFull solutionConfusing
funcp's staticxwithmain's localxand re-computingmain'sxusing the static variable's latest value (e.g. wrongly takingmain'sxas3during the second call instead of the2it was already assigned), or assuming C's unspecified evaluation order makesy = funcp() + xundefined — it is not, becausexis only read here, not modified, in this expression. - Q.36MCQ · 2 marksOfficial answer: A
An activation (call) tree mirrors the actual sequence of function calls made during execution, nested exactly as calls are made: if function P calls Q, Q becomes a child of P's node at that call site, in left-to-right call order — it is not the same as the static call graph, and repeated/recursive calls to the same function name create separate, deeper nodes rather than being merged or flattened.
WATCH OUT FORFull solutionTreating "f2 calls f3 then recursively calls f2" as if it collapses into one extra level (option B) or flattens all of f2's descendants into siblings of f2 (option D), instead of correctly nesting each recursive call one level deeper as its own node with its own children — losing track of exactly how many times f2 recurses (here once, from X=2 down to X=1) and forgetting that f3() is called again inside each new invocation of f2.
- Q.37MCQ · 2 marksOfficial answer: D
- Q.38MCQ · 2 marksOfficial answer: C
- Q.39MCQ · 2 marksOfficial answer: B
- Q.40MCQ · 2 marksOfficial answer: A
- Q.41MCQ · 2 marksOfficial answer: B
Computer Organization and Architecture › Instructions & addressing
Translate the C loop into the assembly skeleton line by line: the shift amount for *8 is log2(8)=3, and pointer increments in a byte-addressable memory must equal the element size (sizeof(int) = 4 bytes here), not 1.
WATCH OUT FORFull solutionPicking U1 = 8 (using the multiplier itself as the shift amount) instead of log2(8) = 3, or forgetting that int is 4 bytes so the byte-addressable pointer increments (U2, U3) must be 4, not 1.
- Q.42MCQ · 2 marksOfficial answer: C
Computer Organization and Architecture › Memory & cache
The 10-bit Addr port of every block is fed by all address lines EXCEPT IA4 and IA3, which instead go to a 2-to-4 decoder that generates the chip-select for each block. So "starting location" (Addr port = 0) only forces the ten bus bits to 0; IA4 and IA3 are free to vary block-to-block since they only pick which block is selected — and their contribution to the 12-bit address is and , not the top two (MSB) bits.
WATCH OUT FORFull solutionAssuming the two lines going to the decoder must be the two MSBs (IA11, IA10), which would wrongly give offsets in multiples of 1024 (option B) — or assuming a decoder always implies a simple linear block order 0,1,2,3 (option A). The trap is that IA4 and IA3 sit in the middle of the address, not at either end, so their weight is and .
- Q.43MCQ · 2 marksOfficial answer: A
- Q.44MCQ · 2 marksOfficial answer: C
- Q.45MCQ · 2 marksOfficial answer: C
- Q.46MCQ · 2 marksOfficial answer: B
Data Structures and Algorithms › Trees & heaps
A binary (max-)heap stored as a nearly complete binary tree has height ; both INSERT (sift-up from a new leaf) and EXTRACT-MAX (move last element to root, then sift-down/max-heapify) do work proportional to the tree's height, so both are in the worst case — reading the max itself is , but restoring the heap property after removing it is not.
WATCH OUT FORFull solutionAssuming EXTRACT-MAX is overall because "the maximum is right at the root" (options C/D) — this only covers locating/reading the max. Removing it still requires refilling the root (with the last array element) and sifting it down through up to levels to restore the max-heap property, so the operation as a whole costs , not .
- Q.47MCQ · 2 marksOfficial answer: C
Each call to
foo(p)first recurses into both children (left, then right) and only after both have returned does it computeretval = p->val + foo(left) + foo(right)and print it — so this is a post-order traversal, but what gets printed at each node is the sum of the entire subtree rooted there, not the node's own stored value.WATCH OUT FORFull solutionAssuming the printf prints the node's own value at the moment of visiting it (as in a plain post-order traversal print), giving 3 8 5 13 11 10 (option A) — instead of recognizing that
retvalaccumulates the subtree sum before printing, since the printf statement executes only after both recursive calls have already returned andretvalhas already been updated. - Q.48MCQ · 2 marksOfficial answer: D
- Q.49MSQ · 2 marksOfficial answer: B, C, D
- Q.50MSQ · 2 marksOfficial answer: B, C, D
- Q.51MSQ · 2 marksOfficial answer: A, D
- Q.52MSQ · 2 marksOfficial answer: C, D
- Q.53MSQ · 2 marksOfficial answer: C, D
- Q.54MSQ · 2 marksOfficial answer: A, D
Data Structures and Algorithms › Complexity
Trace each loop's exact iteration count rather than guessing from loop nesting depth:
Function_1's outerwhilehalvesneach pass while the innerforruns the currentn, giving a geometric series that sums to — the same order asFunction_2's single pass of iterations. Two functions of the same order satisfy (tight bound) and (upper bound) with each other, but never or (which require the ratio to actually vanish or blow up).WATCH OUT FORFull solutionAssuming
Function_1's nested while+for structure must be or just because it looks like two loops, without summing the geometric series (which totals , not ); a second common slip is treating "same order" as automatically implying little- or little-, when those need the ratio of the two functions to tend to or respectively, not merely to be unequal. - Q.55MSQ · 2 marksOfficial answer: A, B
Data Structures and Algorithms › Design techniques
Sequential greedy coloring always produces a proper coloring, and it never uses more than colors — but this bound is not always tight ( alone can fail), and the actual number of colors greedy uses depends on the vertex order, so it need not equal .
WATCH OUT FORFull solutionConfusing the proved greedy bound with a tighter, unproven bound of , and assuming the greedy result equals the chromatic number just because the algorithm is "optimal-looking" — the number of colors greedy uses is order-dependent and can exceed .
- Q.56NAT · 2 marksOfficial answer: 5040
Data Structures and Algorithms › Graph algorithms
is a proper subset of every one of the other 7 subsets of , so in it is adjacent to all of them simultaneously. A BFS starting at therefore has only two levels: level 0 = and level 1 = all remaining 7 vertices. Since BFS's traversal order is not fixed for vertices within the same level (the specification leaves the order neighbors are discovered/enqueued unconstrained), every one of the permutations of the 7 level-1 vertices is a valid BFS visiting order following , and no further choices arise once they are enqueued (all vertices are already visited by then).
WATCH OUT FORFull solutionTreating "adjacent iff proper subset" as only the Hasse-diagram cover relation (i.e., only edges to immediate subsets/supersets), which would make adjacent to just and force a multi-level BFS with far fewer orderings than . The problem states the FULL comparability relation ( or , any degree of nesting), not just cover edges, so is directly adjacent to all 7 other vertices.
- Q.57NAT · 2 marksOfficial answer: 4096
- Q.58NAT · 2 marksOfficial answer: 5
- Q.59NAT · 2 marksOfficial answer: 8
Data Structures and Algorithms › Linear structures
Simulate the stack and queue step by step exactly in the order the operations are listed, tracking the full contents (not just the top/front) so each subsequent pop/dequeue references the correct element.
WATCH OUT FORFull solutionLosing track of the moving front of Q while three separate dequeue-and-push actions happen in operation VIII (mixing up which element is currently at the front of Q), or forgetting that operation III pops before operation IV dequeues, so mis-ordering the interleaving of pops/dequeues against pushes/enqueues.
- Q.60NAT · 2 marksOfficial answer: 2.374 to 2.376
- Q.61NAT · 2 marksOfficial answer: 2
- Q.62NAT · 2 marksOfficial answer: 6
- Q.63NAT · 2 marksOfficial answer: 4
- Q.64NAT · 2 marksOfficial answer: 19
Computer Organization and Architecture › Memory & cache
In a set-associative cache, , so , a quantity independent of block size. Since , this sum is fixed even though the block size itself is never stated in the question — only needs to be found, and it comes out the same for every possible block size.
WATCH OUT FORFull solutionAssuming a block/line size must be given and getting stuck, or (wrongly) assuming a specific block size such as 32 or 64 bytes and computing a TAG value that depends on that unstated assumption; also forgetting to divide by the associativity (8-way) when computing the number of sets, which gives INDEX+OFFSET = 16 and TAG = 16 instead of 19.
- Q.65NAT · 2 marksOfficial answer: 3