First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1Computer Systems and Organization
What is the 8-bit two's complement representation of decimal -5?
- 11111011 Correct answer.
- 11111010
- 10000101
- 00000101
Explanation
In 8-bit two's complement, start with +5 as 00000101, invert all bits to get 11111010, and add 1 to obtain 11111011. The leading 1 indicates a negative value.
Question 2Computer Systems and Organization
What is the hexadecimal equivalent of the binary number 1011 0110?
- 0xCB
- 0xB6 Correct answer.
- 0x6B
- 0xB4
Explanation
Group the binary digits into nibbles: 1011 is B and 0110 is 6, so the hexadecimal value is 0xB6. Each hexadecimal digit represents exactly four binary bits.
Question 3Computer Systems and Organization
Which CPU component performs arithmetic and logical operations?
- ALU Correct answer.
- Program counter
- Cache
- Control unit
Explanation
The arithmetic logic unit, or ALU, executes operations such as addition, subtraction, AND, and OR. The control unit directs execution, while the program counter and cache serve different roles.
Question 4Computer Systems and Organization
During the fetch phase of the instruction cycle, the CPU places the next instruction into which register?
- Memory address register
- Instruction register Correct answer.
- Program counter
- Accumulator
Explanation
The fetch phase reads the instruction at the address in the program counter and loads it into the instruction register. The instruction is then decoded and executed.
Question 5Computer Systems and Organization
Which storage is typically the fastest for a CPU to access?
- Solid-state drive
- CPU registers Correct answer.
- Main memory
- L1 cache
Explanation
CPU registers are located on the processor and are faster than cache, main memory, or secondary storage. The memory hierarchy trades capacity for speed as you move away from the CPU.
Question 6Computer Systems and Organization
An AND gate produces an output of 1 under which condition?
- At least one input is 1
- Both inputs are 1 Correct answer.
- Both inputs are 0
- The inputs differ
Explanation
An AND gate outputs 1 only when every input is 1. If either input is 0, the output is 0.
Question 7Computer Systems and Organization
What is the decimal ASCII code for the uppercase letter 'A'?
- 65 Correct answer.
- 48
- 64
- 97
Explanation
In standard ASCII, uppercase 'A' has decimal value 65. The codes for '0' and lowercase 'a' are 48 and 97, respectively.
Question 8Computer Systems and Organization
Which bus carries memory addresses from the CPU to memory?
- Data bus
- Address bus Correct answer.
- Power bus
- Control bus
Explanation
The address bus transmits the location of a memory word or I/O device that the CPU wants to access. The data bus carries the actual contents, and the control bus carries timing and control signals.
Question 9Computer Systems and Organization
A program loops through an array and accesses consecutive elements in order. Which type of locality does this pattern primarily exploit?
- Spatial locality Correct answer.
- Branch locality
- Semantic locality
- Temporal locality
Explanation
Spatial locality is the tendency to access memory locations near recently accessed addresses. Sequential array access brings nearby elements into the same cache blocks, so later iterations often hit in cache.
Question 10Computer Systems and Organization
An instruction needs a register value that the immediately preceding instruction has not yet written back. What type of pipeline hazard is this?
- Structural hazard
- Control hazard
- Memory hazard
- Data hazard Correct answer.
Explanation
A data hazard occurs when an instruction depends on a result that is not yet available. Forwarding or stalling can resolve it. Structural hazards involve hardware resource conflicts, and control hazards involve branches.
Question 11Computer Systems and Organization
What is a primary purpose of virtual memory?
- Add more physical RAM
- Provide isolated address spaces Correct answer.
- Remove the need for cache
- Increase disk throughput
Explanation
Virtual memory gives each process its own logical address space, which supports isolation and allows programs to use more virtual addresses than physical RAM. It does not increase the actual amount of installed RAM.
Question 12Computer Systems and Organization
Which fields make up an IEEE 754 single-precision floating-point value?
- Mantissa, exponent, parity
- Sign, exponent, checksum
- Sign, exponent, fraction Correct answer.
- Sign, integer, fraction
Explanation
A single-precision IEEE 754 value contains a sign bit, an 8-bit exponent, and a 23-bit fraction, also called the significand. The exponent is biased, and the fraction stores the significant digits.
Question 13Computer Systems and Organization
In the instruction LOAD R1, [R2], what addressing mode is used?
- Register indirect Correct answer.
- Indexed with displacement
- Direct address
- Immediate operand
Explanation
Brackets around a register indicate register indirect addressing: R2 holds the effective address of the operand. The CPU reads memory at the address stored in R2.
Question 14Computer Systems and Organization
Which resource is private to each thread within the same process?
- Stack Correct answer.
- Open files
- Heap
- Global variables
Explanation
Each thread has its own stack, registers, and program counter so it can execute independently. Threads in the same process share the heap, global variables, and open files.
Question 15Computer Systems and Organization
Which condition is one of the four necessary conditions for deadlock?
- Priority inversion
- Queue overflow
- Circular wait Correct answer.
- Resource starvation
Explanation
Deadlock requires mutual exclusion, hold-and-wait, no preemption, and circular wait. Circular wait means each process in a cycle waits for a resource held by another process in that cycle.
Question 16Computer Systems and Organization
How does a little-endian machine store the multi-byte integer 0x12345678?
- Most significant byte first
- Least significant byte first Correct answer.
- All bytes in reverse bit order
- ASCII characters first
Explanation
Little-endian storage places the least significant byte at the lowest memory address. For 0x12345678, the byte 0x78 is stored first, followed by 0x56, 0x34, and 0x12.
Question 17Computer Systems and Organization
How does an I/O device typically notify the CPU that it has completed a transfer?
- Interrupt Correct answer.
- DMA descriptor
- Polling loop
- System call
Explanation
An interrupt signals the CPU that a device needs attention, such as when an I/O operation finishes. The CPU then transfers control to an interrupt handler.
Question 18Computer Systems and Organization
A program spends 40 percent of its execution time in a section that can be made infinitely fast. What is the maximum possible overall speedup?
- 4.0
- 1.667 Correct answer.
- 1.4
- 2.5
Explanation
Amdahl's law limits speedup to 1 divided by the serial fraction. The serial fraction is 60 percent, or 0.6, so the maximum speedup is 1/0.6, about 1.667.
Question 19Computer Systems and Organization
Using Boolean algebra, what does A AND (A OR B) simplify to?
- A OR B
- B
- A AND B
- A Correct answer.
Explanation
This is an absorption law: A(A + B) = A. If A is 1, the expression is 1; if A is 0, the expression is 0, regardless of B.
Question 20Computer Systems and Organization
Which tool combines multiple object files into a single executable?
- Compiler
- Loader
- Assembler
- Linker Correct answer.
Explanation
The linker combines object files, resolves symbolic references between them, and produces an executable. The loader later places the executable into memory for execution.
Question 21Computer Systems and Organization
When adding two signed two's complement numbers, overflow occurs under which condition?
- Carry in and carry out differ Correct answer.
- The result is negative or zero
- Carry out of the sign bit is set
- The operands have opposite signs
Explanation
Signed overflow occurs when the carry into the sign bit differs from the carry out of the sign bit. This can happen only when adding two numbers of the same sign.
Question 22Computer Systems and Organization
A 32-bit byte-addressed system has 64-byte cache blocks and 256 sets in a direct-mapped cache. How many tag bits are needed?
- 16
- 18 Correct answer.
- 20
- 24
Explanation
The block offset needs log2(64) = 6 bits, and the set index needs log2(256) = 8 bits. The remaining address bits form the tag: 32 - 6 - 8 = 18 bits.
Question 23Computer Systems and Organization
A processor has a base CPI of 1.0 and no stalls except branch penalties. If 20 percent of instructions are branches and each branch costs 3 extra cycles, what is the average CPI?
- 1.2
- 1.6 Correct answer.
- 3.0
- 1.5
Explanation
The branch penalty adds 0.20 times 3, or 0.6 cycles per instruction on average. Adding this to the base CPI of 1.0 gives an average CPI of 1.6.
Question 24Computer Systems and Organization
What does a translation lookaside buffer (TLB) store?
- Stores complete pages
- Caches recent translations Correct answer.
- Replaces the entire page table
- Increases the page size
Explanation
The TLB is a small, fast cache of recent virtual-to-physical page translations. A TLB hit avoids accessing the page table in memory for that translation.
Question 25Computer Systems and Organization
Two threads repeatedly increment a shared counter without synchronization, and the final value is too low. What is the main cause?
- CPUs cannot add small integers
- The increment is not atomic Correct answer.
- Threads share one stack
- Caches reject shared writes
Explanation
An unsynchronized increment is a read-modify-write sequence that can interleave with another thread's increment. If both read the same old value before either writes, one update is lost. Making the increment atomic or using a lock prevents this race.
Question 26Computer Systems and Organization
What does the program counter (PC) hold during normal instruction execution?
- The base address of the active stack frame
- The address of the next instruction Correct answer.
- The result produced by the last ALU operation
- The number of instructions completed so far
Explanation
The program counter is a register that holds the address of the next instruction to be fetched. After a fetch, it is normally incremented, or it is loaded with a branch target when control flow changes.
Question 27Computer Systems and Organization
Which memory technology is typically used to build CPU cache because it is fast and does not require refresh?
- DRAM
- SRAM Correct answer.
- Flash memory
- Magnetic disk
Explanation
SRAM stores each bit in a flip-flop-like structure, so it keeps data as long as power is supplied and can be made very fast. DRAM stores bits as charge on capacitors and must be refreshed periodically, which makes it slower for cache use.
Question 28Computer Systems and Organization
What is the primary function of the arithmetic logic unit (ALU)?
- To decode instruction opcodes into control signals
- To perform arithmetic and bitwise logical operations Correct answer.
- To translate virtual addresses into physical addresses
- To store the contents of the stack during procedure calls
Explanation
The ALU performs integer arithmetic such as addition and subtraction, along with bitwise logic, shifts, and comparisons. Control decoding, stack storage, and address translation are handled by other parts of the system.
Question 29Computer Systems and Organization
Which binary sequence is equivalent to the hexadecimal value 0x5C?
- 0101 1100 Correct answer.
- 1100 0101
- 0101 1010
- 1010 1100
Explanation
Each hexadecimal digit corresponds to exactly four binary bits. The digit 5 is 0101 and the digit C is 1100, so 0x5C is 0101 1100.
Question 30Computer Systems and Organization
What is the 8-bit two's complement representation of -5?
- 0000 0101
- 1111 1011 Correct answer.
- 1000 0101
- 1111 1010
Explanation
Start with +5 as 0000 0101, invert all bits to get 1111 1010, and add 1 to obtain 1111 1011. Equivalently, -5 is 256 - 5 = 251, which is 0xFB.
Question 31Computer Systems and Organization
A cache uses a write-through policy. What happens when the processor writes a value that hits in the cache?
- Only the cache block is updated, and main memory is updated when the block is evicted
- The cache block is updated and main memory is updated immediately Correct answer.
- The write is buffered until the next cache flush instruction
- The write bypasses the cache and is sent only to main memory
Explanation
Write-through means that every write updates both the cache and the next level of memory, often through a write buffer. Write-back, by contrast, delays the memory update until the dirty block is evicted.
Question 32Computer Systems and Organization
A processor executes a long stream of independent instructions using a 5-stage pipeline with no stalls. Compared with a single-cycle unpipelined datapath, what is the ideal throughput speedup?
- 1.25
- 25
- 5 Correct answer.
- 2
Explanation
After the pipeline fills, an ideal 5-stage pipeline can complete one instruction per clock cycle. An unpipelined datapath takes one instruction every 5 cycles, so the ideal throughput gain is about 5 times.
Question 33Computer Systems and Organization
What is the main advantage of using direct memory access (DMA) for a block transfer?
- It removes the need for memory-mapped I/O registers
- It encrypts each block before it reaches main memory
- It guarantees completion within a single clock cycle
- It frees the CPU to do other work during the transfer Correct answer.
Explanation
A DMA controller moves data between a device and memory without the CPU executing a load or store for every word. The CPU starts the transfer and can continue executing other work until an interrupt or status check signals completion.
Question 34Computer Systems and Organization
When a procedure is called, where is the return address typically saved?
- In the program counter
- In the memory data register
- In the instruction register
- On the stack Correct answer.
Explanation
A call instruction saves the address of the following instruction on the stack so that a return can restore execution there. The return instruction then pops that saved address back into the program counter.
Question 35Computer Systems and Organization
Which property is most characteristic of a RISC instruction set architecture?
- Most instructions execute in one cycle and use register operands Correct answer.
- Complex instructions are implemented directly in hardware microcode
- Instructions have variable length and many memory operands
- The architecture provides a small number of general-purpose registers
Explanation
RISC designs emphasize simple, fixed-length instructions, load/store memory access, and register-to-register operations that pipeline well. Many RISC instructions are intended to complete in a single cycle in an ideal pipeline.
Question 36Computer Systems and Organization
A program executes 2.0 × 10^9 instructions with an average CPI of 1.5 on a 3.0 GHz processor. What is the approximate execution time?
- 0.5 s
- 1.0 s Correct answer.
- 2.0 s
- 1.5 s
Explanation
CPU time equals instruction count times CPI divided by clock rate. Here that is (2.0 × 10^9 × 1.5) / (3.0 × 10^9) = 1.0 second.
Question 37Computer Systems and Organization
According to De Morgan's laws, which expression is equivalent to NOT (A AND B)?
- (NOT A) OR (NOT B) Correct answer.
- (NOT A) AND (NOT B)
- A OR B
- A AND (NOT B)
Explanation
De Morgan's law states that the negation of a conjunction is the disjunction of the negations. Therefore NOT (A AND B) equals (NOT A) OR (NOT B).
Question 38Computer Systems and Organization
A 32-bit virtual address space uses 4 KiB pages and 4-byte page-table entries. What is the size of a single-level page table for one process, assuming every entry is present?
- 4 GiB
- 4 MiB Correct answer.
- 4 KiB
- 1 MiB
Explanation
A 4 KiB page means the offset uses 12 bits, leaving 20 bits for the virtual page number. Thus there are 2^20 entries, and at 4 bytes each the table size is 4 MiB.
Question 39Computer Systems and Organization
A direct-mapped cache has 64 blocks. A program repeatedly accesses two arrays whose corresponding elements always map to the same cache block. What type of cache miss dominates this pattern?
- Capacity miss
- TLB miss
- Conflict miss Correct answer.
- Compulsory miss
Explanation
In a direct-mapped cache, each memory block can occupy only one cache block. Two frequently used addresses that map to the same cache block repeatedly evict each other, which is a conflict miss.
Question 40Computer Systems and Organization
In IEEE 754 single precision, the significand has 23 explicit fraction bits. If the value 1.0 is stored, adding 2^-24 to it and rounding to nearest even produces what result?
- 1.0 + 2^-23
- 2.0
- 1.0 Correct answer.
- The result is NaN
Explanation
Near 1.0, single-precision numbers are spaced 2^-23 apart, so 2^-24 is exactly half an ULP. Round-to-nearest-even chooses the representable value with an even significand, which is 1.0 rather than 1.0 + 2^-23.
Question 41Programming and Algorithms
In a language where both operands are integers, what is the value of the expression 7 / 2?
- 3 Correct answer.
- 1
- 4
- 3.5
Explanation
When both operands have an integer type, the division operator performs integer division and discards the fractional part, so 7 / 2 evaluates to 3.
Question 42Programming and Algorithms
Following standard operator precedence, what is the value of 4 + 3 * 2?
- 10 Correct answer.
- 24
- 14
- 9
Explanation
Multiplication binds more tightly than addition, so 3 * 2 is evaluated first and its result, 6, is then added to 4.
Question 43Programming and Algorithms
In Java, C, C++, and Python, what is the index of the first element of an array or list?
- The length of the array
- 1
- -1
- 0 Correct answer.
Explanation
These languages use zero-based indexing, so the first element sits at index 0 and the last valid index is one less than the length.
Question 44Programming and Algorithms
How many times does the body of this loop execute?
for (int i = 1; i <= 4; i++) { ... }
- 3
- 0
- 4 Correct answer.
- 5
Explanation
The counter starts at 1 and the loop continues while i <= 4, so i takes the values 1, 2, 3, and 4 before the condition fails.
Question 45Programming and Algorithms
What does a return statement do inside a function?
- It prints the value to the standard output console
- It permanently stores the value in a file on disk
- It returns a value to the caller Correct answer.
- It restarts the function from its first statement
Explanation
A return statement ends execution of the current function and hands a value back to the code that called it, where the call expression evaluates to that value.
Question 46Programming and Algorithms
A while loop's condition is false the very first time it is tested. How many times does the loop body execute?
- Exactly once
- Zero times Correct answer.
- An infinite number of times
- Exactly twice
Explanation
A while loop tests its condition before every iteration, so if the condition is already false, control skips the body entirely.
Question 47Programming and Algorithms
In a language that uses + for string concatenation, what does the expression "3" + "4" produce?
- "34" Correct answer.
- 12
- A type error is raised
- "7"
Explanation
When both operands are strings, the + operator concatenates them, joining the characters into the single two-character string "34".
Question 48Programming and Algorithms
Which data structure processes elements in first-in, first-out order?
- Stack
- Hash table
- Binary search tree
- Queue Correct answer.
Explanation
A queue inserts at the rear and removes from the front, so the element that has waited longest is the first one out.
Question 49Programming and Algorithms
What precondition must hold before binary search can be applied to an array?
- The array must be sorted Correct answer.
- The array must contain only unique values
- The array must be stored as a linked list
- The array must have an odd number of elements
Explanation
Binary search discards half of the remaining range after each comparison, and that deduction is valid only when the elements are in sorted order.
Question 50Programming and Algorithms
A recursive function that never reaches a base case is executed. What happens?
- The compiler inserts a base case during optimization
- It returns 0 automatically when the argument reaches 1
- It runs exactly twice and then stops
- It recurses until the call stack overflows Correct answer.
Explanation
A recursive function needs a base case that returns without making another call; without one, each call pushes a new frame until the call stack is exhausted and the program fails.