Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

EECS 280 Midterm Exam

Fall 2019
Written Portion
This is a closed-book exam. You may use one note sheet, 8.5"x11", double--sided, with your
name on it. This booklet contains space to write you answers for the multiple-choice and written
components of the exam.

Read the entire exam through before you begin working. Work on those problems you find
easiest first. Read each question carefully, and note all that is required of you. Assume all code
is in standard C++11, and use only standard C++11 in your solutions.

Instructions:

● Throughout the exam, assume all necessary #include headers and the using
namespace std; directive are present unless otherwise directed.

● You do not need to verify REQUIRES clauses with assert unless instructed to do so.

● The last several pages include space for scratch work (including the last piece of
paper, which you may tear out).

Write your uniqname on the line provided at the top of each


page.

You are to abide by the University of Michigan/Engineering honor code. To receive a


grade, sign below to signify that you have kept the honor code pledge:

I have neither given nor received aid on this exam, nor have I concealed any violations of
the Honor Code.

Signature: _________________________________________

Name: _________________________________________

Uniqname: _________________________________________

UMID: _________________________________________

EECS 280 Fall 2019 Midterm Answers Packet


1/11
Problem 0: Short Answers (30 Points)
When you make a choice in this section, please fill in the bubble completely to make sure
Gradescope is able to read it.

0a) True/False (10 points)


True False

1. ⓣ ⓕ

2. ⓣ ⓕ

3. ⓣ ⓕ

4. ⓣ ⓕ

5. ⓣ ⓕ

6. ⓣ ⓕ

7. ⓣ ⓕ

8. ⓣ ⓕ

9. ⓣ ⓕ

10. ⓣ ⓕ

EECS 280 Fall 2019 Midterm Answers Packet


2/11
0b) Multiple Choice (20 points)

ⓐ ⓑ ⓒ ⓓ ⓔ 1.

ⓐ ⓑ ⓒ ⓓ ⓔ 2.

ⓐ ⓑ ⓒ ⓓ ⓔ 3.

ⓐ ⓑ ⓒ ⓓ ⓔ 4.

ⓐ ⓑ ⓒ ⓓ ⓔ 5.

ⓐ ⓑ ⓒ ⓓ ⓔ 6.

ⓐ ⓑ ⓒ ⓓ ⓔ 7.

ⓐ ⓑ ⓒ ⓓ ⓔ 8.

ⓐ ⓑ ⓒ ⓓ ⓔ 9.

ⓐ ⓑ ⓒ ⓓ ⓔ 10.

EECS 280 Fall 2019 Midterm Answers Packet


3/11
Problem 1: Strings and I/O (17 Points)
1a) (9 points)

void split_string(char *dst, const char *src, int pos);

EECS 280 Fall 2019 Midterm Answers Packet


4/11
1b) (8 points)

EECS 280 Fall 2019 Midterm Answers Packet


5/11
Problem 2: Arrays and Pointers (18 Points)
2a) (8 points)

1.

2.

3.

4.

2b) (3 points)

int range(const int * array, int length) {

EECS 280 Fall 2019 Midterm Answers Packet


6/11
2c) (7 points)

int search(int **arr, int length_outer, int length_inner) {

EECS 280 Fall 2019 Midterm Answers Packet


7/11
Problem 3: Structs and C-Style ADTs (16 points)

3a) (2 points)

void Playlist_init(Playlist *p_in, string name_in) {

3b) (6 points)

Song *Playlist_find_song(Playlist *p_in, const Song *s_in) {

EECS 280 Fall 2019 Midterm Answers Packet


8/11
3c) (8 points)

void Playlist_merge (Playlist *p_in1, const Playlist *p_in2) {

EECS 280 Fall 2019 Midterm Answers Packet


9/11
Problem 4: Inheritance and Polymorphism (19 Points)

4a) (3 points)

void Phone::depletePower(int amount) {

4b) (3 points)

int countChargedPhones(const std::vector<Device *> &devices) {

EECS 280 Fall 2019 Midterm Answers Packet


10/11
4c) (3 points)

4d) (8 points)

1.

2.

3.

4.

4e) (2 points)

EECS 280 Fall 2019 Midterm Answers Packet


11/11

You might also like