CS135 Flashcards

(84 cards)

1
Q

Define Software Engineering.

A

The application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the main goal of software engineering?

A

To deliver high-quality software that is functional, secure, maintainable, and meets deadlines and budgets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain why maintenance cost is a major concern in SE.

A

More than 50% of lifecycle costs are due to maintenance, making understandability and documentation crucial.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the typical documents produced in the Waterfall Model?

A

Requirements, Specification, Design Documents, User Manuals, Test Data, and Evaluation Reports.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the difference between black-box and white-box testing.

A

Black-box testing is based on specification; white-box testing is based on internal code structure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does JUnit automate?

A

Test execution and evaluation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is meant by ‘Design by Contract’ in Dafny?

A

A method specifies its required inputs (preconditions) and guaranteed outputs (postconditions).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe Boundary Value Analysis (BVA) and when it is useful.

A

A black-box technique focusing on the edges of input domains, useful for catching off-by-one errors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the five typical input values used in BVA?

A

min, min+, nom, max-, max

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an equivalence class in software testing?

A

A subset of inputs that the system treats the same; testing one value from each is often sufficient.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the components of a test case?

A

Name, input(s), expected result, and actual result (for evaluation).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When can a test suite be called minimal?

A

When no test case can be removed without reducing its coverage.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Define C0, Cp, and Ci(k) coverage criteria.

A

C0: statement coverage; Cp: branch coverage; Ci(k): loop coverage up to k iterations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How does Ci(2) work in loop testing?

A

It checks loop behavior for 0, 1, and 2 iterations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why is complete testing impossible?

A

The input space is often too large to test every possible case (e.g., for ints: billions of values).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Compare testing vs program verification.

A

Testing samples input space; verification (e.g. Dafny) symbolically proves correctness for all inputs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a weakest precondition (WP)?

A

The least restrictive condition under which a statement guarantees a postcondition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Explain loop invariants in Dafny.

A

Conditions that must hold before and after every loop iteration; essential for correctness proofs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What does the keyword ‘assert’ do in Dafny?

A

Checks a condition at a point in code; if it fails, verification stops.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

How is substitution used in WP calculations?

A

To replace variables with expressions in postconditions to compute preconditions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What replaces specifications in Extreme Programming (XP)?

A

Tests that define the system’s expected behavior.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What are XPs coding principles?

A

Write tests first; perform 10-minute builds; frequent integration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is a ‘story’ in XP?

A

A small, user-visible feature or functionality unit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the advantage of pair programming in XP?

A

