GATE 2007
184 questions
MCQ 1841-mark 184
Questions 56–60 of 184
Answer: (A)
Binary subtraction works the same way as decimal subtraction: and the borrow is .
Correct Answer:
Consider the following program segment. Here R1, R2 and R3 are the general purpose registers.
Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.
Assume that the memory is byte addressable and the word size is 32 bits. If an interrupt occurs during the execution of the instruction "INC R3", what return address will be pushed on to the stack?
Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.
Assume that the memory is byte addressable and the word size is 32 bits. If an interrupt occurs during the execution of the instruction "INC R3", what return address will be pushed on to the stack?
Answer: (C)
An interrupt is taken only after the current instruction finishes. At that time the PC points to the next instruction, and this value is pushed on the stack. So the return address is the address of the instruction after .
One word is 32 bits bytes. From the table, the instructions before are (2 words), (1), (1) and (1), which is 5 words bytes.
is at . It is 1 word long, so the next instruction, , is at . This is the address pushed on the stack.
Answer: (C)
One word is 32 bits bytes. From the table, the instructions before are (2 words), (1), (1) and (1), which is 5 words bytes.
is at . It is 1 word long, so the next instruction, , is at . This is the address pushed on the stack.
Answer: (C)
Consider the following program segment. Here R1, R2 and R3 are the general purpose registers.
Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.
Assume that the memory is word addressable. After the execution of this program, the content of memory location 2010 is:
Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.
Assume that the memory is word addressable. After the execution of this program, the content of memory location 2010 is:
Answer: (A)
The loop goes round times.
- First pass:
- Next pass:
- Next pass:
- Next pass:
- Next pass:
- Next pass:
- Next pass:
- Next pass:
- Next pass:
- Last pass:
Once is reached, the loop stops. So
Correct Answer:
Consider the following program segment. Here R1, R2 and R3 are the general purpose registers.
Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.
Assume that the memory is word addressable. The number of memory references for accessing the data in executing the program completely is:
Assume that the content of memory location 3000 is 10 and the content of the register R3 is 2000. The content of each of the memory locations from 2000 to 2010 is 100. The program is loaded from the memory location 1000. All the numbers are in decimal.
Assume that the memory is word addressable. The number of memory references for accessing the data in executing the program completely is:
Answer: (D)
Only data references count, not instruction fetches.
runs once and reads into R1: 1 data reference.
The loop starts at . R1 is 10 and lowers it by 1 each pass, and jumps back while R1 is not zero. So the loop runs 10 times.
In each pass, reads one word from memory and writes one word to memory. The other instructions work only on registers. So each pass makes 2 data references, which gives .
Total = .
Answer: (D)
runs once and reads into R1: 1 data reference.
The loop starts at . R1 is 10 and lowers it by 1 each pass, and jumps back while R1 is not zero. So the loop runs 10 times.
In each pass, reads one word from memory and writes one word to memory. The other instructions work only on registers. So each pass makes 2 data references, which gives .
Total = .
Answer: (D)
Consider a Direct Mapped Cache with 8 cache blocks (numbered 0-7). If the memory block requests are in the following order
3, 5, 2, 8, 0, 63, 9,16, 20, 17, 25, 18, 30, 24, 2, 63, 5, 82,17, 24.
Which of the following memory blocks will not be in the cache at the end of the sequence ?
3, 5, 2, 8, 0, 63, 9,16, 20, 17, 25, 18, 30, 24, 2, 63, 5, 82,17, 24.
Which of the following memory blocks will not be in the cache at the end of the sequence ?
Answer: (B)
The cache is direct mapped, so each block goes to line . No replacement policy is needed. The last request that maps to a line stays in it.
Requests to each line, in order:
Line 0: 8, 0, 16, 24, 24. It ends with 24.
Line 1: 9, 17, 25, 17. It ends with 17.
Line 2: 2, 18, 2, 82. It ends with 82.
Line 3: 3. It ends with 3.
Line 4: 20. It ends with 20.
Line 5: 5, 5. It ends with 5.
Line 6: 30. It ends with 30.
Line 7: 63, 63. It ends with 63.
Blocks 3, 20 and 30 are in the cache. Block 18 was replaced by 82 in line 2 (both give 2 when taken mod 8), so 18 is not in the cache.
Answer: (B)
Requests to each line, in order:
Line 0: 8, 0, 16, 24, 24. It ends with 24.
Line 1: 9, 17, 25, 17. It ends with 17.
Line 2: 2, 18, 2, 82. It ends with 82.
Line 3: 3. It ends with 3.
Line 4: 20. It ends with 20.
Line 5: 5, 5. It ends with 5.
Line 6: 30. It ends with 30.
Line 7: 63, 63. It ends with 63.
Blocks 3, 20 and 30 are in the cache. Block 18 was replaced by 82 in line 2 (both give 2 when taken mod 8), so 18 is not in the cache.
Answer: (B)