Exams › GATE › Technical › Computer Science and Information Technology Set 1 (CS1)
23 questions with worked solutions.
Q1. Which one of the following statements is FALSE?
Answer: Programmed I/O mechanism has a better CPU utilization than the interrupt driven I/O mechanism
The statement is false because programmed I/O typically requires the CPU to actively wait for I/O operations to complete, leading to lower CPU utilization compared to interrupt-driven I/O, where the CPU can perform other tasks while waiting for interrupts.
Answer: (ii), (iv), (i), (iii)
The correct order starts with the DNS request to resolve the server's name, as the browser needs the IP address before establishing a connection. Next, the TCP SYN packet is sent to open a connection to the server. After the connection is established, the browser sends the HTTP GET request for the index page, followed by requests for any embedded image objects.
Answer: both O(N) and Ω(N)
The algorithm checks each pair of adjacent elements in a single pass through the array, which requires examining all N elements, resulting in a linear time complexity of O(N). Since it must at least look at each element once to determine the order, it also has a lower bound of Ω(N), making the correct option both O(N) and Ω(N).
Answer: The program gets stuck in an infinite loop
The program enters an infinite loop because the condition 'a < 10' remains true indefinitely. The value of 'a' is updated in such a way that it never reaches or exceeds 10, causing the loop to continue without termination.
Answer: The program will terminate with 4321 as output
The program reads characters from input recursively until it encounters a newline, storing each character in reverse order due to the nature of the recursive calls. When the newline is reached, the recursion unwinds, and the characters are printed in reverse, resulting in '4321' as the output.
Answer: Only the root node
The root node of a B+ tree can have fewer than half of its maximum capacity, allowing it to have just one key when the tree is small or when it is being initialized. This flexibility is essential for maintaining the tree's structure during insertions and deletions.
Q7. Which of the following statements about a relation R in first normal form (1NF) is/are TRUE ?
Answer: R can have a multi-attribute key
A relation in first normal form (1NF) allows for multi-attribute keys, meaning that a primary key can consist of more than one attribute to uniquely identify each record in the relation.
Q8. Which of the following is/are Bottom-Up Parser(s)?
Answer: Shift-reduce Parser
The Shift-reduce Parser is a type of bottom-up parser that builds the parse tree from the leaves (input symbols) up to the root (start symbol) by shifting input symbols onto a stack and reducing them to non-terminals according to production rules.
Answer: P(A ∪ B) = 0.7
The statement P(A ∪ B) = P(A) + P(B) - P(A ∩ B) simplifies to 0.3 + 0.5 - 0.1, which equals 0.7, confirming the correctness of the statement.
Answer: The acknowledgement number N_Q is equal to N_P + 1
The acknowledgement number N_Q is set to N_P + 1 because it indicates that the server Q has received the SYN packet from client P and is acknowledging the next expected sequence number, which is one more than the initial sequence number sent by P.
Answer: Source IP
The source IP address is modified by the NAT device to replace the internal IP with its own public IP, allowing the packet to be correctly routed on the external network.
Answer: (a = 4, b = 4); (a = 3, b = 3); (a = 4, b = 3)
Each statement is atomic and order within a thread is fixed (a=a+1 before b=b+1; b=2b before a=2a). Enumerating all valid interleavings yields exactly {(4,4),(3,3),(4,3)}: T1-then-T2 gives (4,4), T2-then-T1 gives (3,3), and the mixed orders give (4,3). The set matching this is (4,4);(3,3);(4,3), so the stored option is wrong.
Answer: 131, 111, 90
In a max heap, the largest element is at the root, followed by its children, which must also be larger than their own children. After heapifying the given array, the largest value, 131, becomes the root, followed by 111 and 90, which are the next largest elements, thus forming the first three elements of the heap.
Answer: T(n) = Θ(n log log n)
The recurrence relation indicates that the function T(n) grows based on the size of n and its logarithmic factors, specifically due to the repeated halving of n (as seen in T(√n)). This leads to a complexity that is proportional to n multiplied by the logarithm of the logarithm of n, hence T(n) = Θ(n log log n) is the correct characterization.
Answer: 53
In a binary min-heap, the maximum element can only be found in the leaf nodes, which are located in the second half of the array representation. With 105 elements, the leaf nodes start from index 53 to 105, giving us a total of 53 possible indices for the maximum element.
Answer: (X → Y and Y → Z) implies X → Z
This statement is an application of the transitive property of functional dependencies, which states that if one attribute functionally determines a second, and that second attribute functionally determines a third, then the first attribute must also functionally determine the third.
Answer: T1 T3 T2
The correct option T1 T3 T2 maintains the order of conflicting operations from the original schedule S, ensuring that the read and write operations on the same data items occur in the same sequence, thus preserving the consistency of the transactions.
Answer: F(X,Y,Z) = XY + YZ + XZ
The correct option is right because the expression F(X,Y,Z) = XY + YZ + XZ accurately represents the minterms 3, 5, 6, and 7 in the given Boolean function, confirming its equivalence to the specified sum of products.
Answer: If the inputs are x=20, y=20, then the return value is greater than 2²⁰
The function doubles the value of x and adds y in each iteration of the loop, leading to exponential growth. For x=20 and y=20, the number of iterations (20) allows the value of x to increase significantly, resulting in a return value that exceeds 2²⁰.
Answer: G contains an independent set of size at least n/k
A graph with chromatic number k can be colored using k colors, which implies that there must be at least one independent set of vertices that can be colored with the same color. By the pigeonhole principle, if there are n vertices and k colors, at least one color must be assigned to at least n/k vertices, ensuring the existence of an independent set of that size.
Answer: A write hit in WBC can modify the value of the dirty bit of a cache block
In a write-back cache (WBC), a write hit occurs when data is written to a cache block that is already present, allowing the dirty bit to be set or modified to indicate that the block has been changed but not yet written back to main memory.
Answer: 4
The output Y=1 can occur when M1 selects either X1 or X2 (both are 1), and M2 selects either X3 or X4 (both are 0). Since M3's selection does not affect the output when M2 outputs 0, there are 4 combinations of A, B, and C that can yield Y=1.
Answer: 6
Data = 1420-20 = 1400 bytes. Link1 MTU 542 gives payload floor(522/8)*8 = 520, yielding data fragments 520,520,360. Link2 MTU 360 gives payload 336, so each splits: 520->336+184, 520->336+184, 360->336+24, for 6 fragments delivered. Stored '9' is wrong; correct is 6.