CSCI 370: Sample Final

CS 370 Software Engineering Sample Final (Summer 2022)

There may be more than one answer to a question. Choose the best answer to each question. To get any credit for matching questions, all matches must be correct.

Note, if you wish, you can write an explanation next to your answer.

Q1) CD/CI (pipeline):

Show Answer 2. Makes frequent deliveries of software

 

Q2) A Non-Functional Requirement

Show Answer 1. Is usually implied from a Functional one.

 

Q3) RE: the diagram below:

alt text

Show Answer 4. Complete Checkout interacts with the most Actors.

 

Q4)

alt text

Q4) In the above diagram, which Object is activated the most?

Show Answer Register: RegisterOffice

 

Q5) How many lifelines are there?

Show Answer 3

 

Q8) The following pattern is typically used for undoing user actions.

  1. Observer Pattern - adding observers w/out modifying existing code
  2. Strategy Pattern - Separate the code that changes into a separate object which is then passed to code that does not change. Placing algorithms in a separate object that is passed into another class. encapsulating behavior into separate classes.
  3. Factory Pattern - Controls which class gets created. Does not allow programmers to create a specific class.
  4. Command Pattern - placed commands into objects and has two commands execute and unexecute. These commands can be saved for reuse.
  5. Iterator Pattern - e.g. List of Students in a school. The School hides the internal storage of the student list from other objects. Therefore other objects traversal through the Students without knowing how the Student list is being stored.
  6. State Pattern - Have separate pre-defined states for different conditions
  7. Decorator - chain together multiple objects and treat them as one object. i.e. getPrice can get the price of many types of condiments.
  8. Memento - placing a snapshot of an object in another object
  9. Builder:
    1. Protects an object from bad values
    2. Breaks parameters into smaller understandable parts
  10. Singleton - protects a global variable (i.e static) from bad values
Show Answer 4. Command Pattern

 

Q8) The following is NOT part of a Software development life cycle:

  1. Daily Meeting
  2. Targeting Rule
  3. Analyze Current System
  4. Feasibility Study
  5. Scrum
Show Answer 2. Targeting Rule

 

Q9) The following is not good software practice:

Show Answer 2. Using inheritance to handle different behaviors

 

Q10) A state diagram:

Show Answer 1. Focuses on changes to a system/object during program execution

 

Q11) The following is a non-functional requirement:

Show Answer 1. Scalability - ability of software to grow (or shrink)

 

Q12) Non-functional vs functional requirement:

Show Answer 2. A missing non-functional requirement usually causes the software unusable by the user

 

Q13) A lifeline is found in the following diagram:

Show Answer 1. Sequence Diagram

 

DP3)

public class Session {

    private static Session _session = null;

    public Session getSession() {

        if (_session == null)
            _session = new Session();

        return (_session);
    }
}

DP3) Which Design Pattern is shown in the code above?

Show Answer Singleton

 

DP3 Explain)

Show Answer [Insert Explanation Here]

 

public interface MathFunctions {

    double multiply(double a, double b);

    double divide(double a, double b);
}

public class Calculator implements MathFunctions {

    @Override
    public double multiply(double a, double b) {
        return (a * b);
    }
}

OOP15) Anything wrong with the code above?

Show Answer Calculator is not implementing the divide method

 

Q15) The diagram below is a:

alt text

Show Answer 5. State Diagram

 

Q16 and Q17)

alt text

Based on the diagram above:

Q16) Customer can have, at most, this many accounts.

Show Answer 30

 

Q17) Bank Officers can have, at most, this many Customers.

Show Answer 1000

 

Q18) Match the terms on the left with terms on the right. (All choices must be correct to get credit for this)

Waterfall Process ___

Incremental Process ___

Software Re-Use ___

Client Server ___

1) Email Program

2) Using Open-Source Software

3) Allows many changes

4) Airplane Flying Software

Show Answer

Waterfall Process - 4) Airplane Flying Software

Incremental Process - 3) Allows many changes

Software Re-Use - 2) Using Open-Source Software

Client Server - 1) Email Program

 

Q19) Which of the following are attributes of Good Software?

