GATE Practice Set 1
GATE · 2026 · with answers and explanations
- questions
- 34
- Total marks
- 68
- Duration
- 180 minutes
- Negative marking
- −0.67
Subjects: Mathematics · Computer Science · Aptitude (Reasoning)
Question 1
Mathematics · 2 marks · −0.67What is the rank of the matrix [[1, 2, 3], [2, 4, 6], [1, 3, 5]]?
- A.1
- B.2
- C.3
- D.0
Correct answer: B
Explanation: The second row is exactly 2 times the first row, so only two rows are linearly independent. Rows 1 and 3 are independent since neither is a scalar multiple of the other, giving rank 2.
Question 2
Mathematics · 2 marks · −0.67If A is a 3x3 real matrix with eigenvalues 1, 2, and 3, what is the determinant of A?
- A.6
- B.14
- C.36
- D.9
Correct answer: A
Explanation: The determinant of a matrix equals the product of its eigenvalues. Therefore det(A) = 1 * 2 * 3 = 6.
Question 3
Mathematics · 2 marks · −0.67What is the value of the integral from 0 to 1 of x * e^x dx?
- A.1
- B.e - 1
- C.e
- D.2e - 1
Correct answer: A
Explanation: Using integration by parts with u = x and dv = e^x dx: [x*e^x] from 0 to 1 minus the integral of e^x dx from 0 to 1 = e - (e - 1) = 1.
Question 4
Mathematics · 2 marks · −0.67A fair die is rolled twice. What is the probability that the sum of the two outcomes equals 7?
- A.1/12
- B.1/6
- C.5/36
- D.7/36
Correct answer: B
Explanation: There are 36 equally likely outcomes. The pairs summing to 7 are (1,6), (2,5), (3,4), (4,3), (5,2), (6,1) — six pairs. Probability = 6/36 = 1/6.
Question 5
Mathematics · 2 marks · −0.67In the Newton-Raphson method for finding the root of f(x) = x^2 - 4 starting with x_0 = 3, what is x_1?
- A.2.0
- B.2.5
- C.13/6
- D.7/3
Correct answer: C
Explanation: Newton-Raphson formula: x_1 = x_0 - f(x_0)/f'(x_0). Here f(3) = 9 - 4 = 5 and f'(3) = 2 * 3 = 6. So x_1 = 3 - 5/6 = 13/6.
Question 6
Computer Science · 2 marks · −0.67The simplified Boolean expression for F(A, B, C) = sum of minterms (0, 2, 4, 6) is:
- A.A'
- B.B'
- C.C'
- D.A' + B'
Correct answer: C
Explanation: Minterms 0, 2, 4, 6 are exactly those where C = 0 (all even indices). The simplified expression is C' (complement of C).
Question 7
Computer Science · 2 marks · −0.67What is the output of the following C code? int x = 5; printf("%d %d %d", x, x<<1, x>>1);
- A.5 10 2
- B.5 25 1
- C.5 10 3
- D.5 20 2
Correct answer: A
Explanation: x is 5 (binary 101). Left shift by 1 gives 1010 = 10. Right shift by 1 gives 10 = 2. Output is 5 10 2.
Question 8
Computer Science · 2 marks · −0.67Consider the following C function: int f(int n) { if (n <= 1) return 1; return f(n-1) + f(n-2); } The time complexity of f(n) is:
- A.O(n)
- B.O(n log n)
- C.O(n^2)
- D.O(2^n)
Correct answer: D
Explanation: This is the naive recursive Fibonacci computation. The recurrence T(n) = T(n-1) + T(n-2) has an exponential solution, commonly cited as O(2^n).
Question 9
Computer Science · 2 marks · −0.67An array of 10 elements is sorted using insertion sort. In the worst case, how many comparisons are needed?
- A.10
- B.45
- C.90
- D.100
Correct answer: B
Explanation: Worst case for insertion sort occurs when the array is in reverse order. The number of comparisons is 1 + 2 + ... + 9 = n(n-1)/2 = 10 * 9 / 2 = 45.
Question 10
Computer Science · 2 marks · −0.67The maximum number of nodes in a binary tree of height h (where a single-node tree has height 0) is:
- A.2^h
- B.2^h - 1
- C.2^(h+1) - 1
- D.2^(h+1)
Correct answer: C
Explanation: A perfect binary tree of height h has 2^(h+1) - 1 nodes. At each level i (from 0 to h) there are 2^i nodes, and their sum is 2^(h+1) - 1.
Question 11
Computer Science · 2 marks · −0.67In a graph with V vertices and E edges represented as an adjacency list, the space complexity is:
- A.O(V^2)
- B.O(V + E)
- C.O(E^2)
- D.O(V * E)
Correct answer: B
Explanation: An adjacency list stores an array of V lists and across all lists stores a total of 2E entries for an undirected graph. The total space is O(V + E).
Question 12
Computer Science · 2 marks · −0.67Which of the following sorting algorithms has the best worst-case time complexity?
- A.Quick Sort
- B.Merge Sort
- C.Bubble Sort
- D.Insertion Sort
Correct answer: B
Explanation: Merge sort has a worst-case time complexity of O(n log n). Quick sort is O(n^2) in the worst case, and bubble sort and insertion sort are both O(n^2).
Question 13
Computer Science · 2 marks · −0.67What is the time complexity of Dijkstra's algorithm using a binary min-heap for a graph with V vertices and E edges?
- A.O(V^2)
- B.O(E log V)
- C.O((V+E) log V)
- D.O(V * E)
Correct answer: C
Explanation: With a binary min-heap, each of the V extract-min operations takes O(log V), and each of the E decrease-key operations takes O(log V), giving O((V+E) log V).
Question 14
Computer Science · 2 marks · −0.67A system has 3 processes P1, P2, P3 with burst times 10, 5, 8 arriving at time 0. What is the average waiting time under Shortest Job First (non-preemptive) scheduling?
- A.6
- B.7.67
- C.8
- D.5
Correct answer: A
Explanation: SJF order: P2(5) then P3(8) then P1(10). Waiting times: P2 = 0, P3 = 5, P1 = 13. Average = (0 + 5 + 13) / 3 = 6.
Question 15
Computer Science · 2 marks · −0.67In the Banker's algorithm for deadlock avoidance, a state is safe if and only if:
- A.No process is currently blocked
- B.There exists a safe sequence of all processes
- C.All resources are currently available
- D.No process has requested more than its maximum need
Correct answer: B
Explanation: A safe state means there exists at least one sequence in which all processes can finish without deadlock, because enough resources become available as processes complete and release their allocations.
Question 16
Computer Science · 2 marks · −0.67In a demand-paging system, if the page fault rate is p, the memory access time is m, and the page fault service time is s, the effective access time is:
- A.(1-p)*m + p*s
- B.m + p*s
- C.p*m + (1-p)*s
- D.m * s * p
Correct answer: A
Explanation: With probability (1-p) the access completes in time m (no fault), and with probability p it incurs the page fault service time s. The effective access time is (1-p)*m + p*s.
Question 17
Computer Science · 2 marks · −0.67A system uses a 32-bit virtual address space with 4 KB pages and a two-level page table. If the outer page table fits in one page and each page table entry is 4 bytes, how many bits are used for the outer page table index?
- A.10
- B.12
- C.20
- D.8
Correct answer: A
Explanation: Page offset = 12 bits (4 KB pages). Remaining 20 bits split between two levels. The outer page table fits in one 4 KB page with 4-byte entries, holding 1024 entries. So the outer index uses 10 bits.
Question 18
Computer Science · 2 marks · −0.67Which normal form is a relation in if it has no partial dependencies of non-prime attributes on candidate keys?
- A.1NF
- B.2NF
- C.3NF
- D.BCNF
Correct answer: B
Explanation: Second Normal Form (2NF) requires that a relation be in 1NF and have no partial dependency of any non-prime attribute on any candidate key.
Question 19
Computer Science · 2 marks · −0.67Which SQL query correctly finds the second highest salary from an Employee table?
- A.SELECT MAX(salary) FROM Employee WHERE salary < (SELECT MAX(salary) FROM Employee)
- B.SELECT salary FROM Employee ORDER BY salary LIMIT 2
- C.SELECT MIN(salary) FROM Employee WHERE salary > (SELECT MIN(salary) FROM Employee)
- D.SELECT salary FROM Employee WHERE ROWNUM = 2
Correct answer: A
Explanation: The subquery finds the maximum salary and the outer query finds the maximum salary strictly less than it, which is the second highest.
Question 20
Computer Science · 2 marks · −0.67In a schedule, if two transactions T1 and T2 both read and write item X, and the schedule is conflict-equivalent to some serial schedule, the schedule is said to be:
- A.View serializable
- B.Conflict serializable
- C.Recoverable
- D.Cascadeless
Correct answer: B
Explanation: Conflict serializability means the schedule is conflict-equivalent to some serial schedule. This is determined by checking whether the precedence graph is acyclic.
Question 21
Computer Science · 2 marks · −0.67In strict two-phase locking (Strict 2PL), which of the following is guaranteed?
- A.Deadlock-free execution
- B.Conflict serializability and recoverability
- C.Starvation-free execution
- D.Only conflict serializability
Correct answer: B
Explanation: Strict 2PL holds all exclusive locks until the transaction commits or aborts, guaranteeing both conflict serializability (from the 2PL property) and recoverability (from the strict property, as no dirty reads occur).
Question 22
Computer Science · 2 marks · −0.67In TCP, the three-way handshake involves which sequence of segments?
- A.SYN, ACK, FIN
- B.SYN, SYN+ACK, ACK
- C.ACK, SYN, SYN+ACK
- D.SYN, SYN, ACK
Correct answer: B
Explanation: TCP establishes a connection using a three-way handshake: the client sends SYN, the server responds with SYN+ACK, and the client sends ACK.
Question 23
Computer Science · 2 marks · −0.67If host A sends a UDP datagram of 4000 bytes (including 20-byte IP header) to host B, and the path MTU is 1500 bytes, how many IP fragments will be created?
- A.2
- B.3
- C.4
- D.5
Correct answer: B
Explanation: Payload = 4000 - 20 = 3980 bytes. Each fragment can carry at most 1500 - 20 = 1480 bytes of data (already a multiple of 8). Fragments: ceil(3980 / 1480) = 3 (1480 + 1480 + 1020).
Question 24
Computer Science · 2 marks · −0.67The regular expression (a|b)*abb accepts strings over {a, b} that:
- A.Begin with abb
- B.End with abb
- C.Contain abb as a substring
- D.Have exactly three b's
Correct answer: B
Explanation: The regex (a|b)* matches any string of a's and b's (including empty), followed by the literal suffix 'abb'. So the language consists of all strings ending in 'abb'.
Question 25
Computer Science · 2 marks · −0.67What is the minimum number of states in a DFA that accepts all binary strings representing numbers divisible by 3?
- A.2
- B.3
- C.4
- D.5
Correct answer: B
Explanation: When reading a binary number left-to-right, the remainder mod 3 can be 0, 1, or 2. Each remainder is a state, and transitions update the remainder based on the next bit. Three states are necessary and sufficient.
Question 26
Computer Science · 2 marks · −0.67Which of the following languages is NOT context-free?
- A.{a^n b^n | n >= 0}
- B.{a^n b^n c^n | n >= 1}
- C.{ww^R | w in {a,b}*}
- D.{a^n b^m | n <= m}
Correct answer: B
Explanation: The language {a^n b^n c^n | n >= 1} requires matching three symbols simultaneously, which cannot be done with a single stack. By the pumping lemma for CFLs, it is not context-free.
Question 27
Computer Science · 2 marks · −0.67The Halting Problem — determining whether a given Turing machine halts on a given input — is:
- A.Decidable and in NP
- B.Decidable and in P
- C.Undecidable
- D.Context-free but not regular
Correct answer: C
Explanation: Turing proved by diagonalization that no Turing machine can decide the halting problem for all possible inputs. It is the canonical example of an undecidable problem.
Question 28
Computer Science · 2 marks · −0.67In an LR(1) parser, a shift-reduce conflict is resolved by:
- A.Always choosing shift over reduce
- B.Using the lookahead symbol
- C.Backtracking to a previous state
- D.Applying the longest match rule
Correct answer: B
Explanation: LR(1) parsers use a one-token lookahead to decide between shifting and reducing. When the parser state contains both a shift and a reduce action, the lookahead symbol determines which applies.
Question 29
Computer Science · 2 marks · −0.67A direct-mapped cache with 64 blocks uses a 32-bit address. If the block size is 16 bytes, how many bits are used for the tag?
- A.20
- B.22
- C.24
- D.26
Correct answer: B
Explanation: Block offset = log2(16) = 4 bits. Index = log2(64) = 6 bits. Tag = 32 - 4 - 6 = 22 bits.
Question 30
Computer Science · 2 marks · −0.67In a 5-stage pipeline (IF, ID, EX, MEM, WB), a data hazard between two consecutive instructions can be resolved without stalls by using:
- A.Branch prediction
- B.Data forwarding (bypassing)
- C.Instruction reordering by the compiler only
- D.Increasing the clock speed
Correct answer: B
Explanation: Data forwarding (bypassing) routes the result from the EX or MEM stage directly to the input of the EX stage of the dependent instruction, avoiding the need to wait for the write-back stage.
Question 31
Computer Science · 2 marks · −0.67A JK flip-flop with J = 1 and K = 1 at every clock edge behaves as a:
- A.SR latch
- B.D flip-flop
- C.Toggle (T) flip-flop
- D.Transparent latch
Correct answer: C
Explanation: When J = K = 1, the JK flip-flop toggles its output on every clock edge, which divides the clock frequency by 2. This is identical to T flip-flop behavior.
Question 32
Aptitude (Reasoning) · 2 marks · −0.67Choose the word that best fills the blank: "The committee members could not reach a ______, so the decision was postponed."
- A.census
- B.consensus
- C.consent
- D.conscience
Correct answer: B
Explanation: A 'consensus' means general agreement among a group. The sentence describes a situation where agreement could not be reached, making 'consensus' the correct choice.
Question 33
Aptitude (Reasoning) · 2 marks · −0.67A company's revenue in four consecutive quarters was Rs. 120 crore, Rs. 150 crore, Rs. 90 crore, and Rs. 180 crore. What is the average quarterly revenue?
- A.Rs. 130 crore
- B.Rs. 135 crore
- C.Rs. 140 crore
- D.Rs. 145 crore
Correct answer: B
Explanation: Average = (120 + 150 + 90 + 180) / 4 = 540 / 4 = 135 crore.
Question 34
Aptitude (Reasoning) · 2 marks · −0.67A tank can be filled by pipe A in 12 hours and by pipe B in 15 hours. If both pipes are opened together, how long will it take to fill the tank?
- A.6 hours
- B.6 hours 40 minutes
- C.7 hours
- D.7 hours 30 minutes
Correct answer: B
Explanation: Combined rate = 1/12 + 1/15 = 5/60 + 4/60 = 9/60 = 3/20 of the tank per hour. Time to fill = 20/3 hours = 6 hours 40 minutes.