GATE 2025 (Session 1)
65 questions
MCQ 30 · MSQ 13 · NAT 221-mark 30 · 2-mark 35
Questions 36–40 of 65
Consider a memory system with 1M bytes of main memory and 16K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values? [Assume memory is byte addressable, 1K = , 1M = .]
Answer: (A)
The cache size bytes and each block bytes. So the number of cache lines . The index field has bits and the offset field has bits.
Main memory bytes and it is byte-addressable, so an address is bits long. Each line needs a tag field of bits.
Total bits to store all the tag values: .
Answer: 6×2^10
Main memory bytes and it is byte-addressable, so an address is bits long. Each line needs a tag field of bits.
Total bits to store all the tag values: .
Answer: 6×2^10
A processor has 64 general-purpose registers and 50 distinct instruction types. An instruction is encoded in 32-bits. What is the maximum number of bits that can be used to store the immediate operand for the given instruction?
ADD R1, #25 // R1 = R1 + 25
ADD R1, #25 // R1 = R1 + 25
Answer: (B)
There are registers, so one register-number field needs bits. There are distinct instruction types, so the opcode field needs bits (because ).
The instruction (it means ) names only one register, which is both source and destination. It also has an immediate value. So the -bit instruction is split like this: opcode ( bits) one register field ( bits) immediate field (the remaining bits).
Immediate field width bits.
Answer: 20
The instruction (it means ) names only one register, which is both source and destination. It also has an immediate value. So the -bit instruction is split like this: opcode ( bits) one register field ( bits) immediate field (the remaining bits).
Immediate field width bits.
Answer: 20
A computer has two processors, and . Four processes with CPU bursts of 20, 16, 25, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:
uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.
uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.
A process is scheduled to a processor , if the processor is free and no other process is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?
uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.
uses priority of execution for the processes as, , i.e., and have highest and lowest priorities, respectively.
A process is scheduled to a processor , if the processor is free and no other process is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?
Answer: (A)
All four processes arrive together at , and there are two free processors. So two processes start right away. is the top priority of , and is the top priority of . Each of these is also the lowest priority of the other machine, so there is no conflict. The natural start is and , both beginning at .
(burst ) ends first, at , and this frees . Among the waiting , the priority order of () prefers . So starts on at and runs until .
(burst ) ends next, at , and this frees . Only is still waiting, so it starts on at and runs until .
Waiting times: , , , .
Average: .
Answer: 9
(burst ) ends first, at , and this frees . Among the waiting , the priority order of () prefers . So starts on at and runs until .
(burst ) ends next, at , and this frees . Only is still waiting, so it starts on at and runs until .
Waiting times: , , , .
Average: .
Answer: 9
Consider two relations describing teams and players in a sports league:
are team-id and team-name, respectively
denote player-id, player-name and the team-id of the player, respectively
Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having name as 'MI'?
are team-id and team-name, respectively
denote player-id, player-name and the team-id of the player, respectively
Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having name as 'MI'?
Answer: (A)
For each player in , we need the name. We keep only those players whose is the same as that of some team in where .
This gives the query:
Two things must be checked. First, the outer variable must range over and not over , because we need player names. Second, the join condition must be present inside the existential. Options that leave out this join condition would return the name of every player whenever team 'MI' exists, whichever team the player is on.
Answer: {p.pname | p∈players ∧ ∃t(t∈teams ∧ p.tid=t.tid ∧ t.tname='MI')}
This gives the query:
Two things must be checked. First, the outer variable must range over and not over , because we need player names. Second, the join condition must be present inside the existential. Options that leave out this join condition would return the name of every player whenever team 'MI' exists, whichever team the player is on.
Answer: {p.pname | p∈players ∧ ∃t(t∈teams ∧ p.tid=t.tid ∧ t.tname='MI')}
A packet with the destination IP address 145.36.109.70 arrives at a router whose routing table is shown. Which interface will the packet be forwarded to?
Answer: (A)
A router uses longest-prefix matching. It finds all entries whose subnet contains the destination address. Then it picks the entry with the longest prefix, because that is the most specific.
Destination address: . Now check each entry:
- (E1): it matches any address of the form , so it matches.
- (E2): the 3rd octet must be from to . Our 3rd octet is , so it does not match.
- (E3): the 3rd octet must be from to . Here is inside this range, so it matches.
- (E4): it covers only , so it does not match.
Two entries match: E1 with and E3 with . The entry has the longer prefix, so it is chosen.
Answer: E3
Destination address: . Now check each entry:
- (E1): it matches any address of the form , so it matches.
- (E2): the 3rd octet must be from to . Our 3rd octet is , so it does not match.
- (E3): the 3rd octet must be from to . Here is inside this range, so it matches.
- (E4): it covers only , so it does not match.
Two entries match: E1 with and E3 with . The entry has the longer prefix, so it is chosen.
Answer: E3