FreeExam

Embedded engineer: Memory and Resource Constraints

Original technical interview practice in ownership and allocation bounds, linker reservations, C integer and lifetime rules, fixed-point error, and memory and energy budgets.

These prompts are original practice. They are not questions from a named employer or a live hiring loop.

  1. 1.An arena begins at byte address 0x1003. The next object needs 8-byte alignment and occupies 12 bytes. With no header, which address is its earliest aligned start?

    Show answer and explanation
    1. 0x1010
    2. 0x1004
    3. 0x1003
    4. 0x1008

    Answer: 0x1008

    The least address at or above 0x1003 divisible by eight is 0x1008. Five bytes are padding before the 12-byte object. Alignment is a property of the actual start address, not just the requested size.

  2. 2.A supplied fixed pool stores payloads of 18 bytes, each preceded by a 4-byte header. Every block stride must be a multiple of 8 bytes. How many bytes does one block consume?

    Show answer and explanation
    1. 18
    2. 24
    3. 22
    4. 32

    Answer: 24

    Payload plus header requires 22 bytes. Rounding that stride up to a multiple of eight gives 24 bytes, so successive blocks can meet the same alignment rule. This model excludes any separate pool metadata.

  3. 3.Two tasks each retain three distinct message blocks while awaiting replies. A service needs two additional distinct blocks before it can reply to either task. All eight may be live together. What minimum pool capacity meets this specified peak?

    Show answer and explanation
    1. 6 blocks
    2. 5 blocks
    3. 9 blocks
    4. 8 blocks

    Answer: 8 blocks

    The simultaneous live set contains three blocks for each task plus two for the service: 3+3+2=8. Summing average use or counting only each task's local demand misses the stated overlap.

  4. 4.An operation holds one block from a four-block pool and then waits for another. Four such operations can start together, and none releases its first block until it obtains the second. What resource failure is possible?

    Show answer and explanation
    1. All four wait indefinitely
    2. One operation must automatically win
    3. The fifth allocation alone is delayed
    4. Pool reuse eliminates the wait cycle

    Answer: All four wait indefinitely

    Each operation can own one block, exhausting the pool. Every operation then waits for a block that only another waiting operation could release. A fixed pool bounds allocation size but does not itself prevent resource deadlock.

  5. 5.A pool has separate small and large classes. All four small blocks are occupied; both large blocks are free. Its contract forbids borrowing across classes. A small request arrives. What result follows?

    Show answer and explanation
    1. It must receive half of a large block
    2. It must succeed because total free bytes exceed its size
    3. It must borrow the oldest large block
    4. Allocation fails under this contract

    Answer: Allocation fails under this contract

    The contract makes capacity class-specific. Free storage in a class that the allocator cannot use does not establish success for this request. A borrowing or splitting policy would change that contract.

  6. 6.A region allocator frees all objects together at an epoch boundary. A callback scheduled for the next epoch still stores a pointer into the old region. What must the design address?

    Show answer and explanation
    1. The callback requires a larger local stack only
    2. Region reset necessarily cancels every external reference
    3. The callback outlives its allocation epoch
    4. The arena's numerical base address is odd

    Answer: The callback outlives its allocation epoch

    Bulk reclamation invalidates the old objects even if their bytes remain unchanged temporarily. Deferred users need a lifetime that survives their use, a copy into another owner, or cancellation before reclamation.

  7. 7.A message block is returned to its pool twice along one error path. The allocator inserts every returned block into a free list and has no duplicate check. What corruption can follow?

    Show answer and explanation
    1. The block can never be allocated again after its first return
    2. Two live allocations can receive the same block
    3. Only the block’s stored length changes; ownership stays unique
    4. The payload is duplicated into a new physical RAM bank

    Answer: Two live allocations can receive the same block

    Duplicate free-list entries can cause the same storage to be handed to two clients. Their independent writes then corrupt each other. Payload checksums do not establish unique allocator ownership.

  8. 8.A pool reference consists of a slot index only. A stale reference names slot 2 after its old object was freed and slot 2 was reused. What can the stale client incorrectly access?

    Show answer and explanation
    1. A guaranteed null object because the index is unchanged
    2. Only an automatic immutable snapshot of the old object
    3. A different object's contents in the reused slot
    4. A new slot outside the pool by definition

    Answer: A different object's contents in the reused slot

    The index identifies storage, not a particular lifetime in that storage. Reuse can make a stale reference appear numerically valid while naming a new object. A generation check needs an appropriate wrap and lifetime contract as well.

  9. 9.A parser writes a result into caller-owned storage and returns a view into that storage. The caller immediately overwrites the storage for its next packet while another component retains the view. What contract was violated?

    Show answer and explanation
    1. The view's backing storage must remain stable during use
    2. Returning a view always copies the underlying bytes
    3. A read-only view prevents its owner from modifying storage
    4. The parser must have used floating point

    Answer: The view's backing storage must remain stable during use

    A view generally borrows storage rather than owning a copy. Const or read-only access through the view does not stop the owner from reusing the same bytes. Ownership and permitted reuse must cover all active users.

  10. 10.A C function returns a pointer to a nonstatic local array. The caller dereferences it after the function has returned. Is the pointer made valid because a debugger still shows the old bytes?

    Show answer and explanation
    1. Yes, until a different function uses an array
    2. Yes, because unchanged physical bytes extend object lifetime
    3. No; the array's lifetime has ended
    4. Yes, if the caller only reads one byte

    Answer: No; the array's lifetime has ended

    The local array's lifetime ends on return. Seeing residual bytes is not a language-level lifetime guarantee. The result must instead use storage with a sufficient lifetime, such as caller-provided or explicitly owned storage.

  11. 11.A nonzero-size C realloc call fails and returns null. Code assigns that result directly over the only pointer to an existing allocation while trying to resize it. What information can be lost under realloc's failure contract?

    Show answer and explanation
    1. The pointer needed to retain or free the original allocation
    2. Every pointer elsewhere in the process becomes null
    3. The original allocation is automatically freed on every failure
    4. Only the requested new size, never access to old storage

    Answer: The pointer needed to retain or free the original allocation

    For a nonzero resize request, a failed realloc leaves the original allocation intact. Overwriting its only pointer can leak it. Keep the original pointer until the resize result is checked, according to the allocator's actual contract.

  12. 12.A moving buffer can grow during append. A component stores a pointer into its middle, then append relocates the buffer and releases the old storage. What must happen before using that interior reference again?

    Show answer and explanation
    1. Assume realloc preserves every interior pointer
    2. Use volatile to extend the old allocation's lifetime
    3. Reestablish it against the new owned buffer
    4. Add the old capacity to the stale pointer

    Answer: Reestablish it against the new owned buffer

    Relocation invalidates pointers into the released allocation. A validated offset may help reconstruct a reference to the corresponding bytes in the new object, provided the data and bounds still exist. Volatile does not repair lifetime.

  13. 13.A supplied worst-case stack model has main frames totaling 320 bytes. At the deepest point an interrupt uses 96 bytes, and a permitted nested interrupt adds 80 bytes on the same stack. What peak follows, excluding other overhead?

    Show answer and explanation
    1. 320 bytes
    2. 400 bytes
    3. 496 bytes
    4. 416 bytes

    Answer: 496 bytes

    The permitted overlap is 320+96+80=496 bytes. Taking the maximum handler frame alone misses nesting. This answer uses the stated frame bounds; context-save, alignment, and other target costs must be included if the model has them.

  14. 14.Tasks A and B have separate stacks of 600 and 800 bytes. Their calls cannot overlap within either task, but both stacks remain reserved simultaneously. What RAM reservation follows?

    Show answer and explanation
    1. 800 bytes
    2. 600 bytes
    3. 1,400 bytes
    4. 200 bytes

    Answer: 1,400 bytes

    Separate reserved stacks occupy RAM even when one task is not executing. Under this allocation model the reservation is the sum, 600+800=1,400. Mutually exclusive CPU execution does not let the same reserved bytes serve both stacks automatically.

  15. 15.A stack watermark reports 180 bytes overwritten after one test. An untested error path can allocate a larger frame. What does the watermark establish by itself?

    Show answer and explanation
    1. The compiler’s complete worst-case call and interrupt stack bound
    2. A universal maximum over every permitted error path
    3. Observed use in that execution
    4. A proof that every byte retaining the fill pattern is unreachable

    Answer: Observed use in that execution

    A watermark records effects of executions that occurred. It cannot cover an unexecuted path simply because the unused pattern survived. A justified stack budget needs the relevant paths, call and interrupt model, and target costs.

  16. 16.A stack guard detects a write beyond a protected boundary. A local buffer overflows into another local variable within the permitted stack region. What detection claim is unsupported?

    Show answer and explanation
    1. That the overflowing write occurred inside the stack region
    2. That a guard can detect any access at its protected boundary
    3. That the permitted stack occupies address space
    4. That this boundary guard detects the intra-region overwrite

    Answer: That this boundary guard detects the intra-region overwrite

    A boundary guard need not separate every local object. It can miss corruption that remains inside the accessible region. Object-level bounds checking, instrumentation, and boundary protection address different failure locations.

  17. 17.Firmware enters a fault handler because the normal stack is corrupted. That handler builds a large diagnostic object on the same damaged stack before saving any evidence. What dependency can defeat reporting?

    Show answer and explanation
    1. Dependence on the failed stack
    2. A guarantee that fault-path local arrays require no storage
    3. An automatic unlimited fresh stack on every fault entry
    4. A checksum operation that repairs the interrupted stack before any writes

    Answer: Dependence on the failed stack

    A failure path can repeat the resource failure that triggered it. An independently bounded reporting path and suitable fault-entry stack arrangement can help, but actual exception-entry and memory contracts remain target-specific.

  18. 18.A linker map assigns 24 KiB of static RAM and 10 KiB of reserved stacks within a 40 KiB region. An independent heap requires 8 KiB in that same region. Ignoring padding, what deficit follows?

    Show answer and explanation
    1. 6 KiB
    2. 8 KiB
    3. 2 KiB
    4. 0 KiB

    Answer: 2 KiB

    The requested reservation totals 24+10+8=42 KiB, exceeding the 40 KiB region by 2 KiB. A map that lists only static sections does not by itself budget every runtime reservation.

  19. 19.A section occupies 6 KiB in flash as its load image and 6 KiB in RAM at its run address after startup copying. Which resource accounting follows?

    Show answer and explanation
    1. Only 6 KiB flash because its initial bytes are constant
    2. Only 6 KiB RAM because code copies it
    3. 6 KiB flash plus 6 KiB RAM
    4. 12 KiB RAM and no flash

    Answer: 6 KiB flash plus 6 KiB RAM

    The supplied load and run regions are distinct reservations. Copying initialization bytes into RAM does not remove their load image from flash. Both regions must fit their corresponding budgets.

  20. 20.A zero-initialized 3 KiB section has no stored byte-for-byte load image under a supplied binary format. Startup clears its RAM range. What allocation still exists?

    Show answer and explanation
    1. No memory because the binary contains no payload bytes
    2. 3 KiB of RAM
    3. 3 KiB of additional nonzero flash data
    4. Only the startup instruction's own size

    Answer: 3 KiB of RAM

    Omitting zero payload bytes from a file saves load-image space, not the runtime RAM reservation. Startup must clear the intended address range before code relies on those zero-initialized objects.

  21. 21.A team places retained data in a no-initialize section. Its generic startup loop nevertheless clears the whole containing RAM bank. What happens to retention under that startup behavior?

    Show answer and explanation
    1. Only a linker checksum can decide whether writes occur
    2. The section name overrides every startup write
    3. The retained bytes are erased by the clearing loop
    4. No-initialize necessarily disables the RAM bank

    Answer: The retained bytes are erased by the clearing loop

    Section placement and startup code must agree. A no-initialize label does not prevent an explicit clearing loop from writing those addresses. Retention also requires the hardware to retain the bank in the relevant reset or power state.

  22. 22.A flash routine is copied into RAM, but its literal table remains in a flash bank that is inaccessible during the operation. What dependency remains?

    Show answer and explanation
    1. The function's RAM address proves all dependencies are in RAM
    2. A data fetch from the unavailable flash bank
    3. Only the source file's extension matters
    4. Moving instructions automatically relocates every referenced object

    Answer: A data fetch from the unavailable flash bank

    Relocating instruction bytes alone does not establish that literals, callees, vector accesses, or other dependencies are available. The linked image and target fetch behavior determine what the operation can safely access.

  23. 23.A linker drops unreferenced sections. A hardware-read vector table has no ordinary code reference and no retention rule. What build failure is possible?

    Show answer and explanation
    1. The table becomes larger because it has no references
    2. The table is removed despite hardware needing it
    3. The hardware automatically recreates the table
    4. Only its human-readable label can disappear

    Answer: The table is removed despite hardware needing it

    The linker's reachability model may not know about hardware consumers. Required sections need the appropriate retention and placement mechanism, then verification in the final linked artifact. A source declaration alone may be insufficient.

  24. 24.A source defines a 1 KiB buffer. Link-time optimization proves it unused in the selected build and removes it. Why can source-level sums disagree with the final RAM map?

    Show answer and explanation
    1. A guarantee that optimization can only increase storage reservations
    2. A rule that every declared object reserves physical bytes in every build
    3. Link-time retention and elimination
    4. A requirement to preserve eliminated objects as anonymous heap storage

    Answer: Link-time retention and elimination

    Source estimates can count eliminated objects or miss toolchain-generated storage. The final map and binary describe that particular build's retained sections; runtime allocations and stacks still need their own budgets.

  25. 25.A supplied memory-protection unit accepts power-of-two regions aligned to their size. A 6 KiB object begins at an 8 KiB-aligned address. What smallest single region can cover it under this rule?

    Show answer and explanation
    1. 6 KiB
    2. 12 KiB
    3. 4 KiB
    4. 8 KiB

    Answer: 8 KiB

    A 4 KiB region is too small and a 6 KiB region is not permitted. An 8 KiB region at the stated aligned base covers the object, including 2 KiB of additional address range that protection analysis must account for.

  26. 26.A packet declares length L, and the supplied unsigned size type has maximum 65,535. A buffer must hold L+8 bytes. Which precheck prevents that addition from wrapping?

    Show answer and explanation
    1. L≤65,527
    2. L≤65,535
    3. L≥8
    4. L+8≥L, evaluated only after allocation

    Answer: L≤65,527

    Require L≤MAX−8 before computing the sum in that type. For this model the limit is 65,527. Checking a wrapped result after using it cannot establish that the allocation covered the declared payload.

  27. 27.An unsigned 16-bit allocation-size computation stores 300×300 in that type. The actual buffer needs one byte per element. What truncated size follows modulo 65,536?

    Show answer and explanation
    1. 90,000 bytes
    2. 24,464 bytes
    3. 65,535 bytes
    4. 300 bytes

    Answer: 24,464 bytes

    The mathematical product is 90,000. Reduction modulo 65,536 gives 24,464. A successful allocation of that smaller size does not make later writes for 90,000 elements valid; validate multiplication before narrowing or allocating.

  28. 28.For nonnegative element count n and positive element size s, an allocator can represent at most M bytes. Which division-based condition safely checks the product bound before multiplying?

    Show answer and explanation
    1. n≥floor(M/s), because larger counts need fewer bytes
    2. n≤floor(M/s)
    3. n+s≤M regardless of the positive element size
    4. n≤M×s, with that product computed without a separate bound

    Answer: n≤floor(M/s)

    For s>0, n×s≤M is equivalent to n≤floor(M/s). This avoids first computing a potentially overflowing product. The separate s=0 case and allocator-specific constraints must be handled according to the actual API contract.

  29. 29.A packet buffer has 100 bytes. A proposed slice starts at offset 80 and has length 30. Which subtraction-based bounds check correctly rejects it without adding offset and length?

    Show answer and explanation
    1. offset+length computed in an unchecked narrow type
    2. offset≤100 or length≤100−offset
    3. length≤100 alone
    4. offset≤100 and length≤100−offset

    Answer: offset≤100 and length≤100−offset

    After confirming offset≤capacity, compare length with capacity−offset. Here only 20 bytes remain, so length 30 fails. The order matters when subtraction uses an unsigned type; an out-of-range offset must not be subtracted first.

  30. 30.A supplied C implementation has 32-bit int and unsigned int, and both operands of a comparison are int and unsigned int respectively. For int a=−1 and unsigned int b=1, what does a<b evaluate to?

    Show answer and explanation
    1. A compile-time error in every conforming implementation
    2. Always undefined behavior
    3. False
    4. True

    Answer: False

    The usual arithmetic conversions convert a to unsigned int in this stated model. Its value becomes UINT_MAX, which is not less than one. The comparison is defined here, but it does not express a signed mathematical comparison of −1 and 1.

  31. 31.A C17 implementation has 32-bit int. It computes int result=50,000*50,000 with both operands of type int. Is assigning the result afterward to a 64-bit object sufficient to make this multiplication defined?

    Show answer and explanation
    1. No; the int multiplication already overflows
    2. Only if the destination is volatile
    3. Yes; the destination controls every intermediate type
    4. Yes; all signed integer products wrap in C17

    Answer: No; the int multiplication already overflows

    The product 2,500,000,000 exceeds the stated signed-int maximum. Widen an operand before multiplication so the operation itself uses a sufficiently wide type. A wider destination cannot retroactively repair signed overflow.

  32. 32.On a stated C17 target, uint16_t is unsigned short, int is 32-bit, and int represents all uint16_t values. For uint16_t a=60,000,b=60,000, what type performs a*b before assignment?

    Show answer and explanation
    1. int
    2. uint16_t
    3. unsigned long long automatically
    4. The destination variable's type

    Answer: int

    Integer promotions convert both operands to int on this target. The product then exceeds the signed-int range. The unsigned type of the stored operands alone does not guarantee unsigned multiplication after promotion.

  33. 33.In C17, a uint32_t value is shifted left by 32 on a target where uint32_t is an unpromoted 32-bit unsigned int. What language-level result is guaranteed?

    Show answer and explanation
    1. The original value on every conforming C17 implementation
    2. A count of zero because every source-language shift uses CPU count masking
    3. Zero on every conforming C17 implementation
    4. No guaranteed defined result

    Answer: No guaranteed defined result

    For this promoted operand width, a shift count must be less than 32. An instruction's possible count masking does not define an out-of-range C expression. Check the count and choose the intended boundary behavior explicitly.

  34. 34.In C17, firmware right-shifts a negative signed integer. No implementation behavior is specified in the question. Can a portable result be inferred solely from the mathematical value and shift count?

    Show answer and explanation
    1. Yes; the result always rounds toward zero like signed division
    2. Yes; signed and unsigned right shifts always give the same result
    3. Yes; the operation always fills with zero bits
    4. No; the C17 result is implementation-defined

    Answer: No; the C17 result is implementation-defined

    C17 leaves the result of right-shifting a negative signed value implementation-defined. Use a specified representation and operation when a particular rounding or sign-fill rule is required. Later language editions may use different rules.

  35. 35.A C17 loop uses an 8-bit unsigned char i on an implementation with UCHAR_MAX=255: for(i=0;i<=255;i++). There is no break. What happens to the termination condition?

    Show answer and explanation
    1. The loop must run exactly 255 times
    2. It becomes false when i stores 256
    3. It stays true when i wraps from 255 to zero
    4. Unsigned increment at 255 necessarily raises a language exception

    Answer: It stays true when i wraps from 255 to zero

    Every representable i is at most 255. Increment converts the next value back into unsigned char, returning to zero. The condition remains true. A wider loop variable or a condition that fits the intended iteration contract avoids this trap.

  36. 36.A parser receives five raw bytes and passes their address to a C function that requires a null-terminated string. No zero byte is present in or guaranteed after those five bytes. What input contract is missing?

    Show answer and explanation
    1. Termination within accessible storage or a bounded alternative
    2. A declaration of the same byte pointer as volatile
    3. An assumption that raw packet length automatically supplies a following zero byte
    4. A checksum over the five bytes, regardless of string termination

    Answer: Termination within accessible storage or a bounded alternative

    Raw byte length and string termination are distinct properties. A string function can continue reading beyond the available object when no valid terminator exists. Use a length-aware operation or establish termination within properly allocated storage.

  37. 37.A C function receives int values[20] as a parameter and computes sizeof(values)/sizeof(values[0]) to recover the caller's array length. What did the parameter declaration actually provide?

    Show answer and explanation
    1. A compile-time guarantee that every caller passes 20 elements
    2. A complete 20-element local array copy
    3. A pointer parameter, not a retained array-length value
    4. A hidden mandatory runtime length field

    Answer: A pointer parameter, not a retained array-length value

    An ordinary array parameter is adjusted to a pointer parameter. sizeof(values) therefore measures the pointer in this function. An explicit length or an API with appropriate bounds information is needed; syntax alone does not recover the caller's actual allocation.

  38. 38.Two byte ranges overlap: destination begins one byte after source, and four bytes must be moved within the same array. Which standard C operation has the overlap contract needed here?

    Show answer and explanation
    1. memmove
    2. memcpy
    3. strcpy for arbitrary binary bytes
    4. memcmp

    Answer: memmove

    memmove supports overlapping source and destination ranges when the specified ranges are otherwise valid. memcpy requires nonoverlap. Correct length, accessible storage, and object requirements still matter whichever operation is chosen.

  39. 39.A struct has padding bytes whose values are not part of its member values. Two instances have equal member values. What can a raw memcmp of the whole struct establish about logical equality in general?

    Show answer and explanation
    1. Guaranteed member-wise inequality whenever any padding byte differs
    2. A representation difference despite equal member values
    3. A comparison that automatically ignores padding and applies member semantics
    4. A promise that sizeof excludes all padding bytes

    Answer: A representation difference despite equal member values

    Object representation includes padding on the stated implementation. Comparing that representation need not match member-wise equality. Define logical equality over the relevant members rather than treating unspecified padding as application data.

  40. 40.A C17 program reads a float object through an unrelated uint32_t pointer, assuming alignment is adequate. Does adequate alignment alone establish that this typed access is allowed?

    Show answer and explanation
    1. Only the source variable's spelling decides aliasing
    2. No; the language's aliasing/access rules also apply
    3. Yes; matching widths make all object types interchangeable
    4. Yes; alignment is the only rule for every pointer cast

    Answer: No; the language's aliasing/access rules also apply

    An aligned address does not by itself permit access through an incompatible type. A suitable byte copy can inspect representation without that particular incompatible lvalue access, but interpreting the bits still depends on the format and target contract.

  41. 41.A packet reserves three bytes for a little-endian unsigned value: [0x10,0x20,0x30]. With explicitly widened unsigned assembly, what 24-bit value follows?

    Show answer and explanation
    1. 0x302010
    2. 0x201030
    3. 0x003020
    4. 0x102030

    Answer: 0x302010

    The lowest-addressed byte contributes bits 7:0, then 0x20 contributes bits 15:8 and 0x30 bits 23:16. Their combination is 0x302010. This explicitly defined packet format need not match the CPU's native representation.

  42. 42.A signed field uses sign-magnitude with one sign bit and seven magnitude bits, unlike two's complement. Bits are 0x85. Under the supplied encoding, what value follows?

    Show answer and explanation
    1. 133
    2. −5
    3. −123
    4. 5

    Answer: −5

    The top bit marks negative and the low seven bits contain magnitude five. The result is −5 under this explicitly supplied encoding. A sign-extension rule for two's complement would decode a different format.

  43. 43.A range needs every integer from −300 through +300 inclusive. Using ordinary two's-complement signed widths, what smallest listed width suffices?

    Show answer and explanation
    1. 9 bits
    2. 10 bits
    3. 16 bits as the only mathematically sufficient width
    4. 8 bits

    Answer: 10 bits

    Nine signed bits cover −256 through 255, which is too small. Ten cover −512 through 511. Storage types and hardware access widths can impose additional implementation choices beyond this mathematical minimum.

  44. 44.A buffer pointer p addresses an array of ten bytes. In C, which statement about p+10 is correct?

    Show answer and explanation
    1. It may be read whenever the physical memory appears unchanged
    2. It cannot even be formed for a valid end-of-array comparison
    3. It is a one-past pointer, not a readable element
    4. It points to an eleventh byte guaranteed to belong to this array

    Answer: It is a one-past pointer, not a readable element

    C permits a pointer one past an array for appropriate pointer operations and comparisons. It does not create an extra element. Dereferencing that one-past pointer is outside the array's accessible elements.

  45. 45.Two separately allocated objects happen to have adjacent numerical addresses. A C routine subtracts pointers into those unrelated allocations to infer an element count. What premise is missing for defined array pointer subtraction?

    Show answer and explanation
    1. A shared array-object relationship
    2. Equal pointer types and numerical adjacency, regardless of allocation ownership
    3. A guarantee that both printed numerical addresses are nonzero
    4. Allocation of both objects during the same startup phase

    Answer: A shared array-object relationship

    Pointer subtraction has an array-object requirement; numerical adjacency alone does not combine distinct allocations into one array. Track sizes and offsets within the actual owner rather than inferring a shared array from addresses.

  46. 46.A checked parser narrows a received 32-bit length to 16 bits before comparing it with capacity 100. A supplied input length is 65,540. What narrowed value can pass that check despite the original request being too large?

    Show answer and explanation
    1. 4
    2. 65,535
    3. 65,540
    4. 100

    Answer: 4

    Conversion to an unsigned 16-bit value reduces 65,540 modulo 65,536, yielding four. Validate the original range before narrowing. Checking only the truncated value does not bound the original declared request.

  47. 47.A C helper receives n=0 as an unsigned size and evaluates n−1 before checking n. What value category follows under unsigned arithmetic?

    Show answer and explanation
    1. A required processor exception instead of any representable integer value
    2. A negative signed value automatically produced by the subtraction
    3. Zero because unsigned arithmetic always saturates at its lower bound
    4. The unsigned type’s maximum

    Answer: The unsigned type’s maximum

    Unsigned subtraction is modulo one more than the type's maximum. Subtracting one from zero yields that maximum. Empty-range checks must precede calculations that assume at least one element.

  48. 48.Firmware validates a packet length, then another writer can change that same shared length before it controls a memory copy. What correctness issue remains even if the original bounds check was mathematically right?

    Show answer and explanation
    1. A bounds check permanently freezes all shared fields
    2. Only the packet's numerical byte order can change
    3. The copy length must equal zero by language rule
    4. The used value can differ from the validated value

    Answer: The used value can differ from the validated value

    Validation must apply to the data actually used. An appropriate stable snapshot or ownership protocol must keep the relevant fields and storage consistent through the operation. A correct check on an earlier value does not validate a later changed value.

  49. 49.A library API reports a length in 16-bit words. A driver supplies the same numeric value as a byte count to a byte-copy API. For a reported length of 12 words, how much data does it omit?

    Show answer and explanation
    1. 24 bytes
    2. 6 bytes
    3. 12 bytes
    4. 0 bytes

    Answer: 12 bytes

    Twelve 16-bit words contain 24 bytes. Copying only 12 bytes omits half the data, or 12 bytes. Type widths and unit contracts must be explicit at the API boundary; identical numeric values do not imply identical quantities.

  50. 50.A buffer of capacity 32 must contain an ASCII payload plus a terminating zero byte. Embedded zeros are not allowed in this payload. What largest payload length fits?

    Show answer and explanation
    1. 31 bytes
    2. 33 bytes
    3. 16 bytes
    4. 32 bytes

    Answer: 31 bytes

    One of the 32 available bytes is reserved for the terminator. The payload can therefore occupy at most 31 bytes. This is a storage calculation for the supplied byte encoding, not a general count of displayed Unicode characters.

  51. 51.A signed fixed-point format stores integer k as k/256. What stored integer represents −1.5 exactly?

    Show answer and explanation
    1. −384
    2. −512
    3. −128
    4. −256

    Answer: −384

    Multiply the real value by the scale: −1.5×256=−384. The question specifies the scale directly; informal Q-format names can be ambiguous about how sign and integer bits are counted.

  52. 52.A signed 16-bit stored integer represents value k/1024. What maximum positive real value is representable?

    Show answer and explanation
    1. 32767/1024
    2. 1024/32767
    3. 32 exactly
    4. 65535/1024

    Answer: 32767/1024

    The largest stored signed 16-bit integer is 32,767. Dividing by the specified scale gives 31.9990234375. Positive 32 would require stored integer 32,768, outside the stated signed range.

  53. 53.An ideal fixed-point quantizer rounds to nearest with step 1/128 and has enough range to avoid clipping. What maximum absolute quantization error follows?

    Show answer and explanation
    1. 128
    2. 1/64
    3. 1/256
    4. 1/128

    Answer: 1/256

    Rounding to the nearest grid point leaves at most half a step of error, or 1/256. Tie handling decides which adjacent value is chosen at an exact midpoint but not this maximum magnitude.

  54. 54.A fixed-point encoder truncates toward zero at step 0.25. It encodes input −0.6. What represented value follows?

    Show answer and explanation
    1. −0.6 exactly
    2. −0.5
    3. −0.75
    4. 0.5

    Answer: −0.5

    −0.6 divided by 0.25 is −2.4. Truncation toward zero gives stored integer −2, representing −0.5. Flooring would instead give −3 and represent −0.75; the rounding rule matters for negative inputs.

  55. 55.A supplied integer division rule truncates toward zero. Firmware computes −7/4. What integer result follows?

    Show answer and explanation
    1. −2
    2. 0
    3. −1
    4. 1

    Answer: −1

    The exact quotient is −1.75; truncation toward zero gives −1. This differs from mathematical floor, which would give −2. Fixed-point rescaling must use the intended signed rounding rule explicitly.

  56. 56.Two stored integers represent x=a/16 and y=b/16. Their exact product uses stored integer a×b before rescaling. What scale does that raw product have?

    Show answer and explanation
    1. 256 per stored unit
    2. 1/16 per stored unit
    3. 1/32 per stored unit
    4. 1/256 per stored unit

    Answer: 1/256 per stored unit

    Multiplying the values gives xy=(a×b)/(16×16). The raw product therefore has scale 1/256. Returning to a 1/16 output scale requires a defined division and rounding step after using enough intermediate width.

  57. 57.A coefficient is stored at scale 1/100 as k=30, and an input at scale 1/10 as m=15. What real product do those stored values represent before output rounding?

    Show answer and explanation
    1. 0.045
    2. 4.5
    3. 45
    4. 0.45

    Answer: 0.45

    The represented operands are 30/100=0.3 and 15/10=1.5. Their product is 450/1000=0.45. Treating both stored integers as though they shared a scale would give the wrong unit conversion.

  58. 58.An unsigned accumulator sums 16 values, each at most 255. What smallest listed bit width contains every possible exact sum?

    Show answer and explanation
    1. 11 bits
    2. 12 bits
    3. 10 bits
    4. 8 bits

    Answer: 12 bits

    The maximum sum is 16×255=4,080. Eleven unsigned bits reach only 2,047, while twelve reach 4,095. This bounds the stated sum; additional bias or later operations would require separate analysis.

  59. 59.A dot product sums ten signed products. Each product is already known to lie in [−900,900], with no correlations that reduce the bound. What sufficient symmetric magnitude bound follows for the sum?

    Show answer and explanation
    1. 1,800
    2. 9,000
    3. 90,000
    4. 900

    Answer: 9,000

    The triangle inequality gives at most ten times 900 in magnitude, or 9,000. Individual product bounds do not justify cancellation. This is a sufficient worst-case bound, even if some real workloads never attain it.

  60. 60.A filter's stored arithmetic saturates to [−100,100] after each addition. What is the result of (80+50)+(-50) under this rule?

    Show answer and explanation
    1. 80
    2. −20
    3. 50
    4. 100

    Answer: 50

    The first sum 130 saturates to 100, then adding −50 yields 50. Reassociating as 80+(50−50) gives 80, so per-operation saturation changes associativity and can make algebraic rearrangements behaviorally significant.

  61. 61.A control output saturates at 100, but its integrator continues accumulating a positive error internally. Later the error turns negative yet output stays at the limit for many steps. What stored-state issue does this demonstrate?

    Show answer and explanation
    1. A proof that the sampling clock has stopped
    2. Integrator windup beyond the actuator's usable range
    3. An arithmetic identity that all saturation removes memory
    4. A mandatory change in packet byte order

    Answer: Integrator windup beyond the actuator's usable range

    Clamping the final output alone need not constrain internal accumulated state. An anti-windup policy must coordinate the integrator with the actual output constraints and control design. The appropriate policy depends on the controller and plant model.

  62. 62.A quantized recurrence is y_next=floor(y/2) for integer y, including negative values. Starting y=−1 with zero external input, what state persists?

    Show answer and explanation
    1. An alternating +1,−1 cycle
    2. 1
    3. −1
    4. 0

    Answer: −1

    floor(−1/2)=−1, so −1 is a fixed point. Quantization and rounding can create nonzero residual states even when the corresponding exact real-valued recurrence tends toward zero. A different signed rounding rule changes this example.

  63. 63.A supplied exact fixed-point rescale computes round-to-nearest-even of 2.5 and 3.5. Which pair follows?

    Show answer and explanation
    1. 3 and 4
    2. 2 and 4
    3. 3 and 3
    4. 2 and 3

    Answer: 2 and 4

    At an exact halfway case, nearest-even chooses the neighboring even integer. Thus 2.5 rounds to two and 3.5 to four. This rule avoids systematically choosing the same side of every tie but does not guarantee unbiased error for every input distribution.

  64. 64.Firmware rescales 5/2 and 5/2 separately to integers using truncation, then adds. Another version adds the exact fractions first and truncates once. What pair of totals follows?

    Show answer and explanation
    1. 4 and 4
    2. 5 and 5
    3. 5 and 4
    4. 4 and 5

    Answer: 4 and 5

    Separate truncations give two plus two, or four. The exact sum is five and stays five when truncated once. Moving a rescale across an addition can change numerical behavior even without overflow.

  65. 65.A calibration subtracts baseline 2,000 from raw unsigned reading 1,900. The required physical result is signed −100. What must the arithmetic preserve?

    Show answer and explanation
    1. A conversion to a narrow unsigned type before subtraction
    2. The unsigned result as proof the value cannot be negative
    3. A signed range that represents the negative difference
    4. The assumption that subtraction always saturates at zero

    Answer: A signed range that represents the negative difference

    The mathematical difference is −100. Choose operand conversions and an intermediate range that actually represent it before any narrowing. Merely assigning a wrapped unsigned result to a signed destination does not establish the desired computation portably.

  66. 66.A reciprocal approximation gives relative error at most 0.01 in magnitude. An otherwise exact positive multiplication uses it to approximate division. What relative-error bound follows under this supplied model?

    Show answer and explanation
    1. Exactly zero for every divisor
    2. At most 0.01
    3. The absolute input value regardless of divisor
    4. At most 1.0

    Answer: At most 0.01

    If the approximate reciprocal is (1/d)(1+ε), multiplying by exact x gives (x/d)(1+ε). The relative error remains ε in this simplified nonzero-result model. Quantization, underflow, clipping, and other arithmetic errors were explicitly excluded.

  67. 67.A computation sums 1,000 nonnegative terms, each independently rounded with absolute error≤0.001. With no cancellation assumption, what absolute accumulated error bound is justified?

    Show answer and explanation
    1. 0.001
    2. 0.000001
    3. Exactly zero
    4. 1.0

    Answer: 1.0

    The triangle inequality permits a worst-case total error of 1,000×0.001=1.0. A square-root-of-count estimate would require statistical assumptions about error dependence and bias that the question does not supply.

  68. 68.Two filters use the same nominal coefficients, but one stores intermediate state at 12 bits and the other at 24 bits. What is required before claiming bit-for-bit equivalent outputs?

    Show answer and explanation
    1. Matching finite-precision operation and state semantics
    2. Only matching the coefficient decimals printed in a design document
    3. Only using the same filter function name in both compiled binaries
    4. Only processing the same number of input samples

    Answer: Matching finite-precision operation and state semantics

    Finite-precision state and intermediate operations are part of a filter's behavior. Coefficients alone do not define bit-exact equivalence. Establish equivalence under the actual representation, update order, saturation or wrap, and initial-state rules.

  69. 69.An index lookup approximates a function by choosing the lower endpoint on intervals of width 0.02. A supplied Lipschitz bound is abs(f(x)−f(y))≤3abs(x−y). What uniform error bound follows within an interval?

    Show answer and explanation
    1. 3.02
    2. 0.06
    3. 0.006
    4. 0.02

    Answer: 0.06

    The farthest input-to-lower-endpoint separation is at most 0.02. Multiplying by the supplied Lipschitz constant gives error at most 0.06. This bounds lookup approximation only, excluding stored-value quantization and other computation errors.

  70. 70.A firmware estimate stores a positive variance. Rounding a tiny positive value to zero leads later code to divide by that stored variance. What numerical precondition needs an explicit policy?

    Show answer and explanation
    1. Division by stored zero automatically restores the lost precision
    2. Increasing only the input sampling rate proves a positive stored denominator
    3. The denominator must remain valid for the later operation
    4. Positive real inputs can never quantize to zero

    Answer: The denominator must remain valid for the later operation

    A valid real-valued model does not ensure every quantized intermediate satisfies later preconditions. Minimum representable values, explicit rejection, or another justified numerical policy must be part of the design; silently dividing by zero is not a precision fix.

  71. 71.A battery task has two mathematically equivalent energy formulas. One subtracts nearly equal large floating-point numbers to obtain a tiny residual. What numerical risk should the implementation assess?

    Show answer and explanation
    1. A guaranteed buffer overrun
    2. Automatic exact integer arithmetic for every subtraction
    3. A rule that equivalent algebra always produces identical floating-point error
    4. Loss of significant digits in the small difference

    Answer: Loss of significant digits in the small difference

    When approximate large operands nearly cancel, their small absolute errors can dominate the residual. Algebraic equivalence over real numbers does not establish equal finite-precision behavior. Evaluate conditioning, input uncertainty, and a suitable formulation for the required range.

  72. 72.An unsigned measurement has maximum 1,023. Firmware computes its square exactly before taking a later square root. What smallest listed unsigned width holds the square?

    Show answer and explanation
    1. 16 bits
    2. 19 bits
    3. 20 bits
    4. 10 bits

    Answer: 20 bits

    1,023²=1,046,529, which exceeds 19-bit maximum 524,287 and fits within 20-bit maximum 1,048,575. The later square root does not excuse overflow in the intermediate square.

  73. 73.A three-axis squared magnitude uses three independent signed inputs with abs(x),abs(y),abs(z)≤100. Ignoring later operations, what maximum exact nonnegative sum follows?

    Show answer and explanation
    1. 10,000
    2. 30,000
    3. 300
    4. 90,000

    Answer: 30,000

    Each square is at most 10,000, and all three bounds can occur together. Their sum is therefore at most 30,000. Signed range, multiplication promotion, and the accumulator's width must all support the chosen representation.

  74. 74.A running average is updated as avg += (sample−avg)/8 using signed integer division toward zero. avg=100 and sample=101 repeatedly. What state follows without a fractional residual mechanism?

    Show answer and explanation
    1. avg alternates between 100 and 101 automatically
    2. avg reaches 101 after exactly eight updates
    3. avg becomes 108 immediately
    4. avg stays 100

    Answer: avg stays 100

    Each update computes (101−100)/8 as zero, so the state never moves. Retaining fractional state or a remainder can change that behavior. A real-valued exponential average has a different convergence behavior from this quantized recurrence.

  75. 75.A signed two's-complement 8-bit value is −128. Its positive mathematical magnitude is 128. Can that magnitude be represented in the same signed 8-bit type?

    Show answer and explanation
    1. Yes, as +128
    2. Yes, as +127 without error
    3. Only if the value is declared volatile
    4. No

    Answer: No

    The signed range is −128 through 127. The negative endpoint has no positive counterpart in that same type. Absolute-value, negation, and narrowing operations need a range that can represent the required mathematical result.

  76. 76.A device has a 2 KiB queue reservation and messages of 96 bytes plus 32 bytes metadata each. There is no other per-slot cost. How many complete slots fit?

    Show answer and explanation
    1. 16
    2. 32
    3. 64
    4. 21

    Answer: 16

    Each slot needs 128 bytes. 2 KiB is 2,048 bytes, so the reservation holds 2,048/128=16 complete slots. Ignoring metadata would overestimate usable capacity.

  77. 77.A zero-copy fan-out sends one 1 KiB block to three readers. Each reader has an 8-byte descriptor. The block stays shared and no payload is duplicated. What total payload-plus-descriptor memory is live?

    Show answer and explanation
    1. 1,048 bytes
    2. 1,024 bytes
    3. 3,096 bytes
    4. 3,072 bytes

    Answer: 1,048 bytes

    There is one 1,024-byte payload and three 8-byte descriptors: 1,024+24=1,048 bytes. Sharing reduces payload copies but requires a lifetime that extends until all readers finish.

  78. 78.A broadcast block has reference count three for three valid readers. Two readers release it. What count remains, assuming exact serialized bookkeeping?

    Show answer and explanation
    1. 1
    2. 3
    3. 0
    4. 2

    Answer: 1

    Each reader releases one reference, so three minus two leaves one. Reclaiming the block at that point would violate the remaining reader's ownership. Reference counting also needs correct synchronization and a policy for every acquisition and release path.

  79. 79.Two heap objects each own the other through a strong reference count. External references disappear, but each object's count remains one. What memory-management limitation is exposed?

    Show answer and explanation
    1. Immediate reclamation because there are no remaining external clients
    2. A reduction in their combined payload size without changing either object
    3. A strong-reference cycle
    4. Automatic discovery and collection of all unreachable objects by counting alone

    Answer: A strong-reference cycle

    The objects can be unreachable from clients while keeping each other's counts nonzero. Ownership graphs need a suitable cycle policy, weak links, or another reclamation mechanism. Correct arithmetic on the counts alone does not solve reachability cycles.

  80. 80.A telemetry path can create 20 distinct blocks per second, and each block may remain owned for up to 0.5 seconds. The model permits an instantaneous initial burst of four plus subsequent arrivals bounded by 20t over any duration t. What peak live-block bound follows?

    Show answer and explanation
    1. 4
    2. 24
    3. 10
    4. 14

    Answer: 14

    Within a maximum 0.5-second holding window, the arrival envelope permits 4+20×0.5=14 blocks. This uses the supplied burst-plus-rate bound, not merely a long-run average. Endpoint conventions and discrete arrivals must follow the actual model.

  81. 81.A producer may issue an unlimited instantaneous burst even though its long-run average is below consumer throughput. Does that average alone justify a finite lossless queue size?

    Show answer and explanation
    1. No
    2. Yes, capacity equals average rate numerically
    3. Only if every payload has the same checksum
    4. Yes, a one-element queue always suffices

    Answer: No

    A long-run average does not bound burst size or the arrival demand in a finite service interval. A finite lossless capacity needs an appropriate arrival envelope, backpressure, or a changed loss/latency contract.

  82. 82.A latest-sample buffer replaces old unsent state with the newest sample. A requirement instead demands a complete audit trail of every sample. What mismatch exists?

    Show answer and explanation
    1. A latest-value buffer necessarily retains all prior generations
    2. The overwrite policy discards required history
    3. The buffer's address alone proves durable history
    4. The audit requirement fixes the CPU's endianness

    Answer: The overwrite policy discards required history

    A latest-state policy can be suitable for freshness but intentionally loses intermediate states. It does not meet a requirement to retain every event. Queueing, durable storage, admission, or explicit loss behavior must match the information contract.

  83. 83.A compressor promises at most input size plus 12 bytes overhead, and can produce that maximum on incompressible input. A 200-byte input is accepted. What output capacity is sufficient under this bound?

    Show answer and explanation
    1. 200 bytes
    2. 212 bytes
    3. 12 bytes
    4. 188 bytes

    Answer: 212 bytes

    The worst-case bound is 200+12=212 bytes. Expected compression ratio is not an allocation bound. Use the actual codec's documented maximum and check arithmetic for the permitted input range.

  84. 84.A decoder accepts a 64-byte compressed packet that can expand to 4 KiB. Its output buffer is 1 KiB, and it checks only compressed input size. What resource bound is missing?

    Show answer and explanation
    1. The assumption that compressed output is never larger than input
    2. A different spelling for the packet type
    3. A check that 64 is less than the compressed input buffer
    4. A validated bound on decompressed output

    Answer: A validated bound on decompressed output

    A small encoded input can describe a much larger output. Enforce output capacity, work limits, and format validity during decoding. Validating only the compressed byte count does not bound expansion.

  85. 85.A parser handles nesting iteratively with an explicit stack of 32 entries. Input grammar permits arbitrary depth, and no depth rejection exists. What changed about the resource problem?

    Show answer and explanation
    1. A still-bounded stack needing overflow handling
    2. An unlimited allocation because an explicit stack is not a call stack
    3. A proof that iteration makes arbitrary nesting fit into 32 entries
    4. An automatic change to the grammar’s permitted input language

    Answer: A still-bounded stack needing overflow handling

    Replacing recursion can make resource use easier to control, but the permitted input can still exceed the explicit stack's capacity. The parser must reject, stream, or otherwise handle such depth according to its contract.

  86. 86.A log record needs 40 bytes plus a 4-byte checksum and is padded to a 16-byte boundary. A 4 KiB region has no other metadata. How many complete records fit?

    Show answer and explanation
    1. 102
    2. 85
    3. 93
    4. 256

    Answer: 85

    Each padded record uses 48 bytes. floor(4,096/48)=85, leaving 16 bytes. Format padding, checksums, and any additional page or index metadata belong in storage budgeting.

  87. 87.A ring stores 100 bytes per second in 10,000 usable bytes. It overwrites the oldest byte when full and has no compression. What steady-state history duration does capacity represent?

    Show answer and explanation
    1. 100 seconds
    2. 10 seconds
    3. 10,000 seconds
    4. 1,000 seconds

    Answer: 100 seconds

    The history window is usable capacity divided by arrival rate: 10,000/100=100 seconds. This does not make overwritten history recoverable, and real record metadata or bursts can change the effective time window.

  88. 88.A memory scrub takes 3 μs per KiB. The startup deadline permits only 60 μs for this scrub step. Under the linear model, what maximum size fits?

    Show answer and explanation
    1. 3 KiB
    2. 180 KiB
    3. 60 KiB
    4. 20 KiB

    Answer: 20 KiB

    Dividing the 60 μs budget by 3 μs per KiB gives 20 KiB. Other startup work is excluded by the stated step-specific budget. Actual bandwidth, contention, and target initialization rules need separate evidence.

  89. 89.A supplied energy model charges 2 μJ to enter and leave deep sleep, while deep sleep saves 0.5 mW relative to idle. Ignoring all other differences, what sleep duration breaks even?

    Show answer and explanation
    1. 1 ms
    2. 4 ms
    3. 4 seconds
    4. 40 ms

    Answer: 4 ms

    Break-even time equals transition energy divided by power saved: 2×10⁻⁶ J divided by 0.5×10⁻³ W is 0.004 s. Shorter intervals cost more transition energy than they save under this model.

  90. 90.Mode A uses 10 mW for 2 ms then zero for the rest of a 10 ms window. Mode B uses 3 mW for all 10 ms. Ignoring transition energy, which consumes less in the window?

    Show answer and explanation
    1. A:20 μJ versus B:6 μJ
    2. A:100 μJ versus B:30 μJ
    3. Both:30 μJ
    4. A:20 μJ versus B:30 μJ

    Answer: A:20 μJ versus B:30 μJ

    Energy is power times duration. A uses 10 mW×2 ms=20 μJ; B uses 3 mW×10 ms=30 μJ. A faster mode can consume less here, but the result follows these supplied numbers rather than a universal clock-speed rule.

  91. 91.A subsystem consumes 100 μJ whenever it wakes, regardless of the number of records sent, plus 1 μJ per record. What energy sends ten records in one wake instead of ten separate wakes?

    Show answer and explanation
    1. 110 μJ instead of 1,010 μJ
    2. 10 μJ in both cases
    3. 100 μJ in both cases
    4. 1,010 μJ instead of 110 μJ

    Answer: 110 μJ instead of 1,010 μJ

    Batching pays the fixed wake cost once: 100+10=110 μJ. Ten individual wakes cost ten times 101=1,010 μJ. Memory, freshness, and failure requirements still constrain whether this batching policy is acceptable.

  92. 92.A retained 8 KiB RAM bank draws 4 μA during sleep; disabling it saves that current but requires 12 μJ to reconstruct its contents later at 3 V. Ignoring other costs, what sleep interval breaks even?

    Show answer and explanation
    1. 1 second
    2. 12 seconds
    3. 3 seconds
    4. 0.1 second

    Answer: 1 second

    The saved power is 3 V×4 μA=12 μW. Reconstructing costs 12 μJ, so the break-even interval is one second. The contents must actually be reconstructible, and latency requirements are separate from energy accounting.

  93. 93.Two tasks share one scratch arena because their main functions are mutually exclusive. An asynchronous completion from task A may still use it after task B starts. What fact defeats the sharing argument?

    Show answer and explanation
    1. Scratch memory cannot be shared in any possible design
    2. Mutual exclusion of main calls proves all callbacks have finished
    3. Only allocation alignment matters for arena reuse
    4. Memory-use lifetimes overlap despite nonoverlapping main calls

    Answer: Memory-use lifetimes overlap despite nonoverlapping main calls

    The relevant overlap is every access lifetime, including asynchronous work. Sharing can be valid only when ownership and completion establish that previous users are finished before reuse. Function return alone is not always that completion boundary.

  94. 94.A queue stores pointers to dynamically allocated messages. Removing an entry does not free its payload under this API. The shutdown loop discards every entry but never releases payloads. What leak remains?

    Show answer and explanation
    1. No leak because removing a pointer frees its referent in C
    2. Only stack storage that disappears on function return
    3. Only the queue's numerical occupancy counter
    4. The pointed-to message allocations

    Answer: The pointed-to message allocations

    Container membership and payload ownership are separate. If shutdown owns the responsibility to free each message, dropping its pointer without release leaks that allocation. The API must define which participant cleans up each terminal path.

  95. 95.A startup self-test allocates 2 KiB, then frees it. A runtime task later allocates 3 KiB after that test has completed. No other lifetimes overlap. What peak for these two allocations follows, ignoring allocator overhead?

    Show answer and explanation
    1. 5 KiB
    2. 3 KiB
    3. 2 KiB
    4. 1 KiB

    Answer: 3 KiB

    For disjoint lifetimes, peak live payload is the maximum rather than the sum: 3 KiB. Whether the allocator can reuse the freed storage, and any fragmentation or overhead, are additional implementation questions excluded from this live-payload model.

  96. 96.A task can launch six asynchronous reads. Each read needs its own 256-byte response buffer until completion. What payload reservation supports all six simultaneously?

    Show answer and explanation
    1. 6 bytes
    2. 256 bytes
    3. 512 bytes
    4. 1,536 bytes

    Answer: 1,536 bytes

    Six distinct in-flight ownership intervals require six buffers: 6×256=1,536 bytes. Reusing one buffer after merely launching a read would mix concurrent operations unless a different API contract serializes or copies the data.

  97. 97.A diagnostic counter uses a saturating unsigned 8-bit value. It has reached 255, then ten more failures occur. What does the stored value establish about the true total since zero?

    Show answer and explanation
    1. Exactly 265 failures
    2. At least 255 failures
    3. Exactly 255 failures
    4. A modulo remainder of nine

    Answer: At least 255 failures

    Saturation preserves a lower bound after reaching the limit but loses additional increments. It does not encode the exact excess count. The interpretation differs from wrapping arithmetic and should match the monitoring requirement.

  98. 98.A static allocation removes runtime allocation failure from a particular path. The path can still receive a request larger than that static buffer. What behavior must still be defined?

    Show answer and explanation
    1. Rejection, bounded processing, or another valid oversize policy
    2. The larger request must be silently truncated without a contract
    3. Static storage automatically grows to the request
    4. Every request becomes valid because allocation is deterministic

    Answer: Rejection, bounded processing, or another valid oversize policy

    Deterministic allocation does not validate arbitrary input sizes. The path still needs explicit bounds and a defined response when input exceeds capacity. Silent truncation can itself violate message integrity or application semantics.

  99. 99.A release build's map fits all sections, but its tested peak uses only one of two supported operating modes. What is still needed to justify the complete runtime memory budget?

    Show answer and explanation
    1. Bounds for modes and transition overlap
    2. Only the smallest function’s local-variable declaration count
    3. A proof that any unused linker gap guarantees every future allocation
    4. The source repository’s total byte count regardless of execution behavior

    Answer: Bounds for modes and transition overlap

    Static layout is one part of the budget. Runtime ownership, stacks, queues, and mode-transition coexistence can change the peak. Analyze the allowed behavior rather than extending one observed mode's usage to every mode.

  100. 100.A memory allocator guarantees constant-time free-list removal once a suitable class is selected. Its size-class search is unbounded in the stated model. Does the first guarantee establish constant-time allocation overall?

    Show answer and explanation
    1. Yes, if returned addresses are aligned
    2. Yes, because one substep is constant time
    3. Only when every allocation's payload is zeroed
    4. No

    Answer: No

    An operation's total bound must include every required step. A constant-time removal substep does not bound an unbounded class search, locking delay, or initialization. Use the allocator's complete contract for timing claims.

  101. 101.An optimization halves payload copies but retains each shared input block until the slowest consumer finishes. What resource tradeoff must be measured or bounded?

    Show answer and explanation
    1. A guarantee that every possible live-memory peak falls with fewer copies
    2. A guarantee that eliminating payload copies removes lifetime and ownership obligations
    3. Copy work versus retained-block demand
    4. Only the number of edited source-code lines

    Answer: Copy work versus retained-block demand

    Avoiding copies can extend source lifetimes and increase the number of simultaneously retained blocks. Evaluate end-to-end resource and latency bounds for the actual consumer behavior. Fewer copied bytes does not alone prove a lower live-memory requirement.