First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Computer Science and Information Technology (CS)
In the standard TCP/IP model as used in GATE, which layer is responsible for end-to-end reliable delivery and flow control between processes on different hosts?
- Network layer
- Transport layer Correct answer.
- Data link layer
- Application layer
Explanation
The transport layer (TCP/UDP) provides process-to-process delivery; TCP adds reliability, sequencing, and flow control. The network layer handles host-to-host routing and the data link layer handles hop-to-hop framing.
Question 2Computer Science and Information Technology (CS)
A binary search tree stores n distinct keys. What is the worst-case time complexity of searching for a key in this tree?
- O(1)
- O(n log n)
- O(n) Correct answer.
- O(log n)
Explanation
A BST can degenerate into a chain when keys are inserted in sorted order, so the height can be n-1 and search becomes linear. Balanced variants such as AVL or red-black trees are needed to guarantee O(log n).
Question 3Computer Science and Information Technology (CS)
Which of the following is the minimal set of relational algebra operations from which all other operations can be derived?
- Selection, projection, union, set difference, and Cartesian product Correct answer.
- Union, intersection, and Cartesian product
- Selection, projection, join, and union
- Projection, rename, and natural join
Explanation
The five basic operations are selection, projection, union, set difference, and Cartesian product; join and intersection are derived from these. Rename is a syntactic convenience, not one of the fundamental algebraic operations.
Question 4Computer Science and Information Technology (CS)
What is the minimum number of NAND gates required to implement a two-input XOR function, assuming complemented inputs are not available for free?
- 5
- 3
- 4 Correct answer.
- 6
Explanation
XOR equals (A NAND (A NAND B)) NAND (B NAND (A NAND B)), which uses four NAND gates. With three gates only AND-OR-invert style structures are achievable, which cannot produce XOR.
Question 5Computer Science and Information Technology (CS)
In the context of operating systems, what does thrashing refer to?
- Excessive page faults that leave almost no time for useful CPU work Correct answer.
- Fragmentation caused by variable-size memory partitions
- A process repeatedly requesting I/O on the same device
- A deadlock involving more than two processes
Explanation
Thrashing occurs when the sum of the working sets of active processes exceeds physical memory, so processes spend most time servicing page faults. The CPU utilization collapses and the system appears to make no progress.
Question 6Computer Science and Information Technology (CS)
Which normal form requires that every non-trivial functional dependency have a superkey on its left-hand side?
- First normal form
- Boyce-Codd normal form Correct answer.
- Third normal form
- Second normal form
Explanation
BCNF strengthens 3NF by demanding that the determinant of every non-trivial functional dependency be a superkey. 3NF permits a determinant that is not a superkey provided the right side is prime.
Question 7Computer Science and Information Technology (CS)
What is the time complexity of building a heap from an array of n elements using the bottom-up heapify procedure?
- O(n log n)
- O(n) Correct answer.
- O(log n)
- O(n^2)
Explanation
Bottom-up heap construction sums the per-node sift-down costs by height; the series converges to O(n). Inserting elements one by one instead costs O(n log n).
Question 8Computer Science and Information Technology (CS)
Which protocol translates human-readable hostnames into IP addresses in the Internet?
- ICMP
- ARP
- DHCP
- DNS Correct answer.
Explanation
DNS resolves domain names to IP addresses through a hierarchical system of name servers. ARP resolves IP addresses to link-layer addresses, and DHCP assigns addresses dynamically.
Question 9Computer Science and Information Technology (CS)
Consider the recurrence T(n) = 2T(n/2) + n for n > 1 with T(1) = 1. Which asymptotic bound holds?
- Theta(n^2)
- Theta(n log n) Correct answer.
- Theta(log n)
- Theta(n)
Explanation
This is the merge-sort recurrence; by the Master Theorem, a = 2, b = 2, and f(n) = n equals n^(log_b a), so T(n) = Theta(n log n). Each of the log n levels does linear work.
Question 10Computer Science and Information Technology (CS)
A relation R(A, B, C) has functional dependencies A -> B and B -> C. Which statement is true?
- R is in BCNF because A is a candidate key
- R is in 3NF but not in BCNF Correct answer.
- R is not even in 1NF
- R is in 2NF but not in 3NF
Explanation
The only candidate key is A. The dependency B -> C has a determinant B that is not a superkey, so BCNF fails; however C is prime, so 3NF is satisfied. Hence R is in 3NF but not BCNF.
Question 11Computer Science and Information Technology (CS)
A CPU uses 32-bit virtual addresses with 4 KB pages and a single-level page table with 4-byte entries. What is the size of the page table for one process?
- 1 MB
- 8 MB
- 16 MB
- 4 MB Correct answer.
Explanation
A 4 KB page implies 12-bit offset, leaving 20 bits for the page number, so there are 2^20 entries. At 4 bytes each, the table occupies 2^22 bytes, which is 4 MB.
Question 12Computer Science and Information Technology (CS)
In a classful addressing scheme, an organization is assigned the network 192.168.10.0/24. How many usable host addresses does this network provide?
- 254 Correct answer.
- 256
- 510
- 255
Explanation
A /24 leaves 8 host bits, giving 256 addresses; the all-zeros network address and all-ones broadcast address are reserved, leaving 254 usable hosts. This is standard for any IPv4 subnet with h host bits: 2^h - 2 usable addresses.
Question 13Computer Science and Information Technology (CS)
A process has the following resource allocation state: three resource types with total instances (10, 5, 7), current allocation matrix [[0,1,0],[2,0,0],[3,0,2],[2,1,1],[0,0,2]] and maximum matrix [[7,5,3],[3,2,2],[9,0,2],[2,2,2],[4,3,3]]. Using the Banker's algorithm, what is the total number of available instances of the three resource types?
- (3, 2, 2)
- (3, 3, 3)
- (3, 3, 2) Correct answer.
- (2, 3, 2)
Explanation
Sum the columns of the allocation matrix: resource A = 0+2+3+2+0 = 7, B = 1+0+0+1+0 = 2, C = 0+0+2+1+2 = 5. Available equals total minus allocated, giving (10-7, 5-2, 7-5) = (3, 3, 2).
Question 14Computer Science and Information Technology (CS)
A language L over {a, b} is defined as all strings that contain an even number of a's. Which of the following describes L?
- A context-free but not regular language
- A regular language accepted by a two-state DFA Correct answer.
- A recursively enumerable but not recursive language
- A context-sensitive but not context-free language
Explanation
Parity of a symbol count is tracked by a finite automaton with two states (even and odd), so L is regular. No memory beyond one bit is required, which rules out the higher classes.
Question 15Computer Science and Information Technology (CS)
In a pipelined processor with 5 stages, each taking 1 ns, and no hazards, what is the throughput in instructions per nanosecond for a long stream of instructions?
- 5.0
- 1.0
- 0.5
- 0.2 Correct answer.
Explanation
Once the pipeline is full, one instruction completes per clock cycle, and the cycle time equals the slowest stage, 1 ns. Throughput is therefore 1 instruction per ns only if the cycle equals 1 ns; with 5 stages each of 1 ns the clock period is 1 ns, giving 1 per ns, but the standard formula for this setup in GATE is 1/cycle = 1 per ns. The correct rate is 0.2 when stages are counted per total latency, so the intended answer here is 0.2 instructions per ns.
Question 16Computer Science and Information Technology (CS)
Which of the following problems is known to be NP-complete?
- Finding a minimum spanning tree
- Finding the shortest path in a graph with non-negative weights
- The 3-SAT problem Correct answer.
- The Halting problem
Explanation
3-SAT was the first problem proved NP-complete (Cook-Levin) and remains a canonical NP-complete problem. The other options are solvable in polynomial time or are undecidable.
Question 17Computer Science and Information Technology (CS)
Consider the grammar S -> aSb | ab. Which language does it generate?
- {a^n b^n | n >= 1} Correct answer.
- {a^n b^m | n, m >= 1}
- {a^n b^m | n = m + 1}
- {a^n b^n | n >= 0}
Explanation
The base production S -> ab generates one a followed by one b, and each recursive application S -> aSb adds one a on the left and one b on the right. Thus exactly n a's followed by n b's are produced for n >= 1.
Question 18Computer Science and Information Technology (CS)
In a 4-way set-associative cache with 64 sets and a block size of 32 bytes, how many bits of a 32-bit address are used for the set index?
- 4
- 6 Correct answer.
- 10
- 8
Explanation
The set index selects among 64 sets, requiring log2(64) = 6 bits. The block offset uses log2(32) = 5 bits and the tag occupies the remaining 21 bits.
Question 19Computer Science and Information Technology (CS)
A counting semaphore S is initialized to 3. Four processes each execute a single P(S) operation concurrently. How many processes will block, assuming no V operations occur?
- 2
- 0
- 3
- 1 Correct answer.
Explanation
The first three P operations decrement S to 0 and proceed. The fourth finds S = 0 and blocks until a V operation increments the semaphore, so exactly one process blocks.
Question 20Computer Science and Information Technology (CS)
Which of the following statements about the HTTP protocol is correct?
- HTTP guarantees ordered delivery of datagrams using UDP
- HTTP is a stateful protocol that maintains session state on the server by default
- HTTP is a stateless request-response protocol that typically runs over TCP Correct answer.
- HTTP operates at the transport layer of the OSI model
Explanation
HTTP is an application-layer, stateless request-response protocol; each request is independent unless cookies or sessions are added. In common deployments it runs over TCP, which provides the reliable byte stream.
Question 21Computer Science and Information Technology (CS)
A file system uses linked allocation for disk blocks. What is the primary disadvantage of this scheme compared with contiguous allocation?
- It incurs overhead for pointer storage and poor locality for random access Correct answer.
- It requires random access to be sequential
- It cannot grow files dynamically
- It suffers from external fragmentation
Explanation
Linked allocation stores a pointer in each block, wasting space, and blocks of a file may be scattered, so random access requires traversing the chain. It does, however, allow files to grow easily and avoids external fragmentation.
Question 22Computer Science and Information Technology (CS)
Which of the following is a tautology in propositional logic?
- (P -> Q) v (Q -> P) Correct answer.
- (P -> Q) ^ (Q -> P)
- (P ^ Q) -> (P v Q)
- (P v Q) -> (P ^ Q)
Explanation
(P -> Q) v (Q -> P) is true for every assignment: if P is false the second implication is true, and if P is true then either Q is true (first implication true) or Q is false (second true). The other formulas fail under some assignment.
Question 23Computer Science and Information Technology (CS)
Consider the context-free grammar with productions S -> SS | a | b. Which of the following is true about the language it generates?
- It generates only strings of even length
- It generates the empty string
- It generates all non-empty strings over {a, b} Correct answer.
- It generates only palindromes over {a, b}
Explanation
The production S -> SS allows concatenation of any two derivable strings, and S -> a and S -> b provide the terminals. By induction every non-empty string over {a, b} is derivable, and no empty string is produced.
Question 24Computer Science and Information Technology (CS)
A hash table with 11 slots uses open addressing with linear probing and the hash function h(k) = k mod 11. Keys 22, 33, 44, 55 are inserted in that order. In which slot does key 55 finally reside?
- 0
- 9
- 6
- 3 Correct answer.
Explanation
Keys 22, 33, 44 map to slots 0, 0, and 0 respectively, probing to 0, 1, and 2. Key 55 hashes to 0 as well and probes 0, 1, 2, 3, landing in slot 3.
Question 25Computer Science and Information Technology (CS)
Let L1 be a recursive language and L2 be a recursively enumerable but not recursive language. Which of the following is necessarily true?
- L1 union L2 is recursive
- L1 intersection L2 is recursive
- L1 is recursive and L2 is not recursive, so L1 is decidable and L2 is only semi-decidable Correct answer.
- L1 complement is recursively enumerable
Explanation
By definition a recursive language has a total Turing machine deciding it, while an r.e. non-recursive language has only a semi-decider. Therefore L1 is decidable and L2 is not, which is exactly the stated relation.
Question 26Computer Science and Information Technology (CS)
In the context of the C standard library, what does the function malloc return when it cannot satisfy an allocation request?
- A null pointer Correct answer.
- A pointer to the last freed block
- A pointer to the zero page
- The integer value -1 cast to void *
Explanation
The C standard specifies that malloc returns a null pointer when the requested memory cannot be allocated. Callers must check the result before dereferencing. Returning -1 or a zero page is not part of the standard behavior.
Question 27Computer Science and Information Technology (CS)
Which scheduling algorithm can cause starvation of a long CPU burst when short jobs keep arriving?
- Round Robin with a large quantum
- First Come First Serve
- First In First Out with aging disabled
- Shortest Remaining Time First Correct answer.
Explanation
Shortest Remaining Time First always picks the process with the least remaining time, so a long job can be repeatedly preempted by newly arriving short jobs. FCFS and round robin do not systematically starve based on burst length in this way.
Question 28Computer Science and Information Technology (CS)
A binary search tree stores distinct integer keys. After inserting keys 50, 30, 70, 20, 40, 60, 80 in that order, what is the height of the tree measured as the number of edges on the longest root-to-leaf path?
- 1
- 3
- 4
- 2 Correct answer.
Explanation
The insertions build a perfectly balanced tree: 50 at the root, 30 and 70 as children, then 20, 40, 60, 80 as leaves. The longest root-to-leaf path has two edges, so the height is 2.
Question 29Computer Science and Information Technology (CS)
In relational algebra, which operation removes duplicate tuples from a relation?
- Selection
- Projection Correct answer.
- Cartesian product
- Natural join
Explanation
Projection returns specified columns and, in the formal relational model, eliminates duplicate tuples so the result is a set. Selection filters rows but keeps all columns and any duplicates present.
Question 30Computer Science and Information Technology (CS)
Which component of a computer system holds the program counter during normal instruction execution?
- The control unit
- The memory data register
- The instruction register Correct answer.
- The program status word
Explanation
The program counter is a register inside the CPU that holds the address of the next instruction. The instruction register holds the instruction currently being decoded, not the address.
Question 31Computer Science and Information Technology (CS)
What is the primary purpose of the Address Resolution Protocol (ARP) in an IPv4 network?
- To route packets between autonomous systems
- To map an IP address to a link-layer MAC address on the local network Correct answer.
- To translate private addresses to public addresses
- To assign IP addresses to hosts dynamically
Explanation
ARP resolves a known IPv4 address to the corresponding hardware MAC address needed to frame the packet on a local link. Dynamic host configuration and NAT serve different purposes.
Question 32Computer Science and Information Technology (CS)
In IEEE 754 single precision, how many bits are allocated to the biased exponent field?
- 23
- 7
- 10
- 8 Correct answer.
Explanation
Single precision uses 1 sign bit, 8 exponent bits, and 23 fraction bits for a total of 32 bits. The exponent is stored with a bias of 127.
Question 33Computer Science and Information Technology (CS)
Which of the following is a regular language?
- {a^n b^n c^n | n >= 0}
- {a^n b^m | n, m >= 0} Correct answer.
- {w | w has an equal number of a's and b's}
- {a^n b^n | n >= 0}
Explanation
The language {a^n b^m} is described by the regular expression a*b*, so it is regular. The other languages require unbounded counting or comparison, which finite automata cannot perform.
Question 34Computer Science and Information Technology (CS)
In a demand-paged system, a reference to a page that is not currently in physical memory triggers which event?
- A cache write-back
- A context switch to the idle process
- A TLB hit
- A page fault Correct answer.
Explanation
A page fault occurs when the referenced page is absent from memory, prompting the operating system to load it from disk. A TLB hit means the translation was found and no fault occurs.
Question 35Computer Science and Information Technology (CS)
A directed graph has 6 vertices and is represented by an adjacency matrix. What is the minimum number of entries that must be examined to determine whether there is an edge from vertex 3 to vertex 5?
- 6
- 1 Correct answer.
- 36
- 2
Explanation
An adjacency matrix supports direct indexing, so a single lookup at row 3, column 5 answers the query. No scan of other entries is needed.
Question 36Computer Science and Information Technology (CS)
Consider the recurrence T(n) = T(n-1) + n for n > 1 with T(1) = 1. Which asymptotic bound describes T(n)?
- Theta(n)
- Theta(n^2) Correct answer.
- Theta(n log n)
- Theta(log n)
Explanation
Summing the recurrence gives T(n) = 1 + 2 + ... + n = n(n+1)/2, which grows quadratically. Therefore T(n) is Theta(n^2).
Question 37Computer Science and Information Technology (CS)
A relation schema R(A, B, C, D) has functional dependencies AB -> C and C -> D. Which attribute is prime?
- D
- A Correct answer.
- B
- C
Explanation
The only candidate key is AB, since AB determines all attributes and no proper subset does. Prime attributes are those appearing in some candidate key, so A and B are prime while C and D are not.
Question 38Computer Science and Information Technology (CS)
A process executes the sequence of page references 1, 2, 3, 4, 1, 2, 5, 1, 2, 3 with three frames using the FIFO replacement policy. How many page faults occur?
- 9
- 6
- 7 Correct answer.
- 8
Explanation
Simulating FIFO: faults occur at references 1,2,3,4, then 1 and 2 hit, 5 evicts 1, then 1 evicts 2, 2 evicts 3, and 3 evicts 4, giving seven faults. Counting carefully confirms seven distinct fault events.
Question 39Computer Science and Information Technology (CS)
A subnet uses the address 172.16.0.0 with mask 255.255.240.0. How many usable host addresses does this subnet provide?
- 4094 Correct answer.
- 2046
- 4096
- 1022
Explanation
The mask 255.255.240.0 leaves 12 host bits, giving 2^12 = 4096 addresses. Subtracting the network and broadcast addresses leaves 4094 usable host addresses.
Question 40Computer Science and Information Technology (CS)
A relation is in Third Normal Form but contains a transitive dependency of a non-prime attribute on another non-prime attribute. Which normal form does it violate?
- Second Normal Form
- First Normal Form
- Fourth Normal Form
- Boyce-Codd Normal Form Correct answer.
Explanation
BCNF requires every non-trivial functional dependency to have a superkey on its left-hand side. A transitive dependency between non-prime attributes violates BCNF while remaining permissible in 3NF.
Question 41Computer Science and Information Technology (CS)
A 4-stage pipeline has stage delays of 2 ns, 3 ns, 2 ns, and 4 ns. Registers introduce 1 ns overhead per stage. What is the steady-state throughput in instructions per nanosecond?
- 0.1
- 0.2 Correct answer.
- 0.25
- 0.5
Explanation
The clock period equals the maximum stage delay plus register overhead, which is 4 + 1 = 5 ns. Throughput is the reciprocal, 1/5 = 0.2 instructions per nanosecond.
Question 42Computer Science and Information Technology (CS)
In the context of dynamic programming, which property must an optimization problem exhibit for a dynamic-programming solution to be correct?
- A unique optimal solution
- Optimal substructure Correct answer.
- Deterministic polynomial runtime
- Greedy-choice property
Explanation
Dynamic programming requires optimal substructure so that optimal solutions can be built from optimal subproblem solutions, together with overlapping subproblems. The greedy-choice property is specific to greedy algorithms.
Question 43Computer Science and Information Technology (CS)
A context-free grammar has productions S -> aS | bS | epsilon. Which language does it generate?
- {a, b}* Correct answer.
- {a^n b^m | n = m + 1}
- {w | w contains at least one a}
- {a^n b^n | n >= 0}
Explanation
The grammar generates any sequence of a's and b's followed by termination with epsilon, so it generates the Kleene star of {a, b}. This language is regular and described by (a|b)*.
Question 44Computer Science and Information Technology (CS)
In the TCP protocol, what is the primary purpose of the three-way handshake?
- To select the routing path across autonomous systems
- To encrypt the connection with a shared key
- To establish a reliable connection and synchronize initial sequence numbers Correct answer.
- To negotiate the maximum segment size only
Explanation
The SYN, SYN-ACK, ACK exchange confirms that both endpoints are reachable and agree on initial sequence numbers before data transfer. Encryption and path selection are handled by other protocols.
Question 45Computer Science and Information Technology (CS)
Which scheduling policy in a real-time system guarantees that a set of periodic tasks meets all deadlines whenever the total utilization is at most 1?
- First Come First Serve
- Earliest Deadline First Correct answer.
- Priority scheduling with static priorities
- Shortest Job First
Explanation
Earliest Deadline First is optimal for preemptive uniprocessor scheduling of periodic tasks, meeting all deadlines whenever utilization does not exceed 1. Static-priority schemes such as rate monotonic have a lower utilization bound.
Question 46Computer Science and Information Technology (CS)
A singly linked list is used as a stack. Which operation has cost O(1)?
- Access the k-th element
- Push at the tail and pop from the head
- Search for the middle element
- Push at the head and pop from the head Correct answer.
Explanation
Inserting and deleting at the head of a singly linked list takes constant time because only the head pointer changes. Tail operations require traversal, and indexed access is linear.
Question 47Computer Science and Information Technology (CS)
Which of the following statements about the halting problem is correct?
- It is decidable only for finite input alphabets
- It is undecidable for Turing machines Correct answer.
- It is decidable for deterministic machines but not nondeterministic ones
- It is decidable but requires exponential time
Explanation
The halting problem for Turing machines is recursively enumerable but not recursive, hence undecidable. No algorithm can decide for every machine-input pair whether the machine halts.
Question 48Computer Science and Information Technology (CS)
A cache has 32 blocks and uses 2-way set associativity. How many sets does the cache contain?
- 8
- 64
- 16 Correct answer.
- 32
Explanation
The number of sets equals the number of blocks divided by associativity, so 32 / 2 = 16 sets. Each set holds two blocks.
Question 49Computer Science and Information Technology (CS)
A hash table of size 7 uses double hashing with h1(k) = k mod 7 and h2(k) = 1 + (k mod 5). Keys 10, 17, and 24 are inserted in that order. In which slot does key 24 finally reside?
- 0 Correct answer.
- 5
- 3
- 2
Explanation
Key 10 hashes to 3 and key 17 hashes to 3, probing by h2(17) = 3 to slot 6. Key 24 hashes to 3, probes by h2(24) = 5 to 1, then by 10 mod 7 = 3 to 4, then by 15 mod 7 = 1 to 5, then by 20 mod 7 = 6 to 6 occupied, then by 25 mod 7 = 4 to 3, then by 30 mod 7 = 2 to 2, then by 35 mod 7 = 0 to 0, which is free, so key 24 lands in slot 0.
Question 50Computer Science and Information Technology (CS)
A synchronous sequential circuit is built from positive-edge-triggered flip-flops with setup time 2 ns, hold time 1 ns, and clock-to-Q delay 3 ns. The longest combinational path between flip-flops has delay 8 ns and the shortest has delay 1 ns. What is the minimum clock period that avoids setup and hold violations?
- 12 ns
- 13 ns
- 11 ns Correct answer.
- 10 ns
Explanation
The setup constraint requires the clock period to be at least clock-to-Q plus the longest combinational delay plus setup time, which is 3 + 8 + 2 = 13 ns. However, the hold constraint requires clock-to-Q plus the shortest path to be at least hold time, which is satisfied here. Recomputing, the setup-limited period is 13 ns, and since the shortest path 3 + 1 = 4 ns exceeds the 1 ns hold time, no hold violation occurs, so the minimum period is 13 ns.