Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

EECS 481 — Software Engineering Exam #1, Exams of Programming Languages

An exam for the course EECS 481 - Software Engineering, held in Spring 2020. The exam consists of seven questions with multiple parts, and it is open book, notes, and internet. The exam will be graded on correctness and clarity, and it must be completed within two hours. The exam-answers.txt file must be submitted to the course website. a narrative with blanks that must be filled with the most appropriate corresponding concept from the answer bank.

Typology: Exams

2019/2020

Uploaded on 05/11/2023

thecoral
thecoral 🇺🇸

4.4

(29)

401 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EECS 481 Software Engineering
Spring 2020 Exam #1
There are seven (7) questions in this exam, each with multiple parts. Some questions
span multiple pages. If you get stuck on a question, move on and come back to it later.
Once you download this exam, you have two (2) hours to complete and upload it. If
you encounter technical difficulties, email the staff immediately.
This exam is open book, notes, and Internet. You may not communicate with others
while completing this exam. You can email the staff, make private Piazza posts, or
use Slack to send direct messages to staff. We will try to respond during the hours of
11AM to 11PM Eastern time on Friday, Saturday, and Sunday.
You will complete the exam by filling in the accompanying exam-answers.txt files.
Once complete, submit exam-answers.txt alone to the course website: https://
dijkstra.eecs.umich.edu/kleach/eecs481/shibboleth/exam-submit.php.
Solutions will be graded on correctness and clarity. Each problem has a relatively
simple and straightforward solution. We may deduct points if your solution is far more
complicated than necessary.
If you leave a non-extra-credit portion of the exam blank or drawn an X through it,
you will receive one-third of the points (e.g., 4/3=1.33), for that portion
for not wasting time.
UM uniqname: Generated for kjleach.
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download EECS 481 — Software Engineering Exam #1 and more Exams Programming Languages in PDF only on Docsity!

EECS 481 — Software Engineering

Spring 2020 — Exam

  • There are seven (7) questions in this exam, each with multiple parts. Some questions span multiple pages. If you get stuck on a question, move on and come back to it later.
  • Once you download this exam, you have two (2) hours to complete and upload it. If you encounter technical difficulties, email the staff immediately.
  • This exam is open book, notes, and Internet. You may not communicate with others while completing this exam. You can email the staff, make private Piazza posts, or use Slack to send direct messages to staff. We will try to respond during the hours of 11AM to 11PM Eastern time on Friday, Saturday, and Sunday.
  • You will complete the exam by filling in the accompanying exam-answers.txt files. Once complete, submit exam-answers.txt alone to the course website: https:// dijkstra.eecs.umich.edu/kleach/eecs481/shibboleth/exam-submit.php.
  • Solutions will be graded on correctness and clarity. Each problem has a relatively simple and straightforward solution. We may deduct points if your solution is far more complicated than necessary.
  • If you leave a non-extra-credit portion of the exam blank or drawn an X through it, you will receive one-third of the points (e.g., 4 /3 = 1. 33 ), for that portion for not wasting time.

UM uniqname: Generated for kjleach.

1 Software Process Narrative (13 points)

(1 pt. each) Read the following narrative. Fill in each blank with the single most specific or appropriate corresponding concept from the answer bank. (Each blank does have exactly one corresponding answer.) Each option can be used more than once. A. Alpha Testing B. Agile Development C. Beta Testing D. Build Automation E. Comparator F. Dataflow Analysis G. Development Process H. Dynamic Analysis I. Formal Code Inspection J. Invariant K. Integration Testing L. Maintainability M. Mocking N. Oracle O. Passaround Code Review P. Path Predicate Q. Perverse Incentive R. Quality Property S. Risk T. Requirements V. Software Metric W. Spiral Development X. Static Analysis Y. Threat to Validity Z. Waterfall Model

(a) A developer decides to use gdb to debug a segmentation fault at runtime.

(b) The manager of the Sprightly Software Company decides to plan effort in two-week sprints, with daily stand-up meetings. (c) The leadership of a software company decides to provide bonuses to developers based on the average number of bugs fixed per 1,000 lines of code.

(d) In class, we discussed pacemaker software that allowed attackers to kill patients by wirelessly disabling pacemakers. A company responsible for such software can consid- ering adopting various processes to help account for this aspect of project delivery. (e) The database company Debacle decides to adopt a procss where they deliver prototypes every three months. Each prototype phase, they gather any changing requirements, design and implement software that meet these new requirements, and deliver the next prototype. (f) While inspecting a program with many sequential if statements, you carefully design a test input that causes a specific set of if statements to be taken. (g) In an effort to improve the readability of your code, your teammate reduces its Hal- stead volume. He says that maintainable code must have a minimal Halstead volume. However, you point out that his most recent commit was an unreadable mess with a deceptively low Halstead volume. What does that say about the applicability of the Halstead volume?

(h) Visual Studio embeds a numerical computation for approximating the complexity of code. (i) The company Repo Men writes software for prosthetic hearts. They should consider adopting a process for thoroughly discovering defects. One manager proposes gathering a team of five engineers to prepare comments and evaluate checklists with respect to source code. (j) A function Circumference accepts a single floating point parameter, radius, always returns the value 2PIradius.

2 Testing and Coverage (22 points)

