Match P immediate, Q indirect, R base with index, S base with offset to 1 array element, 2 pointer, 3 record field, 4 constant. The choices give different permutations of these matches.
Your answer
Answer & solution
Official answer: B
Givens and goal
Match P immediate, Q indirect, R base with index, S base with offset to 1 array element, 2 pointer, 3 record field, 4 constant. The choices give different permutations of these matches.
Approach
Write the effective operand or effective address for each addressing mode and identify the high-level data access it implements.
Step-by-step solution
1. Immediate addressing puts the operand value directly in the instruction, such as an encoded literal 7. It naturally represents a constant, so P→4. 2. Indirect addressing obtains an operand’s address through another location or register. A pointer holds an address and is dereferenced to find the actual data, so Q→2. 3. Base-plus-index addressing computes an address from an array base and an index-dependent displacement, conceptually base+i·element_size. Varying i chooses an array element, so R→1. 4. Base-plus-fixed-offset addressing selects a field at a fixed byte displacement from the start of a record, such as record_base+offset_of_field. Thus S→3. 5. The complete mapping is (P,Q,R,S)→(4,2,1,3), option B. The key distinction is a varying index for array positions versus a fixed layout displacement for a named record field; both may ultimately use addition in the hardware.
X, Y and Z are memory locations. R0, R1 and R2 are registers. In a load-store architecture with destination-first syntax, select the instruction sequence implementing Z=X+Y. Options A–C use memory directly in an ADD; D loads X and Y, adds registers, and stores the result.
Your answer
Answer & solution
Official answer: D
Givens and goal
X, Y and Z are memory locations. R0, R1 and R2 are registers. In a load-store architecture with destination-first syntax, select the instruction sequence implementing Z=X+Y. Options A–C use memory directly in an ADD; D loads X and Y, adds registers, and stores the result.
Approach
Separate data movement from arithmetic and trace where each value resides after every instruction.
Step-by-step solution
1. A load-store ISA permits ordinary arithmetic instructions to use registers, not arbitrary memory operands. First execute LOAD R0,X, giving R0=memory[X]. 2. Execute LOAD R1,Y, giving R1=memory[Y]. Both operands of the addition are now available in registers. 3. Execute ADD R2,R0,R1. Destination-first syntax means R2 receives R0+R1; it does not mean R0 is overwritten. 4. Execute STORE Z,R2. This copies the sum from R2 to memory[Z], completing the high-level assignment. This four-instruction sequence is option D. 5. A tries ADD Z,X,Y with all three operands in memory. B loads only X and still uses memory for Y and the ADD destination. C computes ADD R0,X,Y without loading either source. These violate the stated load-store arithmetic restriction even if some other ISA might allow them.
Which register dependence can cause a data hazard in a pipelined processor? A read-after-read, B read-after-write, C write-after-read, D write-after-write. The source does not explicitly constrain instruction issue or completion order.
Your answer
Answer & solution
Official answer: B
Our answer: B in the classic in-order fixed-stage model; WAR/WAW can also be hazards in broader pipeline models.
Givens and goal
Which register dependence can cause a data hazard in a pipelined processor? A read-after-read, B read-after-write, C write-after-read, D write-after-write. The source does not explicitly constrain instruction issue or completion order.
Approach
Explain the true producer-consumer hazard, then state the narrower pipeline model needed to make the official MCQ selection unique.
Step-by-step solution
1. Suppose instruction I1 computes R1=R2+R3 and the following instruction I2 computes R4=R1+1. I2 must read the value produced by I1, so this is a read-after-write (RAW) dependence on R1. 2. If I2 reaches its register-read/use stage before I1’s result is available, it can read the old R1. That is a data hazard. Forwarding or a stall may be needed to preserve the intended computation. Thus B is a genuine hazard category. 3. In the conventional single-issue, in-order, fixed-stage pipeline, reads occur in an earlier fixed stage than writes. A later instruction cannot overtake an earlier read or write. Under those assumptions, WAR and WAW dependencies do not cause hazards, and B is the intended unique answer. RAR is not a hazard because neither instruction changes the shared register. 4. The unrestricted wording is broader. A write-after-read (WAR) hazard can arise if an earlier instruction is delayed before reading R1 and a later instruction overwrites R1 first. A write-after-write (WAW) hazard can arise if a slow earlier instruction and a fast later instruction both write R1, but the earlier write completes last, leaving the wrong final value. 5. Therefore preserve official B for scoring, with the qualification that C and D can also be hazard categories in pipelines permitting the relevant reordering. Register renaming and ordering mechanisms may prevent them, but are not specified.
CS-2026-S1-Q16-PIPELINE-MODEL. This is a model-dependent uniqueness issue, not an official key correction. The published single-answer selection requires the narrower pipeline convention described above.
X and Y are IEEE 754 single-precision values with hexadecimal bit patterns 35C00000 and 34A00000. Find the bit pattern for Z=X+Y among A 35C80000, B 35CC0000, C 35E80000, D 35EC0000.
Your answer
Answer & solution
Official answer: C
Step through it (9 steps)
Givens and goal
X and Y are IEEE 754 single-precision values with hexadecimal bit patterns 35C00000 and 34A00000. Find the bit pattern for Z=X+Y among A 35C80000, B 35CC0000, C 35E80000, D 35EC0000.
Approach
Decode sign, biased exponent and fraction; align exponents, add significands, and re-encode the exact sum.
Step-by-step solution
1. Both operands are positive normal IEEE 754 binary32 numbers. The exponent field of 35C00000 is 107, so its unbiased exponent is −20. Its fraction field is 400000, giving significand 1.5. Thus X = 1.5 × 2−20. 2. For 34A00000 the exponent field is 105, giving unbiased exponent −22; fraction 200000 gives significand 1.25. Thus Y = 1.25 × 2−22 = 0.3125 × 2−20. 3. Their sum is 1.8125 × 2−20. Since 1 ≤ 1.8125 < 2, no exponent renormalization is required. The fraction is 0.8125 = 13/16, which has an exact terminating binary expansion. 4. The exponent bits remain 107, contributing 35800000. The stored fraction is (13/16) × 223 = 680000 in hexadecimal. Combining the fields yields 35E80000. No rounding error occurs here.
Computational check: Python struct unpacked both binary32 operands and repacked their sum, obtaining 0x35e80000. This complements the exact field-level derivation; it is not the sole justification.
Binary significand check: X=1.1₂×2−20 and Y=1.01₂×2−22=0.0101₂×2−20. Their sum is 1.1101₂×2−20. Dropping the implicit leading 1 leaves fraction bits 1101 followed by nineteen zeros, exactly the hexadecimal fraction 680000. Since all significant bits fit within binary32 precision, the rounding mode does not alter the answer here.
A byte-addressed processor has a 2^32-byte physical address space. The cache holds 2^23 bytes in 128-byte blocks. Compare direct-mapped tag length M with K-way set-associative tag length N, where K=2^L and L∈{1,2,3}. Choices are N=M+L, M−L, M+K, M−K.
Your answer
Answer & solution
Official answer: A
Givens and goal
A byte-addressed processor has a 232-byte physical address space. The cache holds 223 bytes in 128-byte blocks. Compare direct-mapped tag length M with K-way set-associative tag length N, where K=2L and L∈{1,2,3}. Choices are N=M+L, M−L, M+K, M−K.
Approach
Partition the same physical address into tag, set index, and block offset for the two organizations.
Step-by-step solution
1. Byte addresses contain 32 bits. A 128-byte block needs log2(128)=7 offset bits. 2. The cache contains 223 / 27 = 216 blocks. In a direct-mapped organization, there are 216 sets, requiring 16 index bits. Hence its tag length is M=32−16−7=9. 3. K=2L ways reduce the set count to 216−L. The set index therefore uses 16−L bits while the block offset remains 7 bits. 4. The set-associative tag length is N=32−(16−L)−7=9+L=M+L.
Common error: Associativity changes the number of sets, not the number of bytes per block. Offset bits do not grow with the number of ways.
Concrete check: for L=2, the cache is four-way. It has 214 sets, so its address fields are 11 tag bits, 14 set-index bits and 7 offset bits, totaling 32. Direct mapping used 9+16+7=32. The increase is log₂4=2 bits, not four bits; this distinguishes M+L from M+K. Subtracting L or K would move the tag in the wrong direction.
A disk rotates at 15000 rpm, has 400 sectors per track and 1024 bytes per sector, and takes 1 ms per adjacent-track move. Starting at track 0, read ten randomly located sectors on each of tracks 5,12,7 in that order. Find the total time to one decimal place, under the published key’s expected-latency convention.
Answer & solution
Official answer: 77.3
Givens and goal
A disk rotates at 15000 rpm, has 400 sectors per track and 1024 bytes per sector, and takes 1 ms per adjacent-track move. Starting at track 0, read ten randomly located sectors on each of tracks 5,12,7 in that order. Find the total time to one decimal place, under the published key’s expected-latency convention.
Approach
Calculate seek time, expected rotational waiting, and actual sector transfer time separately, then add them without double counting.
Step-by-step solution
1. Convert rotation speed to period. A minute is 60000 ms, so one revolution takes 60000/15000=4 ms. 2. The required track movements are |5−0|=5, |12−5|=7 and |7−12|=5. At 1 ms per adjacent move, total seek time is (5+7+5)·1=17 ms. There is no additional seek between sectors on the same track. 3. Under independent uniform rotational positions for successive accesses, average wait to the requested sector is half a revolution, 4/2=2 ms. There are 3·10=30 sector accesses, so the expected rotational wait is 30·2=60 ms. 4. One sector occupies 1/400 of a revolution and takes 4/400=0.01 ms to transfer. Thirty sectors take 0.30 ms. Equivalently, the transfer rate is (400·1024)/4=102400 bytes/ms and the total data is 30·1024=30720 bytes, giving the same 0.30 ms. 5. Add the components: 17+60+0.30=77.30 ms. Rounded to one decimal, the official result is 77.3 ms.
CS-2026-S1-Q59-EXPECTED. This is an expected time under the independent random-angle access model, not an exact elapsed duration fixed by unspecified sector locations. Reordering reads by rotational position or batching nearby sectors would require a different model. The source says “total time” without explicitly saying expected, so the published interval 77.3 to 77.3 is preserved with this qualification.
A pipeline clock is 1 ns, with negligible latch overhead. The shared EX stage performs both arithmetic and LOAD memory reads. A 100-instruction sequence contains (EX time in ns, count): LOAD (1.8,15), IMUL (1.5,10), IDIV (2.5,5), FADD (1.7,10), FSUB (1.7,5), FMUL (2.8,15), FDIV (3.2,5), and other instructions (<1.0,35). Count EX structural-stall cycles.
Answer & solution
Official answer: 95
Givens and goal
A pipeline clock is 1 ns, with negligible latch overhead. The shared EX stage performs both arithmetic and LOAD memory reads. A 100-instruction sequence contains (EX time in ns, count): LOAD (1.8,15), IMUL (1.5,10), IDIV (2.5,5), FADD (1.7,10), FSUB (1.7,5), FMUL (2.8,15), FDIV (3.2,5), and other instructions (<1.0,35). Count EX structural-stall cycles.
Approach
Round each EX occupancy up to whole clock cycles, subtract the one cycle already included in normal pipeline operation, and multiply by instruction counts.
Step-by-step solution
1. Clock boundaries occur every 1 ns. An operation taking t_EX ns occupies the exercise’s single EX resource for ceil(t_EX/1 ns) cycles. A normal instruction already has one EX cycle, so additional blocked cycles per instruction are ceil(t_EX)−1. 2. The instruction-by-instruction contributions are:
3. Sum the final column: 15+10+10+10+5+30+15=95 stalled cycles. 4. This is a stall count, not total program execution time. Do not add the 100 baseline instruction slots or pipeline fill/drain cycles, which are not requested.
The calculation uses the stated exercise’s shared, non-overlapped EX-stage occupancy model: while a multicycle operation holds EX, a subsequent instruction cannot enter it. A separately pipelined or replicated functional unit could have a different initiation interval; its behavior cannot be inferred solely from these operation latencies.
S1 says non-vectored interrupts usually take longer than vectored interrupts to start the device ISR. S2 says daisy-chain interrupt handling has the CPU poll every input device separately. Options: A both true; B both false; C only S1 true; D only S2 true.
Your answer
Answer & solution
Official answer: C
Givens and goal
S1 says non-vectored interrupts usually take longer than vectored interrupts to start the device ISR. S2 says daisy-chain interrupt handling has the CPU poll every input device separately. Options: A both true; B both false; C only S1 true; D only S2 true.
Approach
Distinguish ISR dispatch from hardware priority resolution.
Step-by-step solution
1. A vectored interrupt supplies a vector that identifies the appropriate service routine, often by indexing an interrupt-vector table. This enables direct dispatch to the required ISR. 2. A non-vectored mechanism typically enters a common location and needs extra identification or dispatch work before the device-specific ISR starts. Thus S1 is true in the usual organization; it is a typical comparison, not a universal timing theorem about all CPUs. 3. In a daisy chain, an interrupt-acknowledge signal propagates through devices in priority order. A requesting device captures the acknowledgement and identifies itself; devices earlier in the chain have priority. 4. The CPU need not poll each device individually in that mechanism. That description belongs to software polling, so S2 is false and C is correct.
Decode hexadecimal 0xC2710000 as IEEE-754 binary32 and give its decimal value to two decimal places.
Answer & solution
Official answer: -60.25 to -60.25
Our answer: -60.25
Step through it (6 steps)
Givens and goal
Decode hexadecimal 0xC2710000 as IEEE-754 binary32 and give its decimal value to two decimal places.
Approach
Extract sign, biased exponent, and fraction separately.
Step-by-step solution
1. The 32 bits are 11000010011100010000000000000000. Their binary32 split is sign 1 | exponent 10000100 | fraction 11100010000000000000000. 2. The sign contributes −1. The exponent field is 132, so the unbiased exponent is e=132−127=5. Since the exponent is neither all zero nor all one, use the normalized significand 1.f. 3. The fraction bits contribute 1/2+1/4+1/8+1/128=113/128. Thus the significand is 1+113/128=241/128. 4. The value is −(241/128)×2⁵=−241/4=−60.25. This value is exact, so rounding to two decimal places leaves −60.25. Do not interpret the entire 32-bit word as a two’s-complement integer; IEEE-754 uses separate fields.
Instructions are 16 bits and there are 16 registers. An M instruction has two register operands plus a 6-bit immediate; R has three register operands; C has one register plus a 6-bit offset. Given 2 M opcodes and 7 R opcodes, maximize C opcodes. Options: A 8; B 4; C 64; D 16.
Your answer
Answer & solution
Official answer: B
Givens and goal
Instructions are 16 bits and there are 16 registers. An M instruction has two register operands plus a 6-bit immediate; R has three register operands; C has one register plus a 6-bit offset. Given 2 M opcodes and 7 R opcodes, maximize C opcodes. Options: A 8; B 4; C 64; D 16.
Approach
Count occupied instruction encodings, then show the remaining space can be decoded unambiguously.
Step-by-step solution
1. Each register field needs log₂16=4 bits. M operands use 4+4+6=14 bits, leaving a 2-bit opcode. Each M opcode covers 2¹⁴ instruction words; two cover 2¹⁵, half of all 2¹⁶ words. 2. R operands use 12 bits, leaving a 4-bit opcode. Seven R opcodes cover 7×2¹²=28672 words, or 7/16 of the full space. M and R together occupy 1/2+7/16=15/16. 3. C operands use 4+6=10 bits, leaving a 6-bit opcode. Each C opcode covers 2¹⁰ words. The remaining capacity is (1/16)×2¹⁶=4096 words, so at most 4096/1024=4 C opcodes fit. 4. This upper bound is achievable with prefixes: use 00 and 01 for M. Of the eight remaining length-four prefixes 1000 through 1111, reserve seven for R. Extend the last prefix 1111 by 00,01,10,11 for four six-bit C opcodes. 5. No instruction format’s opcode is a prefix of another assigned opcode in this construction. Therefore four is both feasible and maximal, giving B. Simply observing that six bits permit 64 values ignores the already occupied encoding space.
A byte-addressed machine has 16 MB physical memory and an initially empty 4 KB direct-mapped cache with 16-byte blocks. Repeat P,Q,R,S ten times, where P=0x845B32, Q=0x845B26, R=0x845B36, S=0x846B32. Select: A every P misses; B every R hits; C every Q misses; D all S after the first hit. K=2¹⁰,M=2²⁰.
Select all that apply
Answer & solution
Official answer: A, B
Givens and goal
A byte-addressed machine has 16 MB physical memory and an initially empty 4 KB direct-mapped cache with 16-byte blocks. Repeat P,Q,R,S ten times, where P=0x845B32, Q=0x845B26, R=0x845B36, S=0x846B32. Select: A every P misses; B every R hits; C every Q misses; D all S after the first hit. K=2¹⁰,M=2²⁰.
Approach
Split addresses into tag, line index, and byte offset before tracing the repeating pattern.
Step-by-step solution
1. There are 4096/16=256 cache lines, requiring 8 index bits, and a 16-byte block requires 4 offset bits. In a 24-bit physical address, the remaining 12 bits form the tag. 2. The decompositions (tag,index,offset) are P=(845,B3,2), Q=(845,B2,6), R=(845,B3,6), S=(846,B3,2), all hexadecimal. P and R share one memory block; S has the same index but a different tag; Q has a separate index. 3. In the first cycle, P misses and loads tag 845 into line B3. Q misses and loads its separate line B2. R hits the block loaded by P. S misses and replaces B3 with tag 846. 4. At the start of every later cycle B3 contains S’s tag. P therefore misses and replaces S; R subsequently hits P’s block; S then misses and replaces P again. Q remains resident and hits in all nine later cycles. 5. A and B are true; C and D are false. As a check, misses total 10 for P, 1 for Q, 0 for R, and 10 for S: 21 misses and 19 hits over 40 accesses. Spatial locality explains R’s hits, whereas index conflict explains repeated P/S misses.
A byte-addressed machine has 1 MB physical memory. Address 0xA2C28 maps to cache block number 176 (decimal), numbered from zero. Find the largest cache size in KB under the conventional power-of-two direct-mapped bit-field organization. K=2¹⁰,M=2²⁰.
Answer & solution
Official answer: 128
Givens and goal
A byte-addressed machine has 1 MB physical memory. Address 0xA2C28 maps to cache block number 176 (decimal), numbered from zero. Find the largest cache size in KB under the conventional power-of-two direct-mapped bit-field organization. K=2¹⁰,M=2²⁰.
Approach
Locate the required binary index within the physical address and maximize its allowed leading zeros.
Step-by-step solution
1. A 1 MB byte-addressed space has 20-bit addresses. The given address is 1010 0010 1100 0010 1000 in binary. Let b be block-offset bits and s be index bits. The cache index is (address >> b) mod 2s and cache capacity is 2b+s bytes. 2. The required index 176 is binary 10110000, so s≥8. In the address, the eight-bit slice equal to 10110000 occurs with its low end at bit 6: shifting right by b=6 gives 0x28B0, whose low eight bits are 0xB0=176. Examining possible offsets 0 through 12 yields no other matching eight-bit slice. 3. For b=6, the low 9,10, and 11 bits of 0x28B0 also equal 176 because the added bits are zero. The low 12 bits are 0x8B0=2224, so s=12 fails; all larger widths retain that unwanted set bit and fail too. 4. The maximum feasible choice is b=6,s=11: block size 2⁶=64 bytes, line count 2¹¹=2048, and capacity 2¹⁷=131072 bytes=128 KB. As a direct check, floor(0xA2C28/64)=10416, and 10416 mod 2048=176. 5. The feasible smaller capacities with the same block size are 16,32,64 KB. This maximization relies on conventional power-of-two cache/block sizes and consecutive index bits. Arbitrary modular mappings or nonstandard capacities are not implied by the source wording; retain that model qualification with official answer 128.
A nonpipelined processor averages 5 cycles/instruction at 1.6 GHz. Its pipeline has ideal CPI 1 but runs at 1.2 GHz; 30% of instructions incur an additional 2-cycle stall. Compute long-program speedup to two decimals. The published accepted range is 2.30–2.40.
Answer & solution
Official answer: 2.30 to 2.40
Our answer: 2.34375 (2.34 rounded)
Givens and goal
A nonpipelined processor averages 5 cycles/instruction at 1.6 GHz. Its pipeline has ideal CPI 1 but runs at 1.2 GHz; 30% of instructions incur an additional 2-cycle stall. Compute long-program speedup to two decimals. The published accepted range is 2.30–2.40.
Approach
Compare actual seconds per instruction, not CPI alone.
Step-by-step solution
1. The nonpipelined average instruction time is CPI/frequency=5/(1.6×10⁹) seconds=3.125 ns. 2. Each pipelined instruction contributes one base cycle on average. The expected added stall cost is 0.30×2=0.60 cycles per instruction, so effective CPI is 1.60. 3. The pipelined instruction time is 1.60/(1.2×10⁹) seconds=4/3 ns≈1.33333 ns. Its clock is slower, so a CPI reduction by itself would overstate the improvement. 4. Speedup is old time/new time=3.125/(4/3)=2.34375, which rounds to 2.34. Equivalently use (5/1.6)/(1.6/1.2). 5. The full official accepted interval 2.30–2.40 is preserved, rather than replaced with a single exact scoring value. The calculation assumes long-program throughput, negligible pipeline fill/drain cost, and additive two-cycle stalls as stated; a short program or overlapping penalties would need more details.
A non-pipelined single processor receives an asynchronous device interrupt while running a program. Order these steps: (i) save the program counter, (ii) load the ISR start address into the program counter, (iii) finish the current instruction. A iii,i,ii; B i,iii,ii; C i,ii,iii; D iii,ii,i. Options C and D continue on source page 11.
Your answer
Answer & solution
Official answer: A
Approach: Preserve a consistent return point before redirecting instruction execution. First finish the instruction already in progress: step iii. In the usual instruction-boundary interrupt model, this leaves the program’s architectural state consistent and determines the address at which it must resume. Interrupts are asynchronous arrivals, but service is begun at an instruction boundary. Next save the program counter containing that resume address: step i. Finally load the ISR entry address into the program counter: step ii. Fetching now begins in the interrupt routine, and the saved address remains available for return. The sequence is iii,i,ii, option A. B and C save before the current instruction has completed; D overwrites the return address with the ISR address before saving it. This ordering describes the stipulated simple processor, not an attempt to interrupt halfway through a partially completed instruction.
Two independent multiplexers feed an ALU. Mux_A selects either 32-bit register RA or a 32-bit immediate; Mux_B selects either 32-bit register RB or another 32-bit immediate. The ALU writes a 32-bit register RZ. Which are supported? A two register operands; B one register and one immediate; C two immediate operands; D only one-register/one-immediate operations.
Select all that apply
Answer & solution
Official answer: A, B, C
Approach: Enumerate independent multiplexer settings instead of assuming the instruction formats of a familiar processor. Selecting RA at Mux_A and RB at Mux_B gives two register operands, so A is supported. Selecting RA and the B-side immediate, or the A-side immediate and RB, gives one register and one immediate; B is supported. Selecting the immediate input at both multiplexers gives two immediate operands, so C is supported as well. All selected values are 32 bits and can be delivered simultaneously to the ALU, whose result goes to RZ. No data connection in the shown partial datapath forces a mux to choose a register merely because the other mux chose an immediate. Thus select A,B,C. D is false because its word “only” excludes the other two combinations. This is a claim about the available datapath connections, not proof that a particular instruction-set encoding actually exposes every such combination.
A byte-addressable system has 1 MiB of main memory, 20-bit addresses, and a 16 KiB direct-mapped cache with 16-byte blocks. How many bits store the tag values for all lines, excluding other metadata? A 6×2^10; B 8×2^10; C 2^12; D 2^14. Here K=2^10 and M=2^20.
Your answer
Answer & solution
Official answer: A
Step through it (7 steps)
Approach: Split an address into tag, cache-line index and byte offset; then multiply tag width by the number of lines. A 16-byte block requires log₂16=4 offset bits. The cache contains 16 KiB/16 bytes=214/24=210 lines, so direct mapping requires 10 index bits to select a line. From the 20 address bits, the remaining tag width is 20−10−4=6 bits. Every line needs its own stored tag to distinguish the main-memory blocks that map to that line. Therefore total tag storage is 210×6=6144 bits, option A. This is a bit count, not a byte count. The 16 KiB cache size describes data capacity; valid bits, dirty bits and other control metadata are not part of the requested tag values. Ignoring the block offset or using the number of bytes instead of lines would produce the wrong tag width or multiplier.
A processor has 64 general-purpose registers, 50 instruction types, and fixed 32-bit instructions. For ADD R1,#25, meaning R1=R1+25, what is the maximum immediate field width in the conventional fixed-width opcode/register-field model? A 16; B 20; C 22; D 24 bits.
Your answer
Answer & solution
Official answer: B
Approach: Reserve the minimum bits needed for the opcode and the explicitly encoded register, then assign the remainder to the immediate. There must be at least 50 opcode patterns. Five bits provide only 32 patterns, while six provide 64, so the opcode requires ceil(log₂50)=6 bits. Selecting among 64 registers requires log₂64=6 bits. This two-address instruction uses R1 both as a source and as the destination; the same register is encoded once, not in two independent fields. Thus the immediate can occupy 32−6−6=20 bits, option B. The calculation assumes a uniform opcode field and no additional mode or reserved fields, as intended by the question. A 16-bit immediate would leave unused capacity under those assumptions, while 22 or 24 bits would not leave enough room for both required fields. An instruction-set design with variable-length opcodes would need additional specification before such a maximum could be established.
Memory is searched in order L1,L2,main memory. L1 has 95% hit rate and 10 ns access time. L2 has 85% hit rate conditional on an L1 miss; its 20 ns time already includes the L1 miss penalty. Main-memory access is 200 ns including both cache miss penalties. Find average access time in ns to two decimals.
Answer & solution
Official answer: 11.83 to 11.87
Our answer: 11.85
Approach: Partition accesses into mutually exclusive completion paths and weight the total time of each path. An L1 hit has probability 0.95 and total time 10 ns. An L1 miss followed by an L2 hit has probability 0.05×0.85=0.0425 and total time 20 ns. Missing both caches has probability 0.05×0.15=0.0075 and total time 200 ns. These probabilities sum to 1. The expected time is therefore 0.95×10+0.0425×20+0.0075×200=9.50+0.85+1.50=11.85 ns. The word “including” in the diagram is essential: adding 10 ns again to the L2 or memory path would double-count time already included. Likewise the 85% L2 hit rate applies only to accesses reaching L2, not to all processor requests.
Select the processor properties that belong to its Instruction Set Architecture (ISA). Options: A. cache capacity; B. processor clock frequency; C. number of cache levels; D. total number of registers.
Select all that apply
Answer & solution
Official answer: D
An ISA is the programmer-visible contract implemented by a processor, including instruction meanings, operand formats, and architectural registers. Therefore the number of registers that machine instructions can name belongs to that contract, making D the intended selection.
Cache capacity and the number of cache levels are generally microarchitectural implementation choices. Two processors may execute the same machine code while using different cache hierarchies. Clock frequency likewise affects execution speed, but is not a definition of the instruction set. Thus A, B, and C are not ISA properties in this question.
There is a necessary terminology qualification: “total number of registers” must mean the architectural register set. Physical registers used for renaming, pipeline latches, and other hidden internal storage need not be specified by the ISA and can vary across implementations. Under the intended architectural interpretation, select D only.
Ordinary radix-2 Booth multiplication is applied to signed 16-bit two's-complement operands M=1100 1101 1110 1101 and Q=1010 0100 1010 1010. How many additions and subtractions of the multiplicand occur in total? Count arithmetic operations, not shifts.
Answer & solution
Official answer: 13
Step through it (18 steps)
In radix-2 Booth multiplication append q−1=0 to the multiplier and inspect (qi,qi−1) for i=0,…,15. A pair 01 causes addition of M, 10 causes subtraction of M, and 00 or 11 causes neither. Each iteration still performs its arithmetic right shift, but shifts are not included in the question's count. The count depends on the multiplier's bit transitions, not on the value of M.
Read Q from its least significant end. The positions producing subtraction (10) are i=1,3,5,7,10,13,15, seven positions. The positions producing addition (01) are i=2,4,6,8,11,14, six positions. The remaining positions i=0,9,12 have equal adjacent bits and require no arithmetic update.
Thus there are 7+6=13 additions/subtractions during the 16 iterations. Do not append an extra seventeenth correction for the leading one: the fixed-width signed Booth algorithm already handles that sign bit through its arithmetic shifts. Answer: 13.
A byte-addressable system has a direct-mapped cache. Addresses contain 4 tag bits and 12 cache-index bits; each cache block holds one byte. Choose main-memory address capacity and cache data capacity, respectively. Options: A. 64 KB,4 KB; B. 128 KB,16 KB; C. 64 KB,8 KB; D. 128 KB,6 KB. Use KB=1024 bytes. The original wording says no other information is stored per block.
Your answer
Answer & solution
Official answer: A
A one-byte block needs log2(1)=0 block-offset bits. Therefore each address has tag+index+offset=4+12+0=16 bits. With byte addressing it identifies 216 bytes, or 65536 bytes=64 KB of main memory.
The 12 index bits select one of 212=4096 cache lines. Each line holds one byte of data, so the cache data capacity is 4096 bytes=4 KB. This gives A.
Distinguish data capacity from total physical storage. The tag itself occupies 4 bits per line, so explicitly counting stored tags would add 4096·4 bits=2048 bytes=2 KB, making 6 KB before any other metadata. The offered correct option and standard cache-capacity convention use data bytes only. The original “no other information” wording does not turn the 4 tag bits into addressable data, and no option pairs the 64-KB address space with 6-KB physical storage. Answer: A under the stated data-capacity interpretation.
IEEE 754 binary32 registers hold RX=0xC1100000, RY=0x40C00000, RZ=0x41400000, representing numbers X,Y,Z. Select true equations. A. 4(X+Y)+Z=0. B. 2Y−Z=0. C. 4X+3Z=0. D. X+Y+Z=0.
Select all that apply
Answer & solution
Official answer: A, B, C
Step through it (9 steps)
For a normal binary32 number, value=(−1)s·(1+f/223)·2e−127, where s is the sign bit, e the 8-bit biased exponent, and f the 23-bit fraction integer.
RX has s=1, e=130, and f=0x100000=220. Its fractional contribution is 220/223=1/8, so X=−(1+1/8)·23=−9. RY has s=0,e=129,f=0x400000=222, giving Y=(1+1/2)·22=6. RZ has s=0,e=130 and the same fraction, giving Z=(1+1/2)·23=12.
Now evaluate the choices directly: A gives 4(−9+6)+12=−12+12=0; B gives 2·6−12=0; C gives 4·(−9)+3·12=−36+36=0. D gives −9+6+12=9, not zero. These small integer values and intermediate results are exactly representable, so floating-point rounding does not change the conclusions. Select A,B,C.
A two-level cache has L1 access time 1 ns and hit rate 90%. Conditional on reaching L2, its hit rate is 80%; the L1-miss transfer/access penalty through L2 is 10 ns. An L2 miss adds 100 ns to transfer from main memory. Find average memory access time in ns, to one decimal place, using additive miss penalties.
Answer & solution
Official answer: 4.0
Always pay the 1-ns L1 lookup. With probability 1−0.9=0.1, an L1 miss adds 10 ns for the next level. Of those L1 misses, a fraction 1−0.8=0.2 also miss L2 and incur the additional 100 ns. Therefore AMAT=1+0.1[10+0.2·100]=1+0.1·30=4.0 ns.
An equivalent path-probability calculation makes the nesting clear. L1 hits occur with probability 0.9 and cost 1 ns. L1 miss/L2 hit occurs with probability 0.1·0.8=0.08 and costs 1+10=11 ns. Misses in both levels occur with probability 0.1·0.2=0.02 and cost 1+10+100=111 ns. Their weighted sum is 0.9·1+0.08·11+0.02·111=4.0 ns.
The L2 hit rate is conditional on an L1 miss, not a separate 80% of all requests. Also, the stated miss penalties are additional times; treating them as inclusive complete-path times would describe a different model. Answer: 4.0.
A five-stage pipeline has stage delays 180,250,150,170,250 ns. Each inter-stage latch adds 10 ns. With no stalls, how long does execution of 1000 instructions take, in microseconds to two decimal places?
Answer & solution
Official answer: 260.20 to 261.20
Our answer: 261.04
A synchronous pipeline clock must allow its slowest stage plus the latch overhead to complete. Thus T_clock=max(180,250,150,170,250)+10=260 ns. Adding all five stage delays would instead describe an unpipelined or differently timed design; faster stages must still wait for this common clock.
The first instruction completes after five cycles. Once the pipeline is full, one further instruction completes per cycle, so 999 additional instructions take 999 more cycles. Total cycles=k+n−1=5+1000−1=1004.
Execution time is 1004·260=261040 ns. Dividing by 1000 ns per microsecond gives 261.04 μs. The fill/drain accounting is already included in k+n−1; adding separate extra fill and drain terms would double-count. The value lies within the published acceptable range 260.20 to 261.20 μs. Answer: 261.04.
An application takes 6.3 seconds to execute 6.4×10^8 instructions. Instruction classes are: branch CPI 2, count 2.25×10^8; load CPI 5, count 1.20×10^8; store CPI 4, count 1.65×10^8; arithmetic CPI 3, count 1.30×10^8. Find the clock-cycle duration in ns to one decimal place.
Answer & solution
Official answer: 3.0
Multiply each class count by its cycles per instruction before adding. Branches use 2·2.25×108=4.5×108 cycles; loads use 5·1.20×108=6.0×108; stores use 4·1.65×108=6.6×108; arithmetic uses 3·1.30×108=3.9×108. Total cycles are (4.5+6.0+6.6+3.9)×108=2.1×109.
CPU time equals total cycles times cycle duration, so T_cycle=6.3/(2.1×109)=3×10−9 seconds=3.0 ns. Equivalently, the instruction-count-weighted average CPI is 2.1×109/(6.4×108)=3.28125, leading to the same result. A simple arithmetic average of the four CPIs would be incorrect because the instruction counts differ. The corresponding clock frequency is approximately 333.33 MHz, a useful unit check. Answer: 3.0.
Which statement is false? A Cycle-stealing DMA transfers one word between an I/O device and memory in a stolen cycle. B Burst DMA offers higher bulk-transfer throughput than cycle stealing. C Programmed I/O uses the CPU better than interrupt-driven I/O. D Vectored interrupts can start their service routine faster than non-vectored interrupts.
Your answer
Answer & solution
Official answer: C
Approach: Compare what the CPU must do while an I/O device is not ready, then check the other hardware statements. 1. In programmed I/O the CPU repeatedly polls device status and performs the transfer itself. Time spent waiting or polling is unavailable for useful work on other tasks. 2. With interrupt-driven I/O, the CPU can execute other work until the device signals that attention is required. In the standard comparison used here, this improves CPU utilization. Thus C reverses the expected relationship and is false. 3. Cycle stealing grants DMA a bus cycle for a word transfer, supporting A. Burst DMA keeps the bus for a block, reducing repeated arbitration overhead and supporting B for bulk traffic. 4. A vectored interrupt identifies the appropriate handler through a vector, whereas a non-vectored mechanism needs additional identification or dispatch. This supports D. Answer: C. These are textbook comparisons under comparable conditions, not a claim that interrupt overhead is zero for every workload.
A processor has IF, ID, EX, MEM and WB pipeline stages. Which forwarding claims are correct? A An earlier instruction's result is passed from a source stage to a later instruction's destination stage. B MEM output can feed the next instruction's EX input. C Forwarding does not prevent every pipeline stall. D Forwarding needs no extra hardware.
Select all that apply
Answer & solution
Official answer: A, B, C
Approach: Forwarding supplies a computed value before the normal register-file writeback/read sequence has completed. 1. A later instruction may need a value that an earlier instruction has produced but has not yet written to the architectural register file. A bypass path sends that result directly to the consumer's appropriate stage. This is A. 2. A result available at the output of MEM can be routed to an EX input in a following cycle through pipeline registers and bypass selection. Thus B describes a valid forwarding path. 3. Availability still matters: in the usual five-stage pipeline, a load's value arrives too late for the immediately following instruction's EX stage without a load-use bubble. Control hazards and resource conflicts are not universally removed either. Therefore C is true. 4. Forwarding requires extra wires, multiplexers, register-number comparators and control logic to choose the correct source. D is false. Answer: A, B and C. Forwarding reduces some data-hazard stalls; it does not eliminate timing constraints.
Two set-associative caches use LRU replacement. WBC is write-back; WTC is write-through. Which are true? A A WBC read miss never evicts a dirty block. B A WTC read miss never writes a victim block back to memory. C A WBC write hit can change a dirty bit. D A WTC write miss always writes its victim back before loading a block.
Select all that apply
Answer & solution
Official answer: B, C
Approach: Replacement policy selects the victim, whereas write policy determines whether the victim may contain newer data than main memory. 1. In a write-back cache, a write can modify the cached block without immediately updating memory. The dirty bit records this mismatch. On a write hit to a clean block, the bit can change from 0 to 1, proving C. 2. LRU selection does not guarantee a clean victim. A read miss can evict a dirty write-back block, which must then be written to memory. A's “never” is false. 3. Write-through propagates each write to memory, so a replaced cache block does not need an eviction-time dirty-block write-back in the standard completed-write model. Hence B is true. 4. D is false for the same reason. Moreover, a write-through cache may use no-write-allocate, in which case a write miss need not load a new block or select a cache victim at all. Answer: B and C. Write-through memory traffic caused by the current write is not the same thing as writing back an evicted dirty block.
A hard disk has capacity 512 GB, 32 storage surfaces, 4,096 sectors per track and 1,024 bytes per sector. How many cylinders does it contain? Use the binary capacity convention underlying the official answer.
Answer & solution
Official answer: 4096
Approach: A cylinder is the collection of tracks at one radial position across all storage surfaces. Compute bytes per cylinder before dividing total capacity. 1. One track contains 4,096×1,024=2¹²×2¹⁰=2²² bytes. 2. A cylinder contains one track on each of 32=2⁵ surfaces, so its capacity is 2⁵×2²²=2²⁷ bytes. The stated surface count is already the number of recording surfaces; it must not be doubled again. 3. Under the question's intended binary convention, 512 GB=512×2³⁰=2³⁹ bytes. 4. Number of cylinders = total bytes / bytes per cylinder = 2³⁹/2²⁷=2¹²=4,096. Answer: 4096. Strict decimal GB would mean 512×10⁹ bytes and would produce approximately 3814.697 cylinders, not the key's integer. The binary convention is therefore made explicit rather than silently treating the two unit definitions as identical.
Balance parallel speedup against per-core overhead
Processor Performance
Tap to enlarge
A program takes 100 ns on one 2 GHz core. Work accounting for 90% of that time parallelizes fully and is shared equally among cores. Every additional core adds 10 ns overhead. How many cores minimize total execution time?
Answer & solution
Official answer: 3
Approach: Write a total-time function containing serial work, divided parallel work, and overhead for cores beyond the first. 1. The serial part takes 10 ns regardless of core count. With k≥1 cores, the parallel part takes 90/k ns. 2. There are k−1 additional cores, so overhead is 10(k−1) ns. Thus T(k)=10+90/k+10(k−1)=90/k+10k ns. 3. Treating k temporarily as continuous, T'(k)=−90/k²+10. The stationary point is k²=9, so k=3. Since T''(k)=180/k³>0, this is the unique continuous minimum. 4. It is also a valid integer choice. Check its neighbors: T(2)=65 ns, T(3)=60 ns, T(4)=62.5 ns. The derivative is negative before 3 and positive afterward, excluding more distant improvements. Answer: 3 cores. The 2 GHz rate is not needed because the baseline and overhead are already specified in time units. Ignoring overhead would incorrectly suggest that more cores always help.
A program has 25% load/store instructions. Ideal CPI is 2; instruction-cache miss rate is 2%; data-cache miss rate is 8%; every miss costs 100 cycles. Find the speedup with perfect instruction and data caches, rounded to two decimals.
Answer & solution
Official answer: 3.00
Approach: Express every stall contribution per executed instruction so they can be added to the base CPI. 1. Every instruction requires an instruction fetch. Instruction-cache stalls therefore contribute 0.02 misses/instruction ×100 cycles/miss=2 cycles/instruction. 2. Only 25% of instructions access data memory. Data-cache stalls contribute 0.25 accesses/instruction ×0.08 misses/access ×100 cycles/miss=2 cycles/instruction. 3. With the stated additive, nonoverlapped miss-penalty model, actual CPI=ideal CPI+instruction stalls+data stalls=2+2+2=6. 4. Perfect caches remove both stall terms and restore CPI=2. With the same instruction count and clock rate, execution time is proportional to CPI, so speedup=old time/new time=6/2=3. Answer: 3.00. Using 8% for every instruction would overcount data misses. The reciprocal 2/6 is the new-to-old time ratio, not the speedup factor.
Similar questions1 more → · asked again: GATE 2021 Set 2, Q20
Convert DMA stolen cycles to bit rate
Input/Output, DMA & Interrupts
Tap to enlarge
A 4 MHz processor gives 1% of its cycles to a cycle-stealing DMA controller. Each stolen cycle transfers 8 bytes to memory. Find the rate in bits/s. A 256000; B 3200; C 2560000; D 32000.
Your answer
Answer & solution
Official answer: C
Approach: Keep the units in each multiplication: cycles/second × stolen fraction × bytes/cycle × bits/byte.
1. Derivation. DMA receives 0.01×4×10⁶=40000 processor cycles per second. Each transfers 8 bytes=64 bits, so the rate is 40000×64=2560000 bits/s, option C. The percentage applies to cycles, and the requested unit is bits rather than bytes.
2. Explanation and checks. One MHz means one million cycles per second, so the available total is 4000000 cycles/s. One percent is 0.01, not 0.1. The DMA transfers 320000 bytes/s; multiplying this intermediate result by eight gives the requested 2560000 bits/s. No additional device or memory bottleneck is specified, so the stipulated eight-byte-per-cycle transfer is used directly rather than introducing an extra latency.
Choose the largest numeric IEEE 754 binary32 value among these sign/exponent/fraction fields. All signs are 0. A exponent 01111111, 23 fraction bits all 1; B exponent 11111110, fraction all 1; C exponent 11111111, fraction all 1; D exponent 01111111, fraction all 0.
Your answer
Answer & solution
Official answer: B
Step through it (6 steps)
Approach: Classify special encodings before comparing the ordinary positive values.
1. Derivation. For a normal binary32 value the magnitude is(1+fraction)×2E−127. B has the largest finite exponent 254 and an all-one fraction, giving(2−2⁻²³)×2¹²⁷, the largest finite positive binary32 value. A is just below 2; D is 1. C has exponent 255 and a nonzero fraction, so it is NaN, not a larger number. Answer B.
2. Explanation and checks. An all-ones exponent is reserved: a zero fraction would encode positive infinity, but the nonzero fraction in C encodes NaN. NaN is unordered and is not a numeric maximum. For B the biased exponent 254 becomes 127, and the fraction sum is 1−2−23, giving significand 2−2−23. A instead has actual exponent zero, and D has both exponent zero and fraction zero, so both are much smaller.
Classify register dependencies by read and write sets
Pipelining & Hazards
Tap to enlarge
Instructions have destination first: I1 DIV R3,R1,R2; I2 SUB R5,R3,R4; I3 ADD R3,R5,R6; I4 MUL R7,R3,R8. Which are true? A I1→I2 RAW on R3; B I1→I3 WAR on R3; C I2→I3 RAW on R3; D I3→I4 WAW on R3.
Select all that apply
Answer & solution
Official answer: A
Approach: Write down which instruction produces a register and which consumes it; retain the stated register name.
1. Derivation. I1 writes R3 and I2 reads R3, a read-after-write dependency, so A is true. I1 and I3 both write R3, making their relation WAW rather than WAR. I2 reads R3 and I3 writes it, giving WAR on R3 (they also have RAW on R5). I3 writes R3 and I4 reads it, giving RAW rather than WAW. Only A.
2. Explanation and checks. On R3 the four operations are write, read, write, read. A later read after an earlier write is RAW, two writes give WAW, and a write after an earlier read gives WAR. This sequence directly classifies each proposed pair. Although I2→I3 does have a RAW dependency on R5, option C explicitly says R3 and is therefore false. A dependency is a program-order relationship; whether it produces an actual stall depends on the implementation.
Similar questions3 more → · asked again: GATE 2015 Set 1, Q54
Average time for randomly located disk sectors
Secondary Storage
Tap to enlarge
A disk rotates at 6000 RPM, has average seek time 5 ms, 500 sectors/track, and 512 bytes/sector. A file occupies 3000 randomly located sectors. Using average rotational latency, estimate total read time in seconds to two decimals.
Answer & solution
Official answer: 29.50 to 30.50
Our answer: 30.06
Approach: For each random sector add average seek, half a revolution, and one-sector transfer time.
1. Derivation. At6000RPM one revolution takes 60/6000=0.01s=10ms. Mean rotational latency is 5ms; one of 500 sectors transfers in 10/500=0.02ms. Using a separate average seek and rotational wait for each randomly placed sector gives 3000×(5+5+0.02)ms=30060ms=30.06s. This is an average random-read estimate, not a guaranteed realized time; cache, scheduling and correlated sector positions are not modeled.
2. Explanation and checks. At 100 revolutions/s the entire track passes in 0.01 seconds. A sector is 1/500 of that track, so its transfer time is 0.00002 seconds. The sector byte count cancels if transfer speed is computed as 500×512 bytes per revolution and divided into a 512-byte request. Because locations are random, the intended model charges seek and rotation for every sector rather than only once for a contiguous file. The derived 30.06 lies inside the preserved official acceptance range 29.50–30.50.
A 32-bit instruction contains opcode, addressing-mode field, two register operands, and a 16-bit scalar. The processor has 16 general-purpose registers and 8 addressing modes. What maximum number of opcodes is possible for each mode?
Answer & solution
Official answer: 32
Approach: Reserve enough binary codes for each independent fixed-width field, then count the remaining opcode patterns.
1. Derivation. Each of 16 registers requires 4 bits, so the two register fields use 8 bits. Eight addressing modes require 3 bits and the scalar field uses 16. The opcode therefore has 32−8−3−16=5 bits, supporting 2⁵=32 unique opcodes for each mode under the separate fixed-field format.
2. Explanation and checks. A register identifier uses ceil(log2 16)=4 bits even though an operand value may occupy many more bits. The two fields therefore cost eight bits, not sixteen or thirty-two. The mode field needs ceil(log2 8)=3 bits. After allocating these and the scalar there are five opcode bits. The question asks per addressing mode, so the eight mode patterns are not multiplied into the number of distinct opcode-field encodings.
A nonpipelined 2 GHz unit averages 6 cycles/instruction. A 5-stage redesign at the same frequency ideally achieves 1 instruction/cycle. In program P, 20% of instructions incur 2 stall cycles for data hazards and 20% incur 3 stall cycles for control hazards. Find steady-state speedup to one decimal.
Answer & solution
Official answer: 2.9 to 3.1
Our answer: 3.0
Approach: Add average stall cycles per instruction to ideal CPI and compare elapsed time at equal clock rate.
1. Derivation. The pipelined average CPI is 1+0.20×2+0.20×3=2. Both designs have the same 2GHz frequency, so their steady-state speedup is 6/2=3.0. The5-stage fill/drain overhead is ignored in this throughput model; instruction count is not supplied. Hazard penalties are treated as additive non-overlapped stalls.
2. Explanation and checks. For a conceptual batch of 100 instructions, ideal execution costs 100 cycles, data stalls add 20×2=40, and control stalls add 20×3=60, totaling 200. The old design costs 600 cycles, so the ratio is three. Pipeline depth alone is not the speedup: it affects overlap, while actual CPI includes stalls. No program length is supplied for computing fill/drain effects, and the conventional average calculation treats the stated penalties additively.
A 32-bit ISA has 150 instructions, 75 each of R-type and I-type, and 50 registers. OPCODE includes a 1-bit type tag plus operation bits. R-type fields: OPCODE, UNUSED, DST, SRC1, SRC2. I-type: OPCODE, DST, SRC, immediate/address. Equal-sized register fields are used. If UNUSED, OPCODE and immediate/address sizes are X,Y,Z, find X+2Y+Z.
Answer & solution
Official answer: 34
Approach: Count the operation bits within each type, add the type bit, then subtract register fields from each format.
1. Derivation. There are 75 operations per instruction type, requiring 7 operation bits plus the 1-bit type tag, so Y=8. Each of 50 architectural registers requires 6 bits. The R-type unused field has X=32−8−3×6=6 bits; the I-type immediate field has Z=32−8−2×6=12 bits. Hence X+2Y+Z=6+16+12=34.
2. Explanation and checks. Six bits encode only 64 operations, insufficient for 75, so seven operation bits are necessary. The one-bit type discriminator brings the full opcode width to eight. Similarly five register bits encode only 32 names, while six accommodate 50. The R-type equation is X+Y+18=32 and the I-type equation is Y+12+Z=32. Adding those equations directly gives X+2Y+Z=64−30=34, which independently checks the field-by-field calculation.
A hazard-free 3-stage pipeline has stage delays 10,20,14 ns, no other delay, and fetches one instruction per cycle. Find total time in ns for 100 instructions, starting with an empty pipeline.
Answer & solution
Official answer: 2040
The pipeline clock must accommodate the slowest stage, 20 ns. Three stages take 3 cycles for the first instruction, followed by one cycle per additional instruction. Thus100 instructions require 100+3−1=102 cycles and 102×20=2040 ns. There are no extra latch delays or hazard stalls by premise.
Teaching detail. A synchronous pipeline cannot clock each stage at its own independent duration: its common cycle length is bounded by the slowest stage. The first instruction leaves stage 3 after three 20 ns cycles. The remaining 99 instructions then finish one per cycle, so the elapsed time is (3+99)·20. Summing delays to get 44 ns per instruction would describe a different, unpipelined calculation. Multiplying only 100·20 overlooks the two extra fill/drain cycles in the finite batch.
A keyboard produces one keystroke per second. Polling every 10 ms costs 100 μs per poll plus 200 μs per detected keystroke; its CPU-time fraction is T1. Interrupt handling and processing together cost 1 ms per keystroke; its fraction is T2. Find T1/T2 to one decimal place.
Answer & solution
Official answer: 10.2
Polling every 10 ms means 100 polls per second, consuming 100×100μs=10000μs. Processing one keystroke adds 200μs, giving T1=10200μs/second. Interrupt-based processing consumes 1ms=1000μs per second, so T1/T2=10200/1000=10.2.
Teaching detail. Keep all quantities in the same unit before taking the ratio. Each second contains 1000/10=100 polling intervals, even though only one of those intervals typically detects a keystroke. Poll overhead is therefore paid 100 times, whereas keystroke processing is paid once. The fractions are T1=0.0102 and T2=0.001, and division gives 10.2. The interrupt approach's larger cost per event can still be much cheaper overall because it avoids 99 unproductive polling checks.
Translate for(i=0;i<10;i++) a[i]=b[i]*8, with 32-bit ints and byte addressing. r1=0,r2=10 and r3,r4 point to a,b. L01 tests r1==r2 and exits; L02 loads from r4; L03 shifts left by U1; L04 stores at r3; L05,L06 add U2,U3 to r3,r4; L07 increments r1; L08 jumps to U4. Find U1,U2,U3,U4.
Your answer
Answer & solution
Official answer: B
Multiplication by 8 is a left shift by 3, so U1=3. A32-bit int occupies 4 bytes in the stated byte-addressed memory, so both source and destination pointers advance 4: U2=U3=4. Each iteration must revisit the termination test at L01, making U4=L01. Answer B, under the usual arithmetic range assumptions for this translation.
Teaching detail. The loop counter r1 counts elements, so its increment is one; the address registers count bytes, so their increments differ. Shifting by 3 multiplies a representable nonnegative binary value by 2³, whereas shifting by 8 would multiply by 256. A jump to L02 would skip the test on later iterations and make termination incorrect. Translating signed C shifts or overflow in full generality requires care, but the intended machine-code comparison is element addressing and multiplication by a power of two within the assumed range.
Four 1 KiB blocks form a 4 KiB byte-addressed memory. External IA4,IA3 select blocks X1,X2,X3,X4 through decoder outputs 00,01,10,11; the other ten address lines feed each block's internal address. Find the external decimal addresses where internal Addr=0 for X1 through X4.
Your answer
Answer & solution
Official answer: C
The internal address lines are all external lines except IA4 and IA3. Internal Addr=0 forces every one of those ten lines to 0. The four blocks are then selected by(IA4, IA3)=00, 01, 10, 11, whose external numeric contributions are 0, 8, 16, 24. Thus C. These are the starts in the interleaved external address map, not contiguous 1024-byte block boundaries.
Teaching detail. The address bits used for selection do not feed the internal address port. Setting internal Addr=0 therefore fixes IA11..IA5 and IA2..IA0 to zero, while leaving IA4,IA3 free to encode the selected block. Their binary place values are 16 and 8. This is an interleaved address mapping: the internal address can change as lower external bits change and block selection can change at bit 3. Assuming the chip-select lines are the two most significant bits would incorrectly produce 0,1024,2048,3072.
Multiply binary32 values P=0xC1800000 and Q=0x3F5C2EF4. Which binary32 encoding results? A 0x404C2EF4; B 0x405C2EF4; C 0xC15C2EF4; D 0xC14C2EF4.
Your answer
Answer & solution
Official answer: C
P=0xC1800000 is−16=−2⁴. Q is a positive normal binary32 number with exponent 126 and fraction 0x5C2EF4. Multiplying by−2⁴ flips the sign and raises the biased exponent from 126 to 130, leaving the fraction unchanged. The result is 0xC15C2EF4, option C. Scaling remains within the normal range and is exact.
Teaching detail. A normal binary32 value is (−1)s·(1+fraction/2²³)·2e−127. For P the sign is 1, biased exponent 131, and fraction zero, yielding −16. For Q the sign is 0 and biased exponent 126. Exact scaling by 16 adds four to that exponent, while the negative multiplier changes the sign bit to 1. Packing sign 1, exponent 130, and unchanged fraction 0x5C2EF4 yields the stated hexadecimal word. No significand multiplication or rounding is needed for this power-of-two scaling.
An 8-way set-associative cache has 64 KiB data capacity and 32-bit byte addresses divided into tag, set index, and block offset. Find the tag width.
Answer & solution
Official answer: 19
Step through it (4 steps)
For byte addressing, cache data capacity equals associativity times number of sets times bytes per block. Therefore the number of sets times block size is 65536/8=8192=213. The index and block-offset fields together occupy 13 bits regardless of the particular power-of-two block size. The tag has 32-13=19 bits. As usual, the stated capacity is data capacity, excluding tag and replacement metadata.
Teaching detail. Let block size be 2b bytes and the number of sets be 2s. Eight ways means each set stores eight blocks, so 216=23·2s·2b and s+b=13. These lower address bits choose a set and byte within a block; the remaining bits identify which memory block occupies the selected way. Therefore tag width is independent of the unspecified block size, provided the conventional power-of-two partition is used. Associativity bits do not appear as a separate address field selecting a way.
Which method gives the highest bulk hard-disk-to-main-memory throughput among A DMA; B interrupt-driven I/O; C polling; D programmed I/O?
Your answer
Answer & solution
Official answer: A
DMA transfers a block directly between the device and memory after CPU setup, avoiding a CPU instruction sequence or interrupt per transferred word. For a large transfer it therefore provides the highest throughput among the offered programmed/interrupt-driven methods, A, under the ordinary comparable-hardware model.
With programmed or polling transfer, the CPU repeatedly tests status and moves data. Interrupt-driven transfer avoids continuous polling but still involves servicing the device. DMA amortizes CPU setup over a block and lets its controller perform the memory transfers, which is the relevant advantage for bulk throughput.
WB and WT are set-associative LRU caches using write-back and write-through respectively. Select FALSE statements: A both need a dirty bit per block; B every WB write hit transfers data to main memory; C WT eviction causes no cache-to-memory transfer; D a WB read miss never evicts a dirty block.
Select all that apply
Answer & solution
Official answer: A,B,D
The question asks for false statements. A is false because write-through does not require dirty bits: writes already update memory. B is false because a write-back hit normally only changes the cache and marks the line dirty. C is true: evicting a write-through line needs no extra write-back. D is false because a write-back read miss can evict a dirty victim and consequently write memory. Thus A, B, D.
Dirty means the cached copy differs from memory. A write-back eviction of a clean victim needs no write; a dirty victim must be written before replacement. LRU determines which victim is chosen, not whether it is dirty, so a read operation can indirectly cause a write-back.
A cache initially has hit rate 0.8, lookup latency 10 ns and additional miss penalty 100 ns. An optimization increases lookup latency to 15 ns, leaving miss penalty unchanged. What minimum new hit rate prevents AMAT increasing? Round to two decimals.
Answer & solution
Official answer: 0.85
Originally the average access time is 10+(1−0.8)100=30 ns. With the slower 15 ns cache it becomes 15+(1−h)100. Requiring this to be at most 30 gives h≥0.85, so the minimum hit ratio is 0.85. The 100 ns miss penalty is additional to the cache lookup, as in the standard AMAT formula.
Solve 15+100−100h≤30: 100h≥85, hence h≥0.85. At exactly 0.85 the AMAT is 15+15=30 ns. A smaller rate would cause the extra cache latency to outweigh the miss-rate improvement.
IEEE-754 binary32 register patterns for A,B,C are C1400000,42100000,41400000 (hex). Which is false? A A+C=0; B C=A+B; C B=3C; D B−C>0.
Your answer
Answer & solution
Official answer: B
Step through it (9 steps)
Decode the binary32 values: 0xC1400000 has sign 1, exponent 130 and significand 1.5, giving −12. 0x42100000 has exponent 132 and significand 1.125, giving 36. 0x41400000 gives 12. Therefore C=A+B is false, since 12≠−12+36=24. The other offered relations hold, so B.
For normalized binary32, value=(−1)^sign ×(1+fraction/223)×2exponent−127. A has unbiased exponent 3 and fraction 0.5: −1.5×8=−12. B has exponent 5 and fraction 0.125: 1.125×32=36. C is +12. Thus A+C=0, B=3C, and B−C=24>0.
An initially empty 2 KB direct-mapped data cache has 64-byte blocks; physical space is 64 KB and words are 16 bits. Access P,Q,R,S in that order ten times, with first-byte addresses 0xA248,0xC28A,0xCA8A,0xA262. Select true statements: A every S hits; B P never evicted after loading; C only R,S remain at the end; D every R evicts Q.
Select all that apply
Answer & solution
Official answer: A,B,D
There are 2048/64=32 cache lines. A byte address maps to line (address>>6) mod 32. P and S both lie in the same block from 0xA240 through 0xA27F, mapping to line 9. Q and R map to line 10 but have different tags. Thus the first P loads the P/S block permanently, and every S access hits. Each Q access replaces R (or loads the initially empty line), and every R access replaces Q. At the end the cache contains the P/S block and the R block, so P still resides and C is false. Select A, B, D. Each two-byte word fits inside its block.
The 16-bit physical byte address splits into 5 tag bits, 5 line bits and 6 offset bits. P: line9,tag 20,offset 8; S: line9,tag 20,offset 34; Q: line10,tag 24,offset 10; R: line10,tag 25,offset 10. The first cycle is miss,miss,miss,hit; later cycles are hit,miss,miss,hit. Therefore there are 21 misses and 19 hits across 40 accesses.
X1 runs at 2 GHz, base CPI 1, with 30% branches and two stall cycles per branch. X2 has the same frequency and base CPI, but predicts 80% of branches correctly, eliminating stalls for those; mispredictions keep the same two-cycle penalty. No other hazards occur. Find speedup rounded to two decimals.
Answer & solution
Official answer: 1.42 to 1.45
Our answer: 1.43
Without prediction, CPI1=1+0.30*2=1.6. With 80 percent correct predictions, only 20 percent of branches still pay the two-cycle penalty, so CPI2=1+0.30*0.20*2=1.12. Both processors have the same frequency and execute the same program, giving speedup 1.6/1.12=10/7, or 1.43 to two decimal places. This uses the stated steady-state CPI model, without separately charging pipeline fill/drain.
Speedup is old execution time/new execution time, not new CPI/old CPI. For N instructions at frequency F, times are N·1.6/F and N·1.12/F, so N and F cancel. The branch predictor saves 0.30×0.80×2=0.48 cycles per instruction, reducing CPI from 1.60 to 1.12.
A system has 2^32 bytes of byte-addressable main memory and a 32 KB direct-mapped cache, with 1 KB=2^10 bytes and 64-byte cache blocks. How many bits are in the address tag?
Answer & solution
Official answer: 17
Step through it (6 steps)
A byte address has 32 bits. The64-byte block uses 6 offset bits; 32KB/64=512 cache lines use 9 index bits. The remaining tag has 32−6−9=17 bits.
A direct-mapped address is partitioned into tag | line index | block offset. The offset selects one of 64 bytes, so it takes log2 64=6 bits. The data capacity contains 32768/64=512 lines, so index needs log2 512=9 bits. Address width is log2(232)=32 bits, leaving 17. Cache size is assumed to mean data capacity, as usual in this exercise, not data plus tag-store overhead.
In IEEE 754 single precision (bias 127), S=1, E=10000001, F=11110000000000000000000. Find the represented decimal value, rounded to two decimal places.
Answer & solution
Official answer: -7.75 to -7.75
Our answer: -7.75
Step through it (5 steps)
The sign is negative. The exponent field 10000001₂=129 gives exponent 2 after subtracting bias 127. The significand is 1.1111₂=31/16. Hence value=−(31/16)·2²=−31/4=−7.75.
For a normalized single-precision number the formula is (−1)S(1.F)_2×2E−127. The stored fraction is .1111₂=1/2+1/4+1/8+1/16=15/16; the hidden leading 1 gives 31/16. E=129 is neither zero nor all ones, so neither subnormal nor infinity/NaN rules apply. Multiplication by 4 yields 7.75, and the sign bit makes it negative.
A five-stage pipeline has stage delays 150,120,150,160,140 ns, and its interstage registers each have 5 ns delay. With no stalls, find the total execution time of 100 independent instructions in ns.
Answer & solution
Official answer: 17160
The clock period is the slowest combinational stage delay plus the pipeline-register delay: 160+5=165 ns. Five stages take five clocks for the first instruction and one clock for each of the remaining 99. Total cycles=5+99=104, so execution time is 104*165=17160 ns under the standard synchronous-pipeline timing convention.
The clock cannot use the average stage delay: every stage must finish before the next common edge, so the 160 ns stage controls. Add 5 ns register overhead once per clock interval to obtain 165 ns, rather than summing all register delays into one stage. The first instruction completes after five clocks and the hundredth after 99 additional clocks. This separates pipeline latency from steady-state throughput and avoids the error 100×5×165.
A byte-addressable machine starts this sequence at address 1000. Instruction, semantics, size in bytes: MOV R1,(5000): R1=MEMORY[5000],4; MOV R2,(R3): R2=MEMORY[R3],4; ADD R2,R1: R2=R1+R2,2; MOV (R3),R2: MEMORY[R3]=R2,4; INC R3: R3=R3+1,2; DEC R1: R1=R1−1,2; BNZ 1004: branch to absolute address 1004 if not zero,2; HALT: stop,1. Initially MEMORY[5000]=10, R3=3000, and MEMORY[3000] through MEMORY[3010] are all 50. All numbers are decimal. Find MEMORY[3010] after execution.
Answer & solution
Official answer: 50
The four-byte first instruction at address 1000 initializes R1=10, and address 1004 is the next instruction, the loop entry. Each loop iteration updates MEMORY[R3], then increments R3 and decrements R1. BNZ tests the zero condition left by that decrement and returns to 1004 while R1 is nonzero. Exactly ten iterations update locations 3000 through 3009. After the tenth, R3 is 3010 and R1 is zero, so the program halts before writing location 3010. Its original value 50 is unchanged.
Instruction addresses are 1000,1004,1008,1010,1014,1016,1018,1020. Thus branching to 1004 skips the initialization at 1000. At iteration k=1,...,10 the address updated is 2999+k and R1 before decrement is 11−k, so memory values written are 60,59,...,51 at 3000,...,3009. The final increment makes R3=3010, but DEC makes R1=0 and the branch falls through to HALT. Merely pointing at 3010 does not write to it.
For IEEE 754 binary32, identify the smallest positive normalized number's exponent and fraction fields. A exponent 00000000/fraction all zero; B exponent 00000000/fraction integer 1; C exponent 00000001/fraction all zero; D exponent 00000001/fraction integer 1. Fraction width is 23 bits.
Your answer
Answer & solution
Official answer: C
A normalized binary32 number has a nonzero exponent field. The smallest positive one uses biased exponent 1 and fraction 0: exponent 00000001, fraction all zeros. Its value is 1.0·21−127=2−126, C. Exponent0 encodes zero or subnormals instead.
Binary32 uses sign 0 for positive, bias 127, and an implicit leading 1 for normal numbers. The least positive normal has the smallest allowed normal exponent and smallest significand. Option B is instead the smallest positive subnormal, 2−149; it is positive but fails the word normalized.
A64-byte block needs 6 offset bits. The remaining index width is 32−22−6=4 bits, giving 16 sets. Capacity2048/64=32 cache lines means 32/16=2 lines per set, so two-way associativity.
Address format is [tag | set index | byte offset]. Capacity includes all ways, so number of sets is not total number of lines unless the cache is direct-mapped. Check reconstruction: 16 sets×2 ways×64 bytes=2048 bytes and 22+4+6=32 address bits.
Similar questions1 more → · asked again: GATE 2024 Set 2, Q11
Input/Output, DMA & Interrupts
Tap to enlarge
DMA cycle stealing moves one 8-bit character per stolen CPU cycle. CPU is 2MHz and 0.5% of cycles are stolen at regular intervals. Find device data rate in bits/s.
Answer & solution
Official answer: 80000
DMA uses 0.005·2, 000, 000=10, 000 CPU cycles per second. Each transfers 8 bits, giving 80, 000 bits per second.
Convert percentage before multiplication: 0.5%=0.005. A 2MHz clock supplies two million cycles each second, so stolen cycles transfer 10000 characters/s. Multiplying by 8 converts to bits/s; 10000 is the byte rate, not the requested bit rate.
Inclusive two-level cache L1,L2 with L2 larger. S1 read misses in write-through L1 do not cause dirty writebacks to L2. S2 write-allocate must accompany write-through and no-write-allocate must accompany write-back. A only S1; B only S2; C both; D neither.
Your answer
Answer & solution
Official answer: A
Write-through propagates each L1 write to the next level, so an evicted L1 line does not need a dirty writeback to L2. S1 is true. Allocation on a write miss is a separate design choice, and the asserted mandatory policy pairing is false. Thus A; conventional write-back/write-allocate and write-through/no-write-allocate combinations already refute S2.
Separate write propagation from write-miss allocation. Write-through specifies when lower memory is updated; write-allocate specifies whether a missing block enters the cache. They are independent policy axes. Inclusion says L1-resident blocks also reside in L2; it does not reverse the normal dirty-state argument for write-through L1.
The same two bytes represent an unsigned value 255 greater under little endian than big endian. Which little-endian hexadecimal values qualify? A 0x6665; B 0x0001; C 0x4243; D 0x0100.
Select all that apply
Answer & solution
Official answer: A; D
For bytes a, b in increasing address order, little-endian value is 256b+a and big-endian value is 256a+b. Their difference 255(b-a) equals 255 exactly when b=a+1. A little-endian numeral must therefore have its high-order byte one larger than its low-order byte. 0x6665 and 0x0100 satisfy this; 0x0001 and 0x4243 have the opposite sign of difference. Answer A, D.
Evaluate options numerically without decimal conversion: byte swap of 0x6665 is 0x6566, difference 0x00FF; swap of 0x0100 is 0x0001, also 0x00FF. The other two have differences −255. Unsigned means the ordinary nonnegative two-byte values, not a signed interpretation of either byte.
Five-stage IF,ID,EX,MEM,WB pipeline; stages each one cycle except MUL EX needs two; ADD EX needs one. ID only decodes; register read happens in EX. Eight instructions alternate ADD,MUL starting ADD, each dependent on previous. Ignore pipeline register delays. Find execution time without forwarding divided by time with forwarding, rounded to two decimals.
Answer & solution
Official answer: 1.87 to 1.88
Our answer: 1.88
With forwarding, dependent instructions enter EX immediately after the previous EX result is ready. EX occupies cycles 3; 4–5; 6; 7–8; 9; 10–11; 12; 13–14. The last WB is cycle 16. Without forwarding, register operands must wait for the previous instruction to finish WB: EX intervals 3; 6–7; 10; 13–14; 17; 20–21; 24; 27–28, and final WB30. Thus speedup=30/16=1.875, rounding to 1.88, inside official 1.87–1.88. This uses the intended cycle-boundary model: a WB result becomes available to an EX register read in the following cycle. Allowing same-cycle WB-to-EX visibility would require a different timing convention; the prompt does not explicitly specify subcycle register timing.
For any instruction with EX finishing in cycle c, MEM occurs c+1 and WB c+2. Forwarding allows the dependent EX to start c+1, whereas the adopted no-forwarding convention requires c+3. Initial IF,ID place first EX in cycle 3; the last instruction then needs two drain cycles after EX. Counting only EX work or omitting pipeline fill/drain produces an incorrect speedup.
Which statements are true? I Daisy chaining assigns interrupt priority. II For a vectored interrupt CPU polls to identify the source. III Polling periodically checks device status bits. IV During DMA the CPU and DMA controller can simultaneously be masters of the bus. Options: A I,II; B I,IV; C I,III; D III only.
Your answer
Answer & solution
Official answer: C
Worked explanation
In a daisy chain an interrupt acknowledge passes through devices in order; the first requesting device captures it, establishing priority. In vectored handling, vector information selects the service routine, avoiding the source-identification poll claimed in II. Polling explicitly means testing device status, establishing III. DMA can overlap CPU computation that does not require the shared bus, but that is different from two simultaneous masters driving one shared bus. The conventional bus arbitration model permits one current owner, making IV false.
Derivation and answer
Daisy chaining imposes interrupt priority, and polling periodically examines device status, so I and III are true. A vectored interrupt supplies identification/vector information rather than requiring source polling. A single shared bus has one current master, so CPU and DMA controller cannot simultaneously master that bus. Thus C in the depicted conventional bus model.
Execute R0←R1+R2 on a single-bus datapath. Figure equivalent: bus connects MAR, MDR, IR, PC and R0–R7; one ALU input comes directly from bus, the other from TEMP1 (loaded from bus); ALU output enters TEMP2, which can drive bus. MAR addresses memory; MDR exchanges memory data. PC increment is handled. Steps (r read,w write): 1 R2_r,TEMP1_r,ALU_add,TEMP2_w; 2 R1_r,TEMP1_w; 3 PC_r,MAR_w,MEM_r; 4 TEMP2_r,R0_w; 5 MDR_r,IR_w. Correct order? A 2,1,4,5,3; B 1,2,4,3,5; C 3,5,2,1,4; D 3,5,1,2,4.
Your answer
Answer & solution
Official answer: C
Worked explanation
Follow data dependencies rather than memorizing an instruction cycle. The instruction register cannot receive the requested instruction before the PC address has been sent to memory and the result has reached MDR, so 3 precedes 5. To add two register values on one bus, first save one operand in TEMP1: step 2 must precede step 1. The ALU result is latched into TEMP2 before R0 can receive it, so 1 precedes 4. Fetch followed by execution therefore gives 3→5→2→1→4. D violates the TEMP1 dependency; A,B attempt execution before the fetch sequence.
Derivation and answer
Fetch the instruction with PC→MAR and memory read(step3), then MDR→IR(step5). Load R1 into TEMP1(step2), add R2 through the bus with TEMP1 and store the result in TEMP2(step1), then TEMP2→R0(step4). Therefore3, 5, 2, 1, 4, C.
A 1 MB direct-mapped cache has 256-byte blocks, access time 3 ns, hit rate 94%, and 64-bit words. On a miss, main memory delivers the first word in 20 ns and every subsequent word in 5 ns. Find average access time to one decimal place. Official scoring accepts 13.3 or 13.5 ns as separate values.
Answer & solution
Official answer: 13.3 OR 13.5
Our answer: 13.5 or 13.3 under the two accepted timing conventions
Worked explanation
Convert the word size first: 64 bits is 8 bytes. A block therefore contains 32 words, and the first-word latency is paid once, followed by 31 further transfers, giving 20+31×5=175 ns. Miss probability is 1−0.94=0.06. If the 175 ns is an extra miss penalty after lookup, every reference pays 3 ns and 6% pay the extra penalty. If it is the entire miss-path time instead, only the hit branch uses the separate 3 ns figure in a weighted average. These conventions produce the two official answers already preserved below. The 1 MB capacity and direct mapping are not needed once the hit rate is given. No early-restart timing is specified, so use a full refill.
Derivation and answer
Each block holds 256/8=32 words. A complete refill takes 20+31·5=175 ns. If a miss incurs the 3 ns cache lookup before refill, AMAT=3+0.06·175=13.5 ns. If the 175 ns miss time is treated as the total miss-service time, the weighted average is 0.94·3+0.06·175=13.32 ns, rounding to 13.3. The official key explicitly accepts both 13.3 and 13.5; neither is silently discarded. Both calculations assume full-block service without critical-word early restart.
R1=0x42200000 and R2=0xC1200000 are IEEE-754 single-precision bit patterns. Find the pattern for R3=R1/R2. A 0x40800000; B 0xC0800000; C 0x83400000; D 0xC8500000.
Your answer
Answer & solution
Official answer: B
Step through it (10 steps)
Worked explanation
For a normal single-precision value, decode (−1)s×(1+fraction/223)×2E−127. R1 has s=0,E=132,fraction=0x200000, so its significand is 1+1/4=1.25 and its value is 40. R2 has s=1,E=130,the same fraction, so it is −10. Divide the represented values, not the hexadecimal integers: 40/(−10)=−4. Normalize −4 as −1.0×2², yielding sign 1, exponent 129=10000001₂ and all-zero fraction. Packing those fields gives 0x80000000+0x40800000=0xC0800000. No rounding is needed because all values are exact powers-of-two fractions.
Derivation and answer
0x42200000 represents+1.25·2⁵=40. 0xC1200000 represents−1.25·2³=−10. Their quotient is−4=−1.0·2². Its sign bit is 1, biased exponent 129, fraction 0, yielding 0xC0800000, B.
A 32-bit-word system has 16 MB byte-addressable memory and a 64 KB four-way set-associative cache with 256-byte blocks. Addresses: A1=0x42C8A4, A2=0x546888, A3=0x6A289C, A4=0x5E4880. Which is true? A A1,A4 map to different sets; B A2,A3 same set; C A3,A4 same set; D A1,A3 same set.
Your answer
Answer & solution
Official answer: B
Worked explanation
Compute organization before extracting bits. Total cache blocks=216/28=28; four blocks per set gives 26 sets. A 24-bit physical byte address therefore divides as tag 10 bits | set 6 bits | byte offset 8 bits. Shifting each address right by 8 discards its final byte; masking the next six bits gives 0x08,0x28,0x28,0x08, or 8,40,40,8. Same set does not require equal tags or equal byte offsets, and four-way associativity does not change this index extraction. Only B among the offered statements is true.
Derivation and answer
The cache has 65536/256=256 lines and 64 four-way sets. Offset uses 8 bits and set index 6 bits, so index=(address>>8)&63. The four addresses map to sets 8, 40, 40, 8, respectively. Exactly A2 and A3 share a set among the listed positive claims, B; A1 and A4 actually also share a set, contrary to A.
A nonpipelined 2.5 GHz processor takes 5 cycles/instruction. Its five-stage pipeline runs at 2 GHz. Program mix: 30% memory,60% ALU,10% branch. Of memory instructions,5% cause 50-cycle stalls. Of branches,50% cause 2-cycle stalls. ALU instructions cause none. Find steady-state speedup to two decimals.
Answer & solution
Official answer: 2.15 to 2.18
Our answer: 2.16
Worked explanation
Use time per instruction, since the two designs have different clocks. For 1000 representative instructions, 300 are memory, of which 15 stall for 750 cycles total; 100 are branches, of which 50 stall for 100 cycles total. Add the ideal 1000 pipeline cycles to obtain 1850, or CPI=1.85. Nonpipelined cycle time is 1/2.5 GHz=0.4 ns, so an instruction takes 2 ns. Pipeline cycle time is 0.5 ns, making average time 0.925 ns. Speedup is old time/new time=2/0.925=2.162162…, rounded 2.16. Counting 5% of all instructions as cache misses would overstate the penalty because that rate is conditional on memory instructions.
Derivation and answer
The non-pipelined time per instruction is 5/(2.5GHz)=2 ns. The pipeline average CPI is 1+0.30*0.05*50+0.10*0.50*2=1.85. At2GHz its average time is 1.85*0.5=0.925 ns per instruction. Speedup=2/0.925=2.162162..., or 2.16, within the official 2.15–2.18 range. This is the long-program steady-state calculation; the fixed pipeline fill/drain cost is neglected because program length is not supplied.
A processor has 64 registers and 16-bit instructions. I-type has opcode, one register and a 4-bit immediate; R-type has opcode and two registers. Given 8 I-type opcodes, what is the maximum number of distinct R-type opcodes?
Answer & solution
Official answer: 14
Worked explanation
A register number occupies log2 64=6 bits. I-type operands occupy 6+4=10 bits, leaving a 6-bit opcode; R-type operands occupy 12 bits, leaving a 4-bit opcode. Their opcode spaces cannot be independently filled because every complete 16-bit word needs an unambiguous interpretation. Each chosen I opcode consumes 210 words, so eight consume 8192. R opcodes each need 212 distinct operand combinations; the 57344 words left permit 14. Constructively, use four-bit prefixes 0000 through 1101 for R instructions. Reserve 1110 and 1111, extending each by two bits to obtain the eight six-bit I opcodes. This proves attainability as well as the counting bound.
Derivation and answer
Each register field needs 6 bits. An I-type opcode leaves 10 operand bits, so 8 I-type opcodes reserve 8*210=8192 of the 65536 instruction words. An R-type opcode needs 12 operand bits, consuming 4096 words. The remaining 57344 words allow 57344/4096=14 R-type opcodes. Achievability: reserve two four-bit opcode prefixes for the eight six-bit I-opcodes and use the other 14 four-bit prefixes for R-type instructions.
A byte-addressed processor has 32-bit addresses and a fully associative 16 kB cache with 16-byte blocks. Find tag bits and index bits, in that order. Choices: A (24,0); B (28,4); C (24,4); D (28,0).
Your answer
Answer & solution
Official answer: D
Step through it (6 steps)
Method: partition the address into tag, set index, and block offset.
1. Because memory is byte-addressed, the offset selects one of the 16 bytes in a block. It requires log2(16) = 4 bits. 2. A fully associative cache has only one set containing all cache lines. Any memory block can occupy any line, so the processor address supplies no set index: log2(1) = 0 bits. 3. The remaining address bits identify which memory block is stored: tag bits = 32 − 4 − 0 = 28. 4. The 16 kB capacity determines the number of available lines, not an address index in this organization. Interpreting kB as 1024 bytes gives 1024 lines, all compared associatively.
Result: D, 28 tag bits and 0 index bits. The four low-order bits are an offset, not an index.
Sixteen address lines are A15 through A0. A five-input AND chip-select gate receives A15, A14, inverted A13, inverted A12, and A11. Which address range enables the chip? Choices: A C800–CFFF; B CA00–CAFF; C C800–C8FF; D DA00–DFFF, all hexadecimal.
Your answer
Answer & solution
Official answer: A
Method: turn the gate into fixed high-order bits and let every unused low-order address bit vary.
1. The active-high AND output is CS = A15 AND A14 AND NOT A13 AND NOT A12 AND A11. It is 1 only when A15…A11 = 11001. 2. Address lines A10…A0 do not enter the gate. Their 11 bits may take any values, giving 211 = 2048 consecutive addresses for the selected chip. 3. The lowest address sets those bits to zero: 1100 1000 0000 0000 in binary, or C800 in hexadecimal. 4. The highest address sets them all to one: 1100 1111 1111 1111, or CFFF. The number of addresses is CFFF − C800 + 1 = 0800 hexadecimal = 2048, agreeing with step 2.
Result: A, C800 through CFFF inclusive. The circles on A13 and A12 are inversions, so those original address lines must be zero, not one.
A cache block contains 8 words of 4 bytes each. With a 60 MHz memory clock, serial miss service uses 1 cycle to accept the address, 3 cycles to fetch the block, then transmits 1 word per cycle. Find maximum bandwidth as a coefficient of 10^6 bytes/s.
Answer & solution
Official answer: 160
1. Compute useful bytes per completed block: 8 words×4 bytes/word=32 bytes. Clock frequency is 60×106 cycles per second. 2. The description gives successive stages, so their times add. Address acceptance takes 1 cycle, block fetching takes 3, and sending eight words at one per cycle takes 8. Total service time is 1+3+8=12 cycles per block. 3. The completed-block rate is (60×106)/12=5×106 blocks/s. Multiplying by 32 bytes/block gives 160×106 bytes/s. 4. Thus the requested numeric coefficient is 160. Equivalently, one block takes 12/(60×106)=200 ns, and 32 bytes/200 ns gives the same bandwidth. 5. Counting only the eight transfer cycles would incorrectly ignore the four-cycle overhead. Conversely, interpreting the three fetch cycles as three per word would contradict the stated fetch of all eight words. This calculation assumes the sequential per-block controller service described; overlapping different block transactions would require a separate pipelining model not specified here.
Which characterize conventional RISC design? I arithmetic only register-to-register; II fixed-length instructions; III hardwired control. Choices: A I,II; B II,III; C I,III; D all three.
Your answer
Answer & solution
Official answer: D
Method
A load/store design keeps arithmetic operands in registers and uses separate instructions for memory transfers. Regular instruction lengths simplify fetching and decoding, while simple instruction semantics support direct hardwired control instead of a large microprogram. These properties work together to simplify pipelining. The question asks about the conventional design model; modern instruction-set families can have compressed encodings or other extensions without making the textbook characterization invalid.
Solution
The conventional RISC design combines register-to-register arithmetic, fixed-length instruction encoding and hardwired control. All three listed characteristics apply, D. These are textbook design characteristics, not a claim that every modern RISC extension has identical instruction lengths.
After an interrupt during process L: P saves L status on control stack; Q finishes current instruction; R executes ISR; S restores L status; T loads ISR PC. Choose A QPTRS; B PTRSQ; C TRPQS; D QTPRS.
Your answer
Answer & solution
Official answer: A
Method
At an instruction boundary the processor has a consistent state to save. Save that state before replacing the program counter, otherwise the return address and other status could be lost. Loading the interrupt-vector target transfers control to the handler; restoring saved state is meaningful only after the handler finishes. The model describes an ordinary precise interrupt, not an exception that aborts and restarts the current instruction.
Solution
Complete the current instruction(Q), save the interrupted process state(P), load the ISR entry PC(T), run the ISR(R), and restore the saved state(S). The order is QPTRS, A.
A 1 GB, 32-bit-wide memory uses 256M×4-bit DRAMs. Each chip has 2^14 rows; refreshing a row takes 50 ns and all rows must refresh every 2 ms. Find the nearest-integer percentage available for reads/writes.
Answer & solution
Official answer: 59.0 to 60.0
Our answer: 59 percent
Method
Eight 4-bit chips operate in parallel to provide the 32-bit word. Since corresponding rows refresh together, the memory loses 16384 row-refresh slots per period, not eight times that number. Convert all durations to one unit: 2 ms=2000000 ns, and refresh consumes 819200 ns. Available time is 1180800 ns per period. Divide available time by total time, rather than reporting the refresh fraction.
Solution
The row refresh time per period is 214·50 ns=819200 ns=0.8192ms. The remaining fraction of the 2ms period is 1−0.8192/2=0.5904, or 59.04%, rounded 59%. The eight parallel 4-bit chips refresh a row together to form the 32-bit memory; their refresh times are not added serially.
Physical addresses span 2^P bytes, words have 2^W bytes, cache capacity is 2^N bytes, blocks hold 2^M words, and associativity is K. Choose tag bits: A P−N−log₂K; B P−N+log₂K; C P−N−M−W−log₂K; D P−N−M−W+log₂K.
Your answer
Answer & solution
Official answer: B
Method
A byte address has P bits. First convert block capacity from words to bytes, obtaining 2M+W. Cache blocks total 2N−M−W; grouping K per set divides this by K. Address bits split into tag, set index and byte-within-block offset. Increasing associativity at fixed capacity reduces index bits and therefore increases tag bits, a useful sign check on the log₂K term. The result assumes integral power-of-two field sizes.
Solution
A block contains 2M+W bytes. There are 2N−M−W/K sets, so index bits=N−M−W−log2K, and block-offset bits=M+W. Subtract both from P address bits: tag=P−N+log2K, B, under the conventional power-of-two cache parameters.
A pipeline is IF,ID,OF,PO,WB. Every stage except PO takes one cycle. Among 100 instructions PO takes 3 cycles for 40, 2 for 35, and 1 for 25. No data/control hazards. Find total cycles under single-occupancy PO operation.
Answer & solution
Official answer: 219
Method
Start with the ideal five-stage baseline: 100+5−1=104 cycles if every PO takes one cycle. The 40 three-cycle operations add 40·2=80 stall cycles; the 35 two-cycle operations add 35·1=35. Total is 104+80+35=219. This agrees with adding three fill cycles, all PO occupancies, and one final writeback cycle. It would be wrong to charge every instruction five separate nonoverlapped stages; most stage work overlaps.
Solution
The single PO stage is occupied for 40*3+35*2+25*1=215 clocks. The first instruction needs 3 clocks to reach PO through IF, ID, OF, and the final instruction needs 1 WB clock afterward. With no data/control hazards, earlier stages can supply the next instruction whenever PO becomes free, so total=3+215+1=219. This uses the intended non-overlapped PO-stage model; a separately internally pipelined execution unit would need an initiation-interval specification.
A 16-bit instruction set has 16 integer and 64 floating registers. Four type-1 instructions use 3 integer operands; eight type-2 use 2 floating operands; fourteen type-3 use 1 integer+1 floating; N type-4 use 1 floating. Find maximal N.
Answer & solution
Official answer: 32
Method
An integer register needs 4 bits and a floating register 6 bits. Operand bits are therefore 12,12,10,6 for the four categories, leaving variable opcode widths 4,4,6,10. Counting complete instruction words avoids assigning incompatible fixed-length opcodes. Each opcode must reserve all combinations of its operands. After subtracting the first three categories from the 65536 available words, divide the remaining words by 64 per type-4 instruction. The prefix construction below verifies that this counting bound can actually be encoded.
Solution
There are 216 instruction encodings. A three-integer-register instruction uses 212 encodings, as does a two-floating-register instruction. Each mixed register instruction uses 210 encodings. The remaining space is 65536−4*4096−8*4096−14*1024=2048. Each type4 opcode needs 64 encodings, so N≤2048/64=32. This bound is achievable with expanding opcodes: allocate 12 four-bit prefixes to types 1/2; the remaining 4 prefixes yield 16 six-bit prefixes, 14 for type3, leaving 2 prefixes expandable to 32 ten-bit type4 opcodes.
C declaration: struct data { int marks[100]; char grade; int cnumber; }; struct data student; Register R1 holds the base address of student. How to access student.grade efficiently? A postincrement (R1)+; B predecrement −(R1); C register direct R1; D indexed X(R1), with signed 16-bit displacement X.
Your answer
Answer & solution
Official answer: D
1. A structure layout assigns each member a fixed byte offset from its base. The compiler determines grade’s offset after the marks array, accounting for the implementation’s layout rules.
2. R1 already contains the base. Computing effective address R1+X directly selects grade without traversing the array or modifying R1.
3. That is displacement/index addressing X(R1), D. Register direct accesses the register rather than the field; predecrement and postincrement unnecessarily change the base. No assumed int width is needed.
A two-level cache sees 1.4 memory accesses per instruction. L1 miss rate is 0.1; L2 has 7 misses per 1000 instructions. Find the L2 miss rate to two decimals.
Answer & solution
Official answer: 0.05
1. Choose a common basis of 1000 instructions. This gives 1000×1.4=1400 L1 accesses.
2. L1 misses on 0.1×1400=140 of these, and only those misses access L2. L2 therefore sees 140 accesses, not 1400 and not 1000.
3. Its local miss rate is L2 misses/L2 accesses=7/140=0.05. Dividing 7 by 1400 instead computes a global miss rate and answers a different question.
A RISC instruction is 4 bytes. Branch offsets are byte offsets relative to the NEXT instruction. Instructions are i:add R2,R3,R4; i+1:sub R5,R6,R7; i+2:cmp R1,R9,R10; i+3:beq R1,Offset. Branch target is i. Find signed decimal Offset.
Answer & solution
Official answer: -16.0 to -16.0
Our answer: -16
1. Let the byte address of instruction i be A. Then i+1,i+2,i+3 have addresses A+4,A+8,A+12.
2. The branch uses the next instruction as reference, which is i+4 at A+16, not the branch’s own address A+12.
3. Offset=target−reference=A−(A+16)=−16 bytes. The negative sign denotes a backward branch. Counting three instruction gaps from the branch itself would incorrectly give −12.
Five pipeline stages IF,ID,OF,EX,WB take 5,4,20,10,3 ns; interstage buffer overhead is 2 ns. NP uses these five stages. EP splits OF into OF1=12 ns,OF2=8 ns. Find EP speedup over NP for 20 independent hazard-free instructions, to two decimals.
Answer & solution
Official answer: 1.49 to 1.52
Our answer: 1.51
1. The clock period is the slowest stage plus buffer overhead. NP therefore has period max(5,4,20,10,3)+2=22 ns. Its five-stage pipeline needs 5+(20−1)=24 cycles, or 528 ns.
2. EP has stages 5,4,12,8,10,3 ns, so its period is 12+2=14 ns. Six stages need 6+19=25 cycles for the same twenty instructions, or 350 ns.
3. Speedup is old time/new time=528/350=1.508571..., rounding to 1.51. Using only the clock ratio 22/14 neglects the extra fill cycle.
A 256-block, 2-way set-associative cache uses LRU and starts empty. Repeat this block-reference sequence ten times: 0,128,256,128,0,128,256,128,1,129,257,129,1,129,257,129. Count conflict misses, excluding compulsory first-access misses.
Answer & solution
Official answer: 76.0
Our answer: 76
1. There are 256/2=128 sets. Block number modulo 128 puts {0,128,256} in set 0 and {1,129,257} in set 1; each set holds only two blocks.
2. For the first set-0 subsequence 0,128,256,128,0,128,256,128 the outcomes are compulsory,compulsory,compulsory,hit,conflict,hit,conflict,hit. LRU ends with 256 then 128 from least to most recent. Set 1 behaves identically.
3. Each later subsequence starts with those two survivors: accesses to its first,third,fifth,seventh entries miss, all now conflicts. Thus repetition 1 has four conflicts total, and each of nine later repetitions has eight. Total=4+9×8=76 conflicts, alongside six compulsory misses.
A cache has capacity N words, blocks of B words, and a 10-bit tag when directly mapped. With unchanged capacity and block size, redesign as 16-way set associative. Find tag width.
Answer & solution
Official answer: 14.0
Our answer: 14
1. Address bits are partitioned into tag, set index, and block offset. Keeping B fixed leaves offset width unchanged.
2. A direct-mapped cache has N/B sets. A 16-way cache of the same total capacity has N/(16B) sets, requiring log₂16=4 fewer index bits.
3. The address width has not changed, so those four bits move to the tag. New tag width=10+4=14 bits. Associativity changes the set count, not the number of offset bits.
A 32-bit IEEE-754 single-precision number has bits 00111110011011010000000000000000 (sign/exponent/fraction: 0 | 01111100 | 11011010000000000000000). Which listed decimal value is closest? A:1.45×10¹. B:1.45×10^-1. C:2.27×10^-1. D:2.27×10¹.
Your answer
Answer & solution
Official answer: C
Step through it (6 steps)
1. For a normal single-precision number, value=(-1)^sign × (1.fraction)₂ × 2stored exponent-127. Here sign=0, exponent 01111100₂=124, and the exponent is therefore -3.
2. The significand is 1+2-1+2-2+2-4+2-5+2-7=1.8515625. Multiplication by 2-3 gives 0.2314453125.
3. Compare the offered approximations rather than requiring an exact match. Its distance from 0.227 is 0.0044453125, much less than its distance from 0.145; 14.5 and 22.7 are far away. Hence C. The hidden leading 1 and exponent bias are both essential.
L1 and L2 cache access times are 1 and 8 cycles. The additional L2-to-memory miss penalty is 18 cycles. The L1 miss rate is twice the L2 miss rate. Given AMAT=2 cycles, find the rates (L1,L2). A:(0.111,0.056). B:(0.056,0.111). C:(0.0892,0.1784). D:(0.1784,0.0892).
Your answer
Answer & solution
Official answer: A
1. Let m be the local L2 miss rate, conditional on reaching L2. The L1 miss rate is 2m. Every access pays 1 cycle, an L1 miss adds 8, and an L2 miss on that path adds 18.
2. Therefore 2=1+2m(8+18m). Expanding gives 36m²+16m-1=0. The quadratic formula gives m=(-16±√400)/72, so its nonnegative root is 4/72=1/18; the other root is invalid as a probability.
3. Thus L2 misses about 0.05556 and L1 misses 1/9≈0.11111. In the requested L1,L2 order, the rounded pair is A. Treating the L2 rate as a global rate, or charging lower-level time on every hit, would give a different model.
I-cache read time/hit ratio:2 ns/0.8; D-cache:2 ns/0.9; shared L2:8 ns/0.9. Main-memory read time is 90 ns. Caches are direct mapped, use referred-word-first and write-back, and every dirty bit is 0. Of reads,60% fetch instructions and 40% fetch operands. Find average read time in ns to two decimals.
Answer & solution
Official answer: 4.72
1. Compute the chance of reaching L2 by weighting the two L1 miss rates: 0.6(1-0.8)+0.4(1-0.9)=0.12+0.04=0.16. Every read first pays the 2 ns L1 lookup.
2. Conditional on an L1 miss, the L2 lookup adds 8 ns. Its local miss probability is 0.1, and such a miss adds 90 ns for memory. The expected additional time on an L1 miss is therefore 8+0.1·90=17 ns.
3. AMAT=2+0.16·17=4.72 ns. As a separate check, instruction reads average 2+0.2·17=5.4 ns and data reads 2+0.1·17=3.7 ns; 0.6·5.4+0.4·3.7=4.72. Clean blocks eliminate dirty write-back penalties, and referred-word-first permits the demanded read to finish without waiting for an unspecified whole-block transfer.
A byte-addressable main memory contains 2^32 bytes, divided into 32-byte blocks. A direct-mapped cache has 512 lines. How many address bits form the tag field?
Answer & solution
Official answer: 18.0
Our answer: 18
Step through it (6 steps)
1. There are 232 separately addressable bytes, so a memory address needs 32 bits. A 32-byte block needs log₂32=5 low-order offset bits to select a byte within it.
2. A direct-mapped cache with 512=29 lines uses 9 index bits to select the one cache line where a block may reside.
3. The remaining high-order bits distinguish the different memory blocks that map to that same line: tag=32-5-9=18 bits. Equivalently, memory has 227 blocks and each of 29 lines represents 218 possible blocks. Do not use 512 as the cache byte capacity; it is the number of lines.
A processor supports up to 4 GB of word-addressable memory, with two bytes per word. What is the minimum address-bus width in bits?
Answer & solution
Official answer: 31.0 : 31.0
Our answer: 31
Using the exam’s binary memory-size convention, 4 GB=2³² bytes. A word address identifies two bytes, leaving 2³¹ addressable words and requiring 31 address bits. Decimal 4·10⁹ bytes gives the same ceiling 31.
The address bus counts addressable units, not bytes unless memory is byte-addressable. Here each address selects one two-byte word, so divide byte capacity by 2 before taking the base-two logarithm. With 31 address bits there are 231 distinct patterns, exactly enough for the word addresses. Thirty bits would reach only 230 words, or 2 GiB, so the lower width is insufficient. Data-bus width and address-bus width are separate questions.
A DMA controller has a 16-bit data-count register. It must transfer 29154 kilobytes from disk into byte-addressable main memory. What is the minimum number of bus acquisitions needed to transfer the file? Use the paper's binary kilobyte and block-transfer convention.
Answer & solution
Official answer: 456.0 : 456.0
Our answer: 456
Under binary kilobytes and burst transfer, a 16-bit count supports at most 2¹⁶ bytes per programmed transfer (or 65535 under a literal maximum-count convention, which gives the same ceiling here). The file has 29154·1024 bytes. Ceiling(29154/64)=456 bus acquisitions. This assumes a DMA burst retains the bus for its programmed block; cycle stealing would count differently. Decimal kilobytes would yield 445, so the binary-unit convention matters.
The file contains 29853696 bytes. A count register bounds bytes per programmed block in byte-addressable memory, so use a ceiling:455 full 64 KiB blocks carry 29818880 bytes, leaving 34816 bytes for one more block. Rounding down would leave data untransferred. If the usable maximum count is 65535 rather than 65536,455 such blocks still fall short and 456 suffice. The answer concerns block ownership episodes, not one bus acquisition per individual byte.
A4-stage pipeline has delays 800,500,400,300 ps. Replace its 800 ps stage by two equivalent stages of 600 ps and 350 ps. Ignoring unspecified register overhead, find the percentage increase in steady-state throughput.
Answer & solution
Official answer: 33.0 : 34.0
Our answer: 33.33%
Ignoring unstated register overhead, the old steady-state clock is 800 ps and the new bottleneck 600 ps. Throughput rises from 1/800 to 1/600 instructions/ps. Relative increase=(800/600−1)·100%=33.333...%, rather than the 25% decrease in clock period.
A pipeline clock must accommodate its slowest stage, so the new clock is max(600,350,500,400,300)=600 ps. After filling, an ideal pipeline completes one item each clock; the number of stages affects latency but not this rate. The ratio of rates is (1/600)/(1/800)=4/3. Subtracting 1 and converting to percent gives 33⅓%. Computing(800−600)/800 instead measures a 25% period reduction, a different requested quantity.
An n-bit carry-lookahead adder uses gates with fan-in at most 2. What is its asymptotic addition time? A: Θ(1). B: Θ(log n). C: Θ(√n). D: Θ(n).
Your answer
Answer & solution
Official answer: B
With bounded fan-in 2, carry generate/propagate combines through a balanced prefix tree of depthΘ(log n). The high-order result depends on Θ(n) inputs, and depth d gates can depend on at most 2d inputs, giving a matching Ω(log n) lower bound. Thus Θ(log n), B.
A carry can be summarized by generate and propagate signals, and adjacent summaries combine associatively. A balanced tree merges pairs, then groups of 4,8 and so on; after logarithmically many levels the needed carry information spans all bits. With fan-in bounded by 2, a constant number of levels cannot combine information from arbitrarily many positions. This restriction is why the unbounded-fan-in intuition of a single huge AND/OR gate cannot justify constant-time addition here.
A processor has 40 instructions and 24 general-purpose registers. Its 32-bit instruction has an opcode, two register fields and an immediate field. How many bits remain for the immediate?
Answer & solution
Official answer: 16.0 : 16.0
Our answer: 16
Forty opcodes require ceil(log₂40)=6 bits. Each of 24 registers requires 5 bits, so two register fields need 10. The immediate field has 32−6−10=16 bits.
An r-bit identifier distinguishes at most 2r possibilities. Five opcode bits cover only 32 instructions, so six are needed; four register bits cover only 16 registers, so five are needed per operand. Some encodings remain unused, but fractional bit fields are impossible in this fixed-field format.
Functional units UF and UG compute F and G in 5 ns and 3 ns. Two instances of each are available. Find the minimum completion time for ten computations F(G(Xi)), i=1,…,10, ignoring other delays.
Answer & solution
Official answer: 28.0 : 28.0
Our answer: 28
Each of the two F units must perform at least five 5 ns operations to finish ten jobs. No F can begin before the first G output at 3 ns, so makespan≥3+25=28 ns. Two G units produce pairs at 3, 6, 9, 12, 15 ns. Feed the F units continuously in paired intervals 3–8, 8–13, 13–18, 18–23, 23–28. This attains 28 ns.
Think in five two-job batches. The G stage finishes each batch every 3 ns, whereas F needs 5 ns, so F is the bottleneck after startup. Waiting buffers hold early G outputs while F is busy. Multiplying ten jobs by 8 ns ignores parallelism; using just 25 ns forgets the unavoidable initial G latency.
A machine has 64 registers and 12 instructions. Each instruction has opcode, two source registers, one destination register, and a 12-bit immediate. Instructions must be individually byte aligned. Find bytes used by 100 instructions.
Answer & solution
Official answer: 500.0 : 500.0
Our answer: 500
Twelve opcodes need 4 bits; each of three register identifiers needs 6 bits for 64 registers; immediate uses 12. Total 34 bits per instruction. Byte alignment requires ceiling(34/8)=5 bytes per instruction, so 100 instructions occupy 500 bytes.
The bit fields require 4+6+6+6+12=34 bits. Individually byte-aligned storage rounds each instruction up to 40 bits, leaving six padding bits per instruction. Rounding only the aggregate 3400 bits would give 425 bytes but pack subsequent instructions at nonbyte boundaries, contrary to the stated alignment rule.
A machine’s physical addresses have 40 bits. Find tag width in a 512 KB, 8-way set-associative cache under the usual byte-addressed binary-capacity convention.
Answer & solution
Official answer: 24.0 : 24.0
Our answer: 24
Step through it (4 steps)
For byte-addressed memory and binary KB, cache capacity 512 KiB=219 bytes with 8 ways gives 216 bytes per way. Index plus block-offset bits total 16 regardless of block size, leaving 40−16=24 tag bits. The usual power-of-two cache and byte-address convention is assumed.
Let a block contain 2b bytes. The number of cache sets is 219/(2³×2b)=216−b. Therefore the address has b offset bits and 16−b index bits; their sum is fixed even though block size is unstated. The remaining high 24 bits distinguish memory blocks mapping to the same set.
A three-stage 3 GHz pipeline has τ1=3τ2/4=2τ3. Split the longest stage into two equal stages. Ignoring pipeline-register delay, find the new frequency in GHz.
Answer & solution
Official answer: 3.9 : 4.1
Our answer: 4 GHz
The relation gives tau2=4tau1/3 and tau3=tau1/2; tau2 is originally longest. A3GHz clock therefore has tau2=1/3 ns and tau1=1/4 ns. Splitting tau2 creates two 1/6 ns stages; the new bottleneck is tau1=1/4 ns, giving 4GHz.
The original stage times are τ1=1/4 ns, τ2=1/3 ns, τ3=1/8 ns. After splitting, the four stages are 1/4,1/6,1/6,1/8 ns. The clock period is their maximum, not their average or sum. Adding one stage does not automatically multiply the frequency by four-thirds; it does so here because of these particular delays.
In a three-address instruction format, what may an address field specify? S1 memory operand; S2 processor register; S3 implied accumulator register. A either S1 or S2; B either S2 or S3; C only S2 and S3; D all S1,S2,S3.
Your answer
Answer & solution
Official answer: A
An instruction such as ADD destination,source1,source2 names its explicit operands. Depending on the instruction-set architecture, these fields can select memory locations or registers. An implied accumulator needs no address field because its identity is determined by the opcode or architecture. The issue is explicit versus implicit designation, not whether an accumulator physically exists.
Solution: Three-address instruction operands can refer to registers or memory as defined by the architecture. An accumulator is implicit in an accumulator architecture, not required as one of these explicit operand addresses. Thus A.
Similar questions3 more → · asked again: GATE 2024 Set 2, Q53
Secondary Storage
Tap to enlarge
Disk seek=4 ms, rotation=10000 RPM, 600 sectors/track, 512 bytes/sector. File has 2000 sectors. Every sector access needs a seek and average half-rotation latency. Find total read time in ms.
Answer & solution
Official answer: 14020
Convert RPM carefully: 10000 revolutions take 60000 ms, so each revolution lasts 6 ms. Half is 3 ms; one of 600 sectors occupies 6/600=0.01 ms of rotation. The stipulated independent per-sector cost is 4+3+0.01=7.01 ms, so the file costs 14020 ms. Assuming sequential sectors share one seek would ignore the explicit premise; 512-byte size is unnecessary once sectors per rotation is known.
Solution: A rotation takes 60000/10000=6ms, so average rotational latency is 3ms. One sector transfer takes 6/600=0.01ms. With a fresh 4ms seek for every sector as stipulated, 2000 sectors take 2000*(4+3+0.01)=14020ms.
A nonpipelined CPU runs at 2.5 GHz with average CPI=4. A five-stage pipelined version runs at 2 GHz due to pipeline delay, with no stalls. Find speedup.
Answer & solution
Official answer: 3.2
Compare time per instruction, not stage count alone. Initially an instruction costs four 0.4-ns cycles, or 1.6 ns. A full stall-free pipeline produces one result per 0.5-ns cycle. Throughput speedup is 1.6/0.5=3.2. Five stages affect latency and initial fill; they do not make the improvement automatically fivefold. This is the steady-state limit for a sufficiently long stream.
Solution: Nonpipelined throughput is 2.5GHz/4=0.625 billion instructions/s. A stall-free full pipeline at 2GHz completes one instruction per cycle, giving 2 billion/s. The steady-state speedup is 2/0.625=3.2. This ignores fill/drain overhead for a finite short instruction sequence, whose length is not supplied.
A read takes 50 ns on a cache miss or 5 ns on a hit. Hit rate 80%. Find mean read time in nanoseconds.
Answer & solution
Official answer: 14
The stated miss time is the entire request time, not an extra penalty. Average=0.8·5+0.2·50=14 ns.
The random read time takes only two stated values:5 with probability.8 and 50 with probability.2. Its expected value is the probability-weighted sum, .8×5+.2×50=4+10=14 ns. Do not add 5 to the miss case: the prompt already says the entire request takes 50 ns on a miss. If it had called 50 an additional miss penalty, the formula would differ.
Virtual addresses 40 bits, page size 8 KB, TLB128 entries arranged 32 sets×4 ways. No process ID in tag. Find minimum TLB tag width.
Answer & solution
Official answer: 22
Step through it (6 steps)
An8 KiB page contributes 13 offset bits, leaving 27 virtual page-number bits. The 32 TLB sets use 5 index bits. Without a process identifier, the tag uses 27−5=22 bits.
Split the virtual address into tag, set index, and page offset. An8KiB page has 213 bytes, so 13 bits select the byte. The remaining 40−13=27 bits form the virtual page number. Thirty-two sets need log 2 32=5 index bits; the four ways do not consume address bits because their tags are compared associatively. The tag therefore needs 27−5=22 bits. No process-ID bits are added because the prompt excludes them.
Disk 15000 RPM, transfer 50×10^6 bytes/s. Average seek is twice average rotational delay; controller transfer time is 10 times disk transfer time. Find total average read/write time for 512 bytes in ms.
Answer & solution
Official answer: 6.1 to 6.2
Our answer: 6.11264
A revolution takes 60000/15000=4 ms, hence average rotational delay 2 ms and seek 4 ms. Disk transfer is 512/(50·106)s=0.01024 ms. Controller transfer adds ten times that, 0.1024 ms. Total 4+2+0.01024+0.1024=6.11264 ms, within 6.1 to 6.2.
One revolution takes 60/15000=.004 seconds=4 ms. A uniformly random angular position gives mean rotational waiting of half a revolution, 2 ms, and the stated seek is 4 ms. Transferring 512 bytes at 50 million bytes/s takes.01024 ms; controller work adds.1024 ms. Sum 4+2+.01024+.1024=6.11264 ms. Keep units consistent: confusing seconds with milliseconds or using a full revolution instead of an average half revolution changes the result drastically.
Instructions are MUL R5, R0, R1; DIV R6, R2, R3; ADD R7, R5, R6; SUB R8, R7, R4. Pipeline stages IF, OF and WB take one cycle; PO takes 3 for MUL, 5 for DIV and 1 for ADD/SUB. PO output can forward to OF. Find total cycles under the stated single occupied PO-stage interpretation.
Answer & solution
Official answer: 13
Step through it (6 steps)
With a single occupied PO stage and the stated forwarding, MUL uses IF1, OF2, PO3–5, WB6. DIV uses PO6–10, ADD uses PO11 and SUB uses PO12; SUB writes back in cycle 13. The dependent ADD/SUB operand fetches use the forwarded results at the end of the preceding producer PO cycle. Thus total 13 cycles. This is the conventional in-order, non-internally-pipelined PO-stage model; independent or internally pipelined functional units would require more scheduling details.
Count occupied execution cycles rather than adding all independent instruction latencies. MUL starts PO in cycle 3 and occupies cycles 3–5. DIV cannot use the same PO stage until cycle 6, then occupies 6–10. ADD depends on both results and uses PO in cycle 11 after forwarding; SUB follows in cycle 12. Its WB is cycle 13. The explicit resource model matters: a separately pipelined multiplier/divider would permit a different schedule, and a non-forwarding design would add dependency stalls.
A byte-addressed machine has two-byte registers and an upward-growing stack. SP is 016E hexadecimal and PC is 5FA0 immediately before a two-word CALL that pushes PC and PSW. What is the resulting SP? A 016A; B 016C; C 0170; D 0172.
Your answer
Answer & solution
Official answer: D
CALL pushes the two-byte PC and two-byte PSW onto an upward-growing stack, adding 4 to SP. Thus hexadecimal 016E+4=0172, D. Instruction length affects the return-address value pushed, not the number of bytes added to this stack.
Each pushed register consumes two bytes. Two pushes therefore add four to the stack pointer: 0x016E+0x0004=0x0172. The two-word length of the CALL affects the saved return PC, not how many registers are pushed. Similarly, the current PC value is not an address increment to add to SP. A downward-growing stack would subtract four, but the question explicitly gives upward growth, ruling out 016A.
A byte-addressable main memory has size 2²⁰ bytes. Blocks contain 16 bytes, and a direct-mapped cache has 2¹² lines. Two consecutive memory-byte addresses are hexadecimal E201F and E2020. For address E201F, identify the tag and cache-line address, in hexadecimal. (A) E,201; (B) F,201; (C) E,E20; (D) 2,01F.
Your answer
Answer & solution
Official answer: A
Step through it (7 steps)
1. A hexadecimal digit represents four bits, so the 4+12+4 split aligns exactly with E | 201 | F. The next address E2020 illustrates the offset wrapping from F to 0 and the cache-line index advancing from 201 to 202.
2. The20-bit address has 4 offset bits for 16-byte blocks and 12 index bits for 212 lines, leaving 4 tag bits. Hex E201F therefore splits tagE, index 201, offsetF. Thus A.
A three-stage pipeline has a five-column reservation table. Stage S1 is used at time slots 1 and 5, S2 at slots 2 and 4, and S3 only at slot 3; all other cells are blank. Determine the minimum average initiation latency (MAL). Initiation times may vary, but no two active operations may use the same stage simultaneously.
Answer & solution
Official answer: 3
1. The forbidden separations come from differences between occupied columns in the same row, not from differences across different stages. Thus the initial forbidden-latency set is exactly {2,4}. To attain average 3, start operations at times 0,3,6,9,...; every pairwise separation is a positive multiple of 3 and therefore safe.
2. Repeated use in S1 forbids initiation separation 4; S2 forbids 2. Therefore allowed positive gaps include 1, 3, 5. Constant gap 3 is collision-free because no multiple of 3 is 2 or 4, achieving average 3. If any gap is 1, its next gap cannot 1 or 3 (the two-gap total would be 2 or 4) and must be at least 5. Pair each such 1 with its following≥5 gap; every pair averages≥3, while unpaired gaps are≥3. Thus no lower long-run average is possible.
Instructions have form OP Ri,Rj,Rk, which reads Rj,Rk and writes Ri. The sequence is I1: ADD R1,R2,R3; I2: MUL R7,R1,R3; I3: SUB R4,R1,R5; I4: ADD R3,R2,R4; I5: MUL R7,R8,R9. Consider S1: I2 and I5 have an anti-dependence; S2: I2 and I4 have an anti-dependence; S3: in a pipeline, an anti-dependence always causes at least one stall. Options: (A) S1 only; (B) S2 only; (C) S1 and S3 only; (D) S2 and S3 only.
Your answer
Answer & solution
Official answer: B
1. I2 reads R3 and I4 later writes R3, a write-after-read anti-dependence, so S2 holds.
2. I2 and I5 both write R7, an output dependence rather than anti-dependence. In-order reads/writes or register renaming can avoid stalls for anti-dependences, so S3 is false. Thus only S2, B.
A machine uses 32-bit words and one-word instructions. It has 64 registers, each 32 bits long. There are 45 instructions, each containing an unsigned immediate and two register operands. Find the largest representable immediate.
Answer & solution
Official answer: 16383
1. Method and setup. Encoding 45 instruction choices needs six bits, since five bits distinguish only 32 choices. Each register identifier also needs six bits; the physical width of a register does not determine the width of its identifier. Allocate opcode and register fields first, then use all remaining bits for the immediate.
2. Work through the result and its assumptions. The opcode needs ceil(log₂45)=6 bits and each of two register fields needs log₂64=6 bits. The32-bit word leaves 32−6−12=14 immediate bits, whose unsigned maximum is 2¹⁴−1=16383.
A perfectly balanced six-stage instruction pipeline has no cycle-time overhead. While an application runs, 25% of its instructions incur two stall cycles each. Find the speedup relative to nonpipelined execution.
Answer & solution
Official answer: 4
1. Method and setup. Measure time in units of one pipeline stage. Without pipelining an instruction consumes six such units; in steady state the pipeline completes one instruction per cycle plus stalls. Weight the stall penalty by the fraction of affected instructions rather than adding two cycles to every instruction.
2. Work through the result and its assumptions. The average cycles per instruction is 1+0.25·2=1.5. A nonpipelined instruction takes six balanced stage times, so steady-state speedup is 6/1.5=4. This ignores fill/drain effects; for a finite N-instruction run with exactly N/2 stall cycles, the usual timing is 6N/(1.5N+5), approaching4.
A cache-block reference sequence has length N and n distinct block addresses. At most k distinct block addresses occur between two consecutive references to the same address. What is the miss ratio for an LRU cache with associativity A≥k? A: n/N. B: 1/N. C: 1/A. D: k/n. The printed inequality is non-strict, and the initial cache state is not specified.
Your answer
Answer & solution
Official answer: A
Our answer: A requires strict A>k and an initially empty cache
1. Method and setup. LRU evicts a block after A other distinct blocks mapped to its set have been accessed. Therefore a guaranteed hit requires the intervening distinct-block count for that set to be strictly less than A. Counting one compulsory miss per distinct address is valid only after establishing that all subsequent references hit and that first references begin uncached.
2. Work through the result and its assumptions. An LRU hit requires fewer than A distinct intervening blocks mapping to the same set. The stated bound k suffices when A>k, but not at A=k. For example, let a direct-mapped cache have A=k=1 and let distinct x, y map to the same set. The sequence x, y, x, y has N=4, n=2 and one distinct intervening block on each reuse, yet all four accesses miss, giving 1 rather than n/N=1/2. Thus the official cold-miss-only answer A needs a strict inequality (or a reuse-distance definition including the reused block) and an initially empty cache.
Processors P₁ and P₂ execute the same instruction set. For the same program and input under identical conditions, P₂ takes 25% less time but has 20% higher CPI than P₁. If P₁ runs at 1 GHz, what is P₂’s clock frequency in GHz?
Answer & solution
Official answer: 1.6
1. Method and setup. CPU time is instruction count multiplied by cycles per instruction and divided by cycles per second. Convert “25% less time” to a time ratio of 0.75, not a frequency multiplier of 1.25. Under the intended equal-instruction-count assumption, that count cancels when taking the ratio of execution times.
2. Work through the result and its assumptions. For the same instruction count, time=IC·CPI/frequency. Given T2/T1=0.75 and CPI2/CPI1=1.2, 0.75=1.2(f1/f2). Therefore f2=1.6f1=1.6GHz. This assumes the same executed instruction count for the same program/input, as intended.
A 16 KB cache is 4-way set associative. A block contains 8 words, each 32 bits. Physical address space is 4 GB. Find the number of tag bits.
Answer & solution
Official answer: 20
Step through it (7 steps)
1. Set up the reasoning. Use the textbook binary KB/GB and byte-addressing convention. Convert words to bytes first: one line has 8×4=32 bytes; compute line count, set count, and their base-two logarithms.
2. Derive the result. A block is 8×4=32 bytes, requiring 5 offset bits. The cache has 16384/32=512 lines and 128 sets, requiring 7 index bits. A4GB byte address is 32 bits, leaving 32−7−5=20 tag bits.
3. Check the interpretation. Do not allocate only three offset bits: those identify the eight words but miss the two byte-within-word bits. The tag, set index, and byte offset together must total the 32 physical-address bits.
In cache design, which statement is correct? A Smaller blocks imply better spatial locality. B Smaller blocks imply smaller tags and lower tag overhead. C Smaller blocks imply larger tags and lower hit time. D Smaller blocks incur a lower miss penalty.
Your answer
Answer & solution
Official answer: D
1. Set up the reasoning. Use the conventional miss-penalty decomposition: fixed access latency plus time to transfer the fetched block. With finite transfer bandwidth, fetching fewer bytes reduces the transfer component.
2. Derive the result. A smaller cache block requires fewer bytes to refill, reducing the transfer component of a miss penalty under the usual fixed-latency, finite-bandwidth memory model. Thus D is the intended statement. It does not improve the program’s inherent spatial locality, and smaller blocks do not justify a shorter tag or guaranteed lower hit time. If critical-word-first timing or fixed-size physical bursts dominate, the measured penalty need not strictly decrease; the answer uses the textbook full-block refill model.
3. Check the interpretation. Spatial locality describes a program's access pattern, not a benefit created by making blocks smaller. Tag size and hit latency require other cache parameters; D is the intended full-block-refill statement, not a universal guarantee under critical-word-first or fixed-burst timing.
A cache's associativity doubles while its total capacity and block size stay fixed. Which is guaranteed not to be affected? A tag-comparator width; B set-index-decoder width; C way-selection-multiplexor width; D processor-to-main-memory data-bus width.
Your answer
Answer & solution
Official answer: D
1. Set up the reasoning. Let capacity be C, line size B, and associativity A. The set count is C/(AB), so doubling A halves the number of sets without changing the line-offset field.
2. Derive the result. With capacity C and block size B fixed, doubling associativity halves the set count C/(AB). The set index loses one bit and the tag gains one. The way-selection fan-in doubles, while the processor-to-main-memory data-bus width need not change. Therefore D. Here multiplexor width means its way-selection configuration/fan-in, not the unchanged data-word output width.
3. Check the interpretation. The index loses a bit and the tag gains a bit. More ways require greater selection fan-in, but internal cache organization does not dictate a new external data-bus width. The keyed interpretation of multiplexor “width” is its selection configuration, not its unchanged output-word width.
Eight memory modules share a one-word-wide system bus. A store occupies the bus for 100 ns with data, address, and control. The target module accepts/stores during those 100 ns and for another 500 ns, totaling a 600 ns module cycle. Module operations may overlap, but the bus handles one request at a time. What is the maximum number of one-word stores that can be initiated in 1 ms?
Answer & solution
Official answer: 10000
1. Set up the reasoning. Compute both throughput limits: the shared bus admits one initiation per 100 ns, while eight modules collectively can sustain eight per 600 ns if their cycles overlap. The slower resource is the bus.
2. Derive the result. The single bus admits at most one new store per 100 ns, so in a half-open 1ms interval the limit is 106/100=10000 initiations. Each module is busy 600 ns, so cycling among six of the eight modules already permits a request every 100 ns without revisiting a busy module. Thus the bus bound is achievable. The question counts stores initiated, not necessarily completed within the interval.
3. Check the interpretation. Show attainability by scheduling requests 100 ns apart and rotating through six or more modules. A module is free by its next use. Count initiations in the half-open observation interval [0,1 ms); requiring all stores to finish by its end would be a different question.
Pipeline-register latency is zero. Four processors have stage delays in ns: P1=(1,2,2,1); P2=(1,1.5,1.5,1.5); P3=(0.5,1,1,0.6,1); P4=(0.5,0.5,1,1,1.1). Which has the highest peak clock frequency? A P1; B P2; C P3; D P4.
Your answer
Answer & solution
Official answer: C
Step 1: A synchronous pipeline must allow its slowest stage to finish during one clock period. With zero register overhead, the minimum period is the maximum stage latency, not the sum or average. Step 2: The four maxima are 2, 1.5, 1 and 1.1 ns respectively. Step 3: Frequency is the reciprocal of period, so P3 is fastest at 1/(1 ns)=1 GHz, C. Its greater number of stages does not itself determine this ranking.
An old pipeline has IF,ID/RF,EX,MEM,WB with delays 1,2.2,2,1,0.75 ns. A new eight-stage pipeline splits ID/RF into ID,RF1,RF2 of 2.2/3 ns each, and EX into EX1,EX2 of 1 ns each. Branches are 20% of instructions and resolve at the end of EX (old) or EX2 (new); after fetching a branch, IF stalls until its next PC is known. Other instructions have average CPI 1. For old/new program times P,Q, find P/Q.
Answer & solution
Official answer: 1.50 to 1.60
Our answer: 1.54
Step 1: Ignoring latch overhead, the old period is max(1,2.2,2,1,0.75)=2.2 ns. The new longest stage is 1 ns. Step 2: In the old design, a branch fetched in cycle 1 resolves at the end of stage 3, so it blocks two following fetch slots. Average CPI is 1+0.2×2=1.4. Step 3: In the new design, EX2 is stage 6: IF,ID,RF1,RF2,EX1,EX2. A branch blocks five following fetch slots, yielding CPI 1+0.2×5=2. Step 4: In the steady-state model, time per instruction is CPI×period. Therefore P/Q=(1.4×2.2)/(2×1)=1.54. Pipeline fill/drain and register overhead are omitted; without program length an exact finite-program ratio is not specified.
Cache access times are read hit 1 ns, read miss 5 ns, write hit 2 ns, write miss 10 ns. A sequence performs 100 instruction fetches, 60 operand reads and 40 operand writes. Cache hit ratio is stated as 0.9. Find mean memory-access time in ns.
Answer & solution
Official answer: 1.68
Our answer: 1.68 if each access class has hit ratio 0.9
Step 1: Count instruction fetches as reads: there are 160 reads and 40 writes, 200 accesses total. Under the intended common hit ratio of 0.9 for each class, a read averages 0.9×1+0.1×5=1.4 ns, and a write averages 0.9×2+0.1×10=2.8 ns. Step 2: Weight by access count: (160×1.4+40×2.8)/200=1.68 ns. Miss times are given complete access times, not penalties to add again. Step 3: Preserve the ambiguity: an aggregate hit ratio alone only fixes 20 total misses. If w are write misses, read misses are 20−w and total time is 160+2×40+4(20−w)+8w=320+4w ns. Thus the mean can be 1.6+0.02w for 0≤w≤20, ranging from 1.6 to 2.0 ns. The official 1.68 assumes w=4 or the same hit ratio for both classes.
A cache has v sets of k consecutive lines each, sets numbered from 0 in order. Memory block j maps to which line interval? A(j mod v)k through(j mod v)k+k−1; B(j mod v) through(j mod v)+k−1; C(j mod k) through(j mod k)+v−1; D(j mod k)v through(j mod k)v+v−1.
Your answer
Answer & solution
Official answer: A
Block j maps to set s=j mod v. Each earlier set occupies k consecutive lines, so this set starts at sk and ends at sk+k−1. Substituting s gives the interval in A.
First choose the set, not a particular way: s=j mod v. There are s earlier sets, each occupying k line positions, so the first line of set s is sk. The k allowed ways occupy offsets 0 through k−1, hence last line sk+k−1. For example, v=4, k=2, j=6 gives s=2 and lines 4, 5. This example also shows why omitting the factor k, as in B, gives the wrong physical positions.
Micro-operations are MBR←PC; MAR←X; PC←Y; Memory←MBR (write at MAR). Which operation can this implement? A instruction fetch; B operand fetch; C conditional branch; D interrupt-service initiation.
Your answer
Answer & solution
Official answer: D
MBR receives the current PC, MAR selects location X, PC is changed to Y, and the saved PC is written at X. This saves a return address and transfers control to another routine, consistent with interrupt-service initiation, D.
Track the values rather than just the register names. The old PC is copied into MBR before PC is overwritten, so it is preserved. MAR directs the final write to X, saving that old PC in memory. Loading Y into PC redirects execution. Together these actions save a return location and jump to a service routine, consistent with D. An instruction fetch would read memory into an instruction register/buffer rather than store the old PC to memory.
A disk has 16 surfaces, 16384 cylinders, 512 bytes/sector and the source says 64 sectors per cylinder. A contiguous 42797 KB file begins at<cylinder 1200, surface 9, sector 40>. Find last cylinder: A1281, B1282, C1283, D1284. The answer model interprets64 sectors per surface-track and KB=1024 bytes.
Your answer
Answer & solution
Official answer: D
Our answer: D under 64 sectors per track and binary KB
Using the intended geometry, each cylinder has 16×64=1024 sectors and each 512-byte sector is half a KiB. The file occupies 42797×2=85594 sectors. Its starting within-cylinder offset is 9×64+40=616. The last sector is therefore at cylinder 1200+floor((616+85594−1)/1024)=1284, D. The source literally says each cylinder contains 64 sectors, but also supplies a surface coordinate and uses the geometry above in the key. The calculation needs 64 sectors per surface-track, rather than per entire cylinder, and KB=1024 bytes; these are explicit intended interpretations.
Under the intended track geometry, one cylinder contains 16×64=1024 sectors, hence 512 KiB. Convert the file to sectors:42797 KiB×1024/512=85594. The starting surface/sector is offset 9×64+40=616 within cylinder 1200. Numbering the first file sector as offset 0 makes its last sector offset 85593, so the combined last offset is 86209. Divide by 1024:84 full cylinders and remainder 193. Add84 to 1200 to obtain 1284. Subtracting1 before the division prevents an off-by-one error for a file ending on a cylinder boundary.
Five pipeline stages FI, DI, FO, EI, WO take 5, 7, 10, 8, 6 ns, with 1 ns buffer delay. Program I1… I12 has only branch I4, taken to I9. Without branch prediction, under end-of-EI resolution, time to complete is A132, B165, C176, D328 ns.
Your answer
Answer & solution
Official answer: B
The pipeline clock period is max(5, 7, 10, 8, 6)+1=11 ns. Because I4 branches to I9, the useful executed instructions are I1, I2, I3, I4, I9, I10, I11, I12: eight instructions. Using the standard model in which the branch is resolved at the end of EI, I4 occupies FI in cycle 4, DI in cycle 5, FO in cycle 6 and EI in cycle 7. Without prediction, target fetch starts in cycle 8. Then I9 finishes WO in cycle 12 and I12 finishes WO in cycle 15. Equivalently, eight useful instructions need 8+5−1=12 cycles without a control hazard, plus three branch-wait cycles. The total is 15×11=165 ns, option B. The answer relies on branch resolution in EI and target fetch in the following cycle; the prompt does not separately specify an earlier branch-resolution mechanism.
A common clock must accommodate the slowest stage plus its buffer:10+1=11 ns. Branch I4 enters EI in cycle 7, after FI4, DI5, FO6. Its target can enter FI in cycle 8, then DI9, FO10, EI11, WO12. The next target-path instructions finish in cycles 13, 14, 15. Thus the total is 165 ns. Counting all 12 source instructions would incorrectly include the skipped I5–I8. The branch resolution convention is stated because a different resolution stage would change the stall count.
Build16K×16 RAM from 1K×8 chips. How many 2-to-4 decoders with enable are needed? A4, B5, C6, D7.
Your answer
Answer & solution
Official answer: B
Two 1K×8 chips operate in parallel to supply each 16-bit word, making one 1K×16 bank. Sixteen such banks give 16K×16, so there are 32 memory chips but only 16 bank-select signals. The low ten address bits select a word within a bank; the upper four bits select the bank. Construct the required 4-to-16 decoding with one 2-to-4 decoder on the upper two bank bits. Its four outputs enable four further 2-to-4 decoders, each decoding the lower two bank bits. The total is 1+4=5 decoders, option B. Four bottom-level decoders are needed to provide sixteen outputs and an additional level is needed to select their enables.
Separate width expansion from depth expansion. Pairing two 8-bit chips gives 16 data bits at one address; it does not double the number of addresses. Sixteen such pairs are needed for 16Kdepth. A4-bit bank number chooses one pair, while 10low address bits are broadcast to all chips. A top decoder selects one group of four pairs, and four enabled bottom decoders select within each group. This produces 16mutually exclusive bank enables with five decoders; it is not one decoder per memory chip.
Using the preceding page size and 1MB16-way VIPT cache with 64-byte blocks, how many page colours prevent synonyms mapping to different sets? A2, B4, C8, D16.
Your answer
Answer & solution
Official answer: C
There are 220/(16×64)=210 cache sets. A 64-byte cache block uses six offset bits, so the ten set-index bits are virtual-address bits 6 through 15. From the preceding linked question, the page size is 8 KiB and the page offset consists of bits 0 through 12. Only seven set-index bits (6 through 12) lie inside the page offset and are automatically identical for synonyms. The remaining three bits (13 through 15) can differ between virtual aliases of the same physical page. Distinguishing 23=8 page colours, and requiring aliases of a physical page to use the same colour, makes all index bits agree. Thus eight colours are necessary and sufficient, option C. Equivalently, colours=(cache size)/(associativity×page size)=1 MiB/(16×8 KiB)=8.
Synonyms share a physical page but can have different virtual page numbers. A VIPT lookup uses virtual index bits before the physical tag is known; if any such bit is outside the page offset, aliases can select different sets. Here10 index bits follow 6block-offset bits, ending at bit15. Only bits 0–12belong to the 8KiBpage offset, leaving three potentially different index bits. Colouring controls exactly those three bits, requiring eight choices. More tag bits do not repair selection of the wrong set.
The decimal value 0.5 in IEEE single precision floating point representation has (A) fraction bits of 000…000 and exponent value of 0 (B) fraction bits of 000…000 and exponent value of −1 (C) fraction bits of 100…000 and exponent value of 0 (D) no exact representation
Your answer
Answer & solution
Official answer: B
Step through it (6 steps)
Normalize 0.5 as 1.0₂×2−1. The fractional field after the implicit leading 1 is all zeros; the actual unbiased exponent is −1. Thus B uses the mathematical exponent convention. For clarity, the stored biased exponent is −1+127=126, binary 01111110, and the full 32-bit encoding is 0x3F000000. The exponent field itself is not a signed −1.
Check: The single-precision format has one sign bit, eight exponent bits, and 23 stored fraction bits. Here the sign is 0, the exponent field is 01111110, and every fraction bit is 0; binary fractions with denominator a power of two can be exact.
Register renaming is done in pipelined processors (A) as an alternative to register allocation at compile time (B) for efficient access to function parameters and local variables (C) to handle certain kinds of hazards (D) as part of address translation
Your answer
Answer & solution
Official answer: C
Renaming assigns different physical registers to distinct logical-register definitions. This removes false dependencies due to reusing a register name, specifically WAR and WAW hazards, allowing more overlapping execution. It cannot remove a genuine RAW data dependency. Thus it handles certain pipeline hazards, C.
Check: For example, an older instruction reading logical R1 and a newer instruction writing logical R1 need not share a physical register. Giving the newer result a new physical destination avoids a write-after-read name hazard while preserving the old value for its reader.
A 256 KByte, four-way set-associative write-back cache uses 32-byte blocks and 32-bit byte addresses. Every tag-directory entry holds the tag plus 2 valid bits, 1 modified bit, and 1 replacement bit. How many address tag bits are there? (A) 11 (B) 14 (C) 16 (D) 27.
Your answer
Answer & solution
Official answer: C
Step through it (7 steps)
Using binary cache units, 256 KiB/32 bytes=8192 cache lines. Four lines per set give 2048=2¹¹ sets, so the set index uses 11 bits. A 32-byte block requires 5 byte-offset bits. The remaining address bits are tag bits: 32−11−5=16, C.
Check: The address splits as [16 tag bits | 11 set bits | 5 byte-offset bits]. Associativity reduces the number of sets relative to the number of lines, so using 13 line-index bits would incorrectly treat the cache as direct mapped.
A 256 KByte, four-way set-associative write-back cache uses 32-byte blocks and 32-bit byte addresses. Every tag-directory entry holds the tag plus 2 valid bits, 1 modified bit, and 1 replacement bit. What is the tag-directory size? (A) 160 Kbits (B) 136 Kbits (C) 40 Kbits (D) 32 Kbits.
Your answer
Answer & solution
Official answer: A
Step through it (9 steps)
There are 256×1024/32=8192 cache lines and hence 8192 tag-directory entries. The preceding calculation gives a 16-bit address tag. Each entry additionally has the explicitly specified 2 valid bits, 1 modified bit and 1 replacement bit, for 16+2+1+1=20 bits. The directory is 8192×20=163, 840 bits=160 Kibits, option A (printed as Kbits). Count entries per cache line, not per set; the problem explicitly assigns the replacement bit per entry.
Check: Four ways do not mean only one tag per set: each way stores a distinct block and needs its own tag and metadata. Equivalently, 2048 sets×4 entries/set×20 bits/entry=163840 bits, confirming the per-line calculation.
A computer receives interrupts on excessive CPU temperature, mouse movement/button events, keyboard key press/release, and completed disk reads. Which should have the highest priority?
(A) Hard disk (B) Mouse (C) Keyboard (D) CPU temperature sensor
Your answer
Answer & solution
Official answer: D
An excessive CPU temperature can imminently damage hardware or invalidate operation, so the intended protective interrupt priority places it above routine disk, mouse and keyboard events. Thus D under the stated safety-oriented priority policy.
Priority is about the urgency and consequences of delaying service, not how frequently an event occurs. A mouse or keyboard event can ordinarily wait briefly without permanent harm; a completed disk read is also routine. An overtemperature condition needs immediate protective handling, such as throttling or shutting down, to prevent damage. Hence the temperature sensor is the intended highest-priority source, rather than whichever input device generates the most interrupts.
The instruction LW R1,20(R2) loads a 32-bit memory word into R1. Its effective address is 20 plus the contents of R2. Which listed addressing mode best describes the memory operand?
The effective address is the content of R2 plus the displacement 20. The memory operand is neither the literal 20 nor a register value, and no scale factor is applied. Among the options this is called base indexed addressing, D; base-plus-displacement is a more precise description.
The operation can be written R1←Memory[R2+20]. Immediate addressing would use 20 itself as data; register addressing would take the operand directly from a register. Scaled indexing would multiply an index by an element size, which is absent here. Thus the listed base-indexed choice is the closest match. The memory word being 32 bits affects the load size, not the formula used to locate that word.
On a non-pipelined sequential processor, transferring 500 bytes uses this interrupt-service program: initialize address register; initialize count=500; LOOP: load one byte from device; store it to the address register's memory location; increment address register; decrement count; if count != 0 go to LOOP. Each load/store takes 2 cycles and every other statement takes 1 cycle. DMA instead needs 20 cycles for initialization/overheads and 2 cycles per byte. What is the approximate DMA speedup over the program?
(A) 3.4 (B) 4.4 (C) 5.1 (D) 6.7
Your answer
Answer & solution
Official answer: A
The two initializations take 2 cycles. Each of 500 loop iterations uses 2 cycles for load, 2 for store and 1 each for increment, decrement and branch, totaling 7. Programmed transfer costs 3502 cycles. DMA costs 20+500×2=1020 cycles. Speedup3502/1020≈3.433, closest to 3.4, A.
Count the conditional branch even on its last, untaken execution: testing the condition is still an instruction. The loop therefore executes 500 loads, 500 stores and 1500 one-cycle bookkeeping instructions, in addition to the two initializations. DMA removes per-byte CPU loop bookkeeping but still pays its transfer cycles and setup. Speedup is old elapsed cycles divided by new elapsed cycles, not the reverse and not the difference between the two counts.
An ideal four-stage instruction pipeline has combinational delays S1=5 ns, S2=6 ns, S3=11 ns, S4=8 ns. A 1 ns pipeline register follows every stage, including the last. Approximately what is its steady-state speedup over the corresponding non-pipelined implementation?
(A) 4.0 (B) 2.5 (C) 1.1 (D) 3.0
Your answer
Answer & solution
Official answer: B
The non-pipelined combinational delay is 5+6+11+8=30 ns. The pipelined clock period is determined by the slowest stage plus its pipeline-register delay: 11+1=12 ns. In ideal steady state one instruction completes every 12 ns, so the conventional throughput speedup is 30/12=2.5, option B. If the non-pipelined implementation also counts a final 1 ns output register, the ratio is 31/12≈2.58, still the same approximate option. This is steady-state throughput, not the latency speedup of one instruction.
After filling, different instructions occupy the four stages concurrently. The clock cannot advance every average-stage delay; the slowest stage must finish before its register captures the result. That sets 12 ns per output instruction despite three faster stages. One instruction still traverses four pipeline cycles, but the question asks steady-state throughput. Using the ideal stage-count speedup of four would require balanced stages with negligible register overhead, neither of which holds here.
An 8 KB direct-mapped write-back cache has 32-byte blocks and 32-bit byte addresses. Metadata per cache block contains one valid bit, one modified bit, and the minimum tag bits needed to identify the mapped memory block. How many metadata bits are needed in total?
(A) 4864 (B) 6144 (C) 6656 (D) 5376
Your answer
Answer & solution
Official answer: D
Step through it (8 steps)
There are 8192/32=256 cache lines, requiring 8 index bits. A 32-byte block requires 5 byte-offset bits, leaving 32−8−5=19 address-tag bits. Add one valid bit and one modified (dirty) bit per line: 21 bits per line. The metadata memory is therefore 256×21=5376 bits, option D. Data storage itself is not included.
Interpret 8 KB as 8×1024 bytes in the conventional cache model. The address splits into [19 tag bits][8 line-index bits][5 block-offset bits]. The index chooses one of the 256 lines, and the offset selects a byte within its 32-byte block. Only the tag must be stored as an address identifier; index and offset are implicit in placement. Write-back additionally needs the dirty bit to decide whether eviction must write data to memory, while valid distinguishes populated from unused entries.
A 4-megabyte main memory is built from 1M×1-bit DRAM chips. Each chip has 1K rows with 1K cells in each row. One refresh operation takes 100 ns. How long does one complete refresh of all memory cells take? Options: (A) 100 ns; (B) 100×2^10 ns; (C) 100×2^20 ns; (D) 3200×2^20 ns.
Your answer
Answer & solution
Answer: B (no official key was published)
A refresh operation refreshes one row in each chip in parallel. Each chip has 1K=2¹⁰ rows, requiring 2¹⁰ refresh operations to cover all its cells. At 100 ns each, the total is 100·2¹⁰ ns, B. The memory needs 32 chips for 4 MiB, but the standard parallel-bank refresh model does not multiply the refresh time by 32.
The row count, rather than the total cell count, determines the number of refresh commands: all 1024 cells on the selected row are refreshed together. Memory capacity determines how many chips are needed, but chips sharing refresh control perform that command concurrently in the model used here. Multiplying by 220 would incorrectly refresh individual cells separately.
A five-stage pipeline has IF, ID, OF, PO and WO stages. IF, ID, OF and WO each take one cycle. PO takes one cycle for ADD/SUB, three for MUL and six for DIV. Operand forwarding is used. How many cycles execute this instruction sequence? I₀: MUL R₂,R₀,R₁ (R₂←R₀×R₁) I₁: DIV R₅,R₃,R₄ (R₅←R₃/R₄) I₂: ADD R₂,R₅,R₂ (R₂←R₅+R₂) I₃: SUB R₅,R₂,R₆ (R₅←R₂−R₆) Options: (A) 13; (B) 15; (C) 17; (D) 19.
Your answer
Answer & solution
Answer: B (no official key was published)
Step through it (6 steps)
With the single shared PO stage, the first MUL occupies PO in cycles 4–6 after IF,ID,OF in cycles 1–3. DIV occupies PO in cycles 7–12; the dependent ADD then uses the forwarded DIV result in PO cycle 13, and SUB uses PO cycle 14. The last WO is cycle 15. Earlier stages stall as necessary while PO is occupied, but forwarding avoids waiting for an extra writeback before dependent execution. Total 15, B. This assumes the ordinary unpipelined multi-cycle PO unit implicit in this question, not separate independently pipelined arithmetic units.
A compact timing schedule is MUL: PO 4–6, WO 7; DIV: PO 7–12, WO 13; ADD: PO 13, WO 14; SUB: PO 14, WO 15. PO is the bottleneck and its occupied cycles sum to 3+6+1+1=11. Three initial stages plus eleven PO cycles plus the final writeback give 3+11+1=15. Forwarding handles the DIV→ADD and ADD→SUB true dependencies.
An L1 cache connects to L2, which connects to main memory. Both connecting data buses are four words wide. L1 blocks contain four words; L2 blocks contain sixteen words. Access times are 2 ns for L1, 20 ns for L2 and 200 ns for main memory. On an L1 miss and L2 hit, one block is transferred from L2 to L1. What is the transfer time? Options: (A) 2 ns; (B) 20 ns; (C) 22 ns; (D) 88 ns.
Your answer
Answer & solution
Answer: C (no official key was published)
The L1 block is 4 words and the L2–L1 bus transfers 4 words, so one bus-width transfer suffices. Under the serial source-read plus destination-write model implicit in the offered transfer-time choices, reading L2 takes 20 ns and writing L1 takes 2 ns, giving 22 ns, C. This is the block movement time, not an extra sum including a previous failed lookup. Bus width alone does not specify pipelining, write overlap or timing semantics; the result relies on this conventional serialized model.
Do not use the entire 16-word L2 block as the transfer size here: the destination L1 line needs only four words, exactly one bus width. Under the stated serialized interpretation, 20 ns pays for the source access and 2 ns for the destination write. The 88 ns distractor is four times 22 ns and incorrectly moves four L1-sized pieces.
An L1 cache connects to L2, which connects to main memory. Both connecting data buses are four words wide. L1 blocks contain four words; L2 blocks contain sixteen words. Access times are 2 ns for L1, 20 ns for L2 and 200 ns for main memory. On misses in both caches, a block is first transferred from main memory to L2, then a block from L2 to L1. What is the total transfer time? Options: (A) 222 ns; (B) 888 ns; (C) 902 ns; (D) 968 ns.
Your answer
Answer & solution
Answer: C (no official key was published)
The L2 block has 16 words and the memory–L2 bus is 4 words wide, so filling it requires four transfers. Under the same non-overlapped read/write model as CS48, each costs 200 ns to read memory plus 20 ns to write L2: 4(200+20)=880 ns. The question says first fill L2, then transfer one 4-word block from L2 into L1, costing 20+2=22 ns. Total 902 ns, option C. No burst/pipelining/critical-word-first mechanism is specified; other timing models would require extra assumptions and are not used.
Keep the destination line size separate at each level: filling L2 moves sixteen words, hence four memory-bus transfers; filling L1 moves four words, hence one L2-bus transfer. The total is therefore 4×220+1×22, not four times the entire two-level path. The question explicitly orders the two fills, so their durations add in the model used.
How many 32K×1 RAM chips are needed for 256K bytes of memory? A 8; B 32; C 64; D 128.
Your answer
Answer & solution
Answer: C (no official key was published)
Each 32K×1 chip stores 32K bits. The required 256K bytes equal 2048K bits. Therefore 2048K/32K=64 chips, C.
A 32K×1 chip stores 32K bits, not 32K bytes. The requested capacity is 256K·8 bits. Dividing gives(256·8)/32=64 chips. Equivalently, eight chips in parallel provide a byte-wide 32K bank, and eight banks provide 256K byte addresses. Confusing width in bits with bytes would undercount by a factor of eight.
When does a CPU normally begin interrupt service? A immediately when raised; B after checking at the end of fetch; C after checking when the current instruction finishes; D at fixed time intervals.
Your answer
Answer & solution
Answer: C (no official key was published)
In the conventional instruction-cycle model, an enabled pending interrupt is checked after the current instruction completes, then control transfers to its service routine. This preserves an instruction boundary rather than interrupting immediately at an arbitrary internal step. Thus C.
The usual instruction-cycle model completes an instruction before recognizing a pending interrupt and saving a consistent next-instruction state. This gives C. An asynchronous request can arrive earlier, but arrival is not the same as immediate transfer of control. Fetch completion is too early in that simple model, and periodic checking is not the general interrupt mechanism. Architecture-specific restartable instructions and precise-exception implementations are finer details outside this convention.
Four pipeline stages S1–S4 require cycles per instruction: I1=(2, 1, 1, 1), I2=(1, 3, 2, 2), I3=(2, 1, 1, 3), I4=(1, 2, 2, 2). Execute two iterations of I1, I2, I3, I4. Find total cycles under overlapping buffered-stage execution, ignoring loop-control overhead: A 16; B 23; C 28; D 30.
Your answer
Answer & solution
Answer: B under continuous overlapped execution (no official key was published)
Ignoring loop-control overhead and allowing the eight instructions from two iterations to overlap, each stage starts after both its instruction’s previous stage and the previous instruction’s same stage finish. The four stage-completion times are(2, 3, 4, 5), (3, 6, 8, 10), (5, 7, 9, 13), (6, 9, 11, 15), (8, 10, 12, 16), (9, 13, 15, 18), (11, 14, 16, 21), (12, 16, 18, 23). Thus completion is at cycle 23, B. This recurrence uses buffered stage outputs; it does not charge an additional loop branch or force a pipeline drain between iterations. Such implementation choices are not explicitly specified by the prompt.
Construct a completion-time grid. A cell cannot start until the same instruction finishes its prior stage and the previous instruction releases this stage. Thus completion(i, j)=max(completion(i−1, j), completion(i, j−1))+duration(i, j). Applying it to the eight instruction rows yields final completion 23; the full row table is given above. Simply summing durations would ignore overlap, while assuming every stage takes one cycle ignores the supplied table. Pipeline draining or stage blocking without buffers changes the model, so those assumptions remain explicit.
An initially empty four-way cache has 16 blocks and memory 256 blocks. Reference sequence:0, 255, 1, 4, 3, 8, 133, 159, 216, 129, 63, 8, 48, 32, 73, 92, 155. With LRU within each set, which block is absent at the end? A 3; B 8; C 129; D 216.
Your answer
Answer & solution
Answer: D (no official key was published)
There are 16/4=4 sets, selected by block number modulo 4. Simulating LRU gives oldest-to-newest final sets: set 0=[8, 48, 32, 92], set 1=[1, 133, 129, 73], set 2=[], set 3=[3, 159, 63, 155]. Thus 3, 8, 129 remain but 216 has been evicted, D. In set 0, insertion 32 removes 4 and insertion 92 removes 216 after 8 was refreshed.
There are 16/4=4 sets; choose set number by block modulo 4. Only blocks mapping to the same set compete for four ways. In set 0, references are 0, 4, 8, 216, 8, 48, 32, 92. The second 8 refreshes its recency; inserting 48 removes 0, 32 removes 4, and 92 removes 216. The final set is 8, 48, 32, 92. Other sets retain 3 and 129. Hence 216, option D, is the absent listed block.
Why is seek latency not proportional to seek distance on a magnetic disk with concentric circular tracks?
(A) Nonuniform request distribution (B) Arm starting and stopping inertia (C) Higher capacity of tracks at platter periphery (D) Unfair arm-scheduling policies
Your answer
Answer & solution
Answer: B (no official key was published)
1. A seek consists of accelerating the arm, moving it and decelerating it to settle accurately at the target track. 2. A short seek may spend most of its time accelerating and braking; a longer seek has a different velocity profile. The average speed is therefore not constant across distances. 3. This is arm starting/stopping inertia, B. Request frequencies and track capacities do not explain the mechanical distance-time relation.
Which statements about auto-increment addressing are true? I: useful for self-relocating code. II: including it in an ISA requires an additional ALU for effective-address calculation. III: increment amount depends on the accessed data-item size.
(A) I only (B) II only (C) III only (D) II and III only
Your answer
Answer & solution
Answer: C (no official key was published)
1. Auto-increment addressing uses a register as an operand address and advances it after the access. To point at the next element, the increment must match the item’s byte size: III is true. 2. It does not inherently make code relocation-independent, so I is not a property of this mode. 3. An implementation can reuse existing arithmetic hardware; an additional ALU is not logically required. II is false, leaving C.
Which must be true of RFE (return from exception) on a general-purpose processor? I: it must be a trap instruction. II: it must be privileged. III: no exception can be allowed during its execution.
(A) I only (B) II only (C) I and II only (D) I,II,III
Your answer
Answer & solution
Answer: B in the conventional privileged-return model (no official key was published)
1. RFE restores saved execution/control state and may change privilege, so the conventional architecture restricts its use to privileged code: II. It returns from a trap rather than being required to generate one, so I is false. 2. A processor may define exceptions/faults during a return, for example invalid saved state, so III is not universally required. Therefore B under the conventional model. 3. Architectures can instead permit restricted unprivileged returns that cannot escalate privilege, so the broad must wording is architecture-dependent.
Which are necessary for L1/L2 cache inclusion? I: L1 must be write-through. II: L2 must be write-through. III: L2 associativity must exceed L1 associativity. IV: L2 must be at least as large as L1.
(A) IV only (B) I and IV only (C) I,II,IV only (D) I,II,III,IV
Your answer
Answer & solution
Answer: A under full-capacity inclusion convention (no official key was published)
1. For every resident L1 block also to be represented in L2 while L1 can use its full capacity, L2 must be at least as large: IV. Write-back can be compatible with inclusion via appropriate dirty-state and invalidation handling, so I and II are not required. 2. Equal associativity can satisfy inclusion; it need not be strictly greater, so III is false. Hence A under the standard capacity convention. 3. A policy that deliberately underutilizes a larger L1 through back-invalidations could preserve resident-set inclusion with a smaller L2, so IV is not a purely set-theoretic necessity without the full-capacity convention.
Which are NOT true in a pipelined processor? I: bypassing handles all RAW hazards. II: register renaming eliminates all register-carried WAR hazards. III: dynamic branch prediction eliminates control-hazard penalties.
(A) I and II only (B) I and III only (C) II and III only (D) I,II,III
Your answer
Answer & solution
Answer: B (no official key was published)
1. RAW is a real data dependency. Forwarding helps only once the producer’s value exists; a load-use consumer can still require a stall. I is false. 2. WAR is a false name dependency. Assigning distinct physical registers removes register-carried WAR hazards, so II is true. 3. Dynamic prediction can still choose the wrong branch direction, requiring recovery. III is false. The NOT-true statements are I and III, B.
Overlapping multiple register windows reduce memory accesses for which items? I: function locals and parameters. II: register saves and restores. III: instruction fetches.
(A) I only (B) II only (C) III only (D) I,II,III
Your answer
Answer & solution
Answer: D (no official key was published)
1. A function’s locals and parameters can stay in its register window instead of memory, reducing I. 2. Overlap exposes caller arguments as callee inputs, and window rotation avoids many explicit saves/restores, reducing II. 3. Eliminating save/restore instructions also removes their instruction fetches, reducing III. Therefore all three are benefits, D. Overflowing the available windows still requires spills, so the reduction is not elimination of all memory traffic.
In an execution pipeline, when can the data TLB be accessed at the earliest?
(A) Before effective-address calculation starts (B) During effective-address calculation (C) After effective-address calculation completes (D) After data-cache lookup completes
Your answer
Answer & solution
Answer: C in the conventional address-generation pipeline (no official key was published)
1. The data TLB maps a virtual page number to a physical frame number. The virtual page number comes from the effective address of the data operand. 2. In the conventional sequential stage model, effective-address calculation must finish before that page number is available for translation. This gives C. 3. Waiting until the cache lookup ends is unnecessary. Speculative or overlapping translation in optimized microarchitectures is a separate implementation possibility, so the statement is not a universal physical restriction.
A machine has a 64-KiB, two-way set-associative data cache with 16-byte blocks, managed using 32-bit virtual addresses; pages are 4 KiB. A row-major double ARR[1024][1024] starts at the beginning of virtual page 0xFF000. A double occupies 8 bytes. The cache is initially empty, there is no prefetching, and only ARR causes data-memory references. The code is: for(i=0;i<1024;i++) for(j=0;j<1024;j++) ARR[i][j]=0.0; What is the total tag storage in the cache directory?
1. The 64-KiB cache with 16-byte blocks contains 4096 lines. Two ways give 2048 sets, requiring 11 index bits; the byte offset needs 4 bits. 2. The 32-bit virtual address therefore leaves 32−11−4=17 tag bits per line. Total tag storage is 4096×17=69632 bits=68 Kibits, option D. 3. Valid, dirty and replacement bits are not tags and are excluded.
A machine has a 64-KiB, two-way set-associative data cache with 16-byte blocks, managed using 32-bit virtual addresses; pages are 4 KiB. A row-major double ARR[1024][1024] starts at the beginning of virtual page 0xFF000. A double occupies 8 bytes. The cache is initially empty, there is no prefetching, and only ARR causes data-memory references. The code is: for(i=0;i<1024;i++) for(j=0;j<1024;j++) ARR[i][j]=0.0; Which element has the same cache index as ARR[0][0]?
1. The index repeats every 2048 sets×16 bytes=32768 bytes. A row contains 1024 doubles×8 bytes=8192 bytes. 2. ARR[4][0] is 4×8192=32768 bytes after ARR[0][0], so it has the same set index, option B. ARR[0][4] and ARR[0][5] are only 32 and 40 bytes later; ARR[5][0] is 40960 bytes later, changing the index.
A machine has a 64-KiB, two-way set-associative data cache with 16-byte blocks, managed using 32-bit virtual addresses; pages are 4 KiB. A row-major double ARR[1024][1024] starts at the beginning of virtual page 0xFF000. A double occupies 8 bytes. The cache is initially empty, there is no prefetching, and only ARR causes data-memory references. The code is: for(i=0;i<1024;i++) for(j=0;j<1024;j++) ARR[i][j]=0.0; What is the cache hit ratio for the initialization loop? The printed statement does not specify write allocation.
(A) 0% (B) 25% (C) 50% (D) 75%
Your answer
Answer & solution
Answer: C (assuming write allocation) (no official key was published)
1. Sequential row-major stores touch two adjacent 8-byte doubles in each 16-byte cache line. With the intended write-allocate policy and an initially empty cache, the first store misses and allocates the line, and the second store hits. 2. The hit ratio is therefore 1/2=50%, option C. The array is page-aligned and thus line-aligned. 3. No line is reused after the traversal moves beyond it, so capacity misses do not change this pairing. A no-write-allocate cache would leave every store a miss and yield 0% (A).
Delayed branching handles control hazards. For a delayed conditional branch, regardless of whether the condition is true or false, which statement holds?
(A) The instruction immediately following the branch in memory is executed (B) The first instruction in the fall-through path is executed (C) The first instruction in the taken path is executed (D) The branch takes longer than any other instruction
Your answer
Answer & solution
Answer: A (no official key was published)
1. In the ordinary non-annulling delayed-branch model, the instruction immediately following the branch in memory executes before control transfers, regardless of whether the branch is taken. That is the delay-slot instruction, option A. 2. Instructions beyond the delay slot on the fall-through or target paths are not both guaranteed to execute. Some ISAs offer annulled slots, but those are outside the simple delayed-branch model used by this linked pair.
A processor has one branch delay slot. Which instruction can be moved into it without other program changes? I1: ADD R2←R7+R8 I2: SUB R4←R5−R6 I3: ADD R1←R2+R3 I4: STORE Memory[R4]←R1 BRANCH to Label if R1==0
(A) I1 (B) I2 (C) I3 (D) I4
Your answer
Answer & solution
Answer: D (no official key was published)
1. I4 stores R1 through address R4 but changes neither register used by the branch condition. Moving it from immediately before the branch to the single delay slot preserves its unconditional execution and lets the branch still test the R1 computed by I3. 2. I1 cannot move because I3 needs R2; I2 cannot move because I4 needs R4; I3 cannot move because I4 and the branch need R1. Thus I4, option D, is the legal choice in the stated dependency model.
A 4-way set-associative cache has 128 lines of 64 words each. Main-memory word addresses are 20 bits. What are the TAG, LINE and WORD field lengths, respectively? Options: (A) 9,6,5 (B) 7,7,6 (C) 7,5,8 (D) 9,5,6
Your answer
Answer & solution
Answer: D (no official key was published)
Step through it (7 steps)
1. Approach. First divide total lines by associativity to obtain sets. The address chooses a word inside a line, then a set; the remaining high bits form the tag.
2. Derivation and interpretation. There are 128/4=32 sets, needing 5 set-index bits. A 64-word line needs 6 word-offset bits. With 20-bit word addresses the tag uses 20−5−6=9 bits. Thus 9,5,6, option D; the stated LINE field is the set index in this associative organization.
A disk pack has 16 surfaces, 128 tracks per surface, 256 sectors per track and 512 bytes per sector, stored bit-serially. What are its capacity and the number of bits needed to address a sector? Options: (A) 256 Mbyte,19 bits (B) 256 Mbyte,28 bits (C) 512 Mbyte,20 bits (D) 64 Gbyte,28 bits
Your answer
Answer & solution
Answer: A (no official key was published)
1. Approach. Multiply surfaces, tracks and sectors for the number of addressable sectors. Multiply once more by bytes per sector for capacity; these two quantities require different address widths.
2. Derivation and interpretation. The number of sectors is 16×128×256=219. At 512=29 bytes each, capacity is 228 bytes=256 MiB. A sector address therefore needs 19 bits. Thus A, using the usual binary Mbyte convention; no byte/bit offset is needed when selecting a sector.
A pipeline has IF, ID (decode/operand fetch), EX, WB. IF, ID and WB each take one cycle; EX takes one cycle for ADD/SUB and three for MUL. Operand forwarding is available. How many cycles complete this sequence? ADD R2,R1,R0 (R2←R1+R0) MUL R4,R3,R2 (R4←R3×R2) SUB R6,R5,R4 (R6←R5−R4) Options: (A) 7 (B) 8 (C) 10 (D) 14
Your answer
Answer & solution
Answer: B (no official key was published)
Step through it (5 steps)
1. Approach. Draw one timeline per instruction. Forwarding removes waiting for register writeback, but it cannot make the three-cycle multiply result available before its EX stage finishes.
2. Derivation and interpretation. ADD uses IF1,ID2,EX3,WB4. Its result is forwarded to MUL, which uses IF2,ID3,EX4–6,WB7. SUB uses IF3,ID4 and waits for the EX unit/result, then executes EX7 and WB8. Therefore completion requires 8 cycles, B, assuming the stated forwarding permits consuming an EX result in the next cycle and no additional structural conflicts.
R1,R2,R3 are general-purpose registers. The program, operation, and size in words are: MOV R1,(3000): R1←M[3000], 2 words LOOP: MOV R2,(R3): R2←M[R3], 1 word ADD R2,R1: R2←R1+R2, 1 word MOV (R3),R2: M[R3]←R2, 1 word INC R3: R3←R3+1, 1 word DEC R1: R1←R1−1, 1 word BNZ LOOP: branch if the result is nonzero, 2 words HALT: stop, 1 word. Initially M[3000]=10, R3=2000 and each location 2000–2010 contains 100. The program begins at location 1000; all these numbers are decimal. Assume word-addressable memory. How many data-memory references occur while running the whole program? Options: (A) 10 (B) 11 (C) 20 (D) 21
Your answer
Answer & solution
Answer: D (no official key was published)
1. Approach. R1 is the countdown and starts at ten. Separate instruction fetches from data accesses: only the initial load and the two memory-operand MOVs inside each iteration count.
2. Derivation and interpretation. The initial MOV reads M[3000] once and sets R1=10. Each of 10 iterations reads M[R3] once and writes it once. All other operand operations are on registers; instruction fetches are not data references. Total data memory references = 1+10*2=21, option D.
R1,R2,R3 are general-purpose registers. The program, operation, and size in words are: MOV R1,(3000): R1←M[3000], 2 words LOOP: MOV R2,(R3): R2←M[R3], 1 word ADD R2,R1: R2←R1+R2, 1 word MOV (R3),R2: M[R3]←R2, 1 word INC R3: R3←R3+1, 1 word DEC R1: R1←R1−1, 1 word BNZ LOOP: branch if the result is nonzero, 2 words HALT: stop, 1 word. Initially M[3000]=10, R3=2000 and each location 2000–2010 contains 100. The program begins at location 1000; all these numbers are decimal. Assume word-addressable memory. What is the final content of location 2010? Options: (A) 100 (B) 101 (C) 102 (D) 110
Your answer
Answer & solution
Answer: A (no official key was published)
1. Approach. Track the address used before INC R3, not after it. The first iteration uses 2000; after ten iterations R3 reaches 2010 only when the loop is about to terminate.
2. Derivation and interpretation. R3 starts at 2000. The 10 loop iterations access addresses 2000 through 2009, then R3 becomes 2010 and R1 becomes zero, ending the loop. Address 2010 is never written, so its initial content 100 remains. Answer A.
R1,R2,R3 are general-purpose registers. The program, operation, and size in words are: MOV R1,(3000): R1←M[3000], 2 words LOOP: MOV R2,(R3): R2←M[R3], 1 word ADD R2,R1: R2←R1+R2, 1 word MOV (R3),R2: M[R3]←R2, 1 word INC R3: R3←R3+1, 1 word DEC R1: R1←R1−1, 1 word BNZ LOOP: branch if the result is nonzero, 2 words HALT: stop, 1 word. Initially M[3000]=10, R3=2000 and each location 2000–2010 contains 100. The program begins at location 1000; all these numbers are decimal. Now assume byte-addressable memory and 32-bit words. If an ordinary interrupt occurs while INC R3 executes, what return address is pushed onto the stack? Options: (A) 1005 (B) 1020 (C) 1024 (D) 1040
Your answer
Answer & solution
Answer: C (no official key was published)
1. Approach. Sum instruction lengths through the completed INC, multiply by four bytes per word, and add the program base. An ordinary interrupt resumes at the next instruction, not at the interrupted instruction’s starting address.
2. Derivation and interpretation. Instructions up through INC occupy 2+1+1+1+1=6 words. At 4 bytes per word, the next instruction DEC R1 is at byte address 1000+6*4=1024. An ordinary interrupt is serviced after the current instruction completes and saves the next instruction address, so C. The INC itself starts at 1020.
Main memory is byte-addressable with 2^16 bytes. A direct-mapped data cache has 32 lines, 64 bytes each, and starts empty. A 50×50 array of bytes is contiguous starting at hexadecimal address 1100H. The complete array is accessed twice, with no intervening changes to cache contents. The source does not specify traversal order; use increasing-address scans for the intended result. How many total data-cache misses occur? Options: (A) 48 (B) 50 (C) 56 (D) 59
Your answer
Answer & solution
Answer: C (no official key was published)
1. Approach. Convert the starting address to a block number and count all touched blocks, including the partial final block. For the second scan, identify conflicts modulo the 32 cache lines instead of treating all 40 blocks as compulsory misses again.
2. Derivation and interpretation. Assuming each complete pass reads the array in increasing memory-address order, the 2500-byte array begins at 0x1100=4352, a 64-byte boundary. It spans ceil(2500/64)=40 blocks, numbered 68 through 107. The cold first pass misses 40 times. In the 32-line direct-mapped cache, blocks 68–75 and 100–107 compete for lines 4–11. In the second pass, loading 68–75 evicts 100–107, so both groups miss again, while the other 24 blocks hit. Total 40+8+8=56, option C. Merely saying the complete array is accessed does not specify traversal order; different orders can produce different miss counts.
Main memory is byte-addressable with 2^16 bytes. A direct-mapped data cache has 32 lines, 64 bytes each, and starts empty. A 50×50 array of bytes is contiguous starting at hexadecimal address 1100H. The complete array is accessed twice, with no intervening changes to cache contents. The source does not specify traversal order; use increasing-address scans for the intended result. Which cache lines are replaced by new blocks during the second access? Lines are numbered from zero. Options: (A) 4 through 11 (B) 4 through 12 (C) 0 through 7 (D) 0 through 8
Your answer
Answer & solution
Answer: A (no official key was published)
1. Approach. Map each memory block to block_number mod 32. Forty sequential blocks exceed the cache by eight, so identify which eight line indices are used twice rather than assuming that replacements start at line zero.
2. Derivation and interpretation. With increasing-address scans as in Q80, the array occupies blocks 68–107. Modulo 32, the first eight blocks 68–75 and final eight 100–107 both map to cache lines 4–11. Only those lines are replaced in the second scan, first by 68–75 and later by 100–107. Answer A. Lines are numbered from zero; the result is conditional on the scan-order assumption omitted from the common statement.
A CPU has fixed 24-bit instructions and a program beginning at decimal address 300. Which listed decimal value is a legal program counter in that instruction stream? The conventional byte-addressing assumption is implicit in the reproduction. Options: (A) 400 (B) 500 (C) 600 (D) 700
Your answer
Answer & solution
Answer: C under byte addressing (no official key was published)
1. With byte-addressed memory and fixed 24-bit instructions, each instruction occupies 3 bytes. Addresses in this instruction stream are 300+3k.
2. Only600 among the listed values differs from 300 by a multiple of 3, so C. Instruction width alone does not establish byte addressing or prohibit other instruction streams; those are the conventional implicit assumptions.
3. Teaching check: Convert instruction width from bits to bytes before testing alignment: 24/8=3. The differences from the starting address are 100,200,300,400; only 300 is divisible by three. This checks positions in the given instruction stream, not all arbitrary code addresses in memory.
A cache block is 64 bytes. Main memory has k banks of width c bytes; consecutive c-byte chunks map cyclically onto consecutive banks. All banks can be read in parallel, but repeated accesses to one bank are serialized. Every parallel round takes k/2 ns of decoding plus 80 ns for the bank access. For c=2,k=24, how long does fetching the block starting at address 0 take? Options: (A) 92 ns (B) 104 ns (C) 172 ns (D) 184 ns
Your answer
Answer & solution
Answer: D (no official key was published)
1. Each parallel round transfers at most 24×2=48 bytes. A 64-byte block starting at zero needs 32 bank-width chunks and hence two rounds.
2. Each round costs 24/2+80=92 ns, including the stated decoding cost. Total latency is 184 ns (D).
3. Teaching check: The block contains 64/2=32 chunks. The first 24 can be read together, but the remaining eight return to banks already used and require a second round. The stated model charges decoding again for that round even though not all 24 banks supply another chunk.
A 1 GHz CPU has five pipeline stages; fetch is stage 1. Conditional branches compute their target and condition in stage 3. After fetching a branch, no further instruction is fetched until the outcome is known. A program has 10⁹ instructions, 20% conditional branches. With base CPI 1 before branch stalls, what approximate execution time results? Options: (A) 1.0 s (B) 1.2 s (C) 1.4 s (D) 1.6 s
Your answer
Answer & solution
Answer: C (no official key was published)
1. A branch fetched in stage 1 resolves at the end of stage 3, so two subsequent fetch slots are lost. The ideal CPI is 1 and branch frequency is 0.2, giving CPI=1+2(0.2)=1.4.
2. At 1 GHz, 109 instructions take approximately 1.4 seconds (C); constant pipeline fill/drain time is ignored as in the options. The statement that instructions take one cycle on average must mean the base CPI before these stalls.
3. Teaching check: The two idle fetch slots are the cycles while the branch passes stages 2 and 3. Since one fifth of instructions causes this penalty, average overhead is 0.4 cycles per instruction. The five-stage depth does not mean five cycles of throughput cost for every ordinary instruction.
The instruction bbs reg,pos,label branches if bit pos of a 32-bit register is 1; positions 0…31 start at the least-significant bit. Emulate it by temp←reg & mask, then branch if temp≠0. How should mask be computed? Options: (A) 0x1 << pos (B) 0xffffffff >> pos (C) pos (D) 0xf
Your answer
Answer & solution
Answer: A (no official key was published)
1. The mask must contain exactly one set bit at position pos: mask=0x1 << pos. AND with the register is nonzero exactly when that bit is set.
2. Thus A. These are register-level pseudocode shifts; a literal C implementation should use an unsigned 32-bit 1 to handle position 31 safely.
3. Teaching check: A one-hot mask isolates exactly the requested bit; an all-ones mask shifted right would generally retain several bits. If implemented in C rather than register pseudocode, use a suitably wide unsigned constant to avoid undefined signed left-shift behavior at the top bit.
A CPU has 32-bit virtual addresses, 4 KB pages, and a 128-entry TLB that is four-way set associative. What is the minimum tag width, excluding any address-space identifier? Options: (A) 11 bits (B) 13 bits (C) 15 bits (D) 20 bits
Your answer
Answer & solution
Answer: C (no official key was published)
Step through it (6 steps)
1. A 4 KB page requires 12 offset bits, leaving 32−12=20 virtual-page-number bits. There are 128/4=32 TLB sets, requiring 5 index bits.
2. The minimum tag is the remaining 20−5=15 bits, option C. Additional address-space identifiers are not included in the stated minimum.
3. Teaching check: Partition the virtual address into offset, set index and tag. Page offsets require log₂4096=12 bits. Four-way associativity means only 128/4=32 sets, so five more bits select the set and the remaining fifteen distinguish pages within that set.
Compare two 32 KB caches with 32-byte blocks and 32-bit addresses: one is two-way set associative, the other direct mapped. A 2:1 multiplexer takes 0.6 ns; a k-bit comparator takes k/10 ns. The hit-latency model counts comparator and way-selection delays. Find two-way cache hit latency h₁. Options: (A) 2.4 ns (B) 2.3 ns (C) 1.8 ns (D) 1.7 ns
Your answer
Answer & solution
Answer: A (no official key was published)
Step 1: 32 KB / 32 B=1024 cache lines. Two ways give 512 sets, so index=9 bits and block offset=5 bits.
Step 2: The tag is 32−9−5=18 bits. Two tag comparisons proceed in parallel, taking 18/10=1.8 ns; selecting the matching way adds 0.6 ns.
Step 3: Thus h1=2.4 ns, A, within the stated model that counts comparator and multiplexer latency.
Step 4: Teaching check: Two-way associativity halves the number of sets relative to direct mapping, increasing the tag by one bit. Both way tags are compared in parallel, so do not double comparator latency. The selected data then passes through one 2:1 multiplexer.
Compare two 32 KB caches with 32-byte blocks and 32-bit addresses: one is two-way set associative, the other direct mapped. A 2:1 multiplexer takes 0.6 ns; a k-bit comparator takes k/10 ns. The hit-latency model counts comparator and way-selection delays. Find direct-mapped hit latency h₂. Options: (A) 2.4 ns (B) 2.3 ns (C) 1.8 ns (D) 1.7 ns
Your answer
Answer & solution
Answer: D (no official key was published)
1. A direct-mapped 32 KB cache with 32-byte blocks has 1024 lines, requiring 10 index bits and 5 offset bits. The tag has 32−10−5=17 bits.
2. Its comparison takes 17/10=1.7 ns and no way-selection multiplexer is needed. Thus h2=1.7 ns, D, using the problem’s comparator/multiplexer-only timing model.
3. Teaching check: Direct mapping determines the only candidate line from the index bits, so no way selection is needed. There are 1024 lines rather than 512 sets, giving a 17-bit rather than 18-bit tag. The difference in hit time comes from both the tag size and the absent multiplexer.
A CPU has a 32 KB direct-mapped cache with 128-byte blocks. C array A[512][512] uses 8-byte elements. The two programs execute separately from the same initially cold cache; i,j,x are in registers. P1: for(i=0;i<512;i++) for(j=0;j<512;j++) x+=A[i][j]; P2: for(i=0;i<512;i++) for(j=0;j<512;j++) x+=A[j][i]; Let M1,M2 be their cache-miss counts. Use the conventional block-aligned base address assumed by the listed answers. Find M1. Options: (A) 0 (B) 2048 (C) 16384 (D) 262144
Your answer
Answer & solution
Answer: C (no official key was published)
1. In C, A is row-major. Each 128-byte cache block holds 128/8=16 elements.
2. P1 visits all 512×512 elements sequentially, so one compulsory miss serves each group of 16 elements. For a block-aligned A, M1=512×512/16=16384, C; each later element in the same block hits.
3. Teaching check: C’s rightmost subscript varies over contiguous elements. Each cache block supplies sixteen consecutive doubles, causing one miss followed by fifteen hits in a sequential scan. The whole array is much larger than the cache, but immediate within-block reuse still occurs.
A CPU has a 32 KB direct-mapped cache with 128-byte blocks. C array A[512][512] uses 8-byte elements. The two programs execute separately from the same initially cold cache; i,j,x are in registers. P1: for(i=0;i<512;i++) for(j=0;j<512;j++) x+=A[i][j]; P2: for(i=0;i<512;i++) for(j=0;j<512;j++) x+=A[j][i]; Let M1,M2 be their cache-miss counts. Use the conventional block-aligned base address assumed by the listed answers. Find M1/M2. Options: (A) 0 (B) 1/16 (C) 1/8 (D) 16
Your answer
Answer & solution
Answer: B (no official key was published)
1. P1 has 16384 misses under the block-aligned assumption. P2 accesses A[j][i] with stride 512×8=4096 bytes=32 cache lines.
2. The cache has 32768/128=256 lines, so successive row accesses cycle through only 256/gcd(256,32)=8 cache indices. With 512 rows, every would-be reused block is evicted before the next column accesses it.
3. All 512²=262144 P2 accesses miss. M1/M2=16384/262144=1/16, B.
4. The last options are on physical page 13.
5. Teaching check: A 4096-byte stride advances by 32 cache indices modulo 256. Only eight indices participate in a column, repeatedly overwriting each other. Thus the next column cannot reuse the previous column’s blocks, even though adjacent elements within a row occupy the same block.
A CPU has one interrupt-request and one interrupt-grant line. What is possible? A neither vectored interrupts nor multiple devices; B multiple devices but no vectors; C both; D vectors but only one device.
Your answer
Answer & solution
Answer: C (no official key was published)
Multiple devices can share an interrupt-request line and arbitrate using a daisy-chained grant or an interrupt controller. The selected device can then place its vector on the data bus. Therefore both multiple devices and vectored interrupts are possible, C; one request wire does not require a single interrupt source.
A request wire signals that some device needs service; it need not encode which one. Arbitration through a controller or daisy-chain grant selects one requester, which can then supply an interrupt vector over another bus. Thus one shared request/grant pair does not limit the system to one device or one fixed service routine. C is possible; actual priority/fairness depends on the arbitration design.
Three-word ADD A[R0],@B uses destination indexed address A+R0 and source memory-indirect address M[B]. Opcode/modes are word 1, A and B are words 2/3. How many memory cycles in execution? A3; B4; C5; D6. Distinguish opcode-only fetch boundary from fetching all instruction words before execution.
Your answer
Answer & solution
Answer: D if operand words fetched in execution; B if all three instruction words already fetched (no official key was published)
After fetching the opcode word, execution reads instruction word A and instruction word B (two cycles), reads destination M[A+R0] (one), reads the indirect pointer M[B] and then source M[M[B]] (two), and writes the sum to M[A+R0] (one). This totals six, D. If the phrase execution cycle instead excludes fetching ALL three instruction words, only the four operand accesses remain, B. The paper lack an explicit fetch-cycle boundary; the six-cycle answer uses the conventional opcode-only initial fetch assumed by this style of question. The total including all instruction words is seven memory accesses, with no overlap or cache effects specified.
Separate instruction-word reads from operand-addressing reads. After an opcode-only fetch, two more reads retrieve A and B. Indexed destination contributes one read of its old value; indirect source contributes one read for the pointer and one for its pointed-to value. Finally one write stores the sum. That is 2+1+2+1=6. If all three instruction words were already fetched, only four accesses remain; the missing boundary definition is therefore material, not a computational error.
Match 1 A[I]=B[J]; 2 while(*A++); 3 int temp=*x; to (a)indirect,(b)indexed,(c)autoincrement addressing. A (1, c),(2, b),(3, a); B (1, a),(2, c),(3, b); C (1, b),(2, c),(3, a); D (1, b),(2, b),(3, c). GFG D begins (1, b); GateForum D begins (1, a).
Your answer
Answer & solution
Answer: C (no official key was published)
Array indexing A[I]=B[J] naturally uses indexed addressing; walking a pointer with *A++ uses autoincrement; dereferencing *x uses indirect addressing. The matching is (1, b),(2, c),(3, a), option C.
Indexed addressing adds a scaled index to an array base, matching 1. Autoincrement supplies the current pointer address and advances the pointer, matching 2. Plain dereference uses an address stored in a register or variable without an index, matching 3. Thus the mapping is 1b2c3a. These are natural implementation correspondences, not claims that a compiler must choose exactly these machine instructions.
Direct-mapped cache data capacity 32 KB, block 32 bytes, CPU 32-bit byte addresses. Required(index bits, tag bits): A(10, 17); B(10, 22); C(15, 17); D(5, 17). Use binary capacity units.
Your answer
Answer & solution
Answer: A (no official key was published)
Step through it (6 steps)
The cache contains 32 KiB/32 bytes =1024 lines, so its index needs 10 bits. A block offset needs log2(32)=5 bits. Of the 32 address bits, 32−10−5=17 remain for the tag. Thus (10, 17), option A.
First divide data capacity by block size to obtain 1024 distinct cache positions. Choosing one needs 10 bits. Choosing a byte within 32-byte block needs 5 low-order bits. The tag identifies which memory block is currently occupying that position, using the remaining 32−10−5=17 bits. Check 10+17+5=32. The cache’s total number of bytes is not the number of line indices.
Five one-cycle stages IF instruction fetch, RD decode/register read, EX ALU/address, MA data memory (stores use data read in RD), WB register write. Instructions I1:R0←M[loc1], I2:R0←R0+R0, I3:R2←R2−R0. Total cycles from first fetch through final completion? A8; B10; C12; D15. The source does not explicitly state forwarding.
Your answer
Answer & solution
Answer: A, conditional on forwarding (no official key was published)
With ordinary EX forwarding, the load-use dependency requires one bubble: I1 follows IF1, RD2, EX3, MA4, WB5; I2 follows IF2, RD3 (held through cycle 4), EX5, MA6, WB7; I3 follows IF3 (held), RD5, EX6, MA7, WB8. The add result forwards to the subtract without another bubble. Total 5+2+1=8 cycles, option A. Forwarding is not explicitly stated in the paper, so 8 is conditional, not a uniquely established result from the written stage definitions alone. Without forwarding, with register write/read in opposite halves of one cycle, the two RAW dependencies instead add four bubbles, producing 11 cycles, absent from the choices.
With forwarding, the memory-loaded value appears only after I1’s MA stage, so I2 cannot consume it in EX at cycle 4; stall one cycle. Its ALU result can then forward directly to I3’s EX, adding no second bubble. An unstalled three-instruction/five-stage pipeline would take 7 cycles, so the one bubble makes 8. If forwarding is absent, register availability imposes further waits; the question’s stage list alone does not justify treating 8 as universal.
A10 KB/s device transfers bytes individually. Interrupt overhead 4 microseconds; byte-transfer time to CPU/memory negligible. Minimum intended performance gain using interrupts rather than program-controlled polling? A15; B25; C35; D45. Interpret as CPU occupation ratio and state unit convention.
Your answer
Answer & solution
Answer: B, approximately 25 (no official key was published)
Polling occupies the CPU throughout the interval between consecutive bytes. Using the decimal convention 10 KB/s=10000 bytes/s, this interval is 100 microseconds, whereas interrupt servicing costs 4 microseconds. CPU-time cost ratio is 100/4=25, option B. This compares CPU occupation, not device throughput, which is unchanged. With binary KB the exact ratio is 1/(10240×4×10−6)=24.4140625; 25 is the intended rounded/conventional option.
At 10000 bytes/s a byte arrives every 100 microseconds. Polling continually tests readiness and occupies the CPU for that whole interval. Interrupt service instead occupies only 4 microseconds per byte; the rest can run unrelated work. Their CPU cost ratio is 100/4=25. This is not a 25-fold faster physical device. Binary KB changes the exact ratio, hence the declared convention matters.
Disk:16 surfaces, 512 tracks/surface, 512 sectors/track, 1 KB/sector, 3000 rpm. DMA steals a 40 ns memory cycle for each four-byte word. Maximum CPU-blocked percentage: A10; B25; C40; D50. Check exact units rather than assuming one option is exact.
Your answer
Answer & solution
Answer: B, approximate only (no official key was published)
One track passes the head per revolution; surfaces and tracks determine capacity, not a multiplier of simultaneous transfer rate. Rotation rate is 3000/60=50 revolutions/s. With binary KiB, the transfer rate is 512×1024×50 bytes/s. At four bytes per stolen cycle, memory is occupied for (512×1024×50/4)×40×10−9=0.262144 of the time, or 26.2144%. The nearest option is B (25%), but no option equals the exact result. Decimal KB gives 25.6%, still not exactly 25%; B requires approximate arithmetic.
Compute the streaming rate for the track under one active head:50 revolutions/s times 512 sectors/revolution times 1024 bytes/sector. Divide by 4 to obtain stolen cycles/s, then multiply by 40 ns/cycle. This dimensional chain yields 0.262144 seconds blocked per second. Multiplying by surfaces or total tracks would incorrectly assume simultaneous transfer from all disk positions. B is nearest, but 26.2144% is not exactly 25%.
Single-bus CPU: MAR, MDR, IR, PC, general registers and ALU input latches S, T share the bus; ALU output returns directly to it. All widths equal; increments must use ALU. Memory read takes two cycles: address→MAR then memory→MDR. After instruction fetch, execute ADD R0, R1 meaning R0←R0+R1. Minimum execution cycles A2; B3; C4; D5.
Your answer
Answer & solution
Answer: B (no official key was published)
The diagram has separate S and T input latches and a combinational ALU output returning directly to the bus. Cycle 1 transfers R0 to S; cycle 2 transfers R1 to T; cycle 3 transfers ALU(S+T) through the bus to R0. The single bus cannot carry both distinct operands in one cycle, and the result is latched after the two operands are ready. Three execution cycles are necessary and sufficient, option B; instruction fetch is excluded.
A single bus transports only one independently selected register value each cycle. Load S from R0 and T from R1 in separate cycles. Only after both inputs are latched can the combinational sum be selected onto the bus and captured in R0, using a third cycle. This supplies both a feasible schedule and a lower bound: two operand transfers plus a later result transfer cannot fit in two cycles.
Single-bus CPU: MAR, MDR, IR, PC, general registers and ALU input latches S, T share the bus; ALU output returns directly to it. All widths equal; increments must use ALU. Memory read takes two cycles: address→MAR then memory→MDR. Two-word CALL Rn, sub: opcode fetch already increments PC to second word. Execute Rn←PC+1 and PC←M[PC]. Minimum execution cycles A2; B3; C4; D5.
Your answer
Answer & solution
Answer: C (no official key was published)
At execution start PC addresses the second instruction word. A four-cycle schedule is: (1) broadcast PC to MAR and S; (2) read M[MAR] into MDR while loading the increment operand 1 into T; (3) send ALU(S+T) to Rn; (4) send MDR to PC. The external memory read does not occupy the internal bus carrying 1 in cycle 2. Three bus transfers of PC, return address, and target plus preparation of the increment require four cycles in this latched-input datapath. Thus C (4), assuming the usual constant-one ALU input/control needed for the specified increment operation, which the schematic does not explicitly draw.
Two different results must be preserved: the incremented return address and the target stored in memory. Broadcast PC to MAR and S together in the first cycle, since both need the same value. In the second, memory fills MDR while the internal bus supplies the increment constant to T. The third transfers S+T to Rn; the fourth transfers MDR to PC. Memory’s external transfer can overlap internal-bus work; counting it as another serialized internal transfer would overestimate. The constant input is a conventional control assumption explicitly identified.
A 16-bit format has sign bit 15, seven-bit excess 64 exponent in 14…8, eight-bit pure fractional mantissa in 7…0; sign-magnitude. Printed 85(a): encode positive 0.239×2^13 without normalization or rounding. Hex choices A 0D24; B 0D4D; C 4D0D; D 4D3D.
Your answer
Answer & solution
Answer: D (no official key was published)
The sign is 0. The seven-bit biased exponent is 13+64=77=0x4D. The eight-bit pure-fraction field is obtained by truncation: floor(0.239×256)=61=0x3D, binary 00111101. Concatenating sign, exponent, and mantissa gives 0x4D3D, option D. No normalization or rounding is applied.
Bias affects the exponent field, not the mantissa:13+64=77, or binary 1001101. Truncating eight fraction bits gives floor(.239×256)=61, binary 00111101. The sign 0 followed by exponent 1001101 produces the high byte 01001101=4D; the low byte is 3D. Round-to-nearest would be a different instruction, explicitly excluded here.
A 16-bit format has sign bit 15, seven-bit excess 64 exponent in 14…8, eight-bit pure fractional mantissa in 7…0; sign-magnitude. Printed 85(b): normalize the representation from(a), now storing an implicit leading 1 before the binary point, padding only zeros during shifts. Hex choices A 0A20; B 1134; C 49D0; D 4AE8. Preserve the linked truncated value, not a fresh conversion of the exact decimal.
Your answer
Answer & solution
Answer: D (no official key was published)
Part(a) stores the fraction .00111101₂ times 213. Moving the radix point three places right gives 1.11101₂×210. With the leading 1 implicit and only zeros padded, the eight stored fraction bits are 11101000=0xE8. The biased exponent is 10+64=74=0x4A, so the word is 0x4AE8, option D. This normalizes the truncated stored mantissa from part(a). Directly converting the original exact decimal to normalized form would produce different low bits; the explicit zero-fill rule is essential.
Begin with the already truncated .00111101×213. Shift three places to make its leading 1 sit before the point:1.11101×210. Drop only that implicit leading 1 and pad the remaining fraction to 11101000. The new biased exponent 10+64=74 gives high byte 4A; the fraction givesE 8. This transformation preserves the stored number exactly. Re-expanding the original decimal instead would introduce nonzero lower bits disallowed by the zero-padding premise.
Which addressing modes support program relocation at runtime? (i) Absolute; (ii) Based; (iii) Relative; (iv) Indirect. Options: (A) i and iv (B) i and ii (C) ii and iii (D) i,ii and iv
Your answer
Answer & solution
Answer: C (no official key was published)
1. Base addressing forms an address as relocation base plus displacement, while PC-relative addressing uses a displacement from the moving instruction location. Both preserve relative positions when code is relocated, so ii and iii, C.
2. Absolute embedded addresses require adjustment; indirection alone does not guarantee that stored pointer values relocate correctly.
3. Teaching check: If relocation shifts all code by Δ, a PC-relative target shifts with the PC while its displacement stays fixed. A base-addressed target shifts when the base register is updated. An arbitrary indirect pointer can still contain an obsolete absolute address, so indirection alone is not a relocation guarantee.
A CPU has user registers R1,R2,R3. Program in order (operation; instruction size in words): MOV R1,5000 (R1←Memory[5000];2); MOV R2,(R1) (R2←Memory[R1];1); ADD R2,R3 (R2←R2+R3;1); MOV 6000,R2 (Memory[6000]←R2;2); HALT (machine halts;1). Memory is byte-addressable with 32-bit words and the program starts at decimal 1000. If an interrupt occurs after HALT has executed, what decimal return address is saved on the stack? Options: (A) 1007 (B) 1020 (C) 1024 (D) 1028
Your answer
Answer & solution
Answer: D (no official key was published)
1. The five instructions occupy 2+1+1+2+1=7 words. Each word is 32 bits=4 bytes, so the program occupies 28 bytes starting at 1000.
2. Under the ordinary next-instruction-PC convention, after fetching/executing HALT the saved return address is 1000+28=1028. HALT itself begins at 1024;1007 would confuse word and byte addressing.
3. Teaching check: Instruction start addresses are 1000,1008,1012,1016,1024. HALT occupies one four-byte word, so the next sequential address is 1028. Saving 1024 would resume at HALT itself; saving 1007 wrongly treats byte-addressed memory as word-addressed.
A CPU has user registers R1,R2,R3. Program in order (operation; instruction size in words): MOV R1,5000 (R1←Memory[5000];2); MOV R2,(R1) (R2←Memory[R1];1); ADD R2,R3 (R2←R2+R3;1); MOV 6000,R2 (Memory[6000]←R2;2); HALT (machine halts;1). Each register/memory transfer costs 3 cycles, register ADD costs 1 cycle, and instruction fetch/decode costs 2 cycles per word. What is the total execution-cycle count? Options: (A) 29 (B) 24 (C) 23 (D) 20
Your answer
Answer & solution
Answer: B (no official key was published)
1. There are 7 instruction words, so fetch/decode costs 7×2=14 cycles. The first MOV loads a memory word, the second MOV uses register-indirect addressing to load one memory word, and the last MOV stores one memory word:3 transfers×3=9 cycles.
2. ADD has register operands and costs 1. No extra HALT execution cost is specified.
3. Total14+9+1=24 cycles. Register-indirect addressing does not itself require another memory load because R1 already contains the address.
4. Teaching check: The instruction sizes sum to seven words, so fetch/decode alone costs fourteen cycles. Indirect MOV R2,(R1) uses R1’s value as an address; it does not first fetch that address from memory. This leaves exactly three data-memory transfers and one ADD.
A two-way set-associative cache contains four blocks total and uses LRU replacement. How many misses occur for block references 8,12,0,12,8? Assume an initially empty cache and conventional block-number modulo number-of-sets mapping. Options: (A) 2 (B) 3 (C) 4 (D) 5
Your answer
Answer & solution
Answer: C (no official key was published)
1. Four blocks in a two-way cache means two sets. With the standard block-number modulo 2 mapping,8,12,0 all map to the same set.
2. Starting empty:8 miss gives[8];12 miss gives[8,12];0 miss evicts least-recent 8, giving[12,0];12 hits and becomes MRU;8 misses and evicts 0. Thus four misses.
3. The unused other set cannot absorb these conflicting blocks. An initially empty cache and conventional set indexing are assumed.
4. Teaching check: Only two ways are available in the even-numbered set despite four blocks existing overall. The access to 12 after inserting 0 is a hit and changes recency. That change determines which entry is evicted on the final 8 reference, although the miss count remains four.
A 26-bit microinstruction has a 13-bit micro-operation field, next-address field X and MUX-select field Y. A MUX selects one of eight status bits. Figure connectivity: X feeds the control address register; Y selects the status MUX; the selected status controls address-register load versus increment; that register addresses control memory. What are (X bits,Y bits,control-memory words)? Options: (A) 10,3,1024 (B) 8,5,256 (C) 5,8,2048 (D) 10,3,512
Your answer
Answer & solution
Answer: A (no official key was published)
1. An eight-input status multiplexer needs Y=log2(8)=3 select bits. Of the 26 microinstruction bits, 13 encode operations, leaving X=26−13−3=10 next-address bits.
2. An address space of ten bits contains 210=1024 control-memory words. Thus (X,Y,words)=(10,3,1024), A.
3. Teaching check: The select field encodes which of eight status lines is used, so it needs three bits rather than eight. The next-address width is what addresses control-memory words; the microinstruction width determines word size, not the number of words.
A disk continuously transfers at 10 Mbytes/s using DMA. A 600-MHz CPU uses 300 cycles to initiate and 900 cycles to complete each 20-Kbyte DMA block transfer. What percentage of CPU time is consumed by transfer overhead? Options: (A) 5.0% (B) 1.0% (C) 0.5% (D) 0.1%
Your answer
Answer & solution
Answer: D (no official key was published)
1. The CPU spends 300+900=1200 cycles per block, or 1200/(600×106)=2 microseconds. At 10 MB/s a 20 KB block takes approximately 2 milliseconds, so CPU overhead is 2 microseconds / 2 milliseconds ×100%=0.1%, D.
2. Consistent binary KB/MB units give about 0.1024%, still the stated approximation. This counts setup/completion CPU time, not the disk-transfer duration as busy CPU time.
3. Teaching check: DMA frees the CPU during the bulk data movement. Charge only 1200 CPU cycles per transfer, not the full disk-transfer interval. Using consistent seconds and clock cycles gives a dimensionless ratio before multiplying by 100 to express a percentage.
A four-stage pipeline has stage delays 150,120,160,140 ns and interstage-register delay 5 ns. With a constant clock period, how long does it take to process 1000 items? Options: (A) 120.4 μs (B) 160.5 μs (C) 165.5 μs (D) 590.0 μs
Your answer
Answer & solution
Answer: C (no official key was published)
1. The common clock period is the slowest stage plus register delay: max(150,120,160,140)+5=165 ns. A four-stage pipeline needs 4 cycles for its first item and 999 more for the remaining items.
2. Total time is (1000+4−1)×165=165495 ns=165.495 microseconds, rounded to 165.5 microseconds, C. This is the standard balanced-clock pipeline timing model.
3. Teaching check: Pipeline throughput is set by the slowest stage, not the sum of stage delays. The sum matters for an unpipelined path; the pipelined batch takes a fill of four cycles plus one cycle for each subsequent item. Include the register delay in every clock period.
For a pipelined CPU with one ALU, consider I. Instruction j+1 uses instruction j’s result; II. A conditional jump executes; III. Instructions j and j+1 need the ALU simultaneously. Which can cause a hazard? A. I and II only; B. II and III only; C. III only; D. All three.
Your answer
Answer & solution
Answer: D (no official key was published)
1. A data hazard concerns operand availability, a control hazard concerns which instruction address to fetch, and a structural hazard concerns resource availability. These are separate reasons a pipeline may need a stall or other mitigation. A single ALU does not eliminate the data or control cases.
2. Using a preceding result can cause a data hazard; a conditional branch causes a control hazard; simultaneous demand for the single ALU causes a structural hazard. Therefore all three can cause hazards, D. The question asks possibility, not that every instance necessarily stalls.
A 16-bit floating-point scheme has sign s at bit 15, six-bit exponent e at bits 14–9, and nine-bit mantissa integer m at bits 8–0. Its value is (−1)^s(1+m·2^(−9))2^(e−31) if e≠111111₂, and zero otherwise. What is the maximum difference between successive representable real numbers? A. 2^(−40); B. 2^(−9); C. 2^22; D. 2^31.
Your answer
Answer & solution
Answer: C (no official key was published)
1. Within an exponent binade, incrementing the nine-bit mantissa integer by one increments the value by 2e−40. Maximizing this requires the largest nonreserved exponent, 62. The positive/negative sign duplicates gaps by symmetry; crossing zero and crossing adjacent exponent ranges cannot exceed the largest within-binade gap.
2. There are six exponent bits and nine fractional mantissa bits. Exponent 63 is reserved for zero, so the largest usable exponent is e=62. For fixed e, adjacent significands differ by 2⁻⁹, giving spacing 2e−31−9. This is largest at e=62, namely 2²², option C. Crossing a binade boundary has the smaller binade’s spacing, and the gaps adjacent to zero are only 2⁻³¹, so neither produces a larger gap.
An n-bit ripple-carry ALU has a full adder at each bit. At bit i its inputs are Ai, Bi XOR K, and carry Ci; the output is Si and the next carry. K is shared by all XOR gates and C0 is the least-significant carry input. For two's-complement operands, which operations can be performed by choosing only K and C0? A. A+B and A−B, but not A+1 B. A+B and A+1, but not A−B C. A+B, but neither A−B nor A+1 D. A+B, A−B and A+1
Your answer
Answer & solution
Answer: A (no official key was published)
1. A full-adder chain adds its two input words and the initial carry, so S=A+(B XOR K...K)+C0 modulo 2n. 2. Enumerate the controls: (0,0) produces A+B; (0,1) produces A+B+1; (1,0) produces A+complement(B)=A−B−1; (1,1) produces A−B. 3. For arbitrary B none of these cancels B entirely. In particular the extra carry in (0,1) gives A+B+1, not A+1. Thus only addition and subtraction are generally available: A.
Solution: The gates feeding the B inputs are XOR gates. For an n-bit word the circuit computes A+(B XOR K…K)+C₀ modulo 2ⁿ. Setting (K,C₀)=(0,0) gives A+B; setting (1,1) gives A+¬B+1=A−B. Neither setting can remove arbitrary B to give A+1 solely by changing those two control lines. Therefore A+B and A−B, but not general A+1, is option A.
A, B and C are 8-bit registers in a hypothetical processor. The program is: MOV B,#0 ; B=0 MOV C,#8 ; C=8 Z: CMP C,#0 ; compare C with zero JZ X ; jump if zero flag is set SUB C,#1 ; C=C-1 RRC A,#1 ; rotate A right through carry once JC Y ; jump if carry is set JMP Z Y: ADD B,#1 ; B=B+1 JMP Z X: RRC transforms A=a7...a0 and carry=c into A=ca7...a1 and carry=a0. Use the instruction effects listed for this hypothetical machine. If A initially equals A0, what is B after execution? A. Number of 0 bits in A0 B. Number of 1 bits in A0 C. A0 D. 8
Your answer
Answer & solution
Answer: B (no official key was published)
1. The C test is before the decrement: C=8,7,...,1 each enters the body, while C=0 exits. There are exactly eight rotations. 2. Write the original bits as a7...a0. The successive carry outputs are a0,a1,...,a7. Any incoming carry sits at the top and cannot emerge until a ninth rotation. 3. Only JC Y reaches ADD B,#1. Thus B increases once for every outgoing 1 and never for an outgoing 0. Starting from zero it ends at a0+...+a7, the population count: B.
Solution: The counter C starts at eight and the loop performs exactly eight one-bit right rotations through carry. The carry tested immediately after the kth rotation is the kth original low-to-high bit of A. Newly inserted carry bits cannot reach the outgoing low position during these eight iterations. B starts at zero and is incremented exactly when the outgoing bit is one, so B is the population count of the original A, option B.
Restoring an eight-bit register after through-carry rotations
Instructions & Addressing Modes
Tap to enlarge
A, B and C are 8-bit registers in a hypothetical processor. The program is: MOV B,#0 ; B=0 MOV C,#8 ; C=8 Z: CMP C,#0 ; compare C with zero JZ X ; jump if zero flag is set SUB C,#1 ; C=C-1 RRC A,#1 ; rotate A right through carry once JC Y ; jump if carry is set JMP Z Y: ADD B,#1 ; B=B+1 JMP Z X: RRC transforms A=a7...a0 and carry=c into A=ca7...a1 and carry=a0. Use the instruction effects listed for this hypothetical machine. Which instruction inserted at X ensures that A ends with its original value? A. RRC A,#1 B. NOP (no operation) C. LRC A,#1 (rotate A left through carry once) D. ADD A,#1
Your answer
Answer & solution
Answer: A under the stated instruction effects (no official key was published)
1. Include carry in the state: (c,a7,a6,...,a0) is a nine-position ring. One RRC moves this ring one position right. 2. The loop performs eight rotations, so its accumulated permutation is R8. Since R9 is the identity, another RRC restores all nine bits. 3. NOP leaves R8 unchanged; one left rotation gives R7, not identity; adding 1 is not a bit-position inverse. Hence A works under the given instruction effects. This explicitly relies on other listed instructions not modifying carry.
Solution: Treat carry and A together as a nine-bit circular register and use the instruction effects stated for this hypothetical processor. Eight right rotations leave one right rotation short of a full nine-bit cycle. Inserting RRC A,#1 at X therefore restores A, irrespective of the initial carry value, giving A. This reasoning uses carry preservation by instructions whose listed effects do not change carry; importing different flag side effects from a real ISA would require a new analysis.
Translation lookaside buffer and cache access time
Memory Organization & Address Translation
Tap to enlarge
A byte-addressable processor has 32-bit virtual and physical addresses and two-level page tables stored in main memory. Address bits are split 10 bits for first-level index, 10 for second-level index, and 12 for page offset. All page-table entries are 4 bytes. TLB hit rate is 96%, physical-cache hit rate 90%; TLB and cache access each take 1 ns, and main memory takes 10 ns. With no page faults, what is mean virtual-address access time, approximately to the nearest 0.5 ns? A. 1.5 ns B. 2 ns C. 3 ns D. 4 ns The statement does not specify whether page-table reads use the cache/hit rate.
Your answer
Answer & solution
Answer: None (no official key was published)
1. A cache-backed physical access costs 1 ns on a hit and 1+10=11 ns on a miss. Its mean is H=0.9×1+0.1×11=2 ns. 2. Every virtual access pays the 1 ns TLB lookup and one final data access. A TLB miss occurs with probability 0.04 and additionally reads two page-table entries. 3. If those reads also use this cache and hit rate, the conditional costs are 3 ns on a TLB hit and 7 ns on a miss. E=0.96×3+0.04×7=3.16 ns, rounding to 3.0 ns (C). 4. If page-table reads bypass the cache, a miss instead costs 1+20+2=23 ns. E=0.96×3+0.04×23=3.8 ns, rounding to 4.0 ns (D). 5. Both interpretations place page tables in main memory; this phrase alone does not resolve caching. Consequently retain the baseline underdetermination instead of asserting an unconditional option.
Solution: If every physical memory reference, including page-table reads, uses the stated cache with 90% hit probability, its mean service time is H=1+0.10×10=2 ns, charging the cache probe before a miss fetch. A lookup always costs 1 ns for the TLB and one data reference; a TLB miss, probability 0.04, adds two page-table references. Thus E=1+(1+2×0.04)H=3.16 ns, which rounds to 3.0 ns, C. If the two page-table references instead bypass the cache and each costs 10 ns, E=1+0.04×20+H=3.8 ns, rounding to 4.0 ns, D. The statement that page tables reside in main memory does not itself specify whether their reads are cached or share the data-cache hit rate. C is the usual all-physical-accesses-cached interpretation, but an unconditional answer is withheld.
A device requests an interrupt through INTR. While which signal is active does it place a CALL instruction on the data bus? (A) INTA (active-low interrupt acknowledge); (B) HOLD; (C) READY; (D) None of these.
Your answer
Answer & solution
Answer: A (no official key was published)
Step 1: Distinguish request from acknowledgment.
Step 2: INTR requests CPU service. Once accepted, INTA tells the external device when it may drive the instruction information onto the data bus. HOLD instead requests bus-master control, and READY indicates whether a transfer can finish without wait states. Their roles do not provide the interrupt-instruction handshake.
Conclusion: For an 8085 INTR request, the external device supplies the instruction during the interrupt-acknowledge sequence, when active-low INTA is asserted. Thus A. HOLD concerns bus ownership and READY controls wait states.
Which 8085 instructions modify the program counter? (A) Only PCHL; (B) Only ADD instructions; (C) Only JMP and CALL; (D) All instructions.
Your answer
Answer & solution
Answer: D (no official key was published)
Step 1: Include the fetch phase, not only the instruction’s explicit operation.
Step 2: An arithmetic instruction still consumes its opcode and possibly operand bytes from the instruction stream. The PC must move beyond those bytes so execution can continue. A jump changes where execution continues, but this extra change does not make jumps the only PC-modifying instructions.
Conclusion: The program counter advances during instruction fetching even for instructions that do not explicitly branch. Branch, call and PCHL instructions additionally replace its value. Therefore it is not modified only by a special instruction subset: D in the ordinary 8085 instruction-fetch model.
Which item is not a kind of memory? (A) Instruction cache; (B) Instruction register; (C) Instruction opcode; (D) Translation lookaside buffer.
Your answer
Answer & solution
Answer: C (no official key was published)
Step 1: Separate a stored field from a storage device.
Step 2: The instruction register can hold an entire instruction, including its opcode; an instruction cache holds instruction bytes. A TLB holds cached address translations. The opcode is the information inside such storage, just as a number written in a register is not itself a register.
Conclusion: A cache, an instruction register, and a translation lookaside buffer are storage structures. An instruction opcode is a bit field identifying an operation, not itself a memory structure. Therefore C.
In absolute addressing, which statement is correct? (A) The instruction contains the operand. (B) The instruction contains the operand’s address. (C) The instruction specifies a register that holds the operand’s address. (D) The operand’s location is implicit.
Your answer
Answer & solution
Answer: B (no official key was published)
Step 1: Locate the address in each addressing mode.
Step 2: For a conceptual instruction LOAD R,[1000], the instruction’s address field 1000 identifies memory containing the operand: absolute addressing. LOAD R,#1000 instead uses 1000 itself as an immediate value. LOAD R,[S] obtains the address from register S. These distinctions correspond to the different answer descriptions.
Conclusion: In absolute/direct addressing the instruction supplies the operand’s address, B. Supplying the operand value is immediate addressing; naming a register containing its address is register-indirect addressing.
Determine the auxiliary carry AC and carry CY flags after this 8085 instruction sequence: MVI H, 5DH MVI L, 6BH MOV A, H ADD L (A) AC=0, CY=0; (B) AC=1, CY=1; (C) AC=1, CY=0. (D) Source variant: GFG prints AC=0, CY=0 (duplicating A), whereas GateForum prints AC=0, CY=1. Original official wording is not verified.
Your answer
Answer & solution
Answer: C (no official key was published)
Step 1: Perform both the nibble sum and the full sum.
Step 2: At the low nibble, hexadecimal D+B=13+11=24=16+8, so a carry crosses the bit3 boundary. At the high nibble,5+6+1=12=C, without a carry beyond the byte. Hence the result is C8, auxiliary carry 1, full carry 0. Source option D differs between reproductions, but neither version competes with the computed option C.
Conclusion: A receives 5D₁₆ and ADD L adds 6B₁₆, yielding C8₁₆. The low nibbles D+B=18₁₆ generate a carry out of bit3, so AC=1. The full sum is below 100₁₆, so CY=0. Thus C.
Which condition harms pipelined-processor performance? (A) Unequal stage delays; (B) Dependencies between consecutive instructions; (C) Shared hardware resources among stages; (D) All of these.
Your answer
Answer & solution
Answer: D (no official key was published)
Step 1: Separate three causes of lost pipeline throughput.
Step 2: Stage imbalance makes the clock period depend on the slowest stage. A dependence can make an instruction wait until its operand is available. A structural conflict occurs when two stages need one shared resource simultaneously. These are independent mechanisms, so an answer listing only one omits other valid possibilities.
Conclusion: Unequal stage delays leave faster stages waiting for the slowest. Data dependence can require stalls, and shared hardware can create structural conflicts. Each can reduce performance, so D. Suitable forwarding, scheduling or duplicated resources may mitigate particular cases, rather than making the hazards impossible.
Which statement describes horizontal microprogramming? (A) Signal decoders are unnecessary. (B) Microinstructions are larger than in vertical microprogramming. (C) Each control signal has its own bit. (D) All of these.
Your answer
Answer & solution
Answer: D (no official key was published)
Step 1: Compare direct bits with encoded control fields.
Step 2: With k directly controlled signals, a fully horizontal word can devote k bits to asserting them. A vertical word can use a shorter encoded field for mutually exclusive alternatives, but then requires decoding to recover the individual control lines. The width-versus-decoder tradeoff explains why all three descriptions hold together in the stated model.
Conclusion: In the fully horizontal model, each control signal has its own bit, so no encoded-control-field decoder is needed. This makes instructions wider than a vertical encoding. All three statements apply to that model, D; sequencing/address decoding is not thereby eliminated.
The circuit takes three-bit inputs A=a₂a₁a₀ and B=b₂b₁b₀ and produces Z=z₃z₂z₁z₀. All registers load simultaneously on falling CLOCK edges; the clock period exceeds every circuit’s settling time. The diagram has R0 (6 bits) holding b₂,a₂,b₁,a₁,b₀,a₀. A full adder takes R0’s b₀,a₀ with carry-in 0. R1 (6 bits) holds the forwarded b₂,a₂,b₁,a₁ and this adder’s carry and sum. A second full adder takes R1’s b₁,a₁ and that stored carry. R2 (5 bits) holds the forwarded b₂,a₂, the second adder’s carry and sum, and the forwarded least-significant sum. A third, unregistered full adder takes R2’s b₂,a₂ and stored carry; its carry and sum are z₃,z₂, while R2’s stored sums directly provide z₁,z₀. Initially R0, R1, R2 are all zero. For clock numbers 1 through 8, A is [110,011,111,101,000,000,000,000] and B is [101,101,011,110,000,000,000,000]. Determine the sequence of eight four-bit output values Z.
Shared context
A and B are unsigned three-bit operands. All three registers R0, R1, R2 load on the same falling clock edge. The source circuit stages three full adders and delays higher input bits and lower result bits to keep each operand pair aligned. All registers initially contain zero.
Answer & solution
Answer: 0000, 0000, 1011, 1000, 1010, 1011, 0000, 0000 (no official key was published)
1. Read the timing rule before doing arithmetic. R0, R1, and R2 load simultaneously on every falling edge. A downstream register therefore samples the old contents of the register before it, not the new value arriving during that same edge. Read Z after the final full adder has settled.
2. Follow one input pair through the circuit. Pair t enters R0 at edge t. Its low-bit sum and carry enter R1 at edge t+1. Its middle-bit sum and carry enter R2 at edge t+2, after which the last full adder produces the high sum bit and final carry. The delayed low bits complete the four-bit output. Thus the input captured at edge 1 first appears as a complete sum after edge 3.
3. Compute the first four operand sums, preserving the carry bit:
Input pair A B Decimal sum Four-bit sum
1 110 101 6+5=11 1011
2 011 101 3+5=8 1000
3 111 011 7+3=10 1010
4 101 110 5+6=11 1011
5–8 000 000 0+0=0 0000
4. Check the first sum at bit level. For 110 + 101, bit 0 gives 0+1+0 = 1, so s0=1,c1=0. Bit 1 gives 1+0+0 = 1, so s1=1,c2=0. Bit 2 gives 1+1+0 = 2, so s2=0,c3=1. The result c3s2s1s0 is 1011.
5. Apply the two-edge delay and the all-zero initial register contents. The requested sequence is:
The initial two outputs come from the zero-filled pipeline. Input pairs 7 and 8 have not yet reached the output at edge 8. Register-by-register synchronous simulation verifies all eight reported outputs.
The circuit takes three-bit inputs A=a₂a₁a₀ and B=b₂b₁b₀ and produces Z=z₃z₂z₁z₀. All registers load simultaneously on falling CLOCK edges; the clock period exceeds every circuit’s settling time. The diagram has R0 (6 bits) holding b₂,a₂,b₁,a₁,b₀,a₀. A full adder takes R0’s b₀,a₀ with carry-in 0. R1 (6 bits) holds the forwarded b₂,a₂,b₁,a₁ and this adder’s carry and sum. A second full adder takes R1’s b₁,a₁ and that stored carry. R2 (5 bits) holds the forwarded b₂,a₂, the second adder’s carry and sum, and the forwarded least-significant sum. A third, unregistered full adder takes R2’s b₂,a₂ and stored carry; its carry and sum are z₃,z₂, while R2’s stored sums directly provide z₁,z₀. What operation does this circuit implement?
Shared context
A and B are unsigned three-bit operands. All three registers R0, R1, R2 load on the same falling clock edge. The source circuit stages three full adders and delays higher input bits and lower result bits to keep each operand pair aligned. All registers initially contain zero.
Answer & solution
Answer: Pipelined unsigned three-bit binary adder, producing a four-bit sum (no official key was published)
1. Identify each arithmetic stage from the source diagram. The first full adder takes a0, b0, and carry-in 0. It produces the least significant sum bit s0 and carry c1. R1 stores those values together with the delayed higher operand bits.
2. Follow the carry to the next stage. The second full adder takes a1, b1, and that same operand pair’s carry c1. It produces s1 and c2. R2 stores these along with the delayed a2,b2 and s0.
3. Finish the sum. The last full adder takes a2,b2,c2 and outputs s2 plus the carry c3. The circuit combines these with the delayed low bits as Z = c3s2s1s0. Consequently the four-bit unsigned result is exactly A+B; the leading carry is retained rather than discarded.
4. Explain why the registers matter. They delay the remaining operand bits and previously computed low sum bits along with the carry. This keeps all four output bits associated with one input pair while different pairs occupy different stages. Without those matching delays, bits from different pairs could be mixed.
5. Identify the implementation and performance. It is a pipelined unsigned three-bit binary adder, accepting a new pair each clock and producing one four-bit sum per clock after filling. A pair captured by R0 at edge t appears at Z after edge t+2 and combinational settling. It passes through three register loads, R0, R1, R2; there are two full clock intervals between its first capture and final output. This explicit convention avoids an ambiguous bare latency number.
A 32-bit floating-point format has fields, from most to least significant: sign (1 bit), fraction (24 bits), exponent (7 bits). Sign 0 means positive and 1 negative. The binary point precedes the fraction bits. The exponent is stored in excess-64 representation, and the exponentiation base is 16. Represent decimal −7.5 as a normalized number in this format. Derive each field and give the complete representation in hexadecimal.
Shared context
The custom 32-bit format stores sign, 24-bit fraction, then 7-bit excess-64 exponent, in that order. Its numeric value is (−1)^s(F/2^24)16^(E−64); no reserved exponent encodings are specified.
Answer & solution
Answer: Sign 1; fraction 0x780000; biased exponent 65; word 0xBC000041 (no official key was published)
1. Write the numeric interpretation of this particular format. For sign bit s, unsigned 24-bit fraction integer F, and unsigned stored exponent E, the value is (−1)s × (F/224) × 16E−64. The storage order is sign, fraction, exponent, unlike IEEE 754.
2. Normalize the magnitude in radix 16. Since 7.5/16 = 0.46875 and 0.46875 = 7/16 + 8/256, we have 7.5 = 0.78₁₆ × 16¹. The leading hexadecimal fraction digit 7 is nonzero, so this is normalized. Leading zeros within that hexadecimal digit’s four binary bits are allowed in radix-16 normalization.
3. Fill each field. The value is negative, so s=1. The six-hex-digit fraction is 780000, giving F=0x780000 and fraction bits 0111 1000 0000 0000 0000 0000. The actual exponent is 1; applying excess-64 gives E=65, whose seven-bit form is 1000001.
4. Concatenate the fields without moving the exponent to the front:
Equivalently, the word is (1 << 31) | (0x780000 << 7) | 65. The fraction is shifted by seven because the exponent occupies the low seven bits.
5. Decode the candidate to verify it: −(0x780000/224) × 1665−64 = −0.46875 × 16 = −7.5 exactly. No rounding is needed because the fraction has a finite binary and hexadecimal representation.
A 32-bit floating-point format has fields, from most to least significant: sign (1 bit), fraction (24 bits), exponent (7 bits). Sign 0 means positive and 1 negative. The binary point precedes the fraction bits. The exponent is stored in excess-64 representation, and the exponentiation base is 16. Find the largest representable value and express it as the nearest power of 10.
Shared context
The custom 32-bit format stores sign, 24-bit fraction, then 7-bit excess-64 exponent, in that order. Its numeric value is (−1)^s(F/2^24)16^(E−64); no reserved exponent encodings are specified.
Answer & solution
Answer: (1 − 2^−24)16^63 ≈ 7.23700515 × 10^75; nearest power 10^76 (no official key was published)
1. Choose the sign for the largest value. The largest representable number is positive, so the sign bit must be 0. A negative sign would reduce the value rather than maximize it.
2. Maximize the fraction. A 24-bit fraction with its binary point to the left has value F/224. All fraction bits equal to 1 give F=224−1 and fraction (224−1)/224 = 1−2−24. This is normalized and is strictly less than 1; replacing it by 1 would invent an unrepresentable fraction.
3. Maximize the exponent. The seven-bit stored field ranges from 0 to 127. Because the bias is 64, its largest actual exponent is 127−64=63. The problem specifies no reserved encodings, so none are excluded as infinity or NaN.
4. Combine the fields using radix 16, not radix 2: V_max = (1−2−24)1663 = (1−2−24)2252 ≈ 7.23700515 × 1075.
5. Convert to the requested nearest power of ten. log10(V_max) = log10(1−2−24) + 63log10(16) ≈ 75.85956. Rounding the exponent to the nearest integer gives 76, hence the nearest power is 1076. The exact maximum above distinguishes the representable value from this order-of-magnitude answer.
Find array elements that conflict in a direct-mapped cache
Cache Memory
Tap to enlarge
A C program declares float A[2048], with four bytes per element and A starting at address 0x00000000. It runs on a computer with an 8-Kbyte direct-mapped data cache and 16-byte cache blocks (lines). Which array elements conflict with A[0] in the cache? Briefly justify.
Shared context
float A[2048] begins at address 0; each element occupies 4 bytes. The direct-mapped data cache has 8 Kbytes = 8192 bytes and 16-byte lines. Part (b) scans from A[2047] to A[0], starting with an empty cache and no other accesses.
Answer & solution
Answer: None; A[1], A[2], A[3] share A[0]’s block but do not conflict (no official key was published)
1. Convert sizes using the standard binary Kbyte convention. The cache holds 8×1024=8192 bytes. Dividing by the 16-byte block size gives 512 direct-mapped cache lines. Each block holds 16/4=4 array elements.
2. Derive the mapping from an array index. Since A begins at address 0, A[i] starts at address 4i. Its memory-block number is floor(4i/16)=floor(i/4). The corresponding cache-line index is floor(i/4) mod 512; the tag distinguishes blocks with that same index.
3. Find all array elements with A[0]’s index. Its block is block 0 and its cache index is 0. An index of 0 requires block number 0,512,1024,… . Within the declared array, 0≤i≤2047, so floor(i/4) ranges only from 0 to 511. Only block 0 occurs, containing A[0], A[1], A[2], A[3].
4. Distinguish sharing from conflict. A[1], A[2], A[3] are in the same memory block as A[0], so they are fetched together and coexist. They do not compete for the line or evict A[0]. A conflict requires a different memory block, hence a different tag, mapping to that line.
5. The next genuinely conflicting block would start at byte address 8192, corresponding to A[2048], which is outside the declared array. Therefore no element within A[0…2047] conflicts with A[0]. Saying merely “A[1…3] have the same cache index” is true but does not answer the eviction/conflict question correctly.
A C program declares float A[2048], with four bytes per element and A starting at address 0x00000000. It runs on a computer with an 8-Kbyte direct-mapped data cache and 16-byte cache blocks (lines). Starting with an empty cache, access each array element once in reverse order, from the last element through the first. Ignore all other data and instruction accesses. How many data-cache misses occur? Briefly justify.
Shared context
float A[2048] begins at address 0; each element occupies 4 bytes. The direct-mapped data cache has 8 Kbytes = 8192 bytes and 16-byte lines. Part (b) scans from A[2047] to A[0], starting with an empty cache and no other accesses.
Answer & solution
Answer: 512 cache misses (no official key was published)
1. Count the blocks touched. The array holds 2048 four-byte elements, so its total size is 8192 bytes. With 16-byte lines, there are 8192/16 = 512 distinct array blocks, each containing four consecutive elements.
2. Trace the first reversed block. The first access, A[2047], misses because the cache is empty and loads the entire block A[2044…2047]. The next accesses A[2046], A[2045], A[2044] therefore hit. Crossing to A[2043] causes the next miss and loads the next group of four.
3. Generalize the pattern. In every group of four reversed accesses, the first is a miss and the other three are hits. No accesses outside the array intervene. The 512 array blocks have distinct cache indices, although even a smaller cache would still preserve this immediate three-hit pattern for a single uninterrupted sequential scan.
4. Multiply the counts: misses = 512×1 = 512, hits = 512×3 = 1536, total accesses = 512+1536 = 2048. All these misses are compulsory first references, not conflict misses.
5. Reverse traversal changes which element first brings in each block, but not the number of blocks touched. A direct-mapped simulation from A[2047] down to A[0] confirms the count of 512 misses.
Why does a cache block contain multiple words? Choices: temporal locality, spatial locality, reduced miss penalty, or none of these.
Your answer
Answer & solution
Answer: B (no official key was published)
Step 1: A reference often predicts references to nearby addresses, for example successive array elements or adjacent instructions. Loading neighboring words with the requested word prepares for those accesses: spatial locality.
Step 2: Temporal locality concerns repeated use of the same location and already motivates retaining even a single cached word. A larger block can increase rather than reduce the transfer time of a miss.
Therefore spatial locality is the specific reason for grouping words, B.
Which 8085 signal supports connecting slow memory: INTR, RESET IN, HOLD, or READY?
Your answer
Answer & solution
Answer: D (no official key was published)
Step 1: Slow memory may not complete a read or write within the processor’s ordinary bus cycle. The processor needs a way to extend that transfer without treating it as a new operation.
Step 2: Deasserting READY inserts wait states until the device is ready, so D. INTR requests interrupt service, RESET IN resets execution, and HOLD requests bus ownership; none is the normal memory-cycle wait-state handshake.
A processor has no dedicated stack-pointer register. Does this prohibit subroutine calls, permit calls but not nesting, permit nesting but not interrupts, or still allow nested calls and interrupts?
Your answer
Answer & solution
Answer: D (no official key was published)
Step 1: A call must preserve a return address, but that address need not be pushed by a special hardware SP. A link register, a general-purpose register used as a software pointer, or explicit memory stores can preserve it.
Step 2: Before a nested call overwrites a link register, software saves the old value in a memory record and restores it on return. Interrupt context can be preserved by analogous hardware/software mechanisms.
Thus the absence of a dedicated stack-pointer register does not rule out nested calls or interrupts: D, assuming the processor otherwise provides the necessary control-transfer and storage operations.
A CPU has privileged and nonprivileged modes. How does the conventional architecture return from privileged to nonprivileged execution? Choices are hardware interrupt, software interrupt, a privileged non-interrupting instruction, or a nonprivileged non-interrupting instruction.
Your answer
Answer & solution
Answer: C under the conventional mode-control architecture (no official key was published)
Step 1: Interrupts and traps normally enter privileged mode. The reverse transition occurs when the OS restores a user context and returns to its instruction stream.
Step 2: A privileged return-from-trap or mode-control instruction can perform that transition without generating a new interrupt, corresponding to C. It is executed while the processor is still privileged.
Qualification: The prompt does not specify an ISA. Some architectures may provide other controlled privilege-dropping mechanisms; the answer uses the standard textbook protection model, not a universal instruction-set theorem.
Match indirect, indexed, and base-register addressing to passing an array as a parameter, implementing an array, and relocatable code. Option A pairs indirect with parameter passing, indexed with arrays, and base-register with relocation; the other choices permute these assignments.
Your answer
Answer & solution
Answer: A (no official key was published)
Step 1: Passing an array by address gives a pointer to its elements; indirect addressing accesses memory through that pointer, matching X with III.
Step 2: Indexed addressing combines an array base with an index/offset, matching Y with I. Base-register addressing expresses locations relative to a relocatable base; changing that base allows the same relative offsets to address relocated code/data, matching Z with II.
An unpipelined CPU has an 8-bit bus, ALU, general registers and MDR, but 16-bit SP and MAR. Byte-select mux/demux connect SP and MAR to the bus; memory operations take two cycles; SP can decrement locally. For push r, perform M[SP]←r then SP←SP−1. How many execution cycles: 2,3,4,5? The complete datapath is linked.
Your answer
Answer & solution
Answer: D (no official key was published)
Step 1: The 16-bit SP must be copied to 16-bit MAR through an 8-bit bus. This requires two distinct bus transfers, one per byte, using the mux/demux controls.
Step 2: Copy the 8-bit register r to MDR in a third cycle. The memory write then uses two cycles with MAR supplying the address and MDR the byte. SP can be decremented locally in parallel after its old value has been transferred, so no additional bus cycle is needed for that decrement.
Total 2+1+2=5 cycles, D, in the standard clocked-transfer schedule with memory write starting after MAR/MDR are loaded. Instruction-fetch cycles are not part of this execution count.
Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.
Task: Find the total capacity of the disk.
Shared context
Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.
Answer & solution
Answer: 320,000 KB = 327,680,000 bytes = 312.5 MiB. (no official key was published)
1. Count all sectors: 20 surfaces × 1000 tracks per surface × 16 sectors per track = 320,000 sectors. The units cancel to sectors, so rotation speed is irrelevant to capacity.
2. Each sector stores 1 KB=1024 bytes. Total capacity is 320,000×1024=327,680,000 bytes.
3. Dividing by 1024² yields 312.5 MiB, often written 312.5 MB under the historical binary convention. Under modern decimal units it is 327.68 MB.
4. The result uses the stated formatted sector payload and does not add hypothetical gaps or disk-controller overhead absent from the problem.
Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.
Task: Find the data transfer rate.
Shared context
Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.
Answer & solution
Answer: 819,200 bytes/s = 800 KiB/s. (no official key was published)
2. A selected track contains 16 sectors ×1024 bytes =16,384 bytes per revolution. Streaming transfer rate is 16,384×50=819,200 bytes/second, or 800 KiB/second.
3. Do not multiply by 20 surfaces: the described single serial transfer channel reads the selected track, not every surface simultaneously.
4. The byte interval is 1/819,200 seconds≈1.220703 μs. This is the sustained transfer rate once positioned, not an average including unspecified seek and rotational waiting times.
Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.
Task: Find the percentage of CPU time required for byte-wise interrupt-driven transfer.
Shared context
Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.
Answer & solution
Answer: 40.96% of CPU time during sustained disk transfer. (no official key was published)
1. The sustained disk rate is 50×16×1024=819,200 bytes/s. Each byte causes its own interrupt, so there are 819,200 interrupts per second of streaming transfer.
2. For each byte the CPU pays both 0.4 μs interrupt overhead and 0.1 μs memory read/write time. Total CPU service is 0.5 μs/byte.
3. CPU busy time per elapsed second is 819,200×0.5 μs=409,600 μs=0.4096 seconds. Therefore utilization is 0.4096×100=40.96%.
4. Counting only the interrupt overhead would give 32.768% and omit the specified data transfer cost. The remaining time can be used for unrelated computation under the stated model.
Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.
Task: Find the maximum percentage of CPU time held up by cycle-stealing DMA.
Shared context
Disk: 20 surfaces, 1000 tracks/surface, 16 sectors/track, 1 KB/sector, 3000 rpm; transfer one byte at a time. For CPU calculations memory transfer costs 0.1 μs/byte, interrupt overhead 0.4 μs/byte, DMA setup negligible and requests always granted. Use 1 KB=1024 bytes.
Answer & solution
Answer: Maximum CPU hold-up is 8.192% during sustained transfer. (no official key was published)
1. Cycle-stealing DMA transfers each byte directly between the device and memory. It does not invoke the CPU once per byte, so the 0.4 μs interrupt overhead does not apply.
2. The memory bus is taken for the specified 0.1 μs per byte. At 819,200 bytes/s, DMA occupies memory for 819,200×0.1 μs=81,920 μs per second.
3. If every stolen cycle would otherwise have been useful to the CPU, the CPU is held up for the full 0.08192 seconds per second: 8.192%. This is the requested maximum.
4. Actual processor slowdown can be lower if some stolen bus cycles overlap times when the CPU needs no memory service. Initialization and termination costs are excluded because the question explicitly makes them negligible.
32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.
Task: Find the tag-field width per block.
Shared context
32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.
Answer & solution
Answer: 16 tag bits per block. (no official key was published)
Step through it (7 steps)
1. An address separates into tag, set index, and byte offset. The 16-byte block needs log₂16=4 offset bits.
2. There are (256×1024)/(4×16)=4096 sets, so the set index needs log₂4096=12 bits.
3. The remaining bits are tag bits: 32−12−4=16. In bit positions, tag=A31…A16, set=A15…A4, byte offset=A3…A0.
4. Associativity affects the number of sets and hence the tag width. There is no address field selecting a way; the stored tags determine which of the four candidate ways matches.
32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.
Task: Find the number and size of comparators for tag matching.
Shared context
32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.
Answer & solution
Answer: Four 16-bit equality comparators for a parallel four-way lookup. (no official key was published)
1. The 12 index bits select one set containing four candidate cache blocks. The requested block may occupy any of those four ways.
2. The incoming 16-bit tag must be compared with each of the four stored 16-bit tags. A standard parallel lookup therefore uses four comparators, each comparing two 16-bit quantities.
3. Each comparator produces one match bit, normally qualified by the corresponding valid bit. The hit way selects its data.
4. Comparators for every cache block are unnecessary because the index has already selected one set. A serial implementation could reuse hardware with additional latency, but the conventional associative lookup requested here is parallel.
32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.
Task: Find total extra memory in bytes required for tag bits.
Shared context
32-bit byte addresses; cache data capacity 256 KB=2^18 bytes; 4-way set associative; 16-byte blocks.
Answer & solution
Answer: 32,768 bytes = 32 KiB for tags only. (no official key was published)
Step through it (8 steps)
1. Total cache blocks equal 256×1024/16=16,384. Every resident block requires its own tag even though blocks share a set index.
2. Each tag has 32−12−4=16 bits. Thus tag storage is 16,384×16=262,144 bits.
3. Convert bits to bytes by dividing by 8: 262,144/8=32,768 bytes, or 32 KiB.
4. This is only the requested tag-bit memory. Valid bits, dirty bits, and replacement metadata would add storage, but their costs are not part of the tag-only question and are not silently included.
Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.
Task: Show all data dependencies among the four instructions.
Shared context
Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.
Answer & solution
Answer: RAW: I1→I2(r2), I1→I3(r2), I1→I4(r2), I2→I4(r4). WAR: I1→I2(r4), I1→I4(r3), I2→I4(r3). No WAW. (no official key was published)
1. List register accesses first: I1 reads r3,r4 and writes r2; I2 reads r2,r3 and writes r4; I3 reads r1,r2 and writes memory; I4 reads r4,r2 and writes r3.
2. A true (RAW) dependence connects an earlier writer to a later reader of that value. I1 supplies r2 to I2, I3 and I4. I2 supplies r4 to I4. These are the four true data dependencies.
3. For completeness, anti-dependencies (WAR) constrain later overwriting of earlier inputs: I1 reads r4 before I2 writes it; I1 and I2 read r3 before I4 writes it. These are I1→I2 on r4, I1→I4 on r3, and I2→I4 on r3.
4. No two instructions write the same register, so there are no output (WAW) dependencies. Only I3 accesses memory, so there is no inter-instruction memory dependence. WAR relations do not become hazards in this in-order five-stage pipeline, where reads precede later writes.
Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.
Task: Identify the data hazards.
Shared context
Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.
Answer & solution
Answer: Without forwarding, RAW hazards: I1→I2 on r2, I1→I3 on r2, I2→I4 on r4. I1→I4 is not a timing hazard. (no official key was published)
2. I1 writes r2 in cycle 5. I2 tries to read it in cycle 3 and I3 in cycle 4, both too early without forwarding. These two true dependencies create RAW hazards.
3. I2 writes r4 in cycle 6, while I4 reads r4 in cycle 5, producing the third RAW hazard.
4. I4 also depends on I1 for r2, but reads in the second half of cycle 5 after I1 writes in its first half. Therefore this dependency is safe under the explicit half-cycle timing.
5. WAR and WAW hazards do not arise in the given ordered pipeline. This list describes the original unstalled timing; adding stalls can incidentally eliminate later conflicts, so dependency and hazard should not be conflated.
Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.
Task: Determine whether forwarding can avoid all the hazards in this sequence.
Shared context
Five stages IF, ID, EX, MEM, WB; reads occur in second half of cycle, writes in first half. I1: sub r2,r3,r4; I2: sub r4,r2,r3; I3: sw r2,100(r1); I4: sub r3,r4,r2.
Answer & solution
Answer: Yes, with normal ALU forwarding and a forwarding path for the store data; no load-use stall is present. (no official key was published)
1. I1 computes its r2 result at the end of EX in cycle 3. I2 needs that value at EX in cycle 4, so forwarding from I1’s EX/MEM register to I2’s ALU input resolves the nearest RAW hazard.
2. I3 may have read a stale r2 during ID4, but its store value can be corrected by forwarding the I1 result from MEM/WB during I3’s EX5 into the store-data path. That corrected value is carried to MEM6 for the write. An equivalent appropriately staged store-data bypass also works.
3. I2 computes r4 at the end of EX4. I4 needs it during EX6; the value can be forwarded from I2’s MEM/WB register to I4’s ALU input. I4’s r2 operand is already correct from the same-cycle WB5/ID5 timing.
4. All producer results are available before their consumer execution or memory-use stages, so no bubble is required with these bypasses. None of the instructions is a load producing a value too late for an immediately following EX stage.
5. The qualification matters: an implementation forwarding only ALU inputs but not correcting the store-data path would not resolve I3’s stale store value. The yes answer assumes forwarding includes the needed store-data path, not an unspecified restricted implementation.
Choose the signal action that inserts an 8085 wait state: lower HOLD, lower READY, raise HOLD, or raise READY.
Your answer
Answer & solution
Answer: B (no official key was published)
Step 1: READY tells the processor whether the current memory or I/O transfer can finish. When READY is low at its sampling point, the processor inserts wait states.
Step 2: Raising READY permits the transfer to proceed. HOLD is for requesting bus control, not the ordinary slow-transfer extension.
Compare latency T1 for one instruction on a pipelined CPU with T2 on an otherwise identical nonpipelined CPU. Options: T1≤T2,T1≥T2,T1<T2,or T1=T2 plus one fetch cycle.
Your answer
Answer & solution
Answer: B under the standard same-work comparison (no official key was published)
Step 1: Pipelining overlaps different instructions; one instruction still passes through all of its stages. If stage delays are d1,…,dk, the unpipelined combinational work is their sum.
Step 2: A clocked pipeline needs roughly k·max(di), plus register overhead, which is at least sum(di). Perfectly balanced ideal stages can match the unpipelined latency; real pipeline registers usually increase it.
Thus T1≥T2, B, in this standard comparison. Throughput improvement across many instructions must not be confused with reducing one instruction’s latency; no universal extra-fetch-cycle formula follows.
When does the 8085 respond to an eligible TRAP request: immediately upon a high level, at the end of fetch, at instruction completion, or at unspecified regular intervals?
Your answer
Answer & solution
Answer: C (no official key was published)
Step 1: The processor normally completes the current instruction before transferring to an interrupt service routine, preserving a well-defined instruction boundary.
Step 2: Thus the textbook choice is C, at the end of execution rather than merely at opcode fetch or immediately on signal assertion.
Qualification: TRAP has edge-and-level triggering requirements; an arbitrary static high level alone is not a complete description of a valid new request. The answer concerns service timing after an eligible request.
Match X indirect,Y immediate,Z autodecrement addressing to 1 loops,2 pointers,3 constants. Options are permutations; C gives X2,Y3,Z1.
Your answer
Answer & solution
Answer: C (no official key was published)
Step 1: Indirect addressing follows a stored address, so it naturally implements pointer access: X→2. Immediate addressing embeds an operand value, so it is suited to constants: Y→3.
Step 2: Autodecrement combines a register decrement with addressing, useful when iterating backward through a sequence or maintaining a loop-related address: Z→1 among the supplied uses.
Therefore C. These are representative uses, not claims that each mode has only one application.
A graphics card has 1 MB on-board memory. Which mode cannot fit:1600×400 at 256 colors;1600×400 at 16 million colors;800×400 at 16 million colors;800×800 at 256 colors? Monitor physical size is also listed.
Your answer
Answer & solution
Answer: B (no official key was published)
Step 1: A palette of 256 colors needs 8 bits=1 byte per pixel. About 16 million colors requires 24 bits=3 bytes per pixel in the conventional packed framebuffer.
Step 2: The four memory needs are 640,000;1,920,000;960,000;640,000 bytes respectively. Only the second exceeds either 1,000,000 or 1,048,576 bytes.
Thus B. Screen size in inches does not affect the number of stored pixels. The calculation assumes one packed buffer without extra padding, double buffering or 32-bit-per-pixel storage.
With 32-bit floating-point A=2·10^30,B=−2·10^30,C=1, perform X=A+B;Y=A+C;X=X+C;Y=Y+B. Choose(X,Y) from(1,1),(1,0),(0,1),(0,0).
Your answer
Answer & solution
Answer: B under conventional single-precision rounding (no official key was published)
Step 1: Stored A and B are exact sign opposites, so A+B cancels to zero; subsequently X=0+1=1.
Step 2: Near magnitude 2·1030, single precision has a spacing vastly greater than 1. Thus A+1 rounds back to A, losing the small addend. Adding B afterward cancels to zero, giving Y=0.
Therefore B. This demonstrates nonassociativity of finite-precision addition. It assumes the stated 32-bit operations/rounding rather than an optimizer reassociating expressions or a wider intermediate format.
The printed 8085 instruction is IN 09H at memory 3050H, with table [3050H]=DAH, [3051H]=09H. In the intended ten-T-state IN trace, opcode fetch uses T1–T4, operand memory read T5–T7, and I/O read T8–TA. Box A is opcode data on AD₇…AD₀, box D is low address for operand fetch, box B is operand data, and box C is high address A₁₅…A₈ during I/O read. The figure initially shows high address 30H and low address 50H.
Task: Give A,B,C,D in hexadecimal.
Shared context
The printed 8085 instruction is IN 09H at memory 3050H, with table [3050H]=DAH, [3051H]=09H. In the intended ten-T-state IN trace, opcode fetch uses T1–T4, operand memory read T5–T7, and I/O read T8–TA. Box A is opcode data on AD₇…AD₀, box D is low address for operand fetch, box B is operand data, and box C is high address A₁₅…A₈ during I/O read. The figure initially shows high address 30H and low address 50H.
Answer & solution
Answer: Intended IN: A=DBH, B=09H, C=09H, D=51H. Copying the printed table gives A=DAH but is inconsistent with IN. (no official key was published)
1. Opcode fetch addresses 3050H, placing 30H on the high address bus and 50H on the multiplexed low bus during its address phase. During its data phase, box A is the opcode byte.
2. The next memory cycle addresses 3051H. High address stays 30H; low address box D is 51H. Memory then returns the immediate port number, so box B is 09H.
3. For the I/O-read cycle, the 8085 places the eight-bit port address on both halves of the address bus. Thus high-address box C is 09H; the low address is also 09H during that cycle’s address phase.
4. The reproductions print DAH at 3050H. A literal transcription therefore fills A=DAH, B=09H, C=09H, D=51H in the intended diagram. Architecturally, however, IN has opcode DBH; DAH is JC addr16 and would require another address byte rather than this I/O cycle. No single execution satisfies both the table and the stated instruction.
5. For a corrected executable IN 09H use DBH at 3050H and keep B,C,D as above. For the literal DAH program, the missing byte at 3052H and initial carry are needed to determine the jump; there is no intended peripheral read.
The printed 8085 instruction is IN 09H at memory 3050H, with table [3050H]=DAH, [3051H]=09H. In the intended ten-T-state IN trace, opcode fetch uses T1–T4, operand memory read T5–T7, and I/O read T8–TA. Box A is opcode data on AD₇…AD₀, box D is low address for operand fetch, box B is operand data, and box C is high address A₁₅…A₈ during I/O read. The figure initially shows high address 30H and low address 50H.
Task: State ALE and active-low RD at T1,T2,T3,T4.
Shared context
The printed 8085 instruction is IN 09H at memory 3050H, with table [3050H]=DAH, [3051H]=09H. In the intended ten-T-state IN trace, opcode fetch uses T1–T4, operand memory read T5–T7, and I/O read T8–TA. Box A is opcode data on AD₇…AD₀, box D is low address for operand fetch, box B is operand data, and box C is high address A₁₅…A₈ during I/O read. The figure initially shows high address 30H and low address 50H.
Answer & solution
Answer: ALE: pulse high in T1, low in T2–T4. RD̅: high, low, low, high. (no official key was published)
1. T1 is the opcode-fetch address phase. ALE pulses high so an external latch can retain the low address before AD₇…AD₀ is reused as a data bus. RD̅ remains inactive high.
2. In T2 and T3 the memory read is active: RD̅ is low and the addressed memory drives the opcode. ALE is low because the low address has already been latched.
3. T4 is internal decoding, not an additional memory read, so RD̅ is high and ALE is low. State-level summary (T1,T2,T3,T4): ALE=(pulse,0,0,0); RD̅=(1,0,0,1). A pulse is not a claim that ALE is high for the entire T1 interval.
4. These first four states are an opcode fetch for either DAH or DBH; thus the opcode discrepancy does not alter this control-signal answer. Subsequent cycles do differ, as explained in part (a).
The printed 8085 instruction is IN 09H at memory 3050H, with table [3050H]=DAH, [3051H]=09H. In the intended ten-T-state IN trace, opcode fetch uses T1–T4, operand memory read T5–T7, and I/O read T8–TA. Box A is opcode data on AD₇…AD₀, box D is low address for operand fetch, box B is operand data, and box C is high address A₁₅…A₈ during I/O read. The figure initially shows high address 30H and low address 50H.
Task: Which signals are combined to tell the peripheral to put data on the bus?
Shared context
The printed 8085 instruction is IN 09H at memory 3050H, with table [3050H]=DAH, [3051H]=09H. In the intended ten-T-state IN trace, opcode fetch uses T1–T4, operand memory read T5–T7, and I/O read T8–TA. Box A is opcode data on AD₇…AD₀, box D is low address for operand fetch, box B is operand data, and box C is high address A₁₅…A₈ during I/O read. The figure initially shows high address 30H and low address 50H.
Answer & solution
Answer: Combine IO/M and RD̅; active-low IOR̅=¬(IO/M)∨RD̅, gated with the decoded port select. (no official key was published)
1. IO/M=1 identifies an I/O cycle, while RD̅=0 requests a read. A peripheral may drive the bus only when both conditions hold.
2. The active-high read condition is (IO/M) AND NOT(RD̅). Complementing gives the usual active-low I/O-read strobe IOR̅=NOT(IO/M) OR RD̅.
3. Truth table in order (IO/M,RD̅)=(0,0),(0,1),(1,0),(1,1) gives IOR̅=1,1,0,1. Thus a memory read does not activate the peripheral.
4. The individual device must also be selected by decoding port 09H; for active-high select S, its active-low enable is NOT S OR IOR̅. The requested common bus-control signals are IO/M and RD̅, with address decoding selecting which peripheral responds.
B and C contain packed-BCD values 00…99. Program: S1: MVI A,99H; MVI D,00H; SUB C; ADD B; DAA; S2: JC S3; MOV E,A; MVI A,99H; SUB E; MOV E,A; JZ S4; MVI D,FFH; JMP S4; S3: INR A; DAA; MOV E,A; S4: … . GFG prints INR A; GateForum prints INC A, which is not an 8085 mnemonic. Interpret the latter as INR for the architectural analysis.
Task: For (B,C)=(44,25) and (33,46), find A at S2.
Shared context
B and C contain packed-BCD values 00…99. Program: S1: MVI A,99H; MVI D,00H; SUB C; ADD B; DAA; S2: JC S3; MOV E,A; MVI A,99H; SUB E; MOV E,A; JZ S4; MVI D,FFH; JMP S4; S3: INR A; DAA; MOV E,A; S4: … . Interpret the latter as INR for the architectural analysis.
Answer & solution
Answer: A=18H (CY=1) and A=86H (CY=0), respectively. (no official key was published)
1. All shown register inputs are packed BCD, so decimal 44 means byte 44H, not byte 2CH. MVI D does not change the accumulator or arithmetic flags.
2. First pair: 99H−25H=74H. ADD 44H gives B8H, with no low-nibble auxiliary carry (4+4=8). DAA corrects the invalid high decimal digit by adding 60H, producing 118H: A=18H and CY=1 at S2.
3. Second pair: 99H−46H=53H. ADD 33H gives 86H, already valid BCD, with no carry or auxiliary carry. DAA makes no correction: A=86H and CY=0.
4. The decimal interpretation is 99−25+44=118, whose lower two digits are 18 with a carry, and 99−46+33=86 without a carry. This part ends before INR and the second DAA, so the later program defect does not change these answers.
B and C contain packed-BCD values 00…99. Program: S1: MVI A,99H; MVI D,00H; SUB C; ADD B; DAA; S2: JC S3; MOV E,A; MVI A,99H; SUB E; MOV E,A; JZ S4; MVI D,FFH; JMP S4; S3: INR A; DAA; MOV E,A; S4: … . GFG prints INR A; GateForum prints INC A, which is not an 8085 mnemonic. Interpret the latter as INR for the architectural analysis.
Task: For (B,C)=(44,25) and (33,46), find D,E at S4.
Shared context
B and C contain packed-BCD values 00…99. Program: S1: MVI A,99H; MVI D,00H; SUB C; ADD B; DAA; S2: JC S3; MOV E,A; MVI A,99H; SUB E; MOV E,A; JZ S4; MVI D,FFH; JMP S4; S3: INR A; DAA; MOV E,A; S4: … . Interpret the latter as INR for the architectural analysis.
Answer & solution
Answer: Literal 8085: (D,E)=(00H,79H) and (FFH,13H). Intended subtraction output for first pair is (00H,19H), requiring a carry-clearing correction. (no official key was published)
1. For the first pair S2 has A=18H,CY=1. JC goes to S3 and D remains 00H. INR A makes A=19H but, on 8085, does not change carry. Therefore CY is still 1.
2. The following DAA uses that retained carry and adds 60H, producing 79H. MOV E,A therefore stores E=79H. It is incorrect to report literal E=19H while silently treating INR as a carry-clearing operation.
3. For the second pair S2 has A=86H,CY=0, so JC is not taken. MOV E,A stores 86H; then A=99H−86H=13H and MOV E,A stores 13H. The result is nonzero, so JZ is not taken and D becomes FFH. Final pair is (FFH,13H).
4. The apparent intent is a signed magnitude: D=00H for nonnegative B−C, FFH for negative, and E the BCD magnitude. That intended first result would be 19H. Replacing INR A by ADI 01H clears the inherited carry for these reachable values and gives the intended result after DAA; this is a proposed repair, not text present in the source.
5. The paper’s clear INR resolves the mnemonic but not the retained-carry defect. Both literal and intended interpretations must remain visible until an authoritative erratum is available.
B and C contain packed-BCD values 00…99. Program: S1: MVI A,99H; MVI D,00H; SUB C; ADD B; DAA; S2: JC S3; MOV E,A; MVI A,99H; SUB E; MOV E,A; JZ S4; MVI D,FFH; JMP S4; S3: INR A; DAA; MOV E,A; S4: … . GFG prints INR A; GateForum prints INC A, which is not an 8085 mnemonic. Interpret the latter as INR for the architectural analysis.
Task: Express D and E at S4 as functions of the decimal values b,c represented by B,C.
Shared context
B and C contain packed-BCD values 00…99. Program: S1: MVI A,99H; MVI D,00H; SUB C; ADD B; DAA; S2: JC S3; MOV E,A; MVI A,99H; SUB E; MOV E,A; JZ S4; MVI D,FFH; JMP S4; S3: INR A; DAA; MOV E,A; S4: … . Interpret the latter as INR for the architectural analysis.
Answer & solution
Answer: If b≤c: E=BCD(c−b), D=FFH for b<c and 00H for equality. If b>c: D=00H, literal E=BCD(b−c)+60H (byte arithmetic), not the intended BCD(b−c). (no official key was published)
1. Define enc(t)=16⌊t/10⌋+(t mod 10) for 0≤t≤99. Since each digit of 99 exceeds or equals the corresponding digit of C, 99H−C is the packed-BCD nine’s complement enc(99−c).
2. ADD B followed by DAA computes 99−c+b. If b>c its decimal value is 100…198, so CY=1 and A=enc(b−c−1). If b≤c, CY=0 and A=enc(99−(c−b)).
3. When b≤c, the no-carry path subtracts this BCD nine’s complement from 99H, giving E=enc(c−b). Zero leaves D=00H; otherwise D becomes FFH. This branch correctly implements zero or a negative signed magnitude.
4. When b>c let d=b−c∈[1,99]. INR changes enc(d−1) by one and leaves CY=1. DAA performs the required low-digit correction, but also adds 60H because carry was preserved. Therefore the literal E is enc(d)+60H (mod 256), with D=00H. For example d=19 gives 79H and d=40 gives A0H, even an invalid BCD digit.
5. The intended function is D=00H if b≥c else FFH, E=enc(|b−c|). It becomes correct if S3 uses ADI 01H instead of INR A: the ordinary addition resets carry appropriately before the final DAA. Do not label the intended function as the unmodified program’s actual behavior.
An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead.
Task: Find average instruction execution time when every branch prevents overlap.
Shared context
An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead.
Answer & solution
Answer: 3.6 ns per instruction (CPI 1.8 at a 2 ns clock). (no official key was published)
1. Without branches, the pipeline accepts a new instruction every cycle, hence steady-state throughput time is 2 ns per instruction, not the individual instruction latency of 10 ns.
2. A branch fetched in cycle t completes at the end of t+4. The successor can be fetched in t+5, whereas normal overlap would fetch it in t+1. Thus each such branch adds four idle fetch cycles, or 8 ns.
3. The expected cycles per instruction are 1+0.20×4=1.8. Multiplying by 2 ns gives 3.6 ns per instruction.
4. Equivalently, 80% of inter-fetch intervals are 2 ns and 20% are 10 ns, so 0.8×2+0.2×10=3.6 ns. Finite programs have fill/drain effects; the question’s average uses the usual long-run idealization.
An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.
Task: Find the revised average instruction execution time.
Shared context
An ideal five-stage pipeline has stage time 2 ns; every instruction uses all five stages. For a nonoverlapped branch, the following instruction is not fetched until the branch completes. Branches are 20% of all executed instructions. Compute steady-state average time, ignoring finite-stream fill/drain overhead. Of the branch instructions, 80% are conditional; half of those are taken. For a not-taken conditional branch the following instructions may overlap.
Answer & solution
Answer: 2.96 ns per instruction (CPI 1.48). (no official key was published)
1. Within the branch population, 20% are unconditional and always impose the no-overlap rule. Another 80%×50%=40% are taken conditional branches. Thus 60% of branches impose the four-cycle penalty.
2. As branches are 20% of all instructions, the fraction of all instructions causing the penalty is 0.20×0.60=0.12. The remaining 0.88 do not interrupt ideal overlap under the stated model.
3. Average CPI is 1+0.12×4=1.48, giving 1.48×2=2.96 ns. Equivalently 0.88×2+0.12×10=2.96 ns.
4. The 50% figure applies only to conditional branches, not to every branch. Ignoring the unconditional 20% of branches would incorrectly reduce the answer to 2.64 ns. No branch prediction or extra recovery penalty is introduced beyond the assumptions given.
System calls are usually invoked by software interrupt, polling, indirect jump, or privileged instruction.
Your answer
Answer & solution
Answer: A (no official key was published)
A user program must request a controlled transition to kernel code. A software trap or software interrupt supplies that entry point, saves the required return state and switches privilege as the architecture specifies. Thus A is the traditional description. An ordinary indirect jump does not itself authorize a privilege change, and polling is a waiting strategy rather than a syscall entry mechanism. Modern processors may use dedicated syscall instructions; the user-callable trap must not be confused with an instruction executable only after privilege has already been obtained.
Find the eight Booth signed digits for decimal −57, most significant first; option B is 0,−1,0,0,+1,0,0,−1.
Your answer
Answer & solution
Answer: B (no official key was published)
The eight-bit two’s-complement representation of −57 is 11000111, obtained from 57=00111001 by inversion and adding one. Append b[−1]=0 and use signed digit d[i]=b[i−1]−b[i]. From low to high the digits are −1,0,0,+1,0,0,−1,0. Reversing them gives 0,−1,0,0,+1,0,0,−1, option B. The weighted check is −26+23−20=−64+8−1=−57. The negative sign in the question is essential.
For multiplying two n-bit numbers using an array multiplier, is maximum output delay O(n²),O(n),O(log n),or O(1)?
Your answer
Answer & solution
Answer: B (no official key was published)
The array contains quadratically many partial-product cells, but delay measures the longest dependent path rather than the total number of cells. In a regular array multiplier, carry/sum information traverses only a linear number of cell stages along a path to the final output. With bounded gate delay per stage, the critical delay is O(n), B. A logarithmic tree multiplier is a different organization; counting all n² cells as if they operated serially incorrectly gives A.
Main memory has 2cm blocks and cache has 2c blocks, with two blocks per set. Which set receives block k: k mod m,c,2c,or 2cm?
Your answer
Answer & solution
Answer: B (no official key was published)
The number of cache sets is capacity divided by associativity: (2c)/2=c. Consecutive main-memory blocks are distributed cyclically over these c sets, so the set index is k mod c. The remaining quotient supplies tag information, while either way within that indexed set may hold the block. Thus B. The paper display products 2cm and 2c, not exponents; reading the latter as 2c would change the set-count formula incorrectly.
RAID configurations provide fault tolerance,high speed,high data density,or none. Select applicable goals.
Select all that apply
Answer & solution
Answer: A,B (no official key was published)
Mirroring or parity can preserve recoverability after a disk failure, providing fault tolerance. Striping distributes transfers across disks and can increase throughput, providing high speed. These are system-level properties, not an increase in the physical bit density of an individual disk, so C is not a RAID benefit. The applicable goals are A,B. Different RAID levels trade these goals differently: RAID0 emphasizes striping without redundancy, while mirrored/parity levels supply failure protection; the answer does not claim every level supplies both equally.
Order hardwired control,horizontal microprogramming,vertical microprogramming from fastest to slowest.
Select all that apply
Answer & solution
Answer: B (no official key was published)
Hardwired control generates signals through dedicated logic without fetching a microinstruction for each control step. Horizontal microcode exposes many control fields directly, reducing decoding and allowing parallel control actions. Vertical microcode is more densely encoded and needs additional decoding, often with less control parallelism. Thus the traditional comparable-design order is hardwired, horizontal, vertical, option B. This is an architectural rule of thumb, not a universal measured ordering across unrelated implementations or clock technologies.
Relative to CISC, does RISC typically have fewer instructions,fewer addressing modes,more registers,and easier hardwired control?
Select all that apply
Answer & solution
Answer: A,B,C,D (no official key was published)
A smaller, more regular instruction repertoire and fewer addressing forms simplify instruction decoding. A load/store style relies heavily on register operands, encouraging a larger register file. Regular simple instruction behavior also makes hardwired control easier to design than for many complex multi-step instructions. These support all four listed typical characteristics. They are historical design tendencies, as the word typically indicates, not strict necessary conditions that classify every modern hybrid processor.
With only immediate and direct addressing, which cannot be implemented: pointers,arrays,records,recursive procedures with locals?
Select all that apply
Answer & solution
Answer: No unconditional impossibility; A,B,D under a restricted direct-code model (no official key was published)
A direct instruction names a fixed address; it cannot in one ordinary memory operation follow a runtime pointer or index. Records with fixed field offsets can use fixed addresses, while pointers, variable array indices and runtime stack frames naturally need computed-address access. This motivates A,B,D only under a model excluding software emulation and code modification. Literally, however, a finite address space permits a dispatch chain: compare the desired address with each legal address and execute the matching direct load/store. Such an interpreter can implement all these features, albeit inefficiently; self-modifying code supplies another possible route if allowed. Therefore the given addressing-mode restriction alone does not prove impossibility, and no unsupported official choice is assigned.
Five instructions pass in order through F, D, E, W. Their respective cycle requirements are I1=(1,2,1,1), I2=(1,2,2,1), I3=(2,1,3,2), I4=(1,3,2,1), I5=(1,2,1,2). Find the completion time.
Answer & solution
Answer: 15 clock cycles (no official key was published)
Step through it (7 steps)
Assume one instruction can occupy each stage at a time, in-order processing and no unmentioned data hazards. A completed instruction may wait for the next stage. A feasible schedule, using inclusive cycle ranges, is:
Instruction F D E W
I1 1 2–3 4 5
I2 2 4–5 6–7 8
I3 4–5 6 8–10 11–12
I4 6 8–10 11–12 13
I5 8 11–12 13 14–15
Waiting is not additional useful stage work: I2 stays at F through cycle 3; I3 stays at D during cycle 7; I4 stays at F during cycle 7; I5 stays at F through cycle 10. Thus the schedule is also feasible with ordinary backpressure rather than unbounded interstage queues. For a lower bound, even with unrestricted waiting buffers the earliest completion recurrence is C(i,j)=max(C(i−1,j),C(i,j−1))+duration(i,j), with zero boundary values. Its rows are (1,3,4,5), (2,5,7,8), (4,6,10,12), (5,9,12,13), (6,11,13,15). No legal schedule can finish before cycle 15, and the displayed schedule attains it. Summing all stage times would incorrectly remove pipeline overlap.
For the assembly below with initial (R1,R2,R3)=(5,0,0), find R1 and R3 on reaching Z: X: CMP R1,0 JZ Z MOV R2,R1 SHR R1 SHL R1 CMP R2,R1 JZ Y INC R3 Y: SHR R1 JMP X Z: ... CMP sets comparison flags; JZ jumps on equality; MOV copies its second operand into its first; SHR/SHL shift by one bit.
Answer & solution
Answer: R1=0, R3=2 (no official key was published)
The SHR followed by SHL clears the least significant bit. Comparing the result against saved R2 detects whether that bit was 1. If so, increment R3. The SHR at Y then advances to the next bit. With nonnegative logical shifts the trace is:
Entry R1 | R2 after MOV | after SHR,SHL | R3 after test | R1 after Y
5 (101) | 5 | 4 (100) | 1 | 2
2 (010) | 2 | 2 (010) | 1 | 1
1 (001) | 1 | 0 (000) | 2 | 0
At the next X, R1=0 makes JZ Z branch before another iteration. Hence final R1=0 and R3=2. R2 happens to remain 1, though it is not requested. The two right shifts in the body do not skip two input bits because the intervening left shift restores the higher-bit positions.
For the same assembly with initial (R1,R2,R3)=(n,0,0), determine R3 on reaching Z: X: CMP R1,0 JZ Z MOV R2,R1 SHR R1 SHL R1 CMP R2,R1 JZ Y INC R3 Y: SHR R1 JMP X Z: ... CMP sets comparison flags; JZ jumps on equality; MOV copies its second operand into its first; SHR/SHL shift by one bit.
Answer & solution
Answer: R3=popcount(n), the number of 1 bits in n. (no official key was published)
For nonnegative integer n (or an unsigned fixed-width register with logical SHR), write current R1=2k+b, where b∈{0,1}. SHR then SHL yields 2k, so CMP detects inequality exactly when b=1; R3 therefore increases by b. The SHR at Y sets R1=k. After t iterations, R1=floor(n/2t) and R3 equals the number of ones in the t low-order bits removed from n. This invariant holds initially and is preserved by the decomposition 2k+b. Termination occurs when R1=0, after all significant bits have been examined, so R3 is the binary population count of n. For n=0 the initial branch exits immediately and R3=0. For negative signed inputs the outcome requires a specified word width and right-shift convention; arithmetic SHR is not covered by this nonnegative-integer proof.
Design 2048 eight-bit locations at 1000h–17FFh for an 8085, using four 1K×4 chips. Each has active-low /CS, /RD, /WR; address A0–A9; data D0–D3. /CS=1 makes data high impedance. GFG explicitly says eight-bit locations; GateForum loses the 8 in the prose.
Answer & solution
Answer: Two 1K×8 banks: 1000h–13FFh and 1400h–17FFh; decode A15…A11=00010 and select bank by A10. (no official key was published)
A 1K×4 chip has 1024 locations of four bits. Put two chips in parallel to make each 1K×8 bank, then use two banks for 2K×8. Name them L0,H0 and L1,H1. Wire all four address inputs to CPU A0–A9. In each bank L’s chip D0–D3 connect to CPU D0–D3, and H’s chip D0–D3 connect to CPU D4–D7. Both chips in a bank share selection and read/write controls.
1000h = 0001 0000 0000 0000 17FFh = 0001 0111 1111 1111 Thus A15…A11=00010 is fixed; A10 selects one of two banks; A9…A0 address a byte within the bank. Let M=NOT(IO/M), true on memory cycles, and S=M·¬A15·¬A14·¬A13·A12·¬A11. Then /CS0=NOT(S·¬A10), to L0 and H0 /CS1=NOT(S· A10), to L1 and H1. Bank 0 responds to 1000h–13FFh and bank 1 to 1400h–17FFh, with no other addresses selected. Connect CPU /RD and /WR to each chip’s /RD and /WR; memory qualification in /CS suppresses I/O-cycle responses.
8085 AD0–AD7 ──┬── bidirectional data bus D0–D7 ── both banks
└── ALE-controlled latch ── A0–A7 ── all chips
8085 A8,A9 ─────────────────────────────── A8,A9 ── all chips
A15…A10, IO/M ── decoder ── /CS0,/CS1
/RD,/WR ───────────────────────────────────────── all chips
The latch is essential because the 8085 multiplexes low address and data pins. The upper chip in each bank maps its local D0 to CPU D4, not CPU D0. Only one bank is enabled per address; deselected banks stay high impedance and cannot fight the data bus.
Octal 342 is treated as an eight-bit integer on an 8085. What decimal value does it represent? Forum options include 226 and−30.
Your answer
Answer & solution
Answer: 226 unsigned; −30 signed twos complement (no official key was published)
Convert 342₈=3·64+4·8+2=226, whose eight bits are 11100010. The 8085 architecture does not automatically attach one language-level signedness to every stored byte; the use determines interpretation. The source does not explicitly say signed. The paper’s faint/missing minus on its D further complicates the option mapping, so both interpretations are retained rather than asserting a unique official answer.
Which should receive higher interrupt priority: hard disk, printer, keyboard, floppy disk?
Your answer
Answer & solution
Answer: Policy-dependent; A in a conventional overrun-sensitive transfer model (no official key was published)
Interrupt priority normally reflects urgency and the cost of delayed service, not merely a device name. A fast unbuffered hard-disk transfer may lose data if not serviced promptly, motivating A in an older transfer-driven design. A buffered DMA disk may need little immediate CPU attention, while another device could have a stricter deadline. Keyboard responsiveness can matter in interactive systems but does not universally outrank data-loss deadlines. The source gives no controller buffering or timing assumptions, so a hardware-independent unique ordering cannot be proved.
Which addressing mode permits relocation without changing code: indirect, indexed, base-register, PC-relative?
Your answer
Answer & solution
Answer: C for general base relocation; D also supports relative references (no official key was published)
Base-register addressing forms effective address=base+stored displacement. Moving the program requires changing the base register, leaving its instruction displacements unchanged, which explains intended C. PC-relative addressing also preserves references within a uniformly moved block because both target and current PC increase by the same relocation amount; their difference stays fixed. Thus D has relocation capability too, though it is not a general replacement for every external/data reference. The scope of relocation is unstated, so C is the standard general mechanism rather than the only conceivable invariant addressing form.
Choose a true claim: all interrupts need enabling, loops cannot be interrupted, processor checks interrupts before a new instruction, only level-triggered interrupts exist.
Your answer
Answer & solution
Answer: C under the ordinary instruction-boundary model (no official key was published)
An eligible interrupt is normally recognized at an architectural instruction boundary, before starting the next instruction, so C expresses the conventional model. Nonmaskable interrupts refute a blanket requirement that every interrupt first be enabled. A software loop comprises instructions and can be interrupted between them. Both edge- and level-triggered interrupt mechanisms exist. Some complex/restartable instructions have additional interrupt points, but these do not rescue the false universal claims in A, B, D.
Does floppy formatting arrange user data contiguously, write only a directory, erase the system area, or write track/sector identification?
Your answer
Answer & solution
Answer: D (no official key was published)
Low-level formatting establishes the physical organization used to locate sectors, including identification and control information on tracks and sectors. This is D. Writing a file-system directory is a higher-level formatting step, and arranging existing files contiguously is closer to allocation or defragmentation. Erasing only a system area does not establish a usable sector layout. The question uses the older physical-floppy meaning; modern operating-system “format” commands often refer to file-system initialization instead.
The 8086 produces 20-bit physical addresses. Therefore it can address 220 distinct byte locations, which is 1, 048, 576 bytes, conventionally called 1 MB in this historical context. This gives A. Its 16-bit offset does not by itself limit the whole physical address space to 64 KB because segmentation combines a segment value and an offset. Individual segment addressing and total physical reach are different quantities.
Draw an 8085-based system to measure the width of a TTL-compatible pulse. State necessary assumptions.
Answer & solution
Answer: Use a gated hardware timer and read its frozen count. (no official key was published)
One valid design uses an 8253 programmable interval timer rather than relying on uncertain software polling time. Configure counter 0 in binary mode 0, initially load N0=65535, and feed it a known clock f. Connect the measured pulse to GATE0. While GATE0 is high the counter decrements; when it falls, counting stops and the retained value N is read. Width is approximately (N0−N)/f, with one-clock quantization and gate synchronization uncertainty.
8085 AD0–AD7 ↔ shared data bus ↔ 8253 D0–D7
└─ ALE latch → low address bus
latched address, upper address, IO/M → port decoder → /CS
8085 /RD,/WR → 8253 /RD,/WR
latched A0,A1 → timer A0,A1
known oscillator f → CLK0
TTL pulse → GATE0 and a separate readable input-port bit 0
Map counter ports to 80h–82h and control to 83h; map the pulse input latch/buffer to 90h. The input buffer must be enabled only for reads of its port. Supply the usual clock, reset, power and bus support circuitry. Gate and clock levels must meet the timer's electrical/timing specifications; synchronize an asynchronous input if required, accounting for the resulting edge uncertainty.
Require the timer to be armed while the pulse is low. The 8253 count load is not complete merely when the second byte is written: allow a complete CLK rising-and-falling sequence after that write before the measured pulse may rise. After the pulse falls, allow the gate synchronization and counter propagation to settle before latching the result. Use a suitable guard interval or ready handshake based on the chosen timer clock and device timing. Require one isolated pulse, and fewer than 65535 counted clocks. Polling must detect the high interval before its falling edge; a separate edge latch can remove that minimum-width limitation. The hardware gate, not the polling latency, determines the count. No unique numerical width follows without the input waveform and f. Other valid designs include calibrated software loops, but their instruction timing and missed-edge error must be stated.
Write an 8085 assembly program to measure a TTL pulse width, stating hardware and timing assumptions. Use the counter/port design of original Q15(a).
Answer & solution
Answer: HL = number of gated clocks; width ≈ HL/f. (no official key was published)
Use the 8253 design in part (a), with pulse bit 0 readable at port 90h. Control byte 30h selects counter 0, low-byte then high-byte access, mode 0 and binary counting. Load FFFFh. After the falling edge, control byte 00h latches counter 0 without changing its mode; read low byte first.
WAITLOW: IN 90H
ANI 01H
JNZ WAITLOW
MVI A,30H
OUT 83H
MVI A,0FFH
OUT 80H
OUT 80H
WAITHIGH:IN 90H
ANI 01H
JZ WAITHIGH
WAITEND: IN 90H
ANI 01H
JNZ WAITEND
MVI A,00H
OUT 83H
IN 80H
MOV E,A
IN 80H
MOV D,A
MVI A,0FFH
SUB E
MOV L,A
MVI A,0FFH
SBB D
MOV H,A
HLT
DE receives the frozen count N. SUB/SBB perform the 16-bit subtraction FFFFh−DE, leaving the elapsed clock count in HL. The SUB's borrow is retained across MOV and MVI, so SBB correctly handles the high byte. Divide this integer by the known clock frequency to obtain seconds; for f=1 MHz each count represents roughly 1 μs.
This is not an unrestricted pulse-capture instrument: the pulse must start only after both count bytes are written and the subsequent complete CLK rising-and-falling loading sequence has occurred. A source-side guard/ready handshake enforces this requirement; the software does not issue a timer-ready signal. Also allow at least one clock period plus the specified propagation margin after the falling edge before the latch command. Choose the external clock relative to the 8085 clock so the displayed polling/readout path already provides that settling interval, or insert a calibrated delay before OUT 83H. The pulse must last long enough to be seen by WAITHIGH, remain low during readout, and not exhaust the initial counter value. Otherwise missed pulses or wrap/terminal-count behavior invalidate the result. A ready handshake, external trigger latch and overflow indication are appropriate extensions. The answer explicitly uses a timer peripheral, whose gate capture avoids treating variable software latency as measured time.
A cache has l sets, block size b, k blocks per set, cache/main-memory times tc,tm. A loop of size nb executes 100 times, with n=km and 1<m≤l. Find hit ratio and discuss l=1.
Answer & solution
Answer: Under cold, aligned contiguous block-level accesses: 99%; l=1 contradicts 1<m≤l. (no official key was published)
The loop contains n blocks and total cache capacity is kl blocks. Assume contiguous aligned loop blocks, ordinary block-number modulo-l indexing, no competing data/code, an initially empty cache and one counted access per loop block per pass. Since n≤kl, each set receives at most ceil(n/l)≤k loop blocks. Thus no loop block must evict another after the first pass.
The first traversal incurs n compulsory misses. The remaining 99 traversals hit on all n blocks. Out of 100n block references, 99n hit, so H=0.99. Neither tc nor tm affects this count; they would enter effective access-time calculations instead.
If b denotes b separately referenced words/instructions per block, the denominator changes: there are 100nb references, still n misses, giving H=1−1/(100b). If b is bytes while instructions have unspecified lengths, that word-reference formula cannot be asserted numerically. The definition of an access must be explicit.
The separate request l=1 is incompatible with the earlier constraint 1<m≤l. If it means keep m>1 while replacing the cache by one fully associative k-block set, then n=km>k. Under LRU and repeated cyclic scanning, every block-level access misses: by the time a block is revisited, at least k distinct blocks have intervened. H=0 at block granularity, or 1−1/b for b consecutive word references per block. This is conditional on LRU; an unspecified replacement policy can produce a different ratio. If the intended comparison instead keeps the entire loop fitting, its warmed-up behavior remains 99%. The source does not resolve these alternatives.
At which 8085 vector address does RST 7.5 start:0000H, 0075H, 003CH, 0034H?
Your answer
Answer & solution
Answer: C: 003CH (no official key was published)
The 8085 vectored restart spacing is eight bytes. The RST 7.5 interrupt vector corresponds to 7.5·8=60 decimal, which is 3C hexadecimal. Thus the routine begins at 003CH, C. Writing 0075H would confuse the interrupt’s label with a hexadecimal address. The related RST 6.5 vector is 0034H, explaining another distractor.
Match DMA I/O, cache, interrupt I/O, condition-code register with disk, high-speed RAM, printer, ALU.
Your answer
Answer & solution
Answer: B: 2, 1, 3, 4 (no official key was published)
DMA transfers blocks between a device such as a disk and memory without a CPU instruction for every word. Cache uses fast RAM to serve frequently accessed data. A printer is a conventional example of interrupt-driven I/O, while the ALU sets condition flags such as zero, carry or overflow. Thus the mapping is 2, 1, 3, 4, B. Device interfaces may support several transfer methods; these are representative associations rather than exclusive physical capabilities.
An N-bit adder uses 4-bit 74181 ALUs and 4-bit 74182 carry generators, with N divisible by 4. What is best asymptotic addition delay?
Your answer
Answer & solution
Answer: B: proportional to log N (no official key was published)
A four-way carry generator combines propagate/generate information for four lower-level groups. Cascading these in a balanced hierarchy reduces the number of groups by a factor of four per level. Therefore carry information traverses O(log₄ N)=O(log N) levels, followed by constant local sum-generation work. B is the best bounded-fan-in architecture among the choices. A serial chain would take linear time, but is not the best organization; constant delay would require unbounded fan-in or a different physical model.
Execute MVI A, 55H; MVI C, 25H; ADD C; DAA. Find final A among 7AH, 80H, 50H, 22H.
Your answer
Answer & solution
Answer: B: 80H (no official key was published)
Binary addition first gives 55H+25H=7AH. The low nibble A hexadecimal represents 10, which is invalid as one BCD digit. DAA adds 06H to correct that nibble, producing 80H. The resulting high nibble 8 is valid, so no further 60H correction is required. Thus B. Interpreting the initial bytes as packed decimal 55 and 25 confirms the decimal sum 80; stopping before DAA would incorrectly choose 7AH.
A microinstruction selects none or one of three operations of kind 1, and any subset of six operations of kind 2. Minimum bits among 9, 5, 8, none?
Your answer
Answer & solution
Answer: C: 8 (no official key was published)
The first field has four possibilities: no operation or one of three. It requires log 2 4=2 bits. The six independently selectable operations have 26 possible subsets, including none, so they require 6 bits. Together there are 4·64=256 combinations, requiring 8 bits, which the 2+6 field construction achieves. Thus C. Encoding the second field as one of seven choices would incorrectly forbid simultaneous operations.
An 8085 must drive a one-bit output port at I/O address FF hexadecimal through a D flip-flop. The transferred bit is D3, and the output must clear at power-on. Using exactly one ten-input NAND gate, one inverter and one D flip-flop, give the interface circuit. State clock/reset polarities explicitly.
Answer & solution
Answer: D←D3; CLK←NAND(A15,…,A8,IO/M,NOT(/WR)); asynchronous clear from reset; Q is the port output. (no official key was published)
The eight-bit I/O address FFH is all ones. In an 8085 I/O cycle, that address is duplicated on the high address bus A15…A8, so these eight nonmultiplexed lines can be decoded without adding an address latch. Do not use AD7…AD0 directly throughout the write: those pins carry the data during the data phase.
Let /WR denote the active-low write strobe and IO/M=1 denote an I/O cycle. Use the one inverter to form W=NOT(/WR). The ten-input NAND receives A15,A14,…,A8,IO/M,W. Its output is CLK = NOT(A15·A14·…·A8·IO/M·W).
A complete connection list is: 8085 D3 → D input of the flip-flop. A15…A8, IO/M, NOT(/WR) → the ten NAND inputs. NAND output → positive-edge-triggered CLK. RESET OUT → active-high asynchronous CLEAR. Q → the one-bit output. Any asynchronous preset input is tied inactive.
For FFH on an I/O write, CLK goes low while /WR is asserted and rises when that write ends. The positive edge captures D3 while the data is valid. For another port, a memory cycle, or a nonwrite cycle, at least one NAND input is zero and the clock remains high. Asynchronous clearing makes Q=0 during the power-on reset independently of clock activity.
The flip-flop's clear polarity matters. The above netlist chooses an active-high CLEAR so the 8085's active-high RESET OUT connects directly. With an active-low /CLR device instead, connect the same active-low power-on /RESET IN net that resets the CPU to /CLR. Do not connect RESET OUT directly to /CLR and do not silently use a second inverter. The edge and reset assumptions are explicit because the question does not specify a particular flip-flop part. This is an ideal bus-timing design, assuming normal setup/hold timing and no wait-state or reset anomaly.
An 8085 must drive a one-bit output port at I/O address FF hexadecimal through a D flip-flop. The transferred bit is D3, and the output must clear at power-on. Write an 8085 program producing equal ON and OFF intervals of seven bus/machine cycles each.
Answer & solution
Answer: MVI A,00H; LOOP: CMA; OUT FFH; JMP LOOP. Each steady-state half-period is 1+3+3=7 machine cycles. (no official key was published)
Only accumulator bit 3 affects this one-bit port. Complementing the entire accumulator is therefore enough to toggle the output: bit 3 alternates between 0 and 1. One program is
MVI A,00H
LOOP: CMA
OUT FFH
JMP LOOP
CMA takes one machine cycle, OUT takes three, and an unconditional JMP takes three. Between the end of one OUT and the end of the next OUT, the processor executes JMP, CMA and OUT. The total is 3+1+3=7 machine cycles. The same instruction path is used whether D3 is changing from 0 to 1 or from 1 to 0, so both steady-state half-periods are equal. At the FFH output port, values FFH and 00H alternate, but only their D3 bits are stored.
The initialization MVI is outside the loop and does not contribute to repeated periods. Power-on clearing ensures the initial output is low; the interval from reset release to the very first transition need not equal a later half-period. Interrupts and inserted wait states must be absent if exact timing is required.
Here “bus cycles” is interpreted as the 8085 machine-cycle count, not seven clock T-states. The instructions take 4+10+10=24 T-states in a normal execution, so a complete square-wave period is 14 machine cycles, or 48 T-states. Counting instruction bytes or taking “7” as seven T-states would give the wrong timing model.
A floating-point value is n=(f,e)=f·2^e. The fractional mantissa f has 6 bits including its sign bit, in sign-magnitude form. The exponent e has 4 bits including its sign bit, also sign-magnitude. A=54.75 and B=9.75 in decimal. No rounding mode, guard-bit convention, or normalization rule is explicitly supplied; use the conventional normalized fraction 1/2≤|f|<1 and state the rounding assumption. Represent A and B in this format.
Answer & solution
Answer: With normalized mantissas and chopping: A→(0 11011,0 110)=54; B→(0 10011,0 100)=9.5. Neither original value is exactly representable. (no official key was published)
The six mantissa bits include the sign, leaving only five fraction-magnitude bits. The four exponent bits similarly leave three bits for its magnitude, so exponents range from −7 to +7, not the biased range of IEEE formats. Use a sign bit of 0 for each positive field.
Convert the values exactly first: 54.75=110110.11₂=.11011011₂×26, 9.75=1001.11₂=.100111₂×24. Both normalized binary fractions need more than five magnitude bits. Therefore there is no exact six-bit-mantissa representation of either input under this normalization. A finite encoding requires a rounding rule; merely truncating without saying so would hide a loss of information.
Under chopping toward zero, retain the first five fraction bits: A: mantissa 0|11011, exponent 0|110; value .11011₂×64=54. B: mantissa 0|10011, exponent 0|100; value .10011₂×16=9.5. The vertical bar separates the sign from magnitude. No hidden leading bit is added; all five fraction bits are explicitly stored. The exponent fields are the sign-magnitude representations of +6 and +4.
For comparison, round-to-nearest with ties-to-even gives A=54 again but B=10, encoded as mantissa 0|10100 with exponent 0|100. B=9.75 lies exactly halfway between 9.5 and 10; the retained significand integer for 10 is even. Other tie rules may choose differently. This alternative is not an official correction: it demonstrates why the source's missing rounding policy matters. The subsequent worked addition and 3.9% error use the explicitly stated chopping model throughout.
A floating-point value is n=(f,e)=f·2^e. The fractional mantissa f has 6 bits including its sign bit, in sign-magnitude form. The exponent e has 4 bits including its sign bit, also sign-magnitude. A=54.75 and B=9.75 in decimal. No rounding mode, guard-bit convention, or normalization rule is explicitly supplied; use the conventional normalized fraction 1/2≤|f|<1 and state the rounding assumption. Show the floating-point addition of A and B.
Answer & solution
Answer: With five-bit mantissa chopping: result (0 11111,0 110)=62. Under round-to-nearest/ties-to-even throughout, result=64 instead. (no official key was published)
Use the chopping encodings A≈.11011₂×26=54 and B≈.10011₂×24=9.5. To add, align both to the larger exponent +6. Shifting B's fraction right by two places gives .0010011₂×26. With only five fraction positions and chopping on alignment, this becomes .00100₂×26=8.
The stored-width addition is
.11011 × 2^6
+ .00100 × 2^6
= .11111 × 2^6.
The mantissa is already normalized, lying between 1/2 and 1, and has five fraction bits. There is no carry that requires an exponent increment. Store mantissa 0|11111 and exponent 0|110, representing (31/32)×64=62. Both fields are within range.
Keeping guard bits changes the intermediate arithmetic but not this particular chopped final answer. With full aligned precision, the represented inputs sum to .1111111₂×26=63.5. Chopping that result to five fraction bits again yields .11111₂×26=62. Thus a final value of 62 does not establish whether guard bits were used; both stated chopping paths happen to agree here.
Under a different policy, round-to-nearest with ties-to-even encodes the inputs as 54 and 10. Their exact sum is 64=.10000₂×27, already representable, so the stored result is mantissa 0|10000, exponent 0|111. The true decimal-input sum is 64.5, which also rounds to 64 at this precision. The source does not choose between these policies. This solution therefore reports 62 only under chopping, with 64 as a clearly separate rounded alternative; it does not present an unspecified hardware behavior as an official answer.
A floating-point value is n=(f,e)=f·2^e. The fractional mantissa f has 6 bits including its sign bit, in sign-magnitude form. The exponent e has 4 bits including its sign bit, also sign-magnitude. A=54.75 and B=9.75 in decimal. No rounding mode, guard-bit convention, or normalization rule is explicitly supplied; use the conventional normalized fraction 1/2≤|f|<1 and state the rounding assumption. Find the percentage error in the addition, to one decimal place.
Answer & solution
Answer: 3.9% relative to the exact sum under chopping (computed 62 versus exact 64.5); 0.8% under the separately stated nearest-rounding model. (no official key was published)
The exact mathematical sum of the original decimal inputs is A+B=54.75+9.75=64.5. With normalized five-bit fraction magnitudes and chopping as in the worked addition, the computed result is 62. The absolute error is |62−64.5|=2.5. Percentage relative error uses the exact value as denominator:
Rounded to one decimal place, the error is 3.9%. If a signed percentage error were desired, it would be −3.9%, indicating underestimation; the usual unqualified percentage error is its nonnegative magnitude.
Do not divide by the computed 62, and do not use 63.5 as the reference merely because that is the exact sum of the already chopped input representations 54 and 9.5. The task concerns addition of the original A and B; input-representation error is part of the total discrepancy from 64.5. Relative to 63.5 alone the arithmetic-stage error would be a different quantity, 100×1.5/63.5≈2.4%.
The source's missing rounding policy persists into this part. Under round-to-nearest/ties-to-even the computed sum is 64, making the corresponding total percentage error 100×0.5/64.5≈0.77519%, or 0.8%. Accordingly 3.9% is a conditional derived answer under the declared chopping convention, not a uniquely verified official value.
Relative addressing is most relevant to writing which application: (A) coroutines, (B) position-independent code, (C) shareable code, or (D) interrupt handlers?
Your answer
Answer & solution
Answer: B: position-independent code (no official key was published)
A PC-relative instruction stores an offset rather than an absolute target address. Its effective target is PC plus that offset. If both instruction and target move by the same relocation amount, the difference between them is unchanged, so the stored offset still works. Absolute addressing instead embeds a location that generally needs relocation. This is why relative addressing is associated with position-independent control transfers, subject to the architecture’s offset range and exact PC convention.
A ROM directly implements multiplication of two unsigned 8-bit inputs. What organization is required?
Your answer
Answer & solution
Answer: D: 64K words ×16 bits (no official key was published)
The two input bytes together provide 16 address bits, so every possible operand pair requires one of 216=65,536 entries. The largest product is 255²=65,025, which needs 16 bits; therefore every stored result is a 16-bit word. The organization is 64K×16. A ROM with only 256 entries would distinguish just one operand, not all pairs, and an 8-bit output would lose the high byte of many products.
How many machine cycles does an ordinary 8085 RET instruction require?
Your answer
Answer & solution
Answer: C: 3 (no official key was published)
RET first fetches its opcode. It then reads the two bytes of the saved return address from the stack, requiring two memory-read machine cycles. Those bytes restore the program counter and the stack pointer advances by two. Thus the total is one opcode-fetch cycle plus two memory-read cycles, or three. Machine cycles are not individual clock T-states, so counting clock periods instead would confuse two different timing measures.
Which multiplier pattern gives frequent operations in Booth multiplication, including an alternating 1010… pattern?
Your answer
Answer & solution
Answer: A: alternating bits (no official key was published)
Booth recoding examines adjacent multiplier bits, with an appended low-order zero. Equal pairs 00 and 11 require no add/subtract; transitions 01 and 10 trigger addition or subtraction. An alternating pattern therefore triggers operations at almost every position. A long run of ones is cheaper because only its boundaries trigger work. Thus the alternating candidate A is worst among the listed patterns under the ordinary radix-2 Booth operation count, even though the number of shift steps remains fixed by word width.
Does a daisy chain provide uniform priorities, nonuniform priorities, only support slow devices, or require a separate processor interrupt pin for every device?
Your answer
Answer & solution
Answer: A: nonuniform priority (no official key was published)
An interrupt acknowledgment or grant propagates down the chain. The first requesting device encountered captures it and prevents later devices from using that grant. Priority therefore depends on physical position in the chain, so devices have nonuniform priority. This scheme is attractive partly because it can share processor interrupt infrastructure; it does not require one processor pin for every device. Nothing in the chaining principle restricts it exclusively to slow devices.
An 8-bit two’s-complement exponent and 24-bit sign-magnitude mantissa are shown. Choices for magnitude include 0.5 through 1−2^−23. What range is justified?
Your answer
Answer & solution
Answer: D for the normalized fractional mantissa; not the full floating value (no official key was published)
With one sign bit and 23 fraction bits, conventional fractional normalization puts a 1 in the first fraction position. The smallest magnitude of the mantissa is therefore 0.100…₂=1/2; the largest is 0.111…₂=1−2−23. This gives choice D for the mantissa. The literal wording asks about normalized numbers, however. Including the signed exponent e∈[−128,127] gives magnitudes from 2−129 to (1−2−23)2127, assuming all exponent patterns are available. No listed short interval describes that full range. The binary-point and reserved-exponent conventions are also not stated explicitly.
A microprogram unit has 25 control signals, at most two active in a word. Find the minimum bits; listed choices are 2,25,10,12.
Your answer
Answer & solution
Answer: 9 unrestricted; C:10 only under a two-selector-field architecture (no official key was published)
The legal output patterns are no active signal, one of 25 single signals, or one of C(25,2)=300 pairs: 326 patterns altogether. An unrestricted binary code therefore needs ceil(log₂326)=9 bits, since 256<326≤512. A decoder can map 326 of the 512 codes to these patterns, proving sufficiency. The listed 10-bit choice instead uses two independent five-bit selectors, each able to select one of 25 signals or a no-op. That practical architecture is sufficient but not information-theoretically minimal. No such field restriction is stated, so the missing 9-bit option is an explicit question/model discrepancy.
For an 8085-style system with output port 00H, analyze the program ORG 0100H; MVI A,00H; LXI H,0105H; OUT 00H; INR A; PCHL; HLT. What does it do to the port? GFG includes OUT and INR but calls the CPU 8052; GateForum calls it 8085 but omits OUT and INR.
Answer & solution
Answer: Outputs 00H, 01H, …, FFH repeatedly (no official key was published)
Interpret the instructions as 8085 instructions: PCHL copies HL into the program counter. The byte addresses are 0100–0101 for MVI A,00H and 0102–0104 for LXI H,0105H. Therefore the next instruction, OUT 00H, starts at 0105H. OUT occupies two bytes, INR A one, PCHL one, so the loop is OUT at 0105H, INR at 0107H, PCHL at 0108H. HLT at 0109H is never reached.
Initialization sets A=0 and HL=0105H once. Each iteration writes A to the port, increments A modulo 256, then jumps back to OUT. Consequently the port receives 0,1,2,…,255,0,…, an indefinitely repeating eight-bit count. An external DAC would turn this into a staircase ramp, but a DAC is not part of the stated hardware.
The two reproductions cannot be treated as one literal program. Thus the port remains at its previous value, which is unspecified.
For the output-port program ORG 0100H; MVI A,00H; LXI H,0105H; OUT 00H; INR A; PCHL; HLT., show the three least significant output-bit waveforms. Account for the differing GateForum program without OUT and INR.
Answer & solution
Answer: D0=01010101…, D1=00110011…, D2=00001111… (no official key was published)
Sample immediately after successive OUT instructions. The low-three-bit output words are 000,001,010,011,100,101,110,111,000,… . Reading each column gives D0: 0 1 0 1 0 1 0 1; D1: 0 0 1 1 0 0 1 1; D2: 0 0 0 0 1 1 1 1. These eight samples repeat. Between output writes the port latch holds its previous value, so each column is a rectangular waveform, not a series of impulses.
If Δ is the interval between writes, D0 has period 2Δ, D1 period 4Δ and D2 period 8Δ, all with 50% steady-state duty cycle. In normal 8085 timing OUT takes 10 T-states, INR A takes 4 and PCHL takes 6, so Δ=20 T-states without interrupts or wait states. Their periods are therefore 40,80,160 T-states. If only qualitative waveforms are required, the relative periods suffice.
Initialization precedes the first write, so the output before that write is not specified. This result belongs to the instruction stream interpreted as 8085.
A 50 MHz processor uses DMA for a disk transferring 2000 Kbytes/s continuously. The average DMA block is 4 Kbytes. Each transfer needs 1000 processor cycles for setup and 500 processor cycles for its completion interrupt. What fraction of CPU time is consumed by disk handling?
Answer & solution
Answer: 0.015 of processor time, i.e. 1.5%. (no official key was published)
First count transfers rather than bytes: 2000 Kbytes/s divided by 4 Kbytes/transfer is 500 transfers/s. The same meaning of K occurs in both quantities and cancels, so decimal versus binary K does not change this rate.
The processor performs 1000+500=1500 cycles of administrative work for every transfer. At 500 transfers/s this costs 750,000 CPU cycles/s. A 50 MHz processor supplies 50,000,000 cycles/s, so the fraction used is 750,000/50,000,000=0.015, or 1.5 percent.
An equivalent time calculation checks the units. Each processor cycle lasts 1/(50×106) s=20 ns. Setup takes 20 microseconds and the completion handler takes 10 microseconds, totaling 30 microseconds per transfer. Transferring 4K bytes at 2000K bytes/s takes 0.002 s=2 milliseconds; 30 microseconds/2 milliseconds again equals 0.015. The transfer uses DMA, so the CPU is not charged for executing an instruction per byte. The calculation counts only the specified setup and completion overhead; additional bus-contention stalls, queuing effects, or other driver costs are not given and should not be invented. The statement that the disk transfers continuously fixes the block rate at its full throughput.
A three-level hierarchy has level-1 access time 50 ns/byte and options 8KB (hit .80), 16KB (.90), 64KB (.95); level-2 access time 200 ns/byte and options 4MB (hit .98), 16MB (.99), 64MB (.995); level 3 has access time 5 microseconds/byte, size 250MB, hit 1.0. Use the GFG table; GateForum has inconsistent duplicated tables, KB/MB units and 250/260MB labels. The question does not explicitly state whether lower-level access times include earlier failed probes. Choose minimum level-1 and level-2 sizes giving average access time strictly below 100 ns.
Answer & solution
Answer: Complete-service-time model: 8KB L1 and 4MB L2 (99.2 ns). Sequential probing gives different feasible minima; see solution. (no official key was published)
If the tabulated times are complete service times for a hit at the corresponding level, and h2 is conditional on missing level 1, then T=h1·50+(1−h1)h2·200+(1−h1)(1−h2)·5000. Try the smallest options first: h1=.80 and h2=.98. Their mutually exclusive outcome probabilities are .80, .196, and .004, summing to one. Hence T=40+39.2+20=99.2 ns, strictly below 100. Since 8KB and 4MB are individually the smallest listed sizes, this pair is componentwise minimal in that model.
A different standard convention treats 50,200,5000 as incremental sequential probe times. Then every access pays 50, every L1 miss pays another 200, and a miss in both pays another 5000: Tseq=50+(1−h1)[200+(1−h2)5000]. The same 8KB/4MB pair gives 110 ns and fails. At 8KB, increasing L2 to 16MB gives exactly 100 ns, still failing the strict inequality; 64MB gives 95 ns. At 16KB, the smallest L2=4MB already gives 80 ns. Thus the nondominated feasible pairs in the sequential model are (8KB,64MB) and (16KB,4MB); neither is smaller in both coordinates. Minimizing total installed bytes selects (16KB,4MB), whereas minimizing L1 first selects (8KB,64MB).
Therefore the familiar 8KB/4MB answer requires the complete-service-time interpretation. Without specifying the timing convention, the literal question has no single model-independent answer. The lower-level hit ratio is also taken as conditional, not as an additional unconditional probability.
A three-level hierarchy has level-1 access time 50 ns/byte and options 8KB (hit .80), 16KB (.90), 64KB (.95); level-2 access time 200 ns/byte and options 4MB (hit .98), 16MB (.99), 64MB (.995); level 3 has access time 5 microseconds/byte, size 250MB, hit 1.0. Use the GFG table; GateForum has inconsistent duplicated tables, KB/MB units and 250/260MB labels. The question does not explicitly state whether lower-level access times include earlier failed probes. Calculate the average time for the sizes selected to satisfy the strict 100 ns bound.
Answer & solution
Answer: 99.2 ns in the complete-service-time model; sequential alternatives are 80 ns for 16KB/4MB or 95 ns for 8KB/64MB. (no official key was published)
For the complete-service-time interpretation, select the smallest listed capacities, L1=8KB and L2=4MB. An access hits L1 with probability .80 and takes 50 ns. It misses L1 and hits L2 with probability .20×.98=.196 and takes 200 ns. It misses both with probability .20×.02=.004 and takes 5000 ns. The mean is therefore .80×50+.196×200+.004×5000=40+39.2+20=99.2 ns per byte. This is 0.8 ns below the required bound. Notice that even the rare .4 percent accesses to level 3 contribute 20 ns to the mean.
This calculation uses exclusive end-to-end outcomes. If the table instead lists incremental sequential access times, earlier failed probes must also be charged: 50+.20×200+.004×5000=110 ns for these same capacities, so they would not be a valid choice. In that model, the (16KB,4MB) pair gives 50+.10×200+(.10×.02)×5000=80 ns. The alternative nondominated (8KB,64MB) pair gives 50+.20×200+(.20×.005)×5000=95 ns. The (8KB,16MB) pair gives exactly 100 ns, which is excluded by “less than”.
Thus report 99.2 ns together with its timing assumption, rather than presenting it as a verified official value.
Which 8085 instruction clears the accumulator’s lower four bits while retaining the upper four: XRI 0FH, ANI F0H, XRI F0H, or ANI 0FH?
Your answer
Answer & solution
Answer: B: ANI F0H (no official key was published)
F0H is binary 11110000. AND with its four high ones preserves the corresponding accumulator bits; AND with its four low zeros clears those bits. Thus ANI F0H performs the required masking. XOR would toggle selected bits instead of necessarily clearing them. ANI 0FH does the opposite mask, preserving the low nibble and clearing the high nibble. The operation is independent of the accumulator’s initial value.
Choose the true statement: ROM is read/write; PC points to the last executed instruction; stack is LIFO; all instructions affect flags.
Your answer
Answer & solution
Answer: C (no official key was published)
A stack removes the most recently pushed item first, which is last-in-first-out. Ordinary ROM is not general read/write memory. A program counter conventionally identifies the next instruction to fetch or the current fetch position, not a record of the last completed instruction. Instructions such as data moves can leave flags unchanged, so not every instruction affects them. Therefore only the stack statement C is a reliable general description among these alternatives.
In a vectored interrupt, is the branch address fixed, supplied via an interrupt vector by the source, obtained from a processor register, or none?
Your answer
Answer & solution
Answer: B (no official key was published)
A vectored interrupt provides an identifying vector that selects the appropriate service routine, avoiding software polling of all sources. In the model described by B, the interrupting device or controller supplies this vector and the CPU uses it to obtain the branch target. Some architectures instead assign fixed vectors internally, such as fixed-priority vectored inputs, so source-supplied information is not a universal definition. A fixed-vector interpretation can also fit A. Thus B is the intended external-vector model, with that architectural assumption made explicit.
Which mechanism is directly justified by locality: interrupts, DMA, polling, or cache memory?
Your answer
Answer & solution
Answer: D (no official key was published)
Temporal locality means a recently accessed item is likely to be accessed again. Spatial locality means nearby addresses are likely to be accessed soon. A cache retains recent blocks in fast storage, exploiting both kinds of locality to avoid slower memory accesses. Interrupts and polling concern detecting events; DMA concerns moving data without the CPU handling every transfer. None depends on locality in the same direct way, so cache memory is the relevant mechanism.
Which two 8085 instructions double DE and leave the result in HL: XCHG/DAD B, XTHL/DAD H, PCHL/DAD D, or XCHG/DAD H?
Your answer
Answer & solution
Answer: D: XCHG; DAD H (no official key was published)
XCHG exchanges the DE and HL register pairs, so HL receives the original DE. DAD H then adds HL to itself and stores the 16-bit result in HL. Thus the pair produces twice the original DE, modulo 216, with carry recording overflow. DAD B would add BC rather than double HL; XTHL exchanges with stack memory; PCHL changes control flow. These different effects rule out the other sequences.
A memory stores 4K words of 16 bits each. How many separate address and data lines are needed?
Your answer
Answer & solution
Answer: C: 12 address,16 data (no official key was published)
With K=1024, 4K=4096=212 distinct words, so selecting one requires 12 address bits. Each selected word contains 16 bits, transferred over 16 parallel data lines in the stated separate-bus model. Multiplying words by bits gives total capacity, but not the address-line count: addresses select words, not individual bits here. The answer assumes no address multiplexing or serial data interface, consistent with the requested separate lines.
A 4K-word cache is four-way set associative with 64 words per block. Find SET and WORD field widths.
Your answer
Answer & solution
Answer: D: 4 set bits,6 word bits (no official key was published)
Step through it (5 steps)
The cache contains 4096/64=64 blocks. Grouping four blocks per set gives 64/4=16 sets, requiring log₂16=4 set-index bits. A block contains 64 words, requiring log₂64=6 word-offset bits. Associativity changes the number of sets, not the within-block offset. No tag width can be computed without the total main-memory address width, but it is not requested. These counts use word addresses, as specified, rather than adding an unstated byte offset.
A and B are unsigned bytes with A=5CH and B=92H; W,X,Y are unsigned bytes and Z is a two-byte unsigned integer. Execute X:=A+B; Y:=abs(A−B); W:=A−B; Z:=A*B. Give the stored values and error conditions. GFG supplies this Y statement; GateForum prints malformed abs(bA-b).
Answer & solution
Answer: With widened intermediates: X=EEH, Y=36H, Z=3478H; W underflows (CAH if wrapping). (no official key was published)
Convert the hexadecimal operands first: A=92 and B=146. Their sum is 238=EEH, within the unsigned-byte range 0 through 255. Their mathematical difference is −54, so its absolute value is 54=36H. The product is 13432=3478H, within the unsigned 16-bit range. Thus X and Z fit their declared destinations and Y fits if abs receives the mathematical signed difference.
W cannot represent −54. A checked implementation reports a range/underflow error; an explicitly wrapping 8-bit implementation stores −54 modulo 256=202=CAH. These are distinct execution models, not two simultaneous outcomes. If execution traps at W, the subsequent assignment to Z is not reached.
There is also an intermediate-arithmetic ambiguity: if A−B is evaluated as an unsigned 8-bit operation before abs, it becomes CAH=202 and abs leaves it unchanged, giving Y=CAH instead of 36H. Similarly Z requires multiplication in a sufficiently wide type, not truncation to a byte before assignment. The pseudocode does not specify these rules or byte order. Report Z as the word 3478H, with bytes 34H and 78H in unspecified order.
A disk has 8 surfaces, outer diameter 12cm, inner diameter 4cm, track spacing 0.1mm, 20 sectors per track, and 96 bytes formatting overhead per 4000-byte data sector. Find unformatted capacity.
Answer & solution
Answer: 262,144,000 bytes under the standard 400-tracks-per-surface model. (no official key was published)
Tracks occupy an annulus, so use the radial width, not the difference of diameters. The usable width is (12−4)/2=4cm=40mm. At a track pitch of 0.1mm, the standard capacity model gives 40/0.1=400 tracks per surface. Eight surfaces therefore have 3200 tracks, and with 20 sectors per track there are 64,000 sectors.
Each physical sector accounts for 4000 payload bytes plus 96 overhead bytes, or 4096 unformatted bytes. Multiplying gives 64,000×4096=262,144,000 bytes. This equals 250 MiB or 262.144 decimal MB. The formatted payload capacity is instead 64,000×4000=256,000,000 bytes, a useful cross-check; the difference 6,144,000 is exactly 96×64,000.
This conventional calculation treats the annular width as 400 track pitches. Counting both boundary centerlines as tracks would require a different geometrical endpoint convention not supplied by the question. It also assumes all surfaces are usable and every track has the stated 20 sectors.
For the disk in 14(a), each track has 20 sectors of 4000 payload bytes plus 96 overhead bytes each. Find bytes transferred per second between disk and memory at 3600 rpm (GFG), or 360 rpm (GateForum).
Answer & solution
Answer: 4,800,000 payload bytes/s at 3600 rpm; 480,000 bytes/s at 360 rpm. (no official key was published)
Effective transfer rate counts payload delivered to memory, not sector formatting bytes. A complete revolution passes 20×4000=80,000 payload bytes under the active head. At 3600 revolutions per minute, the rotational rate is 3600/60=60 revolutions per second. Thus the sustained payload rate is 80,000×60=4,800,000 bytes/s, or 4.8 decimal MB/s.
Under that literal variant the rotation rate is 6 revolutions per second and the answer is 80,000×6=480,000 bytes/s. This factor-of-ten source discrepancy must not be hidden by treating the two reproductions as identical.
The model assumes a continuous transfer from one active surface, ignores seek and rotational-start latency, and treats formatting overhead as space already occupying part of each revolution. Do not multiply the rate by eight surfaces unless simultaneous transfer from eight heads is explicitly specified. The corresponding raw byte rates including formatting would be 4,915,200 and 491,520 bytes/s, but those are not the requested effective payload rates.
MVI B,0AH; MVI A,05H; LXI H,1C40H; CALL SUB; HLT; SUB: CMP M; RZ; INX H; DCR B; JNZ SUB; RET. What does this program do?
Answer & solution
Answer: Searches up to ten bytes at 1C40H–1C49H for the first 05H. (no official key was published)
B starts at decimal 10, A contains the search value 05H, and HL points to 1C40H. In 8085 notation M refers to the memory byte addressed by HL. CMP M computes flags as if subtracting that byte from A, without modifying A. If the byte equals 05H, the zero flag is set and RZ returns immediately to the caller.
On a mismatch, INX H advances the address, DCR B reduces the remaining count, and JNZ repeats while the count remains nonzero. Importantly, that JNZ tests the flags from DCR B, not the earlier comparison. After ten mismatches, B becomes zero and RET returns normally. HLT then stops the main program.
Thus the routine performs a bounded linear search, examining addresses 1C40H through 1C49H and stopping on the first match. On success HL addresses that match and B is the number of positions remaining including the matched position. On failure HL points one byte beyond the searched interval and B=0. A stays 05H throughout.
MVI B,0AH; MVI A,05H; LXI H,1C40H; CALL SUB; HLT; SUB: CMP M; RZ; INX H; DCR B; JNZ SUB; RET. What are the initial contents of A and B for the search?
Answer & solution
Answer: A=05H and B=0AH (decimal 5 and 10). (no official key was published)
MVI means “move immediate”: it loads the byte written in the instruction directly into the named register. MVI B,0AH sets B to hexadecimal 0A, which is decimal 10. MVI A,05H then sets the accumulator to hexadecimal 05, which is decimal 5. These are the initialized values just before CALL SUB, not claims about unspecified power-on register contents.
LXI H,1C40H loads the separate HL pair and does not change either A or B. CALL changes control flow and the stack, not these initialized register values. During the routine A remains the search key 05H because CMP only changes flags. B is the loop counter and can subsequently decrease. The source asks for the initial values, so a final B value derived from an assumed memory image would answer a different question.
MVI B,0AH; MVI A,05H; LXI H,1C40H; CALL SUB; HLT; SUB: CMP M; RZ; INX H; DCR B; JNZ SUB; RET. Find HL after execution; no memory contents are supplied.
Answer & solution
Answer: HL=1C40H+k for first match offset k∈{0,…,9}; if absent, HL=1C4AH. (no official key was published)
Let k be the offset of the first byte equal to 05H among the ten searched locations. For every preceding mismatch the program increments HL exactly once. It therefore reaches the matching address 1C40H+k after k increments. CMP sets zero and RZ returns before INX H, leaving HL pointing directly at the match. In particular, an immediate match leaves HL=1C40H; a match in the last tested byte leaves HL=1C49H.
If all ten comparisons fail, every iteration executes INX H, including the last one. Starting at 1C40H, ten increments give 1C4AH. DCR B then makes B=0 and the routine returns without testing that next address.
No single unconditional final address can be inferred because the source gives no values for memory 1C40H–1C49H. The no-match value 1C4AH is a conditional answer, not an established fact. This distinction also avoids the common off-by-one error of returning 1C49H after ten failures.
A CRT has 80×25 character cells, each 9×12 pixels. Find video-buffer RAM for monochrome graphics at one bit per pixel.
Answer & solution
Answer: 27,000 bytes (216,000 bits), about 26.367 KiB. (no official key was published)
Convert the character grid into pixel dimensions first. There are 80×9=720 horizontal pixels and 25×12=300 vertical pixels. The bitmap therefore contains 720×300=216,000 pixels. At one bit per pixel it requires 216,000 bits, which is 216,000/8=27,000 bytes.
The same result follows by counting 80×25=2000 cells, each covering 9×12=108 pixels: 2000×108=216,000. This cross-check shows that the cell dimensions are not merely font metadata; they determine the graphics resolution. The result is 27 decimal kB or 27,000/1024≈26.367 KiB.
This is a tightly packed one-bit framebuffer. A 720-pixel row occupies exactly 90 bytes, so no padding is needed to reach a whole-byte row boundary. A device might allocate a larger power-of-two RAM bank or impose extra row alignment, but neither is specified. Text-mode character/attribute storage is not the requested buffer: the problem explicitly asks for monochrome graphics mode.
Give the representable integer range of an n-bit two’s-complement word, including the sign bit.
Answer & solution
Answer: −2^(n−1) ≤ N ≤ 2^(n−1)−1 (no official key was published)
The most significant bit has weight −2n−1; the remaining bits have positive weights 1,2,…,2n−2. The smallest value sets only the sign bit, giving −2n−1. The largest clears it and sets all remaining bits, whose sum is 2n−1−1. Thus the range has one more negative value than positive value. Zero uses one of the 2n codes, and there is no separate negative-zero representation.
True or false: multiplexing address/data lines in the 8085 reduces instruction execution time.
Answer & solution
Answer: False (no official key was published)
The same AD0–AD7 pins carry low address bits during the address phase and data during later transfer phases. This saves package pins and wiring, not instruction time. An external latch controlled by ALE preserves the address while the pins are reused for data. Sharing lines can require additional timing constraints rather than making access intrinsically faster. Therefore the asserted speed benefit is false; the principal design tradeoff is interface cost and pin count.
True or false: expanding-opcode instruction formats are commonly employed in RISC machines.
Answer & solution
Answer: False in the conventional RISC/CISC distinction (no official key was published)
An expanding opcode reuses bits otherwise needed for operands to distinguish more operations in formats with fewer operands. This increases encoding flexibility but complicates decoding and produces less uniform formats. Conventional RISC emphasizes regular, often fixed-length instructions and straightforward decoding, so expanding opcodes are associated more with complex instruction-format designs. The statement is a textbook architectural tendency, not a prohibition: real instruction sets may mix features, and “RISC” is not a formal theorem excluding every variable-format encoding.
Write 8085 assembly to add two unsigned 16-bit packed 8-4-2-1 BCD operands in register pairs BC and DE. Place the result in BC; the higher register contains the higher-order decimal digits.
Answer & solution
Answer: Use ADD/DAA for the low byte and ADC/DAA for the high byte; final CY is decimal overflow. (no official key was published)
1. Each packed byte holds two decimal digits. First add C and E in A; DAA adjusts the binary sum into valid packed BCD and supplies the carry into the next two digits.
2. MOV C,A saves the low result without changing flags. MOV A,B also preserves the carry, allowing ADC D to add high bytes plus the low-byte decimal carry.
3. A second DAA adjusts the upper digits. MOV B,A preserves the final carry flag. BC now contains the lowest four decimal digits.
4. A sum above 9999 cannot fit in BC. The fifth digit is final CY (0 or 1); the question supplies no separate overflow destination. This limitation must not be concealed.
Code
MOV A,C ADD E DAA MOV C,A MOV A,B ADC D DAA MOV B,A
A ROM multiplies two unsigned 4-bit inputs. Give M words and N bits per word.
Answer & solution
Answer: M=256,N=8 (no official key was published)
The two operands provide eight address bits together, so the truth table has 2⁸=256 possible input pairs, requiring 256 words. The largest product is 15·15=225, which fits in eight bits but not seven. Therefore each output word needs eight bits. This direct truth-table ROM organization is 256×8; it is not a 16-entry table because both operands independently select the result.
A one-head disk has 200 tracks,2400 rpm and 62,500 bits per track. Find average rotational latency P in ms and transfer rate Q in bits/s.
Answer & solution
Answer: P=12.5 ms,Q=2,500,000 bits/s (no official key was published)
2400 revolutions per minute is 40 revolutions per second, so one revolution takes 25 ms. A uniformly random angular arrival waits half a revolution on average, or 12.5 ms. Reading one full track per revolution transfers 62,500·40=2,500,000 bits/s. The 200-track count affects total capacity, not the instantaneous per-head track rate or rotational delay. Seek time, controller overhead and inter-track gaps are not included in these idealized quantities.
Interrupts arrive every 1 ms. The diagram shows 10 μs response delay while main code still runs, then 10 μs save,80 μs service,10 μs restore. What fraction remains for main execution?
Answer & solution
Answer: 90% (no official key was published)
Only saving, servicing and restoring displace main-program execution: 10+80+10=100 μs per interrupt. Each arrival period is 1000 μs, leaving 900 μs for the main program, or 90%. The initial 10 μs response delay is drawn while main execution continues, so it must not be subtracted again. Doing so would give 89% and double-count time not actually lost. This assumes the depicted nonoverlapping periodic service and no extra overhead beyond the labeled intervals.
The CPU instruction occupies one memory word with fields OP CODE, MODE, RegR. Mode 2 uses the address in RegR to fetch the operand, then increments RegR by one. The instruction is at word address 2000 and RegR selects PC. Find the operand address.
Answer & solution
Answer: 2001, under conventional instruction-fetch PC advancement. (no official key was published)
Use the conventional fetch sequence for a word-addressed CPU. Before instruction fetch PC=2000. Fetching the one-word instruction into the instruction register advances PC to 2001. Decoding then selects PC as the mode-2 address register. The effective operand address is the value of PC at that point, namely 2001, so the operand is the contents of memory word M[2001]. The operand fetch subsequently increments PC again, but this later value is not the operand address.
In register-transfer notation: IR ← M[PC]; PC ← PC+1; EA ← PC; operand ← M[EA]; PC ← PC+1. The addresses 2000 and 2001 respectively hold the instruction and its following operand word. This is the usual immediate-operand idiom implemented by PC autoincrement. It assumes ordinary instruction-fetch advancement of the PC, implicit in the question's CPU convention; it does not treat PC as still 2000 during operand addressing.
The CPU instruction occupies one memory word with fields OP CODE, MODE, RegR. Mode 2 uses the address in RegR to fetch the operand, then increments RegR by one. The instruction is at word address 2000 and RegR selects PC. For a non-jump instruction, find PC after execution.
Answer & solution
Answer: 2002. (no official key was published)
There are two distinct increments. First the instruction fetch consumes the memory word at 2000 and advances PC to 2001. Next mode 2 uses the current PC as the address of the operand, reads M[2001], and increments that selected register by one. Because the selected register is PC, it becomes 2002.
The instruction is specified to be non-jumping, so no later branch-target assignment replaces this sequential address. PC=2002 therefore identifies the next instruction, after both the instruction word and its inline operand word. Do not increment a third time for execution: the next fetch has not yet happened. Conversely 2001 accounts only for instruction fetch and overlooks the addressing mode's explicit post-increment. This result uses the conventional word-addressed fetch semantics implicit in part (a).
A hierarchy has (access time ti seconds, access probability pi, page-transfer time Ti seconds): M1=(10^-6,0.99000,0.001), M2=(10^-5,0.00998,0.1), M3=(10^-4,0.00002,no lower level). A miss at Mi transfers a page from M(i+1) to Mi, taking Ti. Calculate mean time to read one word.
Answer & solution
Answer: 13.0918 microseconds with supplying-level access plus transfers; 13.102 microseconds if serial failed probes are separately charged. (no official key was published)
The probabilities sum to 1, so treat them as unconditional, mutually exclusive probabilities of the level supplying the requested word, rather than three conditional hit ratios. In particular the probability that a transfer into M1 is needed is p2+p3=0.01, while the probability of a transfer from M3 into M2 is p3=0.00002. A word originally at M3 requires both transfers, not just T2.
Under the convention that each case incurs the access time of the supplying level plus the required page-transfer times, the three costs are t1, t2+T1, and t3+T2+T1. Hence
E[T] = p1*t1+p2*(t2+T1)+p3*(t3+T2+T1)
= (0.99000*10^-6+0.00998*10^-5+0.00002*10^-4)
+(0.00998+0.00002)*0.001+0.00002*0.1
= 0.0000010918+0.000010+0.000002
= 0.0000130918 seconds = 13.0918 microseconds.
This is the direct probability-weighted reading of the supplied table. The transfer contributions alone are 12 microseconds; omitting them would be a serious error despite the high first-level hit probability.
The text does not explicitly say whether failed higher-level probes consume additional ti, or whether those costs are already covered in the tabulated/transfer costs. If each request first probes M1 and each M1 miss additionally probes M2, count t1 for every request, t2 for probability 0.01, and t3 for probability 0.00002. Then E[T]=t1+0.01*t2+0.00002*t3+0.01*T1+0.00002*T2=13.102 microseconds. This alternative is a different timing model, not a rounding of 13.0918. No official key is available to resolve that convention; do not silently claim the paper specifies it.
Identify the function of this 8085 segment: LHLD 5000; MVI B,5; GET: IN 20; MOV M,A; INX H; DCR B; JNZ GET.
Answer & solution
Answer: Read five bytes from input port 20 into consecutive memory cells starting at the address stored at 5000/5001. (no official key was published)
LHLD is a direct memory load of a register pair, not an immediate-address load: it loads L from memory[5000] and H from memory[5001]. Let the resulting 16-bit pointer be h. MVI initializes counter B to five. Each iteration reads one byte from the designated input port into accumulator A, and MOV M,A writes it to the memory location addressed by HL.
INX H advances the pointer by one. DCR B decreases the loop count and sets the zero flag. JNZ returns to GET while that count is nonzero. Thus the five iteration-start counts are 5,4,3,2,1, and exactly five input operations occur. The writes target h,h+1,…,h+4; afterward B=0 and HL=h+5, modulo the 16-bit address space.
The numeric radix of bare literals is not explicitly supplied; using customary hexadecimal assembly notation makes the pointer cells 5000H/5001H and port 20H. The transfer structure is unchanged under another assembler's radix convention. No input-ready polling or handshaking is implemented; the program assumes each IN yields a usable byte.
List the registers and addressed locations used by: LHLD 5000; MVI B,5; GET: IN 20; MOV M,A; INX H; DCR B; JNZ GET.
Answer & solution
Answer: HL destination pointer; B count; A input byte; cells 5000/5001 hold pointer; 20 is input-port address; GET is a code label. (no official key was published)
L and H jointly form a 16-bit destination pointer, with L the low byte. LHLD fetches its initial low and high bytes from consecutive memory cells 5000 and 5001; it does not set HL to the literal 5000. The symbol M in MOV M,A denotes memory addressed indirectly by HL and is not another physical register.
A is the accumulator carrying the latest byte returned by IN. B is an 8-bit down-counter initialized to five; DCR B updates the zero condition used by JNZ. INX H changes the register-pair pointer, so successive MOV operations reach consecutive destination addresses. The zero flag is tested after decrement, ensuring five iterations.
The operand 20 designates an I/O port in the separate 8085 port-address space, whereas 5000 and 5001 are memory addresses. GET labels the IN instruction in code and is the branch destination. At completion the original pointer storage cells need not change, B is zero, A contains the last input value, and HL points one location beyond the five-byte output block, subject to address wraparound.
Why do some microprocessors specify a minimum as well as maximum clock frequency?
Answer & solution
Answer: Dynamic internal storage must be refreshed before charge leaks away (no official key was published)
Some processors use dynamic nodes or storage circuits that retain information as charge rather than static feedback. Clocked transitions periodically refresh or transfer that charge. If the clock is slowed excessively or stopped, leakage can corrupt stored state, imposing a minimum rate. This is an implementation property, not a universal law for every processor; a fully static design can often stop its clock while preserving state. The maximum clock rate instead arises from propagation and setup/hold timing constraints.
Why does prefetching instructions into a buffer improve processing speed?
Answer & solution
Answer: It overlaps instruction fetch with execution and reduces fetch waiting (no official key was published)
While the execution unit works on one instruction, a fetch unit can use available bus cycles to obtain later instructions into a queue. When execution needs the next instruction, it may already be present, hiding some memory latency rather than performing fetch and execution strictly serially. The gain is conditional on resources and a sufficiently predictable instruction stream. Branches can invalidate prefetched instructions, and a saturated shared memory bus can limit overlap, so prefetch is not a guarantee of speedup for every program.
An 11-bit instruction with 4-bit address fields allegedly supports five two-address instructions and 32 two-address instructions. How many zero-address instructions remain?
Answer & solution
Answer: Literal premise impossible; 256 if the second group was intended to be one-address (no official key was published)
A two-address instruction uses eight operand bits, leaving only three opcode bits, hence at most eight distinct two-address operations. The literal total of 37 is impossible. If the second phrase is repaired to 32 one-address instructions, five primary opcodes are consumed, leaving three. Expanding each by four bits gives 48 one-address opcode patterns. After using 32, the remaining 16 patterns can each expand by another four bits into 16 zero-address patterns, yielding 256. Both copies repeat “two-address, ” so 256 is explicitly a conditional reconstruction, not a solution to the literal inconsistent specification.
Which bit-slice claims hold: cascade for word length; speed independent of width; no standalone program counter; only the CPU datapath?
Select all that apply
Answer & solution
Answer: A, C, D for conventional ALU/register slices (no official key was published)
A bit-slice component implements a small-width arithmetic/register datapath. Cascading slices constructs a wider datapath, so A holds. Control sequencing and program-counter functions are normally supplied externally to the datapath slice, motivating C and D. Speed is not generally width-independent: carry propagation and inter-slice wiring can increase delay unless additional carry-lookahead structures are used. These claims refer to conventional datapath slices rather than every chip ever marketed in a bit-slice family; specialized sequencer components can supply the omitted control functions.
8085 PCHL copies HL to PC. Which construct is it especially useful for: if/then/else, while, case, call?
Select all that apply
Answer & solution
Answer: C: case dispatch through a jump table (no official key was published)
A case statement can compute an index, retrieve the selected branch address from a table into HL, then use PCHL to jump directly there. This is an indirect/computed branch rather than a fixed immediate target. Ordinary if and while control are usually implemented with conditional direct branches. PCHL also does not save a return address, so it is not a complete CALL instruction. With auxiliary code an indirect jump can participate in many constructs; C identifies the characteristic direct application, not an impossibility theorem for every other use.
Main memory takes 500 ns and cache 50 ns. Requests are 80% reads and 20% writes; read hit ratio is 0.9. Writes update cache and main memory simultaneously. Find average access time.
Answer & solution
Answer: 180 ns for sequential cache lookup then main-memory read on a miss; 176 ns if miss latency already includes lookup or reads begin in parallel. (no official key was published)
Separate access types before averaging. A read hit costs 50 ns. Under the usual serial lookup model, a read miss first spends 50 ns discovering the miss and then 500 ns accessing main memory, for 550 ns. Therefore E[read]=0.9(50)+0.1(550)=100 ns.
The statement explicitly says write-through updates are simultaneous, so the write completes when the slower device completes: E[write]=max(50,500)=500 ns. Adding 50+500 for a write would contradict this parallel-update stipulation. No write buffer or early processor release is stated.
Weighting by request mix gives E[access]=0.8(100)+0.2(500)=180 ns. Equivalently, the overall probabilities are 0.72 read hit, 0.08 read miss and 0.20 write, giving 0.72(50)+0.08(550)+0.20(500).
There is a timing-model ambiguity: if main-memory access starts in parallel with cache lookup, or a quoted 500 ns miss time is interpreted as total latency including lookup, then a miss costs 500 rather than 550 ns. That model gives E[read]=95 ns and overall 176 ns. The text establishes simultaneous writes but does not explicitly establish read overlap; 180 ns is the serial-read result, while 176 ns requires the alternative convention. This is effective time per processor memory request, not a change to the physical 500 ns main-memory device latency.
Three devices A,B,C use interrupt request lines INTR1>INTR2>INTR3. Draw priority logic with an interrupt mask register so A>B>C.
Answer & solution
Answer: Gate each request with its mask enable and assign A to INTR1, B to INTR2, C to INTR3; optional explicit priority gating suppresses lower requests. (no official key was published)
Define mask-register bits MA,MB,MC with 1 meaning masked (disabled). Let RA,RB,RC be pending request signals. Form eligible requests a=RA∧¬MA, b=RB∧¬MB, c=RC∧¬MC.
Schematic using the processor’s specified priority mechanism:
RA ──AND(¬MA)──> INTR1 [highest]
RB ──AND(¬MB)──> INTR2
RC ──AND(¬MC)──> INTR3 [lowest]
↑ three-bit interrupt mask register
Because the processor already prioritizes the three lines, this wiring suffices. If an explicit one-hot external priority network is desired, use instead:
INTR1=a
INTR2=b∧¬a
INTR3=c∧¬a∧¬b.
These equations are also a gate-level schematic: invert a and b as needed and AND the shown eligible inputs. They ensure that only the highest-priority eligible device is presented at a time.
Priority must depend on eligible requests, not raw requests: a masked A must not suppress an unmasked B or C. With all requests asserted and masks 000, A wins; with MA=1 and others 0, B wins; with MA=MB=1, C wins. With every mask bit set, no interrupt is raised.
Assume a device holds its request until acknowledged, or use pending-request latches before these gates, so a lower request survives service of a higher one. Service clears only the acknowledged source’s pending request. Mask-register writes are controlled by the processor. If the hardware convention defines 1 as enabled, replace each ¬M by M; the priority relation itself is unchanged.
A byte-addressed processor has 20 address bits (1 MiB). It needs 256 KiB RAM, 256 KiB EPROM, 16 memory-mapped I/O devices and 1 KiB EERAM. Available chips are printed as RAM 6K×8 at 140 ns, EPROM 256K×8 at 150 ns, and EERAM 256×8 at 500 ns read/3 μs write. Design a memory map minimizing decoding complexity and show its decoding logic.
Answer & solution
Answer: Map RAM 00000–3FFFF, EPROM 40000–7FFFF, EERAM 80000–803FF, I/O C0000–C000F. Literal 6K chips can be used as 64 banks of 4K; a conditional 64K-chip interpretation needs four banks. (no official key was published)
Use K=1024 and hexadecimal byte addresses. The following aligned allocation permits a top-level 2-to-4 decoder on A19,A18: 00: 00000–3FFFF, 256 KiB RAM 01: 40000–7FFFF, 256 KiB EPROM 10: 80000–803FF, 1 KiB EERAM (remaining quadrant reserved) 11: C0000–C000F, 16 one-byte I/O registers (remaining quadrant reserved). The I/O allocation assumes one addressed register per device; a device with multiple registers needs a correspondingly larger aligned subrange. Reset-vector placement is not specified.
Let R=¬A19∧¬A18, P=¬A19∧A18, E=A19∧¬A18, I=A19∧A18. These are active-high bank selections. EPROM has CS=P, internal address A17..A0 and output enable qualified by memory read; it is not written during normal operation.
The paper really print 6K×8 RAM, not 64K×8. A simple literal implementation uses 64 such chips, exposing only their lowest 4 KiB. Connect chip address A11..A0 to processor A11..A0 and hold its extra address bit at zero. A 6-to-64 decoder on A17..A12, enabled by R, selects exactly one chip. CS_RAM[j]=R∧(A17..A12=j), 0≤j<64. This deliberately sacrifices 2 KiB per chip to obtain regular power-of-two decoding. It implements all 256 KiB without assuming an undocumented capacity. The capacity lower bound is ceil(256/6)=43 chips; packing 42 full chips plus 4 KiB of a final chip needs non-power-of-two block selection/address translation, so minimum chip count and simplest decoder are different objectives.
For EERAM form E_exact=E∧(A17..A10=0). A 2-to-4 decoder on A9,A8 selects four 256-byte chips; connect A7..A0 to each. CS_E[k]=E_exact∧(A9A8=k), 0≤k<4. For I/O form I_exact=I∧(A17..A4=0); decode A3..A0 into 16 selects. Qualify all reads/writes with the processor’s memory-cycle control, since these are memory-mapped devices. An 8085-style IO/M signal is low for these cycles. Device-specific active-low chip selects are the complements of the active-high equations.
A shared 8-bit data bus serves selected devices only. For a multiplexed address/data bus, latch the low address using ALE first.
If 6K was intended to be 64K, an explicitly corrected alternative replaces the RAM arrangement by four 64K×8 chips selected by A17,A16, with A15..A0 internal. This common four-chip design must not be presented as using the literal printed components. Partial decoding can omit reserved-region zero tests but creates address aliases; the exact map above avoids them.
A byte-addressed processor has 20 address bits (1 MiB). It needs 256 KiB RAM, 256 KiB EPROM, 16 memory-mapped I/O devices and 1 KiB EERAM. Available chips are printed as RAM 6K×8 at 140 ns, EPROM 256K×8 at 150 ns, and EERAM 256×8 at 500 ns read/3 μs write. The processor clock is printed as 12.5 mHz and a memory transfer allows two clocks. Assuming 8085-like control signals, design extra EERAM interface logic.
Answer & solution
Answer: Literal 12.5 mHz needs no speed wait states. If intended 12.5 MHz, add 5 read wait clocks or 36 write wait clocks in the stated two-clock timing model. (no official key was published)
The printed unit matters: lowercase mHz means millihertz. At literal 12.5 mHz, f=0.0125 Hz, T=80 seconds and two clocks provide 160 seconds. Neither a 500 ns read nor a 3 μs write needs any speed-extension wait states. The extraordinary slowness strongly suggests a unit error, but the paper prints mHz and an official correction is unavailable.
For the conventional intended interpretation 12.5 MHz, T=80 ns and the specified ordinary memory interval is 2T=160 ns. RAM 140 ns and EPROM 150 ns fit this idealized interval; EERAM does not. With W additional whole clocks: Read: (2+W)80≥500 ⇒ W≥4.25 ⇒ W_read=5. Write: (2+W)80≥3000 ⇒ W≥35.5 ⇒ W_write=36. Total durations are 7 clocks=560 ns and 38 clocks=3040 ns. Rounding down would violate the specified device timing.
Interface block diagram
latched address→EERAM decoder→SEL_E SEL_E + memory RD/WR + cycle-start→operation latch / wait controller clock→6-bit elapsed-clock counter→threshold comparators→READY latched address + data bus + held RD/WR→four EERAM chips. READY is high for ordinary accesses. At the beginning of a selected EERAM transfer, latch read versus write, clear the counter and assert READY low before its processor sampling point. Hold address, chip select and the applicable read/write strobe stable as the bus is stretched. At the release sampling point choose READY high only when completion will occur no earlier than 7 clocks after transfer start for a read or 38 for a write. End-of-cycle resets the controller. Equivalently, count five or 36 inserted wait clocks after the nominal two-clock interval. Gate initialization with a single cycle-start pulse so held strobes do not repeatedly reset the counter. A six-bit counter accommodates the longest interval.
These counts follow the problem’s simplified timing model. Actual 8085 READY sampling, decoder delay, setup/hold margins, write-pulse width and whether 3 μs denotes strobe time or internal programming time require the particular EERAM/processor data sheets. If writes are internally timed, latch the write data/address and wait on a busy signal rather than blindly holding a programming pulse. No exact pin waveform or additional nanosecond margin can be inferred from the supplied numbers.
Which interleaving stores consecutive words in consecutive modules, and which stores them within one module?
Answer & solution
Answer: Low-order; high-order (no official key was published)
For M banks, low-order interleaving uses the low address bits as bank number: address j selects bank j mod M. Consecutive addresses consequently cycle through the banks, allowing overlap of sequential accesses. High-order interleaving selects the bank with high bits, leaving the low bits as the location within that bank. A consecutive run then stays in the same bank until it crosses that bank’s address range. These names describe address mapping, not whether the memory cells themselves are physically adjacent.
Which operating mode is required when the 8086 CPU works with an 8087 arithmetic coprocessor? Forum misprints the CPU as 8087.
Answer & solution
Answer: Maximum mode (no official key was published)
The 8086 supports minimum mode for a simpler single-processor system and maximum mode for systems requiring multiprocessor/coprocessor bus coordination. The 8087 participates in the latter environment using the relevant status and request/grant signals. Therefore the 8086 must be configured for maximum mode, with MN/MX driven low.
Match IEEE488, IEEE796, IEEE696, RS232C to: P single-device connection; Q computer-device interconnection; R instrumentation bus; S Multibus.
Answer & solution
Answer: IEEE488–R; IEEE796–S; IEEE696–Q; RS232C–P (no official key was published)
IEEE488 is the general-purpose instrumentation bus used to connect and control measurement equipment. IEEE796 standardizes the Multibus system bus. IEEE696 is the S-100 bus standard, giving the remaining computer-device interconnection association Q. RS232C defines a serial interface conventionally used for a point-to-point connection to one device, giving P. These are historical standard names rather than claims that each phrase is a unique exhaustive definition. Matching the two specific named buses first removes the otherwise broad wording of Q and P.
Match RQ/GT, LOCK, HOLD, READY with: P retain bus ownership during a critical sequence; Q insert wait states; R maximum-mode bus request/grant; S minimum-mode bus request.
Answer & solution
Answer: RQ/GT–R; LOCK–P; HOLD–S; READY–Q (no official key was published)
RQ/GT pins perform the maximum-mode request/grant handshake with another bus master. LOCK indicates that a protected sequence must not be interrupted by granting the bus away. In minimum mode, HOLD requests the bus and the CPU responds with its hold-acknowledge signal. READY lets slower memory or peripherals extend a bus cycle through wait states until data can be transferred safely. Thus ownership negotiation and transfer timing are distinct: READY delays a transaction but does not itself request control of the bus.
Which limits total address-space size: MAR width, available secondary storage, main memory, all, none?
Select all that apply
Answer & solution
Answer: A if MAR means the virtual-address register; terminology needs qualification (no official key was published)
With v virtual-address bits, at most 2v distinct addressable units can be named. Thus the architectural virtual-address width bounds the address space independently of how many pages are resident. Main memory limits residence, while backing storage can limit the amount of committed data, not necessarily the range of legal virtual addresses. The traditional answer A treats MAR as the register carrying that virtual address. If MAR instead denotes the post-translation physical memory-address register, its width bounds physical memory and need not equal the virtual-address width. The source does not make that distinction explicit.
GFG choices: A hardware RST; B external instruction via INTA; C execute from 20H; D NOP; E none. Forum omits A and relabels the rest. What does TRAP do?
Select all that apply
Answer & solution
Answer: A (hardware-vectored restart) (no official key was published)
TRAP is a nonmaskable vectored interrupt. The processor saves the return address and transfers control to its fixed vector 0024H, rather than fetching an instruction supplied by an external device via INTA. Thus 20H and NOP are wrong. The the phrase “executes an RST by hardware” describes that automatic restart-like transfer; it should not be confused with an external RST opcode or the normal software RST vector 20H.
What does ALE do: latch I/O output, disable chip select, latch address bits AD7–AD0, report TRAP enable status, none?
Select all that apply
Answer & solution
Answer: C: enable latching of the low-order address (no official key was published)
The 8085 multiplexes the low eight address bits and data on AD7–AD0. Early in a bus cycle those pins carry address bits; afterward they carry data. ALE signals an external latch to capture the address during the address phase so that it remains available while the shared pins change function. It is therefore an address-demultiplexing control, not a general instruction-output latch or interrupt-status signal. The upper address bits have separate pins and do not require this same demultiplexing step.
A single-address CPU has 16-bit instructions; the low 8 bits are the operand-address field. Design a hardwired fetch cycle which also forms the effective address for an indexed instruction. The reproduction does not specify memory word size, address width, index-mode encoding, or a memory-ready protocol. Give register transfers.
Answer & solution
Answer: MAR←PC; read instruction; IR←MDR, PC←PC+1; EA←zero_extend(IR[7:0])+(indexed?X:0), for word-addressed memory. (no official key was published)
Use a word-addressed memory returning one 16-bit instruction per access, an address-width w≥8, PC, MAR, MDR, IR, index register X and effective-address register EA. Let I be the decoded indexed-mode condition, and Z(IR[7:0]) the zero-extended address field. These are explicit implementation assumptions, not facts supplied by the question.
T0: MAR←PC. T1: assert memory READ; wait until READY; MDR←M[MAR]. T2: IR←MDR; PC←PC+1. T3: EA←Z(IR[7:0]) + (I ? X : 0), modulo 2w; finish fetch.
The operand field must come from the newly loaded IR, so effective-address formation follows T2. PC increment is independent of indexing: indexing modifies the operand address, not the address of the next instruction. The index flag is obtained from the instruction’s opcode/mode decoding; assigning it a particular bit without specification would be unjustified.
If memory is byte-addressed with an 8-bit data bus, use two reads, assemble the two bytes according to the selected endianness, and advance PC by two instead. If memory has a fixed guaranteed cycle, the READY self-loop can be replaced by the corresponding fixed number of timing states. These implementation variants do not change the essential separation of fetch, decode and address formation.
A single-address CPU has 16-bit instructions; the low 8 bits are the operand-address field. Design a hardwired fetch cycle which also forms the effective address for an indexed instruction. The reproduction does not specify memory word size, address width, index-mode encoding, or a memory-ready protocol. Draw the controller logic and datapath.
Answer & solution
Answer: A four-state hardwired sequencer drives PC/MAR/memory/MDR/IR and an indexed-address adder; READY holds the read state. (no official key was published)
Use a word-addressed memory returning one 16-bit instruction per access, an address-width w≥8, PC, MAR, MDR, IR, index register X and effective-address register EA. Let I be the decoded indexed-mode condition, and Z(IR[7:0]) the zero-extended address field. These are explicit implementation assumptions, not facts supplied by the question.
T0: MAR←PC. T1: assert memory READ; wait until READY; MDR←M[MAR]. T2: IR←MDR; PC←PC+1. T3: EA←Z(IR[7:0]) + (I ? X : 0), modulo 2w; finish fetch.
The operand field must come from the newly loaded IR, so effective-address formation follows T2. PC increment is independent of indexing: indexing modifies the operand address, not the address of the next instruction. The index flag is obtained from the instruction’s opcode/mode decoding; assigning it a particular bit without specification would be unjustified.
If memory is byte-addressed with an 8-bit data bus, use two reads, assemble the two bytes according to the selected endianness, and advance PC by two instead. If memory has a fixed guaranteed cycle, the READY self-loop can be replaced by the corresponding fixed number of timing states. These implementation variants do not change the essential separation of fetch, decode and address formation.
Datapath schematic
PC ─→ MAR ─address→ MEMORY ─data→ MDR ─→ IR
PC ─→ incrementer(+1) ─→ PC
IR[7:0] ─→ zero extend ─→ ADDER ─→ EA
X ─→ MUX(X or 0, select I) ─→ ADDER
IR[15:8] ─→ opcode/mode decoder ─→ I
Implement a one-hot sequencer S0,S1,S2,S3 with reset S0=1. Its next-state equations during fetch are S1_next=S0 OR (S1 AND NOT READY), S2_next=S1 AND READY, S3_next=S2; S0_next is asserted on the next fetch request rather than during instruction execution. The final S3 pulse transfers control to execution. Reset and start gating should prevent simultaneous states.
Control outputs: LD_MAR=S0; MEM_READ=S1; LD_MDR=S1 AND READY; LD_IR=S2; INC_PC=S2; LD_EA=S3; FETCH_DONE=S3. Each state’s loads occur at its ending clock edge. The adder’s second input selects X only when I=1. A two-bit state register plus a decoder is an equivalent SSI/MSI implementation. No control ROM is needed: Boolean gates decode state and instruction bits. The READY condition must obey the controller clock’s synchronization requirements.
8085 system: crystal 6 MHz; ROM 0000H–07FFH needs one wait state per access; RAM 1000H–17FFH needs none. Initially A=55H,B=AAH,C=F7H,D=10H,H=10H,L=FFH,PC=0200H,SP=17F0H, separately for each instruction. Find the instruction time for printed “ORI A,22”.
Answer & solution
Answer: 9 T-states = 3 μs, interpreting the printed mnemonic as 8085 ORI immediate. (no official key was published)
The 8085 divides the external crystal frequency by two, giving a 3 MHz processor clock. Therefore one T-state lasts 1/3 μs, not 1/6 μs.
8085 ORI immediate is a two-byte instruction: an opcode-fetch cycle of 4 T-states and an immediate-data memory-read cycle of 3 T-states. With PC=0200H, both bytes, at 0200H and 0201H, lie in ROM. Each access adds one wait state. Total time is (4+1)+(3+1)=9 T-states, or 9/(3 MHz)=3 μs.
The accumulator’s original value affects the logical result but not this timing. The other general-purpose registers and the stack pointer are unused. The printed “ORI A,22” is not the conventional 8085 syntax, which writes only the immediate operand, e.g. ORI 22H. The implicit destination is always A. Whether the literal 22 is decimal or hexadecimal does not alter the cycle count. Treating it as register ORA A would incorrectly discard the immediate-byte read.
8085 system: crystal 6 MHz; ROM 0000H–07FFH needs one wait state per access; RAM 1000H–17FFH needs none. Initially A=55H,B=AAH,C=F7H,D=10H,H=10H,L=FFH,PC=0200H,SP=17F0H, separately for each instruction. Find the instruction time for DCR M.
Answer & solution
Answer: 11 T-states = 11/3 μs ≈3.667 μs. (no official key was published)
The processor clock is 6 MHz/2=3 MHz, so a T-state is 1/3 μs. DCR M decrements the memory byte addressed by HL. It performs a 4-T opcode fetch, a 3-T memory read, and a 3-T memory write, for a nominal 10 T-states.
The opcode address PC=0200H is in ROM, adding one wait state. The operand address is HL=10FFH, obtained by concatenating H=10H and L=FFH. This lies in RAM’s 1000H–17FFH range, so neither the operand read nor the write adds a wait. Thus the total is (4+1)+3+3=11 T-states, or 11/3 μs≈3.667 μs.
“M” does not mean an immediate byte following the opcode; it is the indirect-memory operand at HL. The byte’s value was not specified, but every value uses the same timing. Nor is the ROM wait charged to every machine cycle merely because the program executes from ROM: each cycle’s addressed memory device determines its own wait requirement. The instruction changes arithmetic flags except carry, which is immaterial to the timing calculation.
Design an SSI/MSI interface for an 8085 with demultiplexed addresses. OUT 40H writes an output byte; IN 40H reads INTERRUPT in bit 7 and BUFFULL in bit 0. In the supplied timing diagram active-low write assertion clears INTERRUPT; write completion latches new data and sets BUFFULL. Device active-low STROBE assertion clears BUFFULL; STROBE completion sets INTERRUPT. Supply a block schematic and program transferring 200H bytes starting at memory 3400H.
Answer & solution
Answer: Decode I/O address 40H, use an output latch, handshake flags and status tri-state buffer; poll bit 7 before each of 512 OUT operations. (no official key was published)
Use an 8-bit equality decoder for address 40H gated by IO/M=1. Let SEL denote that I/O decode. Form /W=NOT(SEL AND NOT /WR) and /R=NOT(SEL AND NOT /RD). Thus memory access at 0040H cannot accidentally activate the port. The shared address is safe because read and write select different circuitry.
Schematic
A[7:0],IO/M → address decoder → SEL → /W, /R gating. CPU D[7:0] → 8-bit latch (transparent while /W=0) → DEVICE DATA. /W falling → clear INTERRUPT; /W rising → close data latch, set BUFFULL. /STROBE falling → clear BUFFULL; /STROBE rising → set INTERRUPT. {INTERRUPT,0,0,0,0,0,0,BUFFULL} → tri-state buffer, enabled only by /R=0 → CPU data bus.
One implementation uses a BUFFULL D flip-flop with D=1 clocked by rising /W and asynchronously cleared while /STROBE=0. INTERRUPT uses D=1 clocked by rising /STROBE and asynchronously cleared while /W=0. Initialize BUFFULL=0 and INTERRUPT=1 when the device is ready. The external handshake must avoid overlapping write/acknowledge pulses that violate the flip-flops’ recovery times. Device data is stable after write completion and held until a later write. The timing diagram’s arrows refer to these separate leading/trailing edges, not merely inverse full/empty flags.
8085 program (hexadecimal literals):
LXI H,3400H
LXI B,0200H
WAIT_READY:
IN 40H
ANI 80H
JZ WAIT_READY
MOV A,M
OUT 40H
INX H
DCX B
MOV A,B
ORA C
JNZ WAIT_READY
WAIT_LAST:
IN 40H
ANI 80H
JZ WAIT_LAST
BC counts 512 bytes; HL visits 3400H through 35FFH. The source RAM region for this subproblem must exist; it is independent of the smaller RAM map specified in part (a). Testing bit 7 waits for completion of the device strobe, whereas bit 0 can clear earlier at strobe assertion. The final loop waits for the last acknowledgement rather than returning with the final byte merely buffered. There is no timeout in this minimal program, so a nonresponsive device blocks indefinitely. Reading the status port does not clear either flag.