wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CS2110 Spring 24 Final Exam Prep

Total questions: 35

Worksheet time: 20mins

Name
Class
Date
1.

Convert 42 to 8-bit unsigned binary

a)

00101010

b)

01010100

c)

00101100

d)

00100110

2.

What is 8 in 4-bit 2's complement binary?

a)

0000

b)

0111

c)

1000

d)

You cannot represent 8 in 4-bit 2's complement binary

3.

Given 8-bit unsigned binary numbers: A = 1001 0100 B = 0110 1101 C = 1011 1011, calculate (A & B) ^ C

(NOTE: ^ is XOR)

a)

0000 0100

b)

1011 1011

c)

1011 1111

d)

1011 0111

4.

Which of the following bit masks will clear bit 5 of A?

a)

A | ~(1 << 5)

b)

A | (1 << 5)

c)

A & ~(1 << 5)

d)

A & (1 << 5)

5.

Using DeMorgan's Law, find the equivalent boolean expression to: ~(~A & (B | ~C))

a)

A & ~(B & ~C)

b)

~A | ~(B | ~C)

c)

A | (~B | C)

d)

A | (~B & C)

6.

How many of each transistor type do you need to make a NOT gate?

a)

1 N-type, 2 P-type

b)

1 P-type, 2 N-type

c)

1 P-type, 1 N-type

d)

2 P-type, 2 N-type

7.

What type of gate is this circuit?

a)

AND

b)

OR

c)

NAND

d)

NOR

8.

In a multiplexer with 4 inputs, we have a minimum of ___ selector bit(s) and ___ output(s)

a)

1, 2

b)

2, 2

c)

4, 1

d)

2, 1

9.

What will the output be when A = 1, B = 1?

a)

0

b)

1

10.

Which of the following shows the correct groupings for this K-map? (orange = yellow-red overlap, green = yellow-blue overlap)

a)

b)

c)

d)

11.

Simplify the following K-map to a correct minimum boolean expression

a)

B'C'D' + BC'D' + BCD'

b)

B'C'D' + A'BD' + ABD'

c)

C'D' + BD'

d)

CD' + C'D'

12.

(T/F) State machines are built from level-triggered components

a)

True

b)

False

13.

Which of the following are examples of sequential logic? (Select all that apply)

a)

RS Latch

b)

Gated D Latch

c)

D flip flop

d)

AND gate

14.

What is the addressability and address space of the LC3's memory?

a)

Addressability: 16, Address Space: 16

b)

Addressability: 16, Address Space: 65,536

c)

Addressability: 65,536, Address Space: 16

d)

Addressability: 65,536, Address Space: 65,536

15.

Which of these control signals correspond to a tri-state buffer in the LC-3?

a)

LD.MAR

b)

ALUK

c)

PCMUX

d)

GateMDR

16.

What control signals are set in the 2nd clock cycle of FETCH?

a)

GateALU, LD.MAR, MEM.EN

b)

GateMDR, LD.IR

c)

GatePC, LD.MAR, LD.PC

d)

MEM.EN, LD.MDR

17.

Which type of control signal is used to write to various registers throughout the LC3?

a)

Gate

b)

MUX

c)

MEM

d)

LD

18.

This data flow is used in which of the following LC3 macrostates?

a)

FETCH

b)

EXECUTE - LEA

c)

EXECUTE - LD

d)

EXECUTE - ST

19.

What instruction should fill the given blank to make the program follow the provided pseudocode?

a)

BRp

b)

BRzp

c)

BRnz

d)

BRn

20.

What does .fill 5 do?

a)

Allocates 5 spots in memory

b)

Puts 5 into R0

c)

Put the number 5 in memory

d)

Nothing

21.

The following code implements which structure in LC3 assembly?

a)

If statement

b)

For loop

c)

Function call

d)

Switch Statement

22.

Which of the instructions causes the program to not assemble?

a)

Instruction 1

b)

Instruction 2

c)

Instruction 3

d)

Instruction 4

23.

Match each reserved register (R5-7) with its purpose

a)

R5 - frame pointer, R6 - stack pointer, R7 - return address

b)

R5 - stack pointer, R6 - return address, R7 - frame pointer

c)

R5 - return address, R6 - stack pointer, R7 - frame pointer

d)

R5 - frame pointer, R6 - return address, R7 - stack pointer

24.

In the LC3 calling convention, which of the following are responsibilities of the callee? (Select all that apply)

a)

Pop the return value

b)

Save the previous return address

c)

Allocate space for local variables

d)

Allocate space for arguments

e)

Set the frame pointer to the first local variable

25.

How do we create a pointer to an integer variable x in C?

a)

int ptr = x;

b)

int* ptr = x;

c)

int* ptr = *x;

d)

int *ptr = &x;

26.

What is the type of something in the following declaration:

int *something(struct student)[5];

a)

Something is an array of five functions taking in student structs returning a

pointer to an int

b)

Something is a function taking student structs and returning an array of 5

pointers to ints

c)

Something is an array of five functions taking in student structs and returning

int pointers

d)

Something is an array of 5 int pointers to functions taking in student structs

27.

How can we get the value at index 2 of an array using pointers?

int arr[3] = {1, 2, 3};

a)

&(arr + 2)

b)

*(arr + 2)

c)

arr + 2

d)

*arr + 2

28.

What does static do to a function? (ex: static func(int x))

a)

Makes it not visible outside of its C file

b)

Makes it not lose values between function calls

c)

Means it was defined in another C file

d)

Means it cannot be called multiple times

29.

In which region of memory will a be stored?

a)

Data

b)

Stack

c)

Heap

d)

Code

30.

In which region of memory will "b" and "d" be stored? What are their highest level of visibility?

a)

b: data, outside of file

d: stack. within function

b)

b: data, outside of file

d: data: outside of file

c)

b: data, within file

d: data, within function

d)

b: data, within file

d: data, within file

31.

Where is the variable ptr stored? Assumes ptr is declared in a function.

a)

Heap

b)

Data

c)

Code

d)

Stack

32.

[Choose All Correct] What are some problems with this snippet of code?

a)

Did not null check namePtr

b)

Cannot assume sizeof(char) = 1

c)

Did not reserve enough space for the entire string.

d)

should be &namePtr = myString to assign correctly

33.

[Multi-Select] Which of the following way are valid to access "name" from s1 or s2?

a)

s1.name

b)

s1->name

c)

s2->name

d)

(*s2).name

34.

What is the behavior of this code?

a)

It compiles and runs without errors, printing "10" as the output.

b)

It compiles, but the value printed may not be 10 because the memory where 10 is stored has been freed and may change unpredictably.

c)

It compiles but crashes at runtime due to memory leak.

d)

It does not compile due to a syntax error.

35.

When an instance of this struct is allocated in memory, how are the struct members (name, age) typically stored?

a)

All struct members are stored in contiguous memory locations, with name first, followed by age

b)

Each struct member is stored in its own separate memory location, not near one another.

c)

To optimize space usage, compiler stacks name and age together in the same memory address