GATE 2022
65 questions
MCQ 32 · MSQ 15 · NAT 181-mark 30 · 2-mark 35
Questions 16–20 of 65
Suppose we are given keys, hash table slots, and two simple uniform hash functions and . Further suppose our hashing scheme uses for the odd keys and for the even keys. What is the expected number of keys in a slot?
Answer: (B)
and are both simple uniform hash functions. So each key, odd or even, goes to a given slot with probability .
The expected number of keys in a slot . It does not matter which hash function is used.
Answer:
The expected number of keys in a slot . It does not matter which hash function is used.
Answer:
Which one of the following facilitates transfer of bulk data from hard disk to main memory with the highest throughput?
Answer: (A)
With DMA, the DMA controller carries the full block of data between the disk and memory on its own. The CPU does not have to handle each word. Interrupt-driven, polling and programmed I/O all make the CPU deal with every word, so they are much slower for bulk data.
Answer: DMA based I/O transfer
Answer: DMA based I/O transfer
Let R1 and R2 be two 4-bit registers that store numbers in 2's complement form. For the operation R1+R2, which one of the following values of R1 and R2 gives an arithmetic overflow?
Answer: (B)
The range of a 4-bit 2's complement number is up to .
- Case 1011 + 1110 = it fits
- Case 1100 + 1010 = overflow
- Case 0011 + 0100 = it fits
- Case 1001 + 1111 = it fits
Answer: R1 = 1100 and R2 = 1010
- Case 1011 + 1110 = it fits
- Case 1100 + 1010 = overflow
- Case 0011 + 0100 = it fits
- Case 1001 + 1111 = it fits
Answer: R1 = 1100 and R2 = 1010
Consider the following threads, executing on a single processor, synchronized using three binary semaphore variables, , operated upon using standard and . The threads can be context switched in any order and at any time.
Which initialization of the semaphores would print the sequence BCABCABCA ...?
| T1 | T2 | T3 |
|---|---|---|
|
|
|
Which initialization of the semaphores would print the sequence BCABCABCA ...?
Answer: (C)
Look at the code of each thread: T2 prints B. It waits on and then signals . T1 prints C. It waits on and then signals . T3 prints A. It waits on and then signals .
The output has to begin with B, so only T2 can run first. This needs and . After that, the chain B C A B goes on forever.
(If or were 1, A or C could be printed first.)
Answer:
The output has to begin with B, so only T2 can run first. This needs and . After that, the chain B C A B goes on forever.
(If or were 1, A or C could be printed first.)
Answer:
Consider the following two statements with respect to the matrices
Statement 1:
Statement 2:
where represents the trace of a matrix. Which one of the following holds?
Statement 1:
Statement 2:
where represents the trace of a matrix. Which one of the following holds?
Answer: (C)
.
This is true for any and (here AB has size and BA has size ).
Statement 2 is just the case where both matrices are square, so it is true as well.
Answer: Both Statement 1 and Statement 2 are correct
This is true for any and (here AB has size and BA has size ).
Statement 2 is just the case where both matrices are square, so it is true as well.
Answer: Both Statement 1 and Statement 2 are correct