wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CS 33 S23 Final Trial by Fire

Total questions: 18

Worksheet time: 13mins

Name
Class
Date
1.

What is hex 0xB6 in decimal?

a)

182

b)

163

c)

192

d)

136

2.

A is an object of type foo. What does the memory at A look like when the following code is run?

a)

00 00 00 00 64 44 01 02

b)

01 02 00 00 00 00 00 00

c)

02 01 c0 00 00 00 00 00

d)

00 00 00 00 00 c0 01 02

3.

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?

a)

You could represent fewer numbers, but they could be much larger.

b)

You could represent the same numbers, but with more decimal places.

c)

You could represent both larger and smaller numbers, but with less precision.

d)

Some previously representable numbers would now round to infinity.

4.

Which of these can prevent an ROP attack?

a)

Set random values on the stack and check them to make sure they’re unchanged

b)

Set stack as read-only by setting the correct bits in the process’s page table

c)

Address space layout randomization– randomly move the starting address of the stack

d)

Checking that the user input will not overwrite the amount of buffer space allocated for it

5.

What is add %rsi, (%rax) in MIPS? Assume rsi == t0 and rax == t1.

a)

add $t0, ($t1)

b)
  1. lw $t1, 0($t1)

  2. add $t0, $t0, $t1 

c)

lw $t1, ($t0)

add $t1, $t0, $t1

d)

add $t0, ($t1), $t0

6.

When a program tries to access a page that is mapped in address space but not loaded in physical memory, then

a)

Segmentation fault

b)

Page fault

c)

No issue - proceed as usual

d)

Context switch

7.

What is the order in which preprocess flow happens?

a)

Compile, Preprocess, Link

b)

Compile, Link, Preprocess

c)

Preprocess, Link, Compile

d)

Preprocess, Compile, Link

8.

Which of these are the fastest access time?

a)

L1 cache

b)

Register memory

c)

TLB

d)

Main memory

9.

What is the difference between a trap and a fault?

a)

A trap is an exception, while a fault is not

b)

A trap is intentional, while a fault is not

c)

A trap is recoverable, while a fault is not

d)

A trap is synchronous, while a fault is not

10.

When you print the address of a variable from C, what kind of address is that?

a)

Physical Address

b)

Virtual Address

c)

Depends on the context

11.

Every thread gets its own…

a)

Stack

b)

Register values

c)

Heap area

d)

Processor

12.

What is the difference (or differences) between a TLB and on-chip cache?

a)

The TLB is direct-mapped, while caches are set associative.

b)

The TLB is indexed by the virtual address, while caches are indexed by the physical address.

c)

The TLB stores virtual-to-physical address translations, while caches store data.

d)

The TLB stores instructions, while caches store data.

13.

What does the linker do?

a)

Optimize the performance of the code

b)
  1. Support the abstraction of virtual memory

c)
  1. Enable separate compilation

d)
  1. Preprocess library files

14.
  1. Which of the following require exceptional control flow?

a)
  1. Context switch

b)
  1. Page fault

c)

Function call

d)

Data cache miss

15.

I tried loop unrolling in my program and now it is slow… why could that be?

a)

It introduces extra dynamic instructions, potentially adding to the critical path length.

b)

It introduces extra static instructions, putting more strain on the instruction cache.

c)

It results in unnecessary strength reduction, causing more expensive operations to be executed.

d)

Trick question, it is never harmful for performance.

16.

What is the purpose of a multi-level page table, over a single level?

a)

Faster access to physical memory

b)

Occupies less space

c)

Enables memory protection

d)

Helps to make context-switching faster

17.

I wrote some multithreaded code that is running slower than the sequential version. Why could this be?

a)
  1. There is too much overhead from the linked libraries when I try to parallelize

b)
  1. There is too much overhead to synchronize shared variables

c)
  1. Too much operating system overhead from context switches

d)
  1. There is more contention for cache space

18.

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)