GATE CS 2023 — 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.
- Question 1General Aptitudemcq1 markWe reached the station late, and _______ missed the train.
- A.near
- B.nearly✓
- C.utterly
- D.mostly
Answer: B
Solution
Answer: (B) nearly "nearly missed" means almost missed — the idiomatically and grammatically correct adverb here. "near" is not an adverb in this sense, and "utterly"/"mostly" do not fit. - A.
- Question 2General Aptitudemcq1 markKind : _______ :: Often : Frequently (By word meaning)
- A.Mean
- B.Type✓
- C.Cruel
- D.Kindly
Answer: B
Solution
Answer: GATE awarded Marks To All (MTA) for this question. "Often" and "Frequently" are synonyms. "Kind" as a noun means a sort/category, whose synonym would be "Type" (B). However, "Kind" as an adjective (benevolent) has no synonym among the options ("Cruel" is its antonym), making the analogy ambiguous. Because of this ambiguity, GATE 2023 awarded marks to all candidates. - A.
- Question 3General Aptitudemcq1 markA series of natural numbers obeys for all . If and , what is ?
- A.4✓
- B.5
- C.8
- D.9
Answer: A
Solution
Answer: (A) 4 Work backwards with :F5 = 60-37 = 23 F4 = 37-23 = 14 F3 = 23-14 = 9 F2 = 14-9 = 5 F1 = 9-5 = 4 - A.
- Question 4General Aptitudemcq1 markA survey found 90% of pregnant women received medical care at least once before birth. Of these, 60% received care from doctors, 40% from other providers. Which statement 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 received medical care at most once from a doctor.
- D.Less than half received medical care at most once from a doctor.
Answer: A
Solution
Answer: (A) Fraction receiving care from a doctor . So more than half of all pregnant women received care at least once from a doctor. - A.
- Question 5General Aptitudemcq1 markLooking at the surface of a smooth 3-dimensional object from the outside, which one is TRUE?
- A.The surface must be concave everywhere.
- B.The surface must be convex everywhere.
- C.The surface may be concave in some places and convex in other places.✓
- D.The object can have edges, but no corners.
Answer: C
Solution
Answer: (C) A smooth 3D object can have both convex regions (e.g. a bump) and concave regions (e.g. a dent), so in general the surface may be concave in some places and convex in others. - A.
- Question 6General Aptitudemcq2 marksZombieland's government gives monetary incentives to those who ride bicycles to work, to address the health issues caused by lack of physical exercise. Which statement can be logically inferred with certainty?
- A.All the working population will henceforth ride bicycles to work.
- B.Riding bicycles will ensure all of the working population is free of health issues.
- C.The health experts suggested declaring cycling mandatory.
- D.The Government believes that riding bicycles is a form of physical exercise.✓
Answer: D
Solution
Answer: (D) The government incentivizes cycling specifically to counter the lack of physical exercise, which logically means it treats cycling as a form of physical exercise. The other options overreach beyond what the passage states. - A.
- Question 7General Aptitudemcq2 marksLet and for . Statements: (i) For some , . (ii) There exists such that for all . Which 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
Answer: C
Solution
Answer: (C) both (i) and (ii) are correct For small , exceeds (e.g. : ) -> (i) true. They cross at ; beyond that the quadratic dominates the linear, so for all -> (ii) true. - A.
- Question 8General Aptitudemcq2 marksWhich sentence sequence 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)✓
Answer: D
Solution
Answer: (D) (iii), (ii), (i), (iv) (iii) sets up heavy bags, (ii) she pants climbing stairs, (i) reaching the terrace she notices the man, (iv) describes the man. Order: iii -> ii -> i -> iv. - A.
- Question 9General Aptitudemcq2 marksand are functions of and respectively, and for all real and . Which one is necessarily TRUE for all and ?
- A.and
- B.constant✓
- C.constant and constant (possibly different)
- D.
Answer: B
Solution
Answer: (B) constant If for all independent and , vary with fixed: cannot change, so is a constant; likewise is a constant, and the two constants are equal. Hence both equal the same constant. - A.
- Question 10General Aptitudemcq2 marksWhich option best describes the transformation of the 2-D figure P to Q, and then to R, as shown?

