Font size
WorksheetsCS 33 S23 Final Trial by Fire
Total questions: 18
Worksheet time: 13mins
What is hex 0xB6 in decimal?
182
163
192
136
A is an object of type foo. What does the memory at A look like when the following code is run?
00 00 00 00 64 44 01 02
01 02 00 00 00 00 00 00
02 01 c0 00 00 00 00 00
00 00 00 00 00 c0 01 02
For a floating point number, what would be an effect of allocating more bits to the exponent part by taking them from the fraction part?
You could represent fewer numbers, but they could be much larger.
You could represent the same numbers, but with more decimal places.
You could represent both larger and smaller numbers, but with less precision.
Some previously representable numbers would now round to infinity.
Which of these can prevent an ROP attack?
Set random values on the stack and check them to make sure they’re unchanged
Set stack as read-only by setting the correct bits in the process’s page table
Address space layout randomization– randomly move the starting address of the stack
Checking that the user input will not overwrite the amount of buffer space allocated for it
What is add %rsi, (%rax) in MIPS? Assume rsi == t0 and rax == t1.
add $t0, ($t1)
lw $t1, 0($t1)
add $t0, $t0, $t1
lw $t1, ($t0)
add $t1, $t0, $t1
add $t0, ($t1), $t0
When a program tries to access a page that is mapped in address space but not loaded in physical memory, then
Segmentation fault
Page fault
No issue - proceed as usual
Context switch
What is the order in which preprocess flow happens?
Compile, Preprocess, Link
Compile, Link, Preprocess
Preprocess, Link, Compile
Preprocess, Compile, Link
Which of these are the fastest access time?
L1 cache
Register memory
TLB
Main memory
What is the difference between a trap and a fault?
A trap is an exception, while a fault is not
A trap is intentional, while a fault is not
A trap is recoverable, while a fault is not
A trap is synchronous, while a fault is not
When you print the address of a variable from C, what kind of address is that?
Physical Address
Virtual Address
Depends on the context
Every thread gets its own…
Stack
Register values
Heap area
Processor
What is the difference (or differences) between a TLB and on-chip cache?
The TLB is direct-mapped, while caches are set associative.
The TLB is indexed by the virtual address, while caches are indexed by the physical address.
The TLB stores virtual-to-physical address translations, while caches store data.
The TLB stores instructions, while caches store data.
What does the linker do?
Optimize the performance of the code
Support the abstraction of virtual memory
Enable separate compilation
Preprocess library files
Which of the following require exceptional control flow?
Context switch
Page fault
Function call
Data cache miss
I tried loop unrolling in my program and now it is slow… why could that be?
It introduces extra dynamic instructions, potentially adding to the critical path length.
It introduces extra static instructions, putting more strain on the instruction cache.
It results in unnecessary strength reduction, causing more expensive operations to be executed.
Trick question, it is never harmful for performance.
What is the purpose of a multi-level page table, over a single level?
Faster access to physical memory
Occupies less space
Enables memory protection
Helps to make context-switching faster
I wrote some multithreaded code that is running slower than the sequential version. Why could this be?
There is too much overhead from the linked libraries when I try to parallelize
There is too much overhead to synchronize shared variables
Too much operating system overhead from context switches
There is more contention for cache space
Convert the following to IEEE 32-bit floating point: 0x43c80000
In binary: 0100 0011 1100 1000 0000 0000 0000 0000
(Hint: We have 1 bit for signed bit, 8 bits for exponent field, and 23 bits for the mantissa. The answer is a 3-digit integer.)
(a)
