GATE CS1 Computer Science & Information Technology (CS1) Specimen Paper 2027 PDF with Solutions | SpecimenPaper
Source: specimenpaper.com — GATE Computer Science & Information Technology CS1 specimen paper, 2027. Free practice paper with worked solutions.
Computer Science & Information Technology CS1 Specimen Paper 2027
Official GATE 2025 CS1 question paper — 28 multiple-choice questions with answers verified against the official GATE answer key. Original paper published by IIT Roorkee, hosted on the official GATE website. Practice online with instant marking.
[GATE 2027 CS1, Q1] Ravi had ______ younger brother who taught at ______ university. He was widely regarded as ______ honorable man. Select the option with the correct sequence of articles to fill in the blanks.
Worked solution
Answer:
a; a; an
First blank: singular countable brother is introduced indefinitely, so use a.
Second blank: university begins with the consonant sound yu, so use a, not an.
Third blank: honorable begins with a vowel sound because the h is silent, so use an.
[GATE 2027 CS1, Q2] The CEO’s decision to downsize the workforce was considered myopic because it sacrificed long-term stability to accommodate short-term gains. Select the most appropriate option that can replace the word “myopic” without changing the meaning of the sentence.
Worked solution
Answer:
shortsighted
Identify the meaning of “myopic”: lacking foresight or concerned only with short-term matters.
Check the sentence context: downsizing sacrificed long-term stability for short-term gains, matching shortsightedness.
Compare options: visionary, progressive, and innovative are positive and imply forward thinking, opposite to myopic.
Therefore, “shortsighted” replaces “myopic” without changing the sentence’s meaning.
[GATE 2027 CS1, Q3] The average marks obtained by a class in an examination were calculated as 30.8. However, while checking the marks entered, the teacher found that the marks of one student were entered incorrectly as 24 instead of 42. After correcting the marks, the average becomes 31.4. How many students does the class have?
Worked solution
Answer:
30
Let the number of students be n. The incorrect total marks are 30.8n.
The correction increases the total by 42 minus 24, which is 18, so the new total is 30.8n + 18.
The corrected average is 31.4, so (30.8n + 18) / n = 31.4.
Solve: 30.8n + 18 = 31.4n, giving 0.6n = 18, so n = 30.
[GATE 2027 CS1, Q4] Consider the relationships among P, Q, R, S, and T: • P is the brother of Q. • S is the daughter of Q. • T is the sister of S. • R is the mother of Q. The following statements are made based on the relationships given above. (1) R is the grandmother of S. (2) P is the uncle of S and T. (3) R has only one son. (4) Q has only one daughter. Which one of the following options is correct?
Worked solution
Answer:
Both (1) and (2) are true.
R is Q's mother and Q is S's parent, so R is S's grandmother. Statement (1) is true.
P is Q's brother and male, so P is the uncle of Q's children S and T. Statement (2) is true.
T is S's sister, so Q has at least two daughters; statement (4) is false. Q's gender is unknown, so statement (3) cannot be concluded.
Therefore only statements (1) and (2) are necessarily true, matching the first option.
[GATE 2027 CS1, Q5] According to the map shown in the figure, which one of the following statements is correct? Note: The figure shown is representative. 1st Main Road Library Canteen Physics Lab Hospital 5th Cross Road Hostels Chemistry Lab N Classrooms W E S
Worked solution
Answer:
The chemistry lab is to the southeast of physics lab.
Use the compass arrow: north is up, east is right, south is down, west is left.
Locate Physics Lab and Chemistry Lab on the map.
Chemistry Lab is below and to the right of Physics Lab, so it is southeast of Physics Lab.
Check other options against map positions; they do not match the shown relative locations.
[GATE 2027 CS1, Q6] “I put the brown paper in my pocket along with the chalks, and possibly other things. I suppose every one must have reflected how primeval and how poetical are the things that one carries in one’s pocket: the pocket-knife, for instance the type of all human tools, the infant of the sword. Once I planned to write a book of poems entirely about the things in my pocket. But I found it would be too long: and the age of the great epics is past.” (From G.K. Chesterton’s “A Piece of Chalk”) Based only on the information provided in the above passage, which one of the following statements is true?
Worked solution
Answer:
The pocket-knife is described as the infant of the sword.
Read the passage and locate the exact phrase about the pocket-knife.
The passage says the pocket-knife is the type of all human tools and the infant of the sword.
Check other options: no mirror is mentioned, the planned book was about pocket things, and epics are not called inconvenient.
Therefore, only the statement about the pocket-knife matches the passage directly.
[GATE 2027 CS1, Q7] In the diagram, the lines QR and ST are parallel to each other. The shortest distance between these two lines is half the shortest distance between the point P and line QR. What is the ratio of the area of the triangle PST to the area of the trapezium SQRT? Note: The figure shown is representative. P S T Q R
Worked solution
Answer:
1 3
Let the distance between parallel lines ST and QR be d. Given d is half the distance from P to QR, the distance from P to ST is also d.
Since ST is parallel to QR and S, T lie on PQ, PR, triangles PST and PQR are similar. Their height ratio is d:2d = 1:2, so ST:QR = 1:2.
Thus area(PST):area(PQR) = 1 squared : 2 squared = 1:4. So triangle PST is 1 part and trapezium SQRT is 4 minus 1 = 3 parts.
Therefore area(PST):area(SQRT) = 1:3, so the required ratio is 1 3.
[GATE 2027 CS1, Q8] A fair six-faced dice, with the faces labelled ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, and ‘6’, is rolled thrice. What is the probability of rolling ‘6’ exactly once?
Worked solution
Answer:
75 216
Use binomial probability with n = 3 rolls, success = rolling a 6, p = 1/6, q = 5/6.
Exactly one 6 can occur in any of 3 positions, giving C(3,1) = 3 arrangements.
Probability = 3 x (1/6) x (5/6)^2 = 3 x 25/216 = 75/216.
[GATE 2027 CS1, Q10] A shop has 4 distinct flavors of ice-cream. One can purchase any number of scoops of any flavor. The order in which the scoops are purchased is inconsequential. If one wants to purchase 3 scoops of ice-cream, in how many ways can one make that purchase?
Worked solution
Answer:
20
Model the purchase as distributing 3 identical scoops among 4 distinct flavors.
Use combinations with repetition: number of ways is C(3 + 4 - 1, 4 - 1) = C(6, 3).
Compute C(6,3) = 6 x 5 x 4 / (3 x 2 x 1) = 20.
Thus, there are 20 possible purchases.
[GATE 2027 CS1, Q11] Suppose a program is running on a non-pipelined single processor computer system. The computer is connected to an external device that can interrupt the processor asynchronously. The processor needs to execute the interrupt service routine (ISR) to serve this interrupt. The following steps (not necessarily in order) are taken by the processor when the interrupt arrives: (i) The processor saves the content of the program counter. (ii) The program counter is loaded with the start address of the ISR. (iii) The processor finishes the present instruction. Which ONE of the following is the CORRECT sequence of steps?
Worked solution
Answer:
(iii), (i), (ii)
An asynchronous interrupt is recognized only at an instruction boundary, so the processor first finishes the present instruction: (iii).
After completing the current instruction, the processor saves the return address by storing the program counter contents: (i).
Finally, the program counter is loaded with the starting address of the ISR to begin interrupt handling: (ii).
[GATE 2027 CS1, Q12] Which ONE of the following statements is FALSE regarding the symbol table?
Worked solution
Answer:
Symbol table is not required after the parsing phase.
A symbol table records identifiers and their attributes, including scope information, so the first statement is true.
It can be implemented using data structures such as hash tables or binary search trees, so the second statement is true.
It is created or initialized during lexical analysis and populated as tokens are scanned, so the fourth statement is true.
The symbol table remains useful during semantic analysis and code generation, so saying it is not required after parsing is false.
[GATE 2027 CS1, Q13] Which ONE of the following techniques used in compiler code optimization uses live variable analysis?
Worked solution
Answer:
Register assignment to variables
Live variable analysis determines whether a variable's value may be used later before being redefined.
Variables live simultaneously interfere and cannot share a register, so this analysis supports register assignment.
Strength reduction and constant folding use algebraic or constant evaluation, not liveness. Run-time call management is not register allocation.
[GATE 2027 CS1, Q14] Consider a demand paging memory management system with 32-bit logical address, 20-bit physical address, and page size of 2048 bytes. Assuming that the memory is byte addressable, what is the maximum number of entries in the page table?
Worked solution
Answer:
221
Page size is 2048 bytes = 2^11 bytes, so the page offset needs 11 bits.
Logical address is 32 bits; virtual page number bits = 32 - 11 = 21.
Thus there are 2^21 possible virtual pages, requiring at most 2^21 page table entries.
[GATE 2027 CS1, Q15] A schedule of three database transactions 𝑇1 , 𝑇2 , and 𝑇3 is shown. 𝑅𝑖 (𝐴) and 𝑊𝑖 (𝐴) denote read and write of data item 𝐴 by transaction 𝑇𝑖 , 𝑖 = 1,2,3. The transaction 𝑇1 aborts at the end. Which other transaction(s) will be required to be rolled back? 𝑅1 (𝑋) 𝑊1 (𝑌) 𝑅2 (𝑋) 𝑅2 (𝑌) 𝑅3 (𝑌) 𝐴𝐵𝑂𝑅𝑇(𝑇1 )
Worked solution
Answer:
Both 𝑇2 and 𝑇3
Identify that T1 writes Y before T2 and T3 read Y.
Since T1 aborts, its write to Y is undone.
T2 read Y before T1 aborted, so T2 read dirty data and must roll back.
T3 also read the same uncommitted Y written by T1, so T3 must roll back too.
[GATE 2027 CS1, Q16] Identify the ONE CORRECT matching between the OSI layers and their corresponding functionalities as shown. OSI Layers Functionalities (a) Network layer (I) Packet routing (b) Transport layer (II) Framing and error handling (c) Datalink layer (III) Host to host communication
Worked solution
Answer:
(a)-(I), (b)-(III), (c)-(II)
Recall that the network layer is responsible for logical addressing and deciding routes between networks, so it performs packet routing: (a)-(I).
The transport layer provides end-to-end (host to host) delivery with ports and reliability, so it matches host to host communication: (b)-(III).
The data link layer handles frames, MAC addressing, and error detection/correction on a link, so it matches framing and error handling: (c)-(II).
Thus the correct matching is (a)-(I), (b)-(III), (c)-(II), which is the second option.
[GATE 2027 CS1, Q17] 𝑔(. ) is a function from 𝐴 to 𝐵, 𝑓(. ) is a function from 𝐵 to 𝐶, and their composition defined as 𝑓(𝑔(. )) is a mapping from 𝐴 to 𝐶. If 𝑓(. ) and 𝑓(𝑔(. )) are onto (surjective) functions, which ONE of the following is TRUE about the function 𝑔(. )?
Worked solution
Answer:
𝑔(. ) is not required to be a one-to-one or onto function.
Since f(g(a)) is onto C, every c in C is reached as f(g(a)) for some a in A. This only says f covers C on the set of values actually taken by g.
f being onto C does not force g to cover all of B. Also, g may map two different A elements to the same B element without breaking surjectivity of f(g(. )).
Example: A={a1,a2}, B={b1,b2}, C={c}; let g(a1)=g(a2)=b1 and f(b1)=f(b2)=c. Then f and f(g(. )) are onto, but g is neither injective nor onto.
Therefore g is not required to be one-to-one or onto; only the listed option saying no requirement is always true.
[GATE 2027 CS1, Q18] Let 𝐺 be any undirected graph with positive edge weights, and 𝑇 be a minimum spanning tree of 𝐺. For any two vertices, 𝑢 and 𝑣, let 𝑑1 (𝑢, 𝑣) and 𝑑2 (𝑢, 𝑣) be the shortest distances between 𝑢 and 𝑣 in 𝐺 and 𝑇, respectively. Which ONE of the options is CORRECT for all possible 𝐺, 𝑇, 𝑢 and 𝑣?
Worked solution
Answer:
𝑑1 (𝑢, 𝑣) ≤ 𝑑2 (𝑢, 𝑣)
T is a subgraph of G, so every u-v path in T is also a u-v path in G.
d1(u,v) is the minimum weight over all u-v paths in G.
Since this minimum is taken over a larger set of paths, it cannot exceed the T-only shortest distance d2(u,v).
Therefore d1(u,v) <= d2(u,v) always; equality may or may not occur.
[GATE 2027 CS1, Q19] Consider the following context-free grammar 𝐺, where 𝑆, 𝐴, and 𝐵 are the variables (non-terminals), 𝑎 and 𝑏 are the terminal symbols, 𝑆 is the start variable, and the rules of 𝐺 are described as: 𝑆 → 𝑎𝑎𝐵 | 𝐴𝑏𝑏 𝐴 → 𝑎 | 𝑎𝐴 𝐵 → 𝑏 | 𝑏𝐵 Which ONE of the languages 𝐿(𝐺) is accepted by 𝐺?
Worked solution
Answer:
𝑇(𝑛) = Θ(𝑛2 2𝑛 )
The displayed options and official answer correspond to the recurrence T(n)=2T(n-1)+n 2^n.
Divide by 2^n and set U(n)=T(n)/2^n, giving U(n)=U(n-1)+n.
Expand the sum U(n)=U(0)+1+2+...+n, so U(n)=Theta(n^2).
Multiply back by 2^n to obtain T(n)=Theta(n^2 2^n), matching the official answer.
[GATE 2027 CS1, Q36] Consider a memory system with 1M bytes of main memory and 16K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values? [Assume memory is byte addressable, 1K=210, 1M=220 .]
Worked solution
Answer:
6 × 210
Cache block size 16 bytes = 2^4 bytes, so block offset needs 4 bits.
Cache has 16K/16 = 1K = 2^10 blocks, so direct-map index needs 10 bits.
Address is 20 bits, so tag bits per line = 20 - 10 - 4 = 6 bits.
Total tag storage = number of lines × tag bits = 2^10 × 6 = 6 × 2^10 bits.
[GATE 2027 CS1, Q37] A processor has 64 general-purpose registers and 50 distinct instruction types. An instruction is encoded in 32-bits. What is the maximum number of bits that can be used to store the immediate operand for the given instruction? ADD R1, #25 // R1 = R1 + 25
Worked solution
Answer:
20
64 general-purpose registers require log2(64) = 6 bits to specify one register.
50 distinct instruction types require ceil(log2(50)) = 6 bits for the opcode.
ADD R1, #25 uses one register field, so immediate bits = 32 - 6 opcode bits - 6 register bits = 20.
[GATE 2027 CS1, Q38] A computer has two processors, 𝑀1 and 𝑀2 . Four processes 𝑃1 , 𝑃2 , 𝑃3 , 𝑃4 with CPU bursts of 20, 16, 25, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows: • 𝑀1 uses priority of execution for the processes as, 𝑃1 > 𝑃3 > 𝑃2 > 𝑃4 , i.e., 𝑃1 and 𝑃4 have highest and lowest priorities, respectively. • 𝑀2 uses priority of execution for the processes as, 𝑃2 > 𝑃3 > 𝑃4 > 𝑃1 , i.e., 𝑃2 and 𝑃1 have highest and lowest priorities, respectively. A process 𝑃𝑖 is scheduled to a processor 𝑀𝑘 , if the processor is free and no other process 𝑃𝑗 is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?
Worked solution
Answer:
9.00
At time 0, both processors are free. On M1, P1 has highest priority, so run P1 (20 ms). On M2, P2 has highest priority, so run P2 (16 ms).
At time 16, P2 finishes and M2 is free. Waiting processes are P3 and P4; M2 priority is P3 > P4, so run P3 on M2 from 16 to 41 ms.
At time 20, P1 finishes and M1 is free. Only P4 is waiting, so run P4 on M1 from 20 to 30 ms.
Completion times: P1=20, P2=16, P3=41, P4=30. Waiting times: 0,0,16,20. Average = (0+0+16+20)/4 = 9.00 ms.
[GATE 2027 CS1, Q39] Consider two relations describing 𝑡𝑒𝑎𝑚𝑠 and 𝑝𝑙𝑎𝑦𝑒𝑟𝑠 in a sports league: • 𝑡𝑒𝑎𝑚𝑠(𝑡𝑖𝑑, 𝑡𝑛𝑎𝑚𝑒): 𝑡𝑖𝑑, 𝑡𝑛𝑎𝑚e are team-id and team-name, respectively • 𝑝𝑙𝑎𝑦𝑒𝑟𝑠(𝑝𝑖𝑑, 𝑝𝑛𝑎𝑚𝑒, 𝑡𝑖𝑑): 𝑝𝑖𝑑, 𝑝𝑛𝑎𝑚𝑒, and 𝑡𝑖𝑑 denote player-id, player- name and the team-id of the player, respectively Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having 𝑡𝑛𝑎𝑚𝑒 as ′𝑀𝐼′?
Worked solution
Answer:
{ 𝑝. 𝑝𝑛𝑎𝑚𝑒 | 𝑝 ∈ 𝑝𝑙𝑎𝑦𝑒𝑟𝑠 ∧ ∃𝑡 (𝑡 ∈ 𝑡𝑒𝑎𝑚𝑠 ∧ 𝑝. 𝑡𝑖𝑑 = 𝑡. 𝑡𝑖𝑑 ∧ 𝑡. 𝑡𝑛𝑎𝑚𝑒 = ′𝑀𝐼′)}
Target output is player name, so tuple variable p must range over players and return p.pname.
The player must be linked to a team using the matching team id: p.tid = t.tid.
The team tuple t must range over teams and satisfy t.tname = 'MI'.
Only the first option has p in players, t in teams, the tid join, and the team-name condition.
[GATE 2027 CS1, Q40] A packet with the destination IP address 145.36.109.70 arrives at a router whose routing table is shown. Which interface will the packet be forwarded to?
Worked solution
Answer:
E3
Convert destination 145.36.109.70 and route prefixes to CIDR or binary; a route matches only if its prefix bits equal the destination's leading bits.
Apply longest-prefix match: among matching routes, choose the entry with the largest prefix length; it overrides shorter or default routes.
For 145.36.109.70, the most specific matching route points to interface E3, so the packet is forwarded to E3.
[GATE 2027 CS1, Q41] 1 1 𝐴=[ ] 1 −1 What are the eigenvalues of the matrix 𝐴13 ?
Worked solution
Answer:
64√2, −64√2
Matrix A has trace 0 and determinant -2, so its characteristic equation is lambda^2 - 2 = 0. Hence eigenvalues are sqrt(2) and -sqrt(2).
Eigenvalues of A^13 are the 13th powers of the eigenvalues of A: (sqrt(2))^13 and (-sqrt(2))^13.
(sqrt(2))^13 = 2^6 sqrt(2) = 64 sqrt(2). Because 13 is odd, (-sqrt(2))^13 = -64 sqrt(2).
So the eigenvalues of A^13 are 64 sqrt(2) and -64 sqrt(2).
[GATE 2027 CS1, Q42] Consider the following four variable Boolean function in sum-of-product form 𝐹(𝑏3 , 𝑏2 , 𝑏1 , 𝑏0 ) = ∑(0, 2, 4, 8, 10, 11, 12). where the value of the function is computed by considering 𝑏3 𝑏2 𝑏1 𝑏0 as a 4-bit binary number, where 𝑏3 denotes the most significant bit and 𝑏0 denotes the least significant bit. Note that there are no don’t care terms. Which ONE of the following options is the CORRECT minimized Boolean expression for 𝐹?
Worked solution
Answer:
𝑏̅1 𝑏̅0 + 𝑏̅2 𝑏̅0 + 𝑏1 𝑏̅2 𝑏3
Plot F as 1s at minterms 0,2,4,8,10,11,12 on a 4-variable K-map and mark all other cells 0 because no don't-cares exist.
Group the full b1=0,b0=0 column: cells 0,4,8,12 give the implicant b1' b0'.
Group the wrap-around rectangle with b2=0,b0=0: cells 0,2,8,10 give b2' b0'.
Group cells 10 and 11 with b1=1,b2=0,b3=1 to add b1 b2' b3; the minimized SOP is b1' b0' + b2' b0' + b1 b2' b3.
[GATE 2027 CS1, Q43] Let 𝐺(𝑉, 𝐸) be an undirected and unweighted graph with 100 vertices. Let 𝑑(𝑢, 𝑣) denote the number of edges in a shortest path between vertices 𝑢 and 𝑣 in 𝑉. Let the maximum value of 𝑑(𝑢, 𝑣), 𝑢, 𝑣 ∈ 𝑉 such that 𝑢 ≠ 𝑣, be 30. Let 𝑇 be any breadth- first-search tree of 𝐺. Which ONE of the given options is CORRECT for every such graph 𝐺?
Worked solution
Answer:
The height of 𝑇 is at least 15.
Let the graph diameter be 30, so some vertices a and b satisfy d(a,b)=30.
For any BFS tree T with root r, its height h equals the maximum shortest-path distance from r.
By the triangle inequality, 30 = d(a,b) <= d(a,r)+d(r,b) <= h+h = 2h.
Thus h >= 15. The height need not be exactly 15 or 30, so only 'at least 15' is guaranteed.
[GATE 2027 CS1, Q44] Consider the following two languages over the alphabet {𝑎, 𝑏}: 𝐿1 = { 𝛼𝛽𝛼 | 𝛼 ∈ {𝑎, 𝑏}+ AND 𝛽 ∈ {𝑎, 𝑏}+ } 𝐿2 = { 𝛼𝛽𝛼 | 𝛼 ∈ {𝑎}+ AND 𝛽 ∈ {𝑎, 𝑏}+ } Which ONE of the following statements is CORRECT?
Worked solution
Answer:
𝐿1 is not a regular language but 𝐿2 is a regular language.
For L1, membership needs the same nonempty block alpha to reappear at both ends, so a finite automaton would have to remember an unbounded alpha. Thus L1 is not regular.
For L2, alpha is a nonempty run of a's. Choose alpha as just one a; then any length-three-or-more string starting and ending with a is accepted.
Therefore L2 equals a(a+b)+a, which is a regular expression, so L2 is regular.
Hence L1 is not regular but L2 is regular, matching the third option.
[GATE 2027 CS1, Q45] Consider the following two languages over the alphabet {𝑎, 𝑏, 𝑐}, where 𝑚 and 𝑛 are natural numbers. 𝐿1 = {𝑎𝑚 𝑏 𝑚 𝑐 𝑚+𝑛 | 𝑚, 𝑛 ≥ 1} 𝐿2 = {𝑎𝑚 𝑏 𝑛 𝑐 𝑚+𝑛 | 𝑚, 𝑛 ≥ 1} Which ONE of the following statements is CORRECT?
Worked solution
Answer:
𝐿1 is not a context-free language but 𝐿2 is a context-free language.
Rewrite L2 as a^m b^n c^n c^m. The grammar S -> aSc | T, T -> bTc | epsilon generates it, so L2 is context-free.
Rewrite L1 as a^m b^m c^m c^n. It contains the pattern a^m b^m c^m, which needs three matched counts and cannot be handled by one stack.
Formally, apply the context-free pumping lemma to z = a^p b^p c^(2p) in L1; every valid pump changes the required relation among a, b, and c counts.
Opens your browser's print dialog — choose “Save as PDF” as the destination.
Download the official paper (PDF)
The questions above are our interactive version — answer online, get instant marking and worked solutions. Prefer the original? Download the official GATE Computer Science & Information Technologypaper straight from the exam board.
The PDF opens on the exam board's own website — we link to it, we don't host or alter it.
This Computer Science & Information Technology CS1 specimen paper for 2027 is designed to match the style, weighting and difficulty of the real GATE examination. Work through each question, choose an answer, and the full mark-scheme style solution plus an examiner tip will appear. Your answers, correct/incorrect record and past scores are stored locally in your browser, so you can return and pick up where you left off.
Need it on paper? Use Download / Print PDF above to save this paper — questions, worked solutions and examiner tips included — as a PDF you can print or keep offline. Untick “Include worked solutions” first if you want a clean question paper without the answers.