- A.Op1: Clockwise rotation by 90 deg (axis perpendicular to plane); Op2: reflection along a horizontal line✓
- B.Op1: Counter-clockwise rotation by 90 deg; Op2: reflection along a horizontal line
- C.Op1: Clockwise rotation by 90 deg; Op2: reflection along a vertical line
- D.Op1: Counter-clockwise rotation by 180 deg; Op2: reflection along a vertical line
Answer: A
Solution
Answer: (A) Comparing P to Q, the star is rotated 90 degrees clockwise (about an axis perpendicular to the page). Comparing Q to R, the figure is reflected across a horizontal line. So Operation 1 is a clockwise 90-degree rotation and Operation 2 is a horizontal reflection. - A.
- Question 11Compiler Designmcq1 markConsider statements about a compiler. S1: The front-end includes phases independent of the target hardware. S2: The back-end includes phases specific to the target hardware. S3: The back-end includes phases specific to the programming language of the source code. Identify the CORRECT option.
- A.Only S1 is TRUE.
- B.Only S1 and S2 are TRUE.✓
- C.S1, S2, and S3 are all TRUE.
- D.Only S1 and S3 are TRUE.
Answer: B
Solution
Answer: (B) Only S1 and S2 are TRUE The front-end (lexical/syntax/semantic analysis, IR generation) is machine-independent -> S1 true. The back-end (code generation, machine-specific optimization) is target-hardware specific -> S2 true. The back-end is NOT source-language specific (it works on IR) -> S3 false. - A.
- Question 12Programming & Data Structuresmcq1 markWhich sequence stored at 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
Answer: B
Solution
Answer: (B) 23, 17, 14, 7, 13, 10, 1, 5, 6, 12 A max-heap requires and . Checking (B):
all hold. In (A) 13<14 (A[5]<A[6])? ok, but fails. (C) fails. (D) ? root ok but ... fails. Only (B) is a valid max-heap.23>=17,14 | 17>=7,13 | 14>=10,1 | 7>=5,6 | 13>=12 - A.
- Question 13Programming & Data Structuresmcq1 markSLLdel deletes a node in a singly-linked list given a pointer to the node and to the head. DLLdel does the same for a doubly-linked list. With nodes, what is the worst-case time complexity?
- A.SLLdel is O(1) and DLLdel is O(n)
- B.Both are O(log n)
- C.Both are O(1)
- D.SLLdel is O(n) and DLLdel is O(1)✓
Answer: D
Solution
Answer: (D) SLLdel is O(n) and DLLdel is O(1) In a singly-linked list, deleting a given node needs its predecessor; the copy-next trick works except for the last node, so the worst case is (traverse from head). In a doubly-linked list, the node has a prev pointer, so deletion adjusts prev/next in . - A.
- Question 14Theory of Computationmcq1 markConsider the DFA shown over with states , start state , and the only final state. Which regular expression describes ?

- A.
- B.
- C.✓
- D.
Answer: C
Solution
Answer: (C) From , only a leading reaches the final state . From , reading a keeps you in the accepting cycle, and reading (via and back) returns to ; any other symbol goes to the dead state . So accepted strings are a followed by any sequence of 's and 's: . - A.
- Question 15Discrete Mathematicsmcq1 markThe Lucas sequence for , with and . Which is TRUE?
- A.✓
- B.
- C.
- D.
Answer: A
Solution
Answer: (A) The characteristic equation has roots and . The Lucas numbers have the closed form . Checking: and . Matches option (A). - A.
- Question 16Databasesmcq1 markWhich one refers to the degree (arity) of a relation in relational database systems?
- A.Number of attributes of its relation schema.✓
- B.Number of tuples stored in the relation.
- C.Number of entries in the relation.
- D.Number of distinct domains of its relation schema.
Answer: A
Solution
Answer: (A) Number of attributes of its relation schema The degree (arity) of a relation is the number of attributes (columns) in its schema. The number of tuples is the cardinality, not the degree. - A.
- Question 17Computer Networksmcq1 markTwo hosts use Stop-and-Wait over a point-to-point link. In which scenario is link utilization 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
Answer: B
Solution
Answer: (B) Longer link length and higher transmission rate Utilization . It is lowest when the transmission time is small relative to the propagation time . Higher transmission rate reduces , and longer link increases — together they minimize utilization. - A.
- Question 18Engineering Mathematicsmcq1 markand are matrices where is obtained from by a row rearrangement (A is the circulant with first row 1,2,3,4; B with first row 3,4,1,2). Which is TRUE?
- A.
- B.✓
- C.
- D.
Answer: B
Solution
Answer: (B) and are matrices whose rows are the vector arranged differently; is obtained from by swapping two rows (rows 1 and 3). A single row swap negates the determinant, so . is not (as a circulant with first row its eigenvalues multiply to ), so (C) is false; (A) and (D) are also false. - A.
- Question 19Compiler Designmcq1 markGiven letter -> [A-Za-z], digit -> [0-9], id -> letter (letter | digit)*, which NFA with epsilon-transitions (shown as options A-D) accepts the set of valid identifiers?