A) Acceptability and Usability (easy to use)
B) Dependability and security (won’t crash and will protect data)
C) Efficiency (won’t waste resources)
D) Maintainability (easy to fix)

Show Answer 4\) A, B, C, D

 

Q20)

alt text

Q20) The diagram above shows:

Show Answer 3. Composition vs Aggregation

 

Q21) Dependency Inversion Principle

Show Answer 5. 1, 2, 3

 

// Account depends on SqlServer therefore Sqlserver is lower than Account therefore
// SqlServer is considered to be lower than Account because is depending on it
// dependency inversion replaces the concrete dependency with abstraction i.e. the interface. Replace SqlServer with IDatabase

class Account {
    SqlServer database;
}

class SqlServer {

}

Q23) The code above:

Show Answer 1\) Violates the Open Closed Principle

 

Q24) Which of the following tests are valid Unit Tests:

public class MathTest {

    @org.junit.jupiter.api.Test
    void test1() {
        Math math = new Math();
        System.out.println(math.Execute("add", 1, 2));
    }

    @org.junit.jupiter.api.Test
    void test2() {
        Math math = new Math();
        assertTrue(math.Execute("add", 1, 2) == 4);
    }

    @org.junit.jupiter.api.Test
    void test3() {
        Math math = new Math();
        assertFalse(math.Execute("add", 1, 2) == 3);
    }

    @org.junit.jupiter.api.Test
    void test4() {
        Math math = new Math();
        assertFalse(math.Execute("add", 1, 2) == 4);
    }
}
Show Answer 3. test2(), test3(), test4()

 

Q25) The class above uses the:

public class CustomerId {

    static private int id = 100;

    public int getId() {
        return id++;
    }
}
Show Answer 3. Singleton Pattern

 

Q26) YouTube allows many people to subscribe to multiple channels. This is like which design pattern.

Show Answer 2. Observer Pattern

 

Q27) Ethnography in Software Engineering refers to:

Show Answer 3. User Culture

 

Q28) Match the term on the left with the description on the right

Presentation Layer ___

Controller Layer ___

Software validation ___

Software Requirements ___

1) Often includes a User Story (Who, What, Why, Acceptance Criteria)

2) Model View Controller architecture

3) 3 tier architecture (presentation/business/database)

4) TDD - Unit testing

Show Answer

Presentation Layer: 3) 3 tier architecture (presentation/business/database)

Controller Layer: 2) Model View Controller architecture

Software validation: 4) TDD - Unit testing

Software Requirements: 1) Often includes a User Story (Who, What, Why, Acceptance Criteria)

 

Q29)

alt text

Q29) Regarding the diagram above:

  1. The object that takes the least time is the Actor.
  2. The database is needed to withdraw money.
  3. There are no return messages.
  4. Withdrawal request is stored in the database.
  5. ATM and Database have a “IS-A” relationship
Show Answer 2. The database is needed to withdraw money.

 

Q30) The following will usually cause code to be refactored: (changing code leads to code refactoring)

Show Answer 4. All of the above

 

Extra Credit: (3 Points)

What type of arguments will cause code to crash?

guidelines - null value, large value, small value,
partition based -
test 1 - less than what is expected
test 2 - more than what is expected
test 3 - what is expected

Show Answer [No answer Provided in the prof's sample final. Poke @Mauri on discord if you have the answer]

 

Q31) What is not true about Unit Testing:

Show Answer 5. Allows for testing interactions between various parts of the code.

 

Q32) Which architecture pattern is associated with a Web page?

Show Answer 2\) Client-server pattern

 

Q32) Which architecture pattern is associated with an E-Mail program?

Show Answer 2. Client-server pattern

 

Q33)

alt text

Q33) In the diagram above, A represents:

Show Answer 1. Presentation Layer

 

Which type of testing would a developer probably do?

Show Answer 2. White box - developer knows the code

 

If I want to test the divide function below using “Guideline-based testing” and I already tested divide(1,2) and it correctly returned .5, what other values should I test for in the denominator?

public class Math {

    double divide(double numerator, double denominator) {
        return numerator / denominator;
    }
}
Show Answer 3. 0

 

Things to know: