Last Minute Notes

Computer Fundamentals Interview Playbook

Computer fundamentals interview rehearsal: a 40-question bank with strong-answer checklists, numerical problem recipes (base conversion, two's complement, IEEE 754, cache address breakdown, AMAT, pipelining, CPU time), a 'what happens when you run a program' walkthrough, cheat sheets, common mistakes, and a 5-day study plan.

๐Ÿ“˜ Computer Fundamentals Interview Playbook

The other pages teach the material. This page is for rehearsal: a question bank with what a strong answer contains, recipes for numerical problems, a full "what happens when you run a program" answer, cheat sheets, and a study plan.

Table of Contents

  1. What Interviewers Look For
  2. What Happens When You Run a Program
  3. Question Bank
  4. Numerical Problem Recipes
  5. Cheat Sheets
  6. Common Mistakes
  7. Study Plan

1. What Interviewers Look For

LevelExpected
Campus / new gradBase conversions, two's complement, logic gates, von Neumann model, fetch-decode-execute, cache basics, compiler vs interpreter
MidFloating point pitfalls, encodings (UTF-8), stack vs heap, linking, GC basics, cache-friendly code
Senior / performancePipelining and branch prediction effects, false sharing, SIMD, NUMA, JIT behavior, reading profiler output

These topics often appear inside other questions: "why is this loop slow", "why does this float comparison fail", "why does adding threads make it slower". Connecting theory to observed behavior is what earns credit.


2. What Happens When You Run a Program

A good answer moves from source to silicon.

Points to hit:

  1. Build: preprocessing, compilation to assembly, assembling to object files, linking with libraries (static or dynamic); for Java or C#, compile to bytecode, then JIT at run time.
  2. Launch: the shell forks, the child calls execve, the kernel creates an address space, maps text and data, sets up the stack with arguments and environment.
  3. Dynamic loading: ld.so maps shared libraries and resolves symbols, then _start calls main.
  4. Execution: the CPU fetches instructions through the instruction cache, predicts branches, executes out of order, and retires in order.
  5. Memory: virtual addresses translated through the TLB and page tables; first touches cause page faults; data flows through the cache hierarchy.
  6. I/O: printf buffers, then write traps into the kernel, which talks to the terminal or file system driver.
  7. Scheduling: timer interrupts may preempt the program; other processes share the CPU.
  8. Exit: return from main, exit flushes stdio, the kernel reclaims memory and FDs, the parent collects the exit status with wait.

Pair this with What Happens When You Type a URL for the network side.


3. Question Bank

3.1 Data representation (10)

#QuestionStrong answer includesRead
1Convert 156 to binary and hex.10011100, 0x9C, method shownNumber Systems
2Represent -13 in 8-bit two's complement.Invert and add 1: 11110011Number Systems
3Why do computers use two's complement?Single zero, same adder for signed and unsignedNumber Systems
4What happens on integer overflow in your language?Wrap vs UB vs exception vs bignum, examples of bugsNumber Systems
5Why is 0.1 + 0.2 != 0.3?Binary fractions, rounding, epsilon comparisonNumber Systems
6How would you store currency?Integer minor units or decimal type, plus currency code, rounding modeNumber Systems
7Check if a number is a power of two.x > 0 && (x & (x - 1)) == 0, why it worksNumber Systems
8Unicode vs UTF-8 vs UTF-16?Code points vs encodings, byte lengths, surrogatesNumber Systems
9What is endianness and where does it matter?Byte order, network byte order, file formats, htonlNumber Systems
10What are NaN and Infinity?Encodings, how they arise, NaN != NaNNumber Systems

3.2 Logic and architecture (10)

#QuestionStrong answer includesRead
11Build XOR (or NOT, AND) from NAND gates.Universal gate, gate-level expressionArchitecture
12Combinational vs sequential logic?No memory vs state, flip-flops, clockArchitecture
13How does a full adder work?Sum and carry equations, ripple vs lookaheadArchitecture
14Explain the von Neumann architecture and its bottleneck.Shared memory, buses, modified Harvard cachesArchitecture
15Walk through the instruction cycle.Fetch, decode, execute, memory, write back, interruptsArchitecture
16RISC vs CISC?Load-store, fixed length, micro-ops, ARM vs x86Architecture
17What is pipelining and what are hazards?Throughput, structural, data, control, forwardingArchitecture
18Why does sorting an array speed up a branchy loop?Branch prediction, misprediction penaltyArchitecture
19What is out-of-order execution?Reorder buffer, register renaming, in-order retirementArchitecture
20SRAM vs DRAM?Latch vs capacitor, speed, density, refresh, where usedArchitecture

3.3 Memory and caches (8)

#QuestionStrong answer includesRead
21Why do we need a memory hierarchy?Speed vs size vs cost, localityCaches
22Explain cache mapping schemes.Direct, set associative, fully associative, trade-offsCaches
23Types of cache misses?Compulsory, capacity, conflict, coherenceCaches
24Write-through vs write-back?Traffic, consistency, dirty bit, allocate policiesCaches
25What is cache coherence? MESI?Private caches, invalidation, statesCaches
26What is false sharing and how do you fix it?Same line, ping-pong, padding, per-thread dataCaches
27Why is iterating a 2D array by rows faster?Row-major layout, lines, prefetchingCaches
28Array vs linked list performance in practice?Contiguity, pointer chasing, cache missesCaches

3.4 Compilers, runtimes, and parallelism (12)

#QuestionStrong answer includesRead
29Compiler vs interpreter vs JIT?Timing of translation, startup vs peak, examplesCompilers
30Phases of a compiler?Lexing through code generation, front vs back endCompilers
31What does a linker do?Symbol resolution, relocation, common errorsCompilers
32Static vs dynamic linking?Size, sharing, updates, deploymentCompilers
33Stack vs heap?Lifetime, speed, size, thread ownership, errorsCompilers
34What is in a stack frame, and what is a calling convention?Return address, saved registers, locals, argument registersCompilers
35How does garbage collection work?Roots, mark and sweep, generational, concurrent, leaks still possibleCompilers
36Reference counting vs tracing GC?Cycles, pauses, overheadCompilers
37Concurrency vs parallelism?Structure vs execution, examplesParallelism
38CPU vs GPU?Latency vs throughput design, when to use eachParallelism
39What is SIMD?Vector registers, auto-vectorization, blockersParallelism
40Why might adding threads not speed things up?Amdahl, contention, false sharing, bandwidthParallelism

4. Numerical Problem Recipes

ProblemRecipeExample
Decimal to binaryDivide by 2, collect remainders bottom up156 = 10011100
Binary to hexGroup 4 bits from the right1001 1100 = 0x9C
Two's complement of -xWrite x in n bits, invert, add 1-13 = 11110011
Signed range-2^(n-1) to 2^(n-1) - 116 bits: -32,768 to 32,767
IEEE 754 singleSign; normalize to 1.f x 2^e; exponent e + 127; fraction bits-5.75 = 0xC0B80000
Cache address splitOffset = log2(line); sets = size / (line x ways); index = log2(sets); tag = rest32 KB, 8-way, 64 B, 32-bit: 20 / 6 / 6
AMATHit time + miss rate x miss penalty, nested per level1 + 0.1 x (4 + 0.2 x 80) = 3 ns
Pipeline timek + (n - 1) cycles for n instructions, k stages5 stages, 100 instructions: 104 cycles vs 500 unpipelined
CPU timeInstructions x CPI / clock rate2 x 10^9 x 1.5 / 3 GHz = 1 s
Amdahl speedup1 / ((1 - p) + p / n)p = 0.9, n = 8: 1 / (0.1 + 0.1125) โ‰ˆ 4.7x
Memory addressable2^(address bits) bytes32-bit: 4 GiB
Data rate conversionBits / 8 = bytes1 Gbps = 125 MB/s

5. Cheat Sheets

Powers of two

2^nValueApprox
2^8256
2^101,0241 thousand (Ki)
2^1665,536
2^201,048,5761 million (Mi)
2^301 billion (Gi)
2^324,294,967,2964.3 billion
2^401 trillion (Ti)
2^53JavaScript safe integer limit
2^641.8 x 10^19

Hex digits

HexBinaryHexBinary
0000081000
1000191001
20010A1010
30011B1011
40100C1100
50101D1101
60110E1110
70111F1111

Latency ladder

LevelTime
Register< 1 ns
L1~1 ns
L2~4 ns
L3~10 to 20 ns
DRAM~100 ns
NVMe~10 to 100 ยตs
Data center round trip~0.5 ms
HDD seek~5 to 10 ms
Cross-continent round trip~70 to 150 ms

6. Common Mistakes

  • Comparing floats with ==, or storing money in double.
  • Saying "a character is one byte" in a Unicode world.
  • Forgetting that abs(INT_MIN) overflows.
  • Confusing latency with bandwidth, or bits with bytes.
  • Thinking pipelining makes one instruction faster (it improves throughput).
  • Ignoring the cache when comparing algorithms with the same big-O.
  • Assuming more threads always means more speed.
  • Saying Java is "interpreted" (it is JIT compiled after warm-up).
  • Believing GC prevents all memory leaks.
  • Treating hyper-threads as full cores.

7. Study Plan

DayFocusOutput
1Number SystemsDo 10 conversions, encode two floats by hand, check with Python struct
2ArchitectureDraw the pipeline with a data hazard; explain branch prediction with the sorted-array example
3CachesSolve an address breakdown and an AMAT problem; benchmark row vs column traversal
4Compilers and ParallelismCompile with -S, read the assembly; explain generational GC and SIMD
5This pageSay "what happens when you run a program" out loud, then answer the question bank

Related: Operating Systems builds directly on this material, and DSA benefits from knowing why cache-friendly structures win.

On this page