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.67

What is the rank of the matrix [[1, 2, 3], [2, 4, 6], [1, 3, 5]]?

  1. A.1
  2. B.2
  3. C.3
  4. 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.67

If A is a 3x3 real matrix with eigenvalues 1, 2, and 3, what is the determinant of A?

  1. A.6
  2. B.14
  3. C.36
  4. 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.67

What is the value of the integral from 0 to 1 of x * e^x dx?

  1. A.1
  2. B.e - 1
  3. C.e
  4. 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.67

A fair die is rolled twice. What is the probability that the sum of the two outcomes equals 7?

  1. A.1/12
  2. B.1/6
  3. C.5/36
  4. 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.67

In the Newton-Raphson method for finding the root of f(x) = x^2 - 4 starting with x_0 = 3, what is x_1?

  1. A.2.0
  2. B.2.5
  3. C.13/6
  4. 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.67

The simplified Boolean expression for F(A, B, C) = sum of minterms (0, 2, 4, 6) is:

  1. A.A'
  2. B.B'
  3. C.C'
  4. 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.67

What is the output of the following C code? int x = 5; printf("%d %d %d", x, x<<1, x>>1);

  1. A.5 10 2
  2. B.5 25 1
  3. C.5 10 3
  4. 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.67

Consider 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:

  1. A.O(n)
  2. B.O(n log n)
  3. C.O(n^2)
  4. 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.67

An array of 10 elements is sorted using insertion sort. In the worst case, how many comparisons are needed?

  1. A.10
  2. B.45
  3. C.90
  4. 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.67

The maximum number of nodes in a binary tree of height h (where a single-node tree has height 0) is:

  1. A.2^h
  2. B.2^h - 1
  3. C.2^(h+1) - 1
  4. 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.67

In a graph with V vertices and E edges represented as an adjacency list, the space complexity is:

  1. A.O(V^2)
  2. B.O(V + E)
  3. C.O(E^2)
  4. 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.67

Which of the following sorting algorithms has the best worst-case time complexity?

  1. A.Quick Sort
  2. B.Merge Sort
  3. C.Bubble Sort
  4. 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.67

What is the time complexity of Dijkstra's algorithm using a binary min-heap for a graph with V vertices and E edges?

  1. A.O(V^2)
  2. B.O(E log V)
  3. C.O((V+E) log V)
  4. 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.67

A 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?

  1. A.6
  2. B.7.67
  3. C.8
  4. 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.67

In the Banker's algorithm for deadlock avoidance, a state is safe if and only if:

  1. A.No process is currently blocked
  2. B.There exists a safe sequence of all processes
  3. C.All resources are currently available
  4. 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.67

In 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:

  1. A.(1-p)*m + p*s
  2. B.m + p*s
  3. C.p*m + (1-p)*s
  4. 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.67

A 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?

  1. A.10
  2. B.12
  3. C.20
  4. 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.67

Which normal form is a relation in if it has no partial dependencies of non-prime attributes on candidate keys?

  1. A.1NF
  2. B.2NF
  3. C.3NF
  4. 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.67

Which SQL query correctly finds the second highest salary from an Employee table?

  1. A.SELECT MAX(salary) FROM Employee WHERE salary < (SELECT MAX(salary) FROM Employee)
  2. B.SELECT salary FROM Employee ORDER BY salary LIMIT 2
  3. C.SELECT MIN(salary) FROM Employee WHERE salary > (SELECT MIN(salary) FROM Employee)
  4. 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.67

In 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:

  1. A.View serializable
  2. B.Conflict serializable
  3. C.Recoverable
  4. 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.67

In strict two-phase locking (Strict 2PL), which of the following is guaranteed?

  1. A.Deadlock-free execution
  2. B.Conflict serializability and recoverability
  3. C.Starvation-free execution
  4. 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.67

In TCP, the three-way handshake involves which sequence of segments?

  1. A.SYN, ACK, FIN
  2. B.SYN, SYN+ACK, ACK
  3. C.ACK, SYN, SYN+ACK
  4. 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.67

If 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?

  1. A.2
  2. B.3
  3. C.4
  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.67

The regular expression (a|b)*abb accepts strings over {a, b} that:

  1. A.Begin with abb
  2. B.End with abb
  3. C.Contain abb as a substring
  4. 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.67

What is the minimum number of states in a DFA that accepts all binary strings representing numbers divisible by 3?

  1. A.2
  2. B.3
  3. C.4
  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.67

Which of the following languages is NOT context-free?

  1. A.{a^n b^n | n >= 0}
  2. B.{a^n b^n c^n | n >= 1}
  3. C.{ww^R | w in {a,b}*}
  4. 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.67

The Halting Problem — determining whether a given Turing machine halts on a given input — is:

  1. A.Decidable and in NP
  2. B.Decidable and in P
  3. C.Undecidable
  4. 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.67

In an LR(1) parser, a shift-reduce conflict is resolved by:

  1. A.Always choosing shift over reduce
  2. B.Using the lookahead symbol
  3. C.Backtracking to a previous state
  4. 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.67

A 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?

  1. A.20
  2. B.22
  3. C.24
  4. 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.67

In a 5-stage pipeline (IF, ID, EX, MEM, WB), a data hazard between two consecutive instructions can be resolved without stalls by using:

  1. A.Branch prediction
  2. B.Data forwarding (bypassing)
  3. C.Instruction reordering by the compiler only
  4. 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.67

A JK flip-flop with J = 1 and K = 1 at every clock edge behaves as a:

  1. A.SR latch
  2. B.D flip-flop
  3. C.Toggle (T) flip-flop
  4. 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.67

Choose the word that best fills the blank: "The committee members could not reach a ______, so the decision was postponed."

  1. A.census
  2. B.consensus
  3. C.consent
  4. 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.67

A 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?

  1. A.Rs. 130 crore
  2. B.Rs. 135 crore
  3. C.Rs. 140 crore
  4. 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.67

A 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?

  1. A.6 hours
  2. B.6 hours 40 minutes
  3. C.7 hours
  4. 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.

View all papers — GATE

Practice this paper with a timer

Attempt it online, get scored instantly, and see which subjects are costing you marks.

Start practising free