Consider the following program. Statements of interest are labeled S 1 through S 5. 1 int amazing ( int x , int y , int z ) { 2 if ( x > 0 ) { 3 S_1 ; 4 if ( z < 3 ) { 5 S_2 ; 6 } else { 7 S_3 ; 8 } 9 } 10 if ( x != -1 || y == 0 && z > (2 * y ) ) { 11 S_4 ; 12 } else { 13 S_5 ; 14 } 15 }

(a) (1 pt. each row) In the table below, identify integer values for x, y, and z that result in the coverage specified in the table, or indicate that it is not possible.

Statements covered x y z Not possible

S 2, S 4

S 4

S 2, S 3, S 4

S 2, S 3, S 4

S 1, S 2, S 5

S 1, S 4

S 1, S 2, S 4

S 1, S 3, S 5

Next, consider the function below. Against, statements of interest are labelled S 1 through S 4. 1 int ShuaiDaiLe ( int x , int y , int z ) { 2 if ( x != 1 ) { 3 S_1 ; 4 if ( y > 3 && z < 0 ) { 5 S_2 ; 6 } else { 7 S_3 ; 8 } 9 } 10 if ( x > 1 && y == x ) { 11 S_4 ; 12 } 13 }

(b) (2 pts. each row) In the table below, you are given values of x, y, and z. In the corresponding blanks, fill in the Path Coverage count for each test case (i.e., report how many unique paths are executed; do not report a percentage).

x y z Path coverage (count)

(c) (2 pts.) Identify any one path predicate from the program above that executes a unique path through the program.

(d) (3 pts.) Identify two risks associated with adopting dynamic analysis techniques at a company that currently does not use any. Identify a measurement that could be used to reduce each risk.

(e) (3 pts.) A fresh startup called FaceBack has designed software that can identify the back of a person’s head given a picture of their face. Some team members support adopting an official company list restricting which programming languages can be used as the team grows. In three or fewer sentences, support or refute the use of such approved programming language lists in terms of risk management and process.

(f) (2 pts.) Consider a program with five sequential if statements that accepts five boolean inputs. Assuming each condition evaluates a single unique input, what is the minimum number of test cases required to achieve 100% Path coverage? Condition coverage?

(g) (3 pts.) In three or fewer sentences, support or refute the claim that Microsoft’s Maintainability Index helps identify difficult-to-read code.

(h) (1 pt.) Give one example of a tool used for code review.

(i) (2 pts.) Suppose you are building a large C program that comes with a configure script. Further suppose that you want to use a custom version of gcc located in /usr/local/bin/481-gcc and pass the flags -O3 -Wall. Assuming you are working in the same directory as the configure script. Identify the command input to successfully configure this project.

4 Invariant Detection and Mutants (15 points)

Consider the code snippet below: 1 int rose ( int a , int b ) { 2 int x = 0; 3 4 if ( a <= 0 || b <= 0 ) { 5 return -1; 6 } 7 if ( a > 6 || b > 6) { 8 return -1; 9 } 10 11 if ( a == 3 || a == 5) { 12 x += ( a - 1); 13 } 14 if ( b == 3 || b == 5) { 15 x += ( b - 1); 16 } 17 return x ; 18 }

(a) (3 pts. each row) In the table below, several candidate invariants are listed. For each candidate, EITHER (1) specify a test case in terms of a and b that falsifies the candidate, OR (2) identify a first-order mutant that leads you to retain the candidate. (Fill in the appropriate column).

Invariant Description a b Falsifying mutation (if needed)

rose <= 2b for all a and b On Line , change to

rose is nonnegative and even for all a and b On Line , change to

rose is even for all a and b On Line , change to

rose <= a + b for odd a and b On Line , change to

rose < 12 for all a and b On Line , change to

5 Dataflow Analysis (20 points)

Consider a live variable dataflow analysis for three variables, a, b and c. We associate with each variable a separate analysis fact: either the variable is possibly read on a later path before it is overwritten (live) or it is not (dead). We track the set of live variables at each point: for example, if a and b are alive but c is not, we write { a, b }. The special statement return reads, but does not write, its argument. (You must determine if this is a forward or backward analysis.)

(a) (18 pts.) Complete this live variable dataflow analysis for a, b and c by filling in each Live Vars. box with the set of live variables just before that point in the program.

START

if c < 5

Live vars: (B1) c = c - 1

Live vars: (B2)

while c < a

Live vars: (B3) (^) c = c + 1

Live vars: (B4)

a = c + 1

Live vars: (B5)

c = a - 1

Live vars: (B6)

if b < c

Live vars: (B7)

b = c * 2

Live vars: (B8)

c = c - 1

Live vars: (B9)

return b

Live vars: (B10)

return c

Live vars: (B11)

(b) (2 pts.) Support or refute the claim that a statement with no live variables can be removed without affecting the program’s correctness.

7 Extra Credit (1 pt each; we are tough on reading questions)

(a) (Feedback) What is your least favorite thing about this class?

(b) (Feedback) What is your most favorite thing about this class?

(c) (Pyschology) Provide an example of confirmation bias.

(d) (Psychology) Explain the McNamara fallacy in your own words.

(e) (Random) What is your favorite text editor?

(f) (Your Choice Reading) Identify any optional reading. Write a sentence about it that convinces us that you read it critically. (Our subjective judgment applies here!).

(g) (Your Choice Reading 2) Identify any different optional reading. Write a sentence about it that convinces us that you read it critically. (Our subjective judgment applies here!).