- A.(A)
- B.(B)
- C.(C)✓
- D.(D)
Answer: C
Solution
Answer: (C) A valid identifier matchesletter (letter | digit)*. The correct NFA reads exactly one letter to reach the accepting (double-circle) state, then has an epsilon-structured loop that consumes any number of further letters or digits and returns to the accepting state. Option (C) is the automaton whose epsilon-transitions correctly implement the(letter | digit)*loop after the first letter. The others either accept the empty string or wire the epsilon-loop so it does not faithfully realize(letter | digit)*. - A.
- Question 20Algorithmsmcq1 markAn adversary generates keys to maximize collisions in a hash table ( keys, slots, ). Which is the best hashing strategy?
- A.Division method h(k)=k mod m.
- B.Multiplication method.
- C.Universal hashing method.✓
- D.If k is prime use Division, else Multiplication.
Answer: C
Solution
Answer: (C) Universal hashing method For any fixed hash function (division or multiplication), an adversary who knows it can choose keys that all collide. Universal hashing picks the hash function randomly from a family, so no adversary (choosing keys before the function is drawn) can force many collisions — the expected number of collisions is bounded. - A.
- Question 21Digital Logicmcq1 markThe output of a 2-input multiplexer is connected back to one of its inputs (input 0), with the other input being data and S the select line, as shown. This circuit is functionally equivalent to a

- A.D Flip-flop
- B.D Latch✓
- C.Half-adder
- D.Demultiplexer
Answer: B
Solution
Answer: (B) D Latch When the mux passes the data input (transparent), and when it passes the fed-back output (holds the previous value). This level-sensitive "pass when enabled, hold otherwise" behaviour is exactly a D latch (not an edge-triggered flip-flop). - A.
- Question 22Operating Systemsmsq1 markWhich need to be saved on a context switch from one thread T1 to another thread T2 of the SAME process?
- A.Page table base register
- B.Stack pointer✓
- C.Program counter✓
- D.General purpose registers✓
Answer: B, C, D
Solution
Answer: (B), (C) and (D) Threads of the same process share the address space, so the page-table base register does NOT change -> (A) not needed. Each thread has its own execution context: stack pointer (B), program counter (C), and general-purpose registers (D) must be saved and restored. - A.
- Question 23Operating Systemsmsq1 markWhich guarantee a transition from user mode to kernel mode?
- A.Function Call
- B.malloc Call
- C.Page Fault✓
- D.System Call✓
Answer: C, D
Solution
Answer: (C) and (D) A page fault is a trap handled by the kernel -> always enters kernel mode (C). A system call explicitly traps to the kernel (D). An ordinary function call stays in user mode (A);mallocis a library routine that usually runs in user space and only sometimes makes a system call, so it does not always transition (B). - A.
- Question 24Theory of Computationmsq1 markWhich statements are CORRECT?
- A.The intersection of two regular languages is regular.✓
- B.The intersection of two context-free languages is context-free.
- C.The intersection of two recursive languages is recursive.✓
- D.The intersection of two recursively enumerable languages is recursively enumerable.✓
Answer: A, C, D
Solution
Answer: (A), (C) and (D) Regular, recursive, and recursively enumerable languages are all closed under intersection -> (A),(C),(D) true. Context-free languages are NOT closed under intersection (e.g. is the intersection of two CFLs but is not context-free) -> (B) false. - A.
- Question 25Computer Networksmsq1 markWhich statements about OSPF are INCORRECT?
- A.OSPF implements Bellman-Ford algorithm to find shortest paths.✓
- B.OSPF uses Dijkstra's shortest path algorithm.
- C.OSPF is used as an inter-domain routing protocol.✓
- D.OSPF implements hierarchical routing.
Answer: A, C
Solution
Answer: (A) and (C) OSPF is a link-state protocol that uses Dijkstra's algorithm (so B is correct, A is incorrect). OSPF is an INTRA-domain (interior gateway) protocol, not inter-domain (so C is incorrect; BGP is inter-domain). OSPF does support hierarchical routing via areas (D correct). The incorrect statements are A and C. - A.
- Question 26Discrete Mathematicsmsq1 markGeetha's conjecture is . Which option(s) would imply it?
- A.
- B.✓
- C.✓
- D.
Answer: B, C
Solution
Answer: (B) and (C) - (B) makes true for every , hence the conjecture holds. Implies. - (C) : a single works for all , so in particular each has such a . Implies. - (A),(D) only assert something for SOME , which does not establish the universally-quantified conjecture. - A.
- Question 27Operating Systemsmsq1 markWhich CPU scheduling algorithms can potentially cause starvation?
- A.First-in First-Out✓
- B.Round Robin
- C.Priority Scheduling✓
- D.Shortest Job First✓
Answer: A, C, D
Solution
Answer: (A), (C) and (D) (the official key accepted both {A,C,D} and {C,D}) Priority scheduling can indefinitely postpone low-priority processes (C), and Shortest Job First can starve long jobs when short jobs keep arriving (D). Round Robin is starvation-free (B). FIFO serves strictly in arrival order; GATE's key accepted answers both including and excluding (A), so the marked set is {A, C, D}. - A.
- Question 28Engineering Mathematicsmsq1 markLet . Which statements are TRUE?
- A.f(x) does not have a local maximum.
- B.f(x) has a local maximum.✓
- C.f(x) does not have a local minimum.
- D.f(x) has a local minimum.✓
Answer: B, D
Solution
Answer: (B) and (D) , so critical points at . : -> local maximum at (B); -> local minimum at (D). - A.
- Question 29Algorithmsmsq1 markand . Which statements are TRUE?
- A.✓
- B.
- C.✓
- D.
Answer: A, C
Solution
Answer: (A) and (C) so (A). so (C), which also rules out (B) and (D). - A.
- Question 30Engineering Mathematicsnat1 markLet be the adjacency matrix of the graph shown on vertices (note the self-loops). The value of is __________

Answer: 2 to 4
Solution
Answer: 2 (GATE also accepted 4) The sum of all eigenvalues equals the trace of , i.e. the sum of its diagonal entries. The diagonal is nonzero only where a vertex has a self-loop — here vertices 3 and 4. Under the convention that a self-loop contributes to the diagonal, trace ; under the convention that an undirected self-loop contributes , trace . GATE accepted both and . - Question 31Engineering Mathematicsnat1 markThe value of (rounded to nearest integer) is __________
Answer: 0
Solution
Answer: 0 Integrate over : (the odd integrates to 0). Then (odd in over symmetric limits). So the whole integral is . - Question 32Digital Logicnat1 markA number is written as 132 in radix-4. The same number in radix-5 is __________
Answer: 110
Solution
Answer: 110 . Convert to base 5: . - Question 33Computer Organization & Architecturenat1 markA 3-stage pipeline has stage delays 10 ns, 20 ns, 14 ns. No hazards, one instruction fetched per cycle. The total execution time for 100 instructions is __________ ns
Answer: 2040
Solution
Answer: 2040 Clock period ns. Time for instructions in a -stage pipeline ns. - Question 34Computer Organization & Architecturenat1 markKeyboard: 1 keystroke/sec. Polling every 10 ms costs 100 us/poll; a detected key costs 200 us extra. = fraction of a second in polling+processing. Interrupts: 1 ms to service+process each keystroke; = fraction of a second. The ratio (one decimal) is __________
Answer: 10.2
Solution
Answer: 10.2 Polling: 100 polls/sec , plus 1 keystroke . s. Interrupts: 1 keystroke ms . s. . - Question 35Programming & Data Structuresnat1 markThe integer printed by the C program (funcp uses
static int x=1; x++; return x;, called twice in main) is __________int funcp(){ static int x = 1; x++; return x; } int main(){ int x,y; x = funcp(); y = funcp()+x; printf("%d\n", (x+y)); }Answer: 7
Solution
Answer: 7x = funcp(): static x becomes 2, returns 2, so x=2.y = funcp()+x: static x becomes 3, returns 3, so y=3+2=5. Printx+y = 2+5 = 7. - Question 36Compiler Designmcq2 marksFor the given program (main calls f1(); f2(2); f3();, where f2 calls f3() then recurses), which option represents the activation tree of main?

- A.(A)✓
- B.(B)
- C.(C)
- D.(D)
Answer: A
Solution
Answer: (A) main calls f1, then f2(2), then f3. Inside f2(2): it first calls f3, then (since X!=1) calls f2(1); f2(1) calls f3 then f1. So under f2 the children are f3 and f2(1), and under f2(1) are f3 and f1. The activation tree with main's children {f1, f2, f3}, f2's children {f3, f2}, and the inner f2's children {f3, f1} matches option (A). - A.
- Question 37Compiler Designmcq2 marksFor the control flow graph shown (blocks B1-B4, with B1: i=m-1, j=n, a=10; B2: i=i+1, j=j-1; B3: a=20; B4: i=a+1), which choice lists the live variables at the EXIT of each basic block?

