GATE CS 2022 — 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 markThe _________ is too high for it to be considered _________.
- A.fair / fare
- B.faer / fair
- C.fare / fare
- D.fare / fair✓
Answer: D
Solution
Answer: (D) fare / fair The first blank needs "fare" (the price/charge), which can be "too high"; the second needs "fair" (reasonable/just). So: The fare is too high for it to be considered fair. - A.
- Question 2General Aptitudemcq1 markA function on is for , for , for . The area under the curve on is
- A.
- B.
- C.✓
- D.
Answer: C
Solution
Answer: (C) Area sum of rectangle areas: - A.
- Question 3General Aptitudemcq1 markLet be a root of . The value of is
- A.51
- B.-51
- C.126
- D.-126✓
Answer: D
Solution
Answer: (D) -126 From , . Pair the factors: and . Let . Then the product . With : and , so the product - A.
- Question 4General Aptitudemcq1 markFour statements: (1) All students are inquisitive. (2) Some students are inquisitive. (3) No student is inquisitive. (4) Some students are not inquisitive. Assuming at least one student exists, which two CANNOT be true simultaneously?
- A.Statement 1 and Statement 3✓
- B.Statement 1 and Statement 2
- C.Statement 2 and Statement 4
- D.Statement 3 and Statement 4
Answer: A
Solution
Answer: (A) Statement 1 and Statement 3 "All students are inquisitive" (1) and "No student is inquisitive" (3) are contraries — with at least one student they cannot both hold. The other pairs can be simultaneously true. - A.
- Question 5General Aptitudemcq1 markA player has two plates painted with the letters shown (A and D). Using all five plates exactly once (plates can be rotated in their plane), which option of three additional plates lets the player form a five-letter palindrome?

- A.D, D(rotated), J
- B.R, A(rotated), R✓
- C.Z, E(rotated), D
- D.I, L(rotated), Y
Answer: B
Solution
Answer: (B) R, A, R Combining the two given plates (A and D) with option (B)'s plates (R, A, R) gives the letters , which arrange into the palindrome "RADAR". (Rotations let a plate be reused in its flipped orientation where needed.) None of the other option sets can form a five-letter palindrome with A and D. - A.
- Question 6General Aptitudemcq2 marksPassage: In organizations with good work culture, metrics help improve outcomes; the same metrics are counterproductive in organizations with poor work culture. Which is the CORRECT logical inference?
- A.Metrics are useful in organizations with poor work culture
- B.Metrics are useful in organizations with good work culture✓
- C.Metrics are always counterproductive in organizations with good work culture
- D.Metrics are never useful in organizations with good work culture
Answer: B
Solution
Answer: (B) Metrics are useful in organizations with good work culture The passage directly states that in organizations with good work culture, metrics help improve outcomes — i.e. they are useful there. - A.
- Question 7General Aptitudemcq2 marksBoys were 65% of those who appeared for a test; girls were the rest and accounted for 60% of the qualified candidates. Which is the correct inference?
- A.Equal number of boys and girls qualified
- B.Equal number of boys and girls appeared
- C.The number of boys who appeared is less than the number of girls who appeared
- D.The number of boys who qualified is less than the number of girls who qualified✓
Answer: D
Solution
Answer: (D) The number of boys who qualified is less than the number of girls who qualified Girls account for 60% of qualified candidates (more than half), so fewer than half of the qualified are boys. Hence fewer boys qualified than girls — even though more boys appeared. - A.
- Question 8General Aptitudemcq2 marksA box has 3 green and 2 orange balls. If a green ball is drawn, it is NOT replaced; if an orange ball is drawn, it is replaced with another orange ball. After the first draw, what is the probability of getting an orange ball in the next draw?
- A.
- B.
- C.
- D.✓
Answer: D
Solution
Answer: (D) - First draw green (): box becomes 2 green, 2 orange, so . - First draw orange (): orange is replaced by orange, box stays 3 green, 2 orange, so . Total - A.
- Question 9General Aptitudemcq2 marksThe corners and mid-points of the sides of a triangle are labelled P, Q, R, S, T, U (in some order). Given: PR is parallel to QS; P is on the side opposite corner T; S and U cannot be on the same side. Which statement is correct?
- A.P cannot be placed at a corner
- B.S cannot be placed at a corner✓
- C.U cannot be placed at a mid-point
- D.R cannot be placed at a corner
Answer: B
Solution
Answer: (B) S cannot be placed at a corner Analysing the constraints — the midpoint-segment PR being parallel to QS (a midsegment relation), P opposite corner T, and S, U on different sides — forces S to be a midpoint of a side, so S cannot occupy a corner. - A.
- Question 10General Aptitudemcq2 marksA plot with equally spaced poles (dots) must be divided among four families into similar-shaped plots. Two ropes R1 and R2 are already present and fixed. A single straight rope can pass through three aligned poles. The least number of additional straight ropes needed is