Improved code quality and shared knowledge through constant peer review.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What does Checkstyle do?
Automatically checks Java code for compliance with style guidelines.
26
Give a rule for commenting loops.
Explain the loops purpose, computation, and termination condition.
27
What is the order of items in a Java class file?
Class comment, class statement, public/protected/private variables, constructors, methods.
28
Why is readability important in code?
Improves maintainability and reduces the chance of introducing bugs.
29
What is a node with outdegree 0 called?
A terminal node.
30
Define a branch in a control flow graph.
An edge (a, b) is a branch if there is another edge (a, c) with b = c.
31
What is a cycle in a graph?
A path that starts and ends at the same node.
32
What is a test oracle?
The source (e.g., specification) used to determine the expected output of a test case.
33
Name two typical Javadoc tags.
@param and @return
34
Give an example of a Dafny contract.
requires x >= 0; ensures result == x * x
35
Why might you use symbolic AI in verification?
To reason about all possible inputs and states instead of testing finite cases.
36
What is the IEEE definition of Software Engineering?
Software Engineering is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software.
37
What was the original context of the term 'Software Engineering'?
Introduced as a provocation at NATO workshops in 196869 to emphasize the need for engineering principles in software development.
38
List typical parts of a software product aside from code.
Requirement documents, design documents, user manuals, and test plans.
39
Why is software considered intangible compared to physical engineering?
Software lacks physical constraints, which increases design freedom but also complexity.
40
List five goals of Software Engineering.
Correctness, maintainability, usability, efficiency, and reliability.
41
What does the 'Software Quality Crisis' refer to?
Verification and validation costs surpass the cost of coding itself.
42
How is Software Engineering interdisciplinary?
It intersects with computer science, management, psychology, economics, and law.
43
What is meant by a 'software lifecycle'?
The stages software passes through from initial concept to retirement, typically modeled in SDMs.
44
Describe the phases of the Waterfall model.
Requirements Specification Design Implementation Testing Maintenance.
45
What documents are produced in the design phase of the Waterfall model?
System architecture, user handbook, verification plan.
46
What is the main difference between Spiral and Waterfall?
Spiral allows iterative refinement and risk analysis; Waterfall is strictly linear.
47
What question does a Software Development Model answer?
What shall we do next? How long shall we continue to do it?
48
What is a 'story' in XP?
A small unit of customer-visible functionality replacing formal requirements.
49
How does XP handle system specifications?
By writing tests that define the system's intended behavior instead of documentation.
50
List three coding principles in XP.
Write tests first, frequent integration, 10-minute builds.
51
Contrast V-model testing with Agile testing.
V-model ties each dev phase to a corresponding test phase, while Agile integrates testing continuously.
52
What are advantages of Agile over traditional models?
Fewer documents, higher flexibility, customer feedback throughout.
53
What is the goal of whitebox testing?
To ensure all internal structures of the code are properly tested.
54
Define C0 coverage.
C0 ensures every line of code (node in control flow graph) is executed at least once.
55
Define Cp coverage.
Cp ensures every branch (decision outcome) is executed at least once.
56
Define Ci(k) coverage.
Tests loops for 0, 1, ..., k iterations to ensure looping behavior is exercised.
57
Why might a C0 test suite not detect certain bugs?
It may execute all code paths but miss incorrect logic in alternate branches.
58
How is a control flow graph constructed?
Nodes represent code statements or conditions; edges represent transitions.
59
What is a minimal test suite for a coverage criterion?
A set of tests that satisfies the criterion using the fewest test cases possible.
60
Give an example where Ci(2) testing is useful.
Testing nested or compound loops to ensure correctness under repetition.
61
What is the goal of blackbox testing?
To validate software behavior against the specification without internal knowledge.
62
Describe the process of Boundary Value Analysis.
Identify input boundaries and test at, just above, and just below them.
63
What types of errors does BVA target?
Off-by-one and boundary-related logic faults.
64
Define weak normal equivalence class testing.
Select one test from each equivalence class for each input variable.
65
Define strong normal equivalence class testing.
Test all combinations of equivalence classes of inputs.
66
How are equivalence classes derived?
Based on the output behavior implied by the input domains.
67
When would strong equivalence testing be preferred over weak?
When high reliability is needed or input variable interactions are complex.
68
What is robustness testing?
Extends BVA by testing outside valid input ranges to evaluate failure modes.
69
What is Dafny?
A verification-aware language that uses contracts to ensure correctness.
70
Define a Dafny contract.
A combination of 'requires' (precondition) and 'ensures' (postcondition).
71
How does Dafny differ from traditional testing?
It uses symbolic reasoning to prove correctness for all valid inputs.
72
What is a weakest precondition?
The minimal condition that must be true before a statement to ensure a postcondition.
73
What does 'assert' do in Dafny?
It checks that a condition holds at a specific program point.
74
What are loop invariants?
Conditions that remain true before and after every iteration of a loop.
75
Give a rule to compute WP for sequential composition.
WP[S;T,Q] = WP[S, WP[T,Q]]
76
Explain the benefit of using ghost variables.
Used for reasoning in proofs without affecting compiled code.
77
What is the purpose of code formatting?
Improve readability and maintainability.
78
What is the role of Checkstyle?
A tool that enforces coding style guidelines.
79
List two rules for method formatting in Java.
Braces on same line, blank line between methods.
80
Why should variable declarations be commented?
To explain their role in the context of the program.
81
What should comments on loops explain?
Purpose, computation process, and termination.
82
What is the problem with over-commenting?
It adds noise without value, e.g., trivial comments.
83
Differentiate between stack and queue.
Stack is LIFO; Queue is FIFO.
84
What does the 'errorFree' flag in a stack do?
Indicates whether any unsafe stack operations occurred.