- A.B1: {}, B2: {a}, B3: {a}, B4: {a}
- B.B1: {i,j}, B2: {a}, B3: {a}, B4: {i}
- C.B1: {a,i,j}, B2: {a,i,j}, B3: {a,i}, B4: {a}
- D.B1: {a,i,j}, B2: {a,j}, B3: {a,j}, B4: {a,i,j}✓
Answer: D
Solution
Answer: (D) B1: {a,i,j}, B2: {a,j}, B3: {a,j}, B4: {a,i,j} Compute live variables backward (a variable is live at a point if it is used later before being redefined). Tracing the uses — B4 uses (and loops back using ), B2 uses , B3 defines used in B4 — gives the live-out sets B1:{a,i,j}, B2:{a,j}, B3:{a,j}, B4:{a,i,j}, matching option (D). - A.
- Question 38Operating Systemsmcq2 marksincr/decr each do wait(s); X=X±1; signal(s). 5 threads call incr, 3 call decr, initial X=10. I-1: s binary semaphore =1. I-2: s counting semaphore =2. are final X values. Which gives the MINIMUM possible ?
- A.15, 7
- B.7, 7
- C.12, 7✓
- D.12, 8
Answer: C
Solution
Answer: (C) 12, 7 5 threads call incr (X+1), 3 call decr (X-1); initial X=10. - I-1 (binary semaphore = 1): mutual exclusion holds, so every update applies: (fixed; its minimum is 12). - I-2 (counting semaphore = 2): up to two threads are in the critical section at once, so increments can be lost through races. Minimizing by losing increments while keeping decrements, the smallest reachable value is . Hence . - A.
- Question 39Theory of Computationmcq2 marksConsider : , . Which statement is CORRECT?
- A.
- B.✓
- C.
- D.is not a regular language
Answer: B
Solution
Answer: (B) generates (any number of leading 's, one middle symbol, any number of trailing 's — at least one symbol). The rule wraps matched 's and 's around, but these are absorbed into the form. So , which is regular. - A.
- Question 40Theory of Computationmcq2 marksThe PDA shown (states , start , accepts by empty stack) runs on . Which language does it accept?

- A.✓
- B.
- C.
- D.
Answer: A
Solution
Answer: (A) In state each 'a' pushes an (so at least one is needed, ). Reading 'b' moves to and pops one per . To empty the stack and accept, at least one must still be removed by an epsilon-transition after the 's - so there must be strictly more 's than 's, i.e. . Hence the language is . - A.
- Question 41Computer Organization & Architecturemcq2 marksFor
a[i]=b[i]*8(int = 32-bit, byte-addressable), the assembly usesshl r5,r5,U1,add r3,r3,U2,add r4,r4,U3,jmp U4. Which replaces (U1,U2,U3,U4)?- A.(8, 4, 1, L02)
- B.(3, 4, 4, L01)✓
- C.(8, 1, 1, L02)
- D.(3, 1, 1, L01)
Answer: B
Solution
Answer: (B) (3, 4, 4, L01) Multiplying by 8 is a left shift by 3 -> U1=3. Arraysaandbhold 32-bit ints (4 bytes), so advancing to the next element adds 4 to each base pointer -> U2=4, U3=4. The loop jumps back to the comparison at the top -> U4=L01. So (3,4,4,L01). - A.
- Question 42Computer Organization & Architecturemcq2 marksA 4 KB memory uses four 1 KB blocks. Address lines IA4, IA3 go to a decoder driving the chip-selects (active high); the remaining ten of IA11-IA0 go to the 10-bit address port. What are the starting addresses (IA11-IA0 in decimal) of blocks X1, X2, X3, X4?

- A.(0, 1, 2, 3)
- B.(0, 1024, 2048, 3072)
- C.(0, 8, 16, 24)✓
- D.(0, 0, 0, 0)
Answer: C
Solution
Answer: (C) (0, 8, 16, 24) A block is selected by the decoder from (IA4, IA3), while its internal start (Addr=0) sets the ten address-port bits to 0. So the starting address of each block is determined solely by its (IA4,IA3) code:X1: IA4IA3=00 -> 0 X2: IA4IA3=01 -> 2^3 = 8 X3: IA4IA3=10 -> 2^4 = 16 X4: IA4IA3=11 -> 2^4+2^3 = 24 - A.
- Question 43Digital Logicmcq2 marksA circuit uses T, D, T flip-flops with outputs Q1, Q2, Q3 (initially 0,1,1). Which value of (Q1,Q2,Q3) can NEVER be obtained?