- A.2
- B.4
- C.5
- D.3✓
Answer: D
Solution
Answer: (D) 3 With the two fixed ropes R1 and R2 already in place, three more straight ropes (each passing through aligned poles) are sufficient to cut the plot into four similarly-shaped regions. Fewer than three cannot create four similar plots given the fixed ropes. - A.
- Question 11Algorithmsmcq1 markWhich one of the following statements is TRUE for all positive functions ?
- A., when is a polynomial✓
- B.
- C., when is an exponential function
- D.
Answer: A
Solution
Answer: (A) For a polynomial : and - equal, so . TRUE. (C) fails for exponentials: if then grows far faster than , so . (B) and (D) are false in general. - A.
- Question 12Theory of Computationmcq1 markWhich regular expression represents the language of the finite automaton shown?

- A.
- B.
- C.
- D.✓
Answer: D
Solution
Answer: (D) The automaton has a start state branching into two accepting loops: one reached by reading then cycling on 's (and returning via ), the other by reading then cycling on 's (returning via ). Reading the accepting paths and their self-loops yields the expression in option (D), which captures both symmetric accepting branches. - A.
- Question 13Compiler Designmcq1 markWhich one of the following statements is TRUE?
- A.The LALR(1) parser for G cannot have a reduce-reduce conflict if the LR(1) parser for G does not have a reduce-reduce conflict.
- B.Symbol table is accessed only during the lexical analysis phase.
- C.Data flow analysis is necessary for run-time memory management.
- D.LR(1) parsing is sufficient for deterministic context-free languages.✓
Answer: D
Solution
Answer: (D) Every deterministic context-free language has an LR(1) grammar, so LR(1) parsing suffices for DCFLs -> (D) true. (A) is false: merging LR(1) states in LALR(1) can introduce reduce-reduce conflicts even when LR(1) has none. (B) false (symbol table used across many phases). (C) false (data-flow analysis is for optimization, not run-time memory management). - A.
- Question 14Databasesmcq1 markIn the relational data model, which one of the following statements is TRUE?
- A.A relation with only two attributes is always in BCNF.✓
- B.If all attributes of a relation are prime, then the relation is in BCNF.
- C.Every relation has at least one non-prime attribute.
- D.BCNF decompositions preserve functional dependencies.
Answer: A
Solution
Answer: (A) A relation with only two attributes is always in BCNF A two-attribute relation can only have FDs of the form , , both, or none — in every case the determinant is a superkey, so is in BCNF. (B) false (all-prime does not guarantee BCNF); (C) false (a relation can be all-key); (D) false (BCNF decomposition may lose dependency preservation). - A.
- Question 15Programming & Data Structuresmcq1 markFor reversing a singly linked list in space, which is TRUE about the time complexity?
- A.The best algorithm takes time in the worst case.✓
- B.The best algorithm takes time.
- C.The best algorithm takes time.
- D.It is not possible to reverse a singly linked list in space.
Answer: A
Solution
Answer: (A) time in the worst case Reversing a singly linked list requires rewiring each of the pointers exactly once using three pointers (prev, curr, next) — extra space and time, which is optimal since every node must be visited. - A.
- Question 16Programming & Data Structuresmcq1 markGiven keys, slots, and two simple uniform hash functions , where is used for odd keys and for even keys, what is the expected number of keys in a slot?
- A.
- B.✓
- C.
- D.
Answer: B
Solution
Answer: (B) Each key (whether hashed by or , both simple uniform) lands in any slot with probability . By linearity of expectation, the expected load of a slot , independent of the split between odd and even keys. - A.
- Question 17Computer Organization & Architecturemcq1 markWhich facilitates transfer of bulk data from hard disk to main memory with the HIGHEST throughput?
- A.DMA based I/O transfer✓
- B.Interrupt driven I/O transfer
- C.Polling based I/O transfer
- D.Programmed I/O transfer
Answer: A
Solution
Answer: (A) DMA based I/O transfer DMA transfers blocks directly between disk and memory without CPU involvement per word, giving the highest throughput for bulk transfers. Interrupt-driven, polling, and programmed I/O all involve the CPU per word/byte and are slower. - A.
- Question 18Digital Logicmcq1 markR1 and R2 are 4-bit 2's complement registers. For R1+R2, which values give an arithmetic overflow?
- A.R1 = 1011 and R2 = 1110
- B.R1 = 1100 and R2 = 1010✓
- C.R1 = 0011 and R2 = 0100
- D.R1 = 1001 and R2 = 1111
Answer: B
Solution
Answer: (B) R1 = 1100 and R2 = 1010 Overflow in 2's complement occurs when two same-sign operands produce a different-sign result (range to ). and : sum , outside -> overflow. The others stay in range: (A) ok, (C) ok, (D) ok. - A.
- Question 19Operating Systemsmcq1 markThreads T1 (wait S3; print "C"; signal S2), T2 (wait S1; print "B"; signal S3), T3 (wait S2; print "A"; signal S1), each in a while(true) loop. Which initialization prints BCABCA...?
- A.S1 = 1; S2 = 1; S3 = 1
- B.S1 = 1; S2 = 1; S3 = 0
- C.S1 = 1; S2 = 0; S3 = 0✓
- D.S1 = 0; S2 = 1; S3 = 1
Answer: C
Solution
Answer: (C) S1 = 1; S2 = 0; S3 = 0 To print B first, T2 must run first, so S1=1 (and S2=S3=0 to block T3, T1 initially). T2 prints B, signals S3 -> T1 prints C, signals S2 -> T3 prints A, signals S1 -> T2 again... producing B,C,A,B,C,A,... So S1=1, S2=0, S3=0. - A.
- Question 20Engineering Mathematicsmcq1 markFor matrices : Statement 1: . Statement 2: . Which holds?
- A.Statement 1 is correct and Statement 2 is wrong.
- B.Statement 1 is wrong and Statement 2 is correct.
- C.Both Statement 1 and Statement 2 are correct.✓
- D.Both Statement 1 and Statement 2 are wrong.
Answer: C
Solution
Answer: (C) Both are correct The identity holds whenever both products are defined (and square). is , is , but their traces are equal. and are both with equal trace. So both statements are correct. - A.
- Question 21Programming & Data Structuresmcq1 markWhat is printed?
int x = 1, z[2] = {10, 11}; int *p = NULL; p = &x; *p = 10; p = &z[1]; *(&z[0] + 1) += 3; printf("%d, %d, %d\n", x, z[0], z[1]);- A.1, 10, 11
- B.1, 10, 14
- C.10, 14, 11
- D.10, 10, 14✓
Answer: D
Solution
Answer: (D) 10, 10, 14*p=10withp=&xsets .&z[0]+1is&z[1], so*(&z[0]+1) += 3makes . is unchanged (10). Output: "10, 10, 14". - A.
- Question 22Computer Networksmcq1 markAn enterprise network has two Ethernet segments, a web server, and a firewall, connected via three routers as shown. What is the number of subnets inside the enterprise network?

- A.3
- B.12
- C.6✓
- D.8
Answer: C
Solution
Answer: (C) 6 Each network segment (broadcast domain) is a subnet. Counting from the figure: the two Ethernet segments (2), the web-server link, and the point-to-point links joining the three routers and the firewall together form 6 distinct subnets inside the enterprise network. - A.
- Question 23Theory of Computationmsq1 markWhich statements are TRUE?
- A.Every subset of a recursively enumerable language is recursive.
- B.If a language L and its complement are both recursively enumerable, then L is recursive.✓
- C.Complement of a context-free language must be recursive.✓
- D.If L1 and L2 are regular, then L1-L2 must be deterministic context-free.✓
Answer: B, C, D
Solution
Answer: (B), (C) and (D) - (B) If and are both RE, run both semi-deciders in parallel; one halts, deciding -> recursive. True. - (C) CFLs are recursive, and recursive languages are closed under complement, so is recursive. True. - (D) Regular languages are closed under difference, so is regular, hence deterministic context-free. True. - (A) False: a subset of an RE (even of a recursive) language can be non-recursive. - A.
- Question 24Computer Organization & Architecturemsq1 markWB is a write-back and WT a write-through set-associative cache (LRU). Which statements are FALSE?
- A.Each cache block in WB and WT has a dirty bit.✓
- B.Every write hit in WB leads to a data transfer from cache to main memory.✓
- C.Eviction of a block from WT will not lead to data transfer from cache to main memory.
- D.A read miss in WB will never lead to eviction of a dirty block from WB.✓
Answer: A, B, D
Solution
Answer: (A), (B) and (D) - (A) FALSE: write-through (WT) blocks are never dirty, so WT needs no dirty bit. - (B) FALSE: in write-back, a write hit only updates the cache and sets the dirty bit; it does NOT transfer to memory each time. - (C) TRUE: WT blocks are clean, so eviction needs no write-back. - (D) FALSE: a read miss in WB can evict the LRU block, which may be dirty (then it is written back). - A.
- Question 25Databasesmsq1 markRelations Employee(eId,Name), Brand(bId,bName), Own(eId,bId). Which relational algebra expression returns the set of eIds who own ALL the brands?
- A.✓
- B.✓
- C.
- D.
Answer: A, B
Solution
Answer: (A) and (B) "Owns all brands" is relational division. (A) expresses it directly: , projected on . (B) is the standard "division via difference" formulation: , which returns exactly the employees linked to every brand. Both are correct. - A.
- Question 26Operating Systemsmsq1 markWhich statements about deadlocks are TRUE?
- A.Circular wait is a necessary condition for deadlock.✓
- B.If each resource has more than one instance, a cycle in the wait-for graph indicates a deadlock.
- C.If current allocation leads to an unsafe state, deadlock will necessarily occur.
- D.If every edge in the resource-allocation graph is an assignment edge, the system is not in deadlock.✓
Answer: A, D
Solution
Answer: (A) and (D) - (A) Circular wait is one of the four necessary (Coffman) conditions for deadlock. True. - (D) If every edge is an assignment edge (no process is waiting/requesting), no process is blocked, so no deadlock. True. - (B) False: with multiple instances, a cycle is necessary but not sufficient for deadlock. - (C) False: an unsafe state may lead to deadlock but does not guarantee it. - A.
- Question 27Discrete Mathematicsmsq1 markWhich statements are TRUE for a group ?
- A.If for all , then is commutative.✓
- B.If for all , then is commutative.✓
- C.If the order of is 2, then is commutative.✓
- D.If is commutative, then a subgroup of need not be commutative.
Answer: A, B, C
Solution
Answer: (A), (B) and (C) - (A) -> abelian. True. - (B) means every element is its own inverse; then -> abelian. True. - (C) Any group of order 2 is cyclic, hence abelian. True. - (D) False: every subgroup of an abelian group is abelian. - A.
- Question 28Programming & Data Structuresnat1 markSuppose a binary search tree with 1000 distinct elements is also a complete binary tree, stored using the array representation of binary heap trees. Assuming array indices start at 0, the 3rd largest element is stored at index __________.
Answer: 509
Solution
Answer: 509 A complete binary tree that is also a BST, stored in a 0-indexed array (heap layout), has 1000 nodes. The largest element is the right-most node of the tree; the 3rd largest is found by the in-order predecessor relationships. Working out its array position in the complete-tree layout gives index 509. - Question 29Compiler Designnat1 markConsider the augmented grammar with as terminals: ; ; ; . If , then contains exactly __________ items.
Answer: 5
Solution
Answer: 5 . Taking on "+" moves the dot past "+" in the second item: . Its closure adds the -productions and then the -productions:That is 5 items.[S -> S + . R] [R -> . R*P] [R -> . P] [P -> . (S)] [P -> . id] - Question 30Discrete Mathematicsnat1 markConsider a simple undirected graph of 10 vertices. If the graph is disconnected, the maximum number of edges it can have is __________.
Answer: 36
Solution
Answer: 36 To maximize edges while staying disconnected, make one vertex isolated and put the other 9 in a complete graph : edges . - Question 31Databasesnat1 markConsider a relation with FDs , , . The number of superkeys in is __________.
Answer: 8
Solution
Answer: 8 With FDs , , on : and never appear on a right side, so they are in every key. (via and ), so is the only candidate key. Superkeys all supersets of - Question 32Discrete Mathematicsnat1 markThe number of arrangements of six identical balls in three identical bins is __________.
Answer: 7
Solution
Answer: 7 Placing 6 identical balls in 3 identical bins counts partitions of 6 into at most 3 parts:
That is 7 arrangements.6 | 5+1 | 4+2 | 4+1+1 | 3+3 | 3+2+1 | 2+2+2 - Question 33Computer Organization & Architecturenat1 markA cache with hit rate 0.8 has access latency 10 ns and miss penalty 100 ns. An optimization raises the access latency to 15 ns (miss penalty unchanged). The minimum hit rate (two decimals) needed after the optimization so the average memory access time does not increase is __________.
Answer: 0.85
Solution
Answer: 0.85 Original AMAT access latency miss rate penalty ns. After: latency , hit rate . Require - Question 34Engineering Mathematicsnat1 markThe value of is __________.
Answer: -0.5
Solution
Answer: -0.5 . For small , , so . Hence - Question 35Computer Networksnat1 markResolving www.gate.org.in by a DNS resolver with nothing cached and iterative queries, the number of DNS query-response pairs involved is __________.
Answer: 4
Solution
Answer: 4 Resolving www.gate.org.in iteratively with nothing cached: the local resolver queries the root server (-> .in), then the .in TLD server (-> org.in), then the org.in server (-> gate.org.in), then the gate.org.in authoritative server (-> www). That is 4 query-response pairs. - Question 36Discrete Mathematicsmcq2 marksWhich is the closed form of the generating function of where if is odd, and otherwise?
- A.✓
- B.
- C.
- D.
Answer: A
Solution
Answer: (A) The sequence is . Split into the even-index part (all 1's) and odd-index part ():Checking coefficients: all match option (A). - A.
- Question 37Discrete Mathematicsmcq2 marksFor a simple undirected unweighted graph with adjacency matrix , the number of 3-cycles (triangles) equals the trace of
- A.
- B.divided by 2
- C.divided by 3
- D.divided by 6✓
Answer: D
Solution
Answer: (D) divided by 6 counts closed walks of length 3 from vertex , i.e. (triangles through ). Summing over , counts each triangle times (3 starting vertices 2 directions). So the number of triangles - A.
- Question 38Operating Systemsmcq2 marksWhich one of the following statements is FALSE?
- A.The TLB performs an associative search in parallel on all valid entries using the page number.
- B.If a virtual address has a TLB hit but the word is a cache miss, then the word is always in main memory.
- C.The memory access time using an inverted page table is always the same for all incoming virtual addresses.✓
- D.In hashed page tables, if two distinct virtual addresses hash to the same value, their memory access times will not be the same.
Answer: C
Solution
Answer: (C) — this is FALSE An inverted page table is searched (often via a hash chain) for the entry matching the virtual address, so the access time varies with the position in the table/chain — it is NOT always the same. (A), (B), and (D) are true statements. - A.
- Question 39Databasesmcq2 marksSchedule . Which serial schedule is conflict equivalent to S?
- A.✓
- B.
- C.
- D.
Answer: A
Solution
Answer: (A) Build the precedence graph from conflicting operations (same item, at least one write). Resolving the edges on and (e.g. before gives ; before and gives ; etc.) yields an acyclic graph whose topological order is . - A.
- Question 40Digital Logicmcq2 marksIn the digital display system shown, a 16-bit code word loads register X from S (a 1024-word memory) or R (a 32-word register file); mode bit M selects via T, and P, Q choose the addressed word. Which represents the functionality of P, Q, and T?

- A.P is 10:1 multiplexer; Q is 5:1 multiplexer; T is 2:1 multiplexer
- B.P is 10:2^10 decoder; Q is 5:2^5 decoder; T is 2:1 encoder
- C.P is 10:2^10 decoder; Q is 5:2^5 decoder; T is 2:1 multiplexer✓
- D.P is 1:10 de-multiplexer; Q is 1:5 de-multiplexer; T is 2:1 multiplexer
Answer: C
Solution
Answer: (C) P is 10:2^10 decoder; Q is 5:2^5 decoder; T is 2:1 multiplexer Addressing one of 1024 () words in S needs a 10-to- decoder (P); addressing one of 32 () words in R needs a 5-to- decoder (Q). The mode bit M selects between the two sources to load X, which is a 2-to-1 multiplexer (T). - A.
- Question 41Computer Organization & Architecturemcq2 marksFloating point numbers in RA=0xC1400000, RB=0x42100000, RC=0x41400000 (IEEE-754 single precision). Which one is FALSE?
- A.
- B.✓
- C.
- D.
Answer: B
Solution
Answer: (B) is FALSE Decoding: RA , RB , RC . So . - (A) . True. - (B) ? . FALSE. - (C) ? . True. - (D) . True. - A.
- Question 42Operating Systemsmcq2 marksFour processes P, Q, R, S arrive at t=0 in that order, scheduled by Round Robin with quantum 4. There is exactly one context switch S->Q, exactly one R->Q, exactly two Q->R, and no S->P. Which CPU burst times are NOT possible?
- A.P = 4, Q = 10, R = 6, S = 2
- B.P = 2, Q = 9, R = 5, S = 1
- C.P = 4, Q = 12, R = 5, S = 4
- D.P = 3, Q = 7, R = 7, S = 3✓
Answer: D
Solution
Answer: (D) P = 3, Q = 7, R = 7, S = 3 Simulating Round Robin (quantum 4) for each option and checking the required context-switch pattern (exactly one S->Q, one R->Q, two Q->R, and no S->P): option (D)'s burst times produce a schedule that violates these constraints (it does not yield exactly two Q->R switches without an S->P switch), so it is NOT possible. - A.
- Question 43Programming & Data Structuresmcq2 marksWhat is printed? (a[3][3][3] initialized row-wise with 1..27; loops over i and k with j=0, printing a[i][j][k].)
- A.1 2 3 / 10 11 12 / 19 20 21✓
- B.1 4 7 / 10 13 16 / 19 22 25
- C.1 2 3 / 4 5 6 / 7 8 9
- D.1 2 3 / 13 14 15 / 25 26 27
Answer: A
Solution
Answer: (A) 1 2 3 / 10 11 12 / 19 20 21 The array stores values in row-major order, so is element at offset . For : ; : ; : . With fixed at 0 the output is those three rows. - A.
- Question 44Programming & Data Structuresmcq2 marksWhat is printed?
char a='P', b='x'; char c=(a&b)+'*'; char d=(a|b)-'-'; char e=(a^b)+'+'; printf("%c %c %c", c, d, e);(ASCII: P=80, x=120, *=42, -=45, +=43)- A.z K S✓
- B.122 75 83
- C.* - +
- D.P x +
Answer: A
Solution
Answer: (A) z K S ASCII: P=80 (01010000), x=120 (01111000). - ; 'z'. - ; 'K'. - ; 'S'. Printed as characters: "z K S". - A.
- Question 45Engineering Mathematicsmcq2 marksSolving the system by LU decomposition (; ; ), with unit lower-triangular and upper-triangular, which is the correct combination of , , and ?
- A.
- B.
- C.
- D.✓
Answer: D
Solution
Answer: (D) Doolittle LU on the coefficient matrix: row 2 row 1 gives multiplier , and row 3 row 1 gives , updating . Eliminating column 2 in row 3 gives and the final pivot . Forward/back substitution then yields . - A.
- Question 46Theory of Computationmsq2 marksWhich of the following is/are undecidable?
- A.Given Turing machines M1, M2, decide if L(M1)=L(M2).✓
- B.Given a Turing machine M, decide if L(M) is regular.✓
- C.Given a Turing machine M, decide if M accepts all strings.✓
- D.Given a Turing machine M, decide if M takes more than 1073 steps on every string.
Answer: A, B, C
Solution
Answer: (A), (B) and (C) Equivalence of two TMs (A), whether is regular (B), and whether accepts all strings / (C) are all undecidable (by Rice's theorem for the language properties, and reduction for equivalence). (D) is DECIDABLE: run for 1073 steps on all strings up to length 1073 — a finite check determines whether it ever halts within 1073 steps. - A.
- Question 47Theory of Computationmsq2 marksand . Which is TRUE?
- A.L1 and L2 are regular.✓
- B.L1 and L2 are context-free.✓
- C.L1 is regular and L2 is context-free.✓
- D.L1 and L2 are context-free but not regular.
Answer: A, B, C
Solution
Answer: (A), (B) and (C) Both languages are in fact REGULAR. - : taking already gives all strings that start and end with 'a' (with a non-empty middle), so collapses to a regular language. - : taking , for a single char - i.e. every string of length whose first and last characters are equal - which is regular. Since both are regular (hence also context-free): (A) both regular, (B) both context-free, and (C) L1 regular and L2 context-free are all TRUE; (D) is false because L1 is regular. - A.
- Question 48Theory of Computationmsq2 marks, , . Which statements are FALSE?
- A.L1 is not context-free but L2 and L3 are deterministic context-free.
- B.Neither L1 nor L2 is context-free.✓
- C.L2, L3 and L2 ∩ L3 all are context-free.✓
- D.Neither L1 nor its complement is context-free.✓
Answer: B, C, D
Solution
Answer: (B), (C) and (D) is not context-free; are deterministic context-free (single matching). is NOT context-free. - (A) True (as stated). - (B) FALSE: IS context-free. - (C) FALSE: is not context-free. - (D) FALSE: the complement of IS context-free (a known result). So (B), (C), (D) are the false statements. - A.
- Question 49Algorithmsmsq2 marksis a simple undirected weighted graph with all distinct edge weights. Which statements about its MSTs are TRUE?
- A.The edge with the second smallest weight is always part of any MST.✓
- B.One or both of the edges with the third and fourth smallest weights are part of any MST.✓
- C.The minimum-weight edge crossing any non-trivial cut (S, V\S) is always part of any MST.✓
- D.G can have multiple MSTs.
Answer: A, B, C
Solution
Answer: (A), (B) and (C) With all distinct weights the MST is unique, so (D) is false. By the cut property, the lightest edge across any cut is in the MST (C). The two globally smallest edges are always in the MST (they cannot form a cycle alone), so the second-smallest is included (A). Among the third and fourth smallest, at least one must join without forming a cycle, so (B) holds. - A.
- Question 50Discrete Mathematicsmsq2 marksThe Petersen graph is shown. Which statements are TRUE?

- A.The chromatic number of the graph is 3.✓
- B.The graph has a Hamiltonian path.✓
- C.The second graph shown is isomorphic to the Petersen graph.✓
- D.The size of the largest independent set is 3.
Answer: A, B, C
Solution
Answer: (A), (B) and (C) The Petersen graph has chromatic number 3 (A) and a Hamiltonian path though no Hamiltonian cycle (B); the second drawing is a standard isomorphic redrawing of it (C). Its maximum independent set has size 4, not 3, so (D) is false. - A.
- Question 51Algorithmsmsq2 marksThe recurrence , for , for . Which statements are TRUE?
- A.✓
- B.✓
- C.✓
- D.
Answer: A, B, C
Solution
Answer: (A), (B) and (C) Computing values: - (A) : TRUE. - (B) : . TRUE. - (C) : , TRUE. - (D) : but , so FALSE. Hence (A), (B), (C). - A.
- Question 52Discrete Mathematicsmsq2 marksWhich properties hold for the adjacency matrix of a simple undirected unweighted graph with vertices?
- A.The diagonal entries of are the degrees of the vertices.✓
- B.If the graph is connected, then no entry of can be zero.
- C.If the sum of all elements of is at most , then the graph must be acyclic.
- D.If there is at least a 1 in each row and column of , then the graph must be connected.
Answer: A
Solution
Answer: (A) - (A) - the diagonal of gives the degrees. TRUE. - (B) FALSE: counts walks of length exactly ; in a connected bipartite graph some vertex pairs have no walk of that exact length (parity), so entries of can be zero. - (C) FALSE: sum means at most edges, but the graph can still contain a cycle (in one component while another part is disconnected). - (D) FALSE: a 1 in every row and column only rules out isolated vertices; the graph can still be disconnected (e.g. two separate edges). - A.
- Question 53Engineering Mathematicsmsq2 marksWhich of the following is/are eigenvector(s) of the matrix ?
- A.✓
- B.
- C.✓
- D.✓
Answer: A, C, D
Solution
Answer: (A), (C) and (D) Multiply by each vector: - -> eigenvector (eigenvalue 1). (A) True. - , not a scalar multiple. (B) False. - -> eigenvector (eigenvalue 3). (C) True. - -> eigenvector (eigenvalue 3). (D) True. - A.
- Question 54Computer Organization & Architecturemsq2 marksA 2 KB direct-mapped data cache with 64-byte blocks, 64 KB physical address space, 16-bit words. Words P,Q,R,S are accessed as PQRSPQRS... (40 accesses). Addresses: P=0xA248, Q=0xC28A, R=0xCA8A, S=0xA262. Which statements are TRUE?
- A.Every access to S is a hit.✓
- B.Once P is brought to the cache it is never evicted.✓
- C.At the end only R and S reside in the cache.
- D.Every access to R evicts Q from the cache.✓
Answer: A, B, D
Solution
Answer: (A), (B) and (D) sets (offset 6 bits, index 5 bits). Computing the set index of each address: P (0xA248) and S (0xA262) map to the SAME set and the same 64-byte block; Q (0xC28A) and R (0xCA8A) map to the same set but DIFFERENT blocks (so they conflict). - (A) S shares P's block, so after P is loaded every access to S hits. TRUE. - (B) Only P/S map to P's set with no conflicting block, so P is never evicted. TRUE. - (C) FALSE: P's block stays resident, so it is not "only R and S". - (D) Q and R thrash the same set, so each R access evicts Q. TRUE. - A.
- Question 55Computer Networksmsq2 marksRouting table subnets: 12.20.164.0/22 (R1), 12.20.170.0/23 (R2), 12.20.168.0/23 (Interface 0), 12.20.166.0/23 (Interface 1), default (R3). Which CIDR prefixes can collectively aggregate all these subnets?
- A.12.20.164.0/20
- B.12.20.164.0/22✓
- C.12.20.164.0/21
- D.12.20.168.0/22✓
Answer: B, D
Solution
Answer: (B) and (D) The subnets span 12.20.164.0 through 12.20.171.255. The clean aggregates are 12.20.164.0/22 (covers 164-167) and 12.20.168.0/22 (covers 168-171); together (B) and (D) exactly cover 164-171. Option (C) 12.20.164.0/21 actually aligns to 160.0/21 (covering 160-175), over-covering addresses outside the table, so it is not a correct tight aggregate. - A.
- Question 56Databasesnat2 marksSchemas: Student(sNo,sName,dNo), Dept(dNo,dName), Course(cNo,cName,dNo), Register(sNo,cNo). The query
SELECT * FROM Student AS S WHERE NOT EXISTS (SELECT cNo FROM Course WHERE dNo='D01' EXCEPT SELECT cNo FROM Register WHERE sNo=S.sNo)returns __________ rows (students registered for every D01 course).Answer: 2
Solution
Answer: 2 The query uses the "NOT EXISTS ... EXCEPT" pattern to find students who are registered for every course offered by department D01 (relational division). Evaluating against the given instance, exactly 2 students satisfy this, so 2 rows are returned. - Question 57Computer Networksnat2 marksNetwork with routers P-Q-R (links cost 1). After distance-vector routing converges, link Q-R fails. P and Q send updates at random times at equal rates. The probability (one decimal) of a routing loop (count-to-infinity) forming between P and Q is __________.
Answer: 0.5
Solution
Answer: 0.5 Network P-Q-R (unit link costs); after link Q-R fails, P and Q send updates at random times at equal rates. A routing loop (count-to-infinity) forms only if Q advertises to P (based on the now-stale route) before P can inform Q. With both equally likely to send first, the probability of the loop-forming order is . - Question 58Algorithmsnat2 marksDirected graph , , for . A directed spanning tree rooted at has a directed path from to every vertex. The number of such directed spanning trees rooted at vertex 5 is __________.
Answer: 24
Solution
Answer: 24 The adjacency matrix has for (a lower-triangular reachability). A directed spanning tree rooted at vertex 5 must have a path from 5 to every other vertex; counting the valid arborescences rooted at 5 in this DAG-like structure gives 24. - Question 59Computer Networksnat2 marksA 100 Mbps link connects an earth station to a satellite at altitude 2100 km (signal speed m/s). The time (ms, two decimals) for the receiver to completely receive a 1000-byte packet is __________.
Answer: 7.07 to 7.09
Solution
Answer: 7.08 Transmission time ms. Propagation ms. The receiver fully receives the packet at transmission propagation ms. - Question 60Computer Networksnat2 marksFor TCP over a 1 Gbps link with maximum segment lifetime 60 s, the minimum number of bits for the sequence number field (to prevent wrap-around during MSL) is __________.
Answer: 33
Solution
Answer: 33 Bytes sent in one MSL . The sequence number must not wrap: , so bits - Question 61Computer Organization & Architecturenat2 marksX1 (2 GHz, 5-stage RISC, base CPI 1) runs P with 30% branches, each causing a 2-cycle stall. X2 (same clock) adds a predictor eliminating stalls for correct predictions (no effect on mispredictions). With 80% accuracy, the speedup (two decimals) of X2 over X1 on P is __________.
Answer: 1.42 to 1.45
Solution
Answer: 1.43 X1 CPI (30% branches, 2-cycle stall each). X2 with 80% prediction accuracy: only the 20% mispredicted branches stall: CPI . Speedup (same clock). - Question 62Programming & Data Structuresnat2 marksQueue has four elements (1,2,3,4; 1 at head), empty. Only Enqueue and Dequeue are allowed. The minimum number of Enqueue operations on required to place 's elements into in reverse order without extra storage is __________.
Answer: 0
Solution
Answer: 0 With only Enqueue/Dequeue on and (FIFO queues) and no additional storage, it is impossible to reverse the order of the elements — any sequence of moves preserves relative order. So the minimum number of enqueue operations that could achieve the reversal is 0 (the task cannot be done, hence no valid positive count). - Question 63Operating Systemsnat2 marksFile systems A (contiguous) and B (linked) each store a 100-block file. A new block (data in memory) is inserted between the 50th and 51st block, with free blocks at the end and FCBs in memory. If are the disk accesses for A and B, then is __________.
Answer: 153
Solution
Answer: 153 To insert a block between the 50th and 51st block of a 100-block file: - Contiguous (A): shift blocks 51-100 (50 blocks) one position forward — read each and write each (), plus write the new block, plus ... giving disk accesses. - Linked (B): traverse to the 50th block and relink — accesses (read the 50th block, write the new block, write the updated pointer). - Question 64Operating Systemsnat2 marksA demand-paging system with four frames (initially empty) and LRU, for the reference string 7,2,7,3,2,5,3,4,6,7,7,1,5,6,1, has page-fault rate (faults/accesses, one decimal) equal to __________.
Answer: 0.6
Solution
Answer: 0.6 Reference string (15 accesses), 4 frames, LRU:Counting the faults gives 9 faults over 15 accesses: page-fault rate7,2 -> faults ; 7 hit ; 3 -> fault ; 2 hit ; 5 -> fault (frames full) 3 hit ; 4 -> fault (evict LRU) ; 6 -> fault ; 7 -> fault ; 7 hit ; 1 -> fault ; 5 -> fault ; 6 hit? ... 1 hit - Question 65Compiler Designnat2 marksGrammar with rules: ; ; ; ; (# and % are operators, id an integer). The computed for the root of the parse tree of is __________.
Answer: 80
Solution
Answer: 80 Rules: (so # means multiply) and (so % means divide), left-associative with % binding tighter than #. Expression groups as :10 % 5 = 2 8 % 2 % 2 = (8/2)/2 = 2 20 * 2 * 2 = 80
Practice the full paper with a timer
Attempt GATE CS 2022 in the exact GATE interface and get a detailed score and topic-wise analysis — free.
Create free account →