- A.(0, 0, 1)✓
- B.(1, 0, 0)
- C.(1, 0, 1)
- D.(1, 1, 1)
Answer: A
Solution
Answer: (A) (0, 0, 1) Deriving the next-state equations from the flip-flop connections and simulating the state sequence starting from shows the circuit cycles through a fixed set of states. The state never appears in that reachable sequence, so it can never be obtained. - A.
- Question 44Digital Logicmcq2 marksTwo 4-input MUXes (M1, M2) and one 2-input MUX (M3), with select lines A, B, C as shown, realize a function. Which set of inputs realises ?

- A.(1, 1, 0, 0, 1, 1, 1, 0)
- B.(1, 1, 0, 0, 1, 1, 0, 1)
- C.(1, 1, 0, 1, 1, 1, 0, 0)✓
- D.(0, 0, 1, 1, 0, 1, 1, 1)
Answer: C
Solution
Answer: (C) (1, 1, 0, 1, 1, 1, 0, 0) Simplify the target: . Building the truth table of over and mapping each minterm to the corresponding multiplexer data input (M3 selects between M1 and M2 via A, each selecting via B,C) assigns the input values , matching option (C). - A.
- Question 45Computer Organization & Architecturemcq2 marksIEEE-754 single precision and . Which is in single precision?
- A.0x404C2EF4
- B.0x405C2EF4
- C.0xC15C2EF4✓
- D.0xC14C2EF4
Answer: C
Solution
Answer: (C) 0xC15C2EF4 decodes to (sign 1, exponent 131, mantissa 1.0). Multiplying by just flips the sign and adds 4 to 's exponent, leaving 's mantissa unchanged. 's exponent , sign , so the result is . - A.
- Question 46Programming & Data Structuresmcq2 marksA priority queue is a max-heap. Extract-Max deletes the max; Insert adds a key; both preserve the heap. With elements, the worst-case running times are
- A.Both O(1).
- B.Both O(log n).✓
- C.Extract-Max O(1), Insert O(n).
- D.Extract-Max O(1), Insert O(log n).
Answer: B
Solution
Answer: (B) Both O(log n) Insert appends at the end and sifts up — . Extract-Max removes the root, moves the last element to the root, and sifts down — . Both are in the worst case. - A.
- Question 47Programming & Data Structuresmcq2 marks
foo(p)returnsp->val + foo(p->left) + foo(p->right)and prints that sum. For the binary tree shown (root 10; left subtree root 5 with children 3,8; right subtree root 11 with right child 13), what does foo print when called on the root?
- A.3 8 5 13 11 10
- B.3 5 8 10 11 13
- C.3 8 16 13 24 50✓
- D.3 16 8 50 24 13
Answer: C
Solution
Answer: (C) 3 8 16 13 24 50foocomputes subtree sums and prints each AFTER recursing (post-order), printing the subtree sum:
Output: 3 8 16 13 24 50.foo(3)=3 -> prints 3 foo(8)=8 -> prints 8 foo(5)=5+3+8=16 -> prints 16 foo(13)=13 -> prints 13 foo(11)=11+0+13=24 -> prints 24 foo(10)=10+16+24=50 -> prints 50 - A.
- Question 48Discrete Mathematicsmcq2 marks, with , . A permutation separates A from B if all of A precede all of B, or all of B precede all of A. How many permutations of U separate A from B?
- A.
- B.
- C.
- D.✓
Answer: D
Solution
Answer: (D) Choose the positions for : ways; arrange the other elements in the rest: . Within the chosen ordered slots, put the -block before the -block (or vice versa): factor ; order the elements of () and of (). Total . - A.
- Question 49Discrete Mathematicsmsq2 marksis onto. Define if , with equivalence classes . Define by . Which statements are TRUE?
- A.F is NOT well-defined.
- B.F is an onto (surjective) function.✓
- C.F is a one-to-one (injective) function.✓
- D.F is a bijective function.✓
Answer: B, C, D
Solution
Answer: (B), (C) and (D) is well-defined (any two representatives of a class map to the same -value) -> (A) false. is onto because is onto (B). is injective: distinct classes have distinct -values by construction (C). Being both injective and surjective, is a bijection (D). - A.
- Question 50Computer Networksmsq2 marksmyTCP runs over 100 Mbps with RTT 150 ms and maximum segment lifetime 2 minutes. Which are valid lengths of the Sequence Number field?
- A.30 bits
- B.32 bits✓
- C.34 bits✓
- D.36 bits✓
Answer: B, C, D
Solution
Answer: (B), (C) and (D) The sequence number must not wrap within the maximum segment lifetime (120 s). Bytes sent in 120 s bytes. We need , i.e. bits . So 32, 34, 36 bits are valid; 30 bits () is too small. - A.
- Question 51Discrete Mathematicsmsq2 marksis a set, its powerset, with operation . . Which statements are correct?
- A.H is a group.✓
- B.Every element has an inverse, but H is NOT a group.
- C.For every A, the inverse of A is the complement of A.
- D.For every A, the inverse of A is A.✓
Answer: A, D
Solution
Answer: (A) and (D) (symmetric difference) is associative and commutative, the identity is (), and each is its own inverse since . So is a group (A), and the inverse of is (D), not its complement (C). - A.
- Question 52Computer Networksmsq2 marksClicking www.gate-2023.in triggers an iterative DNS lookup over a 3-tier hierarchy (nothing cached). RTT is the same to DNS servers and to the web server. The HTML has negligible transmission/rendering time and references 10 small objects on the same server. Which are CORRECT about the minimum elapsed time to fully render?
- A.7 RTTs, non-persistent HTTP with 5 parallel TCP connections.
- B.5 RTTs, persistent HTTP with pipelining.
- C.9 RTTs, non-persistent HTTP with 5 parallel TCP connections.✓
- D.6 RTTs, persistent HTTP with pipelining.✓
Answer: C, D
Solution
Answer: (C) and (D) DNS (iterative, 3-tier) takes 3 RTTs (local server queries root, TLD, authoritative). Then: - Persistent HTTP with pipelining: 1 RTT for TCP handshake + 1 RTT to fetch the HTML + 1 RTT to pipeline all 10 objects more RTTs. Total RTTs -> (D). - Non-persistent with 5 parallel connections: 1 RTT (connect) + 1 RTT (HTML), then 10 objects in 2 rounds of 5 parallel connections, each round costing 2 RTTs (connect + fetch) RTTs. Total RTTs -> (C). - A.
- Question 53Engineering Mathematicsmsq2 marksTwo fair coins are tossed. A = HEAD on both; B = HEAD on first; C = HEAD on second. Which statements are TRUE?
- A.A and B are independent.
- B.A and C are independent.
- C.B and C are independent.✓
- D.Prob(B|C) = Prob(B)✓
Answer: C, D
Solution
Answer: (C) and (D) , -> B and C independent (C), and (D). But , so A,B not independent (A false); similarly A,C not independent (B false). - A.
- Question 54Algorithmsmsq2 marksFunction 1:
while n>1: for i=1..n: x++; n=floor(n/2). Function 2:for i=1..100*n: x++. count the x++ executions. Which statements are TRUE?- A.✓
- B.
- C.
- D.✓
Answer: A, D
Solution
Answer: (A) and (D) . . Since both are : (A) and (D). They are the same order, so (B) and (C) are false. - A.
- Question 55Discrete Mathematicsmsq2 marksGreedy coloring assigns each the smallest color not used by its already-colored neighbours. is the maximum degree. Which statements are TRUE?
- A.This procedure results in a proper vertex coloring.✓
- B.The number of colors used is at most Delta(G)+1.✓
- C.The number of colors used is at most Delta(G).
- D.The number of colors used equals the chromatic number.
Answer: A, B
Solution
Answer: (A) and (B) Greedy coloring never gives two adjacent vertices the same color -> proper coloring (A). A vertex has at most neighbours, so among colors at least one is free -> at most colors (B). It may use more than and more than the chromatic number (greedy is not optimal), so (C),(D) false. - A.
- Question 56Discrete Mathematicsnat2 marks, has vertex set ; is an edge iff and ( or ). is the set of BFS visit orderings from . The cardinality of is __________
Answer: 5040
Solution
Answer: 5040 Starting BFS from (which is a subset of every other set, so is adjacent to all 7 other vertices), all 7 remaining vertices are at BFS level 1 and can be visited in any order. The number of orderings is . - Question 57Operating Systemsnat2 marks
int D[128][128]is row-major; each frame holds 512 elements; 30 frames; LRU. The code doesfor i: for j: D[j][i]*=10(column-major access). The number of page faults is __________Answer: 4096
Solution
Answer: 4096 has elements, per frame, so pages; each page holds 4 full rows (since a row is 128 elements, rows per page). The access patternD[j][i]sweeps a whole column (all 128 rows) for each , touching all 32 pages each time. With only 30 frames (LRU), every access to a page that was evicted faults. The total works out to page faults. - Question 58Operating Systemsnat2 marks57-bit virtual addressing, multi-level page tables with L levels, page size 4 KB, each PTE 8 bytes. The value of L is __________
Answer: 5
Solution
Answer: 5 Page offset bits, so the VPN is bits. One page holds entries, so each level indexes 9 bits. Levels . - Question 59Programming & Data Structuresnat2 marksSequence . Push into stack S; enqueue into queue Q; then: pop S, dequeue Q, pop S, dequeue Q; dequeue Q and push into S (repeat 3 times); pop S; pop S. The top element of S afterwards is __________
Answer: 8
Solution
Answer: 8 After the pushes S (top->bottom) = 2,9,8,7,5,1 and Q (front->back)=1,5,7,8,9,2.Top of S is 8.pop S -> 2 (S: 9 8 7 5 1) dequeue Q -> 1 (Q: 5 7 8 9 2) pop S -> 9 (S: 8 7 5 1) dequeue Q -> 5 (Q: 7 8 9 2) dequeue+push x4: move 7,8,9,2 from Q onto S -> S: 2 9 8 7 8 7 5 1 (pushes 7, then 8, then 9, then 2 on top) pop S -> 2 (S: 9 8 7 8 7 5 1) pop S -> 9 (S: 8 7 8 7 5 1) - Question 60Compiler Designnat2 marksFor the SDT computing a signed binary value (N -> I # F), the value computed for input "10#011" (rounded to three decimals) is __________
Answer: 2.374 to 2.376
Solution
Answer: 2.375 before#is the integer part "10" ; after#is the fraction ".011" . . - Question 61Databasesnat2 marksFor the Student table (rows: 1 Naman M 62, 2 Aliya F 70, 3 Aliya F 80, 4 James M 82, 5 Swati F 65), the query
SELECT * FROM Student WHERE gender='F' AND marks>65returns __________ rowsAnswer: 2
Solution
Answer: 2 Female students: Aliya(70), Aliya(80), Swati(65). Of these, marks : Aliya(70) and Aliya(80). Swati(65) is not . So 2 rows. - Question 62Databasesnat2 marksA primary-indexed ordered file has 25,000 fixed-length records of 100 bytes (primary key 15 bytes). Block size 1024 bytes, block pointer 5 bytes. Binary search on the index takes ceil(log2 b) accesses for b index blocks. The worst-case block accesses to find the block possibly containing a key is __________

Answer: 6
Solution
Answer: 6 Records per data block , so data blocks . A primary (sparse) index has one entry per data block; each index entry bytes, so entries per index block . Index blocks . Binary search block accesses. - Question 63Theory of Computationnat2 marksThe minimum number of states in a DFA for does not contain three or more consecutive 1's is __________
Answer: 4
Solution
Answer: 4 Track the number of trailing 1's: state (0 trailing 1's / reset), (one trailing 1), (two trailing 1's) — all accepting — and a dead state reached on the third consecutive 1. That is 4 states, and they are pairwise distinguishable, so 4 is minimum. - Question 64Computer Organization & Architecturenat2 marksAn 8-way set associative cache of size 64 KB is used with a 32-bit address (TAG, INDEX, BLOCK OFFSET). The number of TAG bits is __________
Answer: 19
Solution
Answer: 19 Cache size bytes, 8-way (). The sets-times-block portion is , so INDEX OFFSET bits. TAG bits (independent of the specific block size). - Question 65Computer Networksnat2 marksThe router's forwarding table: 200.150.0.0/16->1, 200.150.64.0/19->2, 200.150.68.0/24->3, 200.150.68.64/27->4, Default->0. A packet to 200.150.68.118 is forwarded to interface ID __________
Answer: 3
Solution
Answer: 3 Check matches (longest prefix wins):Longest matching prefix is /24 -> interface 3./16 200.150.0.0 -> matches (iface 1) /19 200.150.64.0 -> 68 in 64..95? yes third-octet range -> matches (iface 2) /24 200.150.68.0 -> third octet 68 matches -> matches (iface 3) /27 200.150.68.64 -> host range 64..95; 118 > 95 -> NO match
Practice the full paper with a timer
Attempt GATE CS 2023 in the exact GATE interface and get a detailed score and topic-wise analysis — free.
Create free account →