Unit 6: Testing and Debuggin Flashcards

1
Q

What is the goal of testing a program?

A

To find whether there are any ways in which the program fails to work correctly.

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

Why is “run it and see if it works” an inadequate testing method?

A

: Because different inputs can lead to different outcomes, and errors may not be obvious.

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

What is exhaustive testing and why is it impractical?

A

Testing every possible input; impractical due to the vast number of possibilities (e.g., testing two integers would take ~500,000 years).

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

What’s the difference between verification and validation?

A

Verification checks if the program meets the specification. Validation checks if the specification meets the user’s needs.

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

What is a specification in testing?

A

A precise description of what a program is supposed to do – essential for verification.

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

What are the main steps in the testing process?

A
  1. Analyse program/spec
  2. Select test data
  3. Predict results
  4. Run tests
  5. Compare actual and predicted results
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is black-box testing?

A

Testing based on the specification without looking at the code structure. Basically testing the program interface.

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

What is white-box testing?

A

Testing based on the internal structure of the code to ensure every path is tested.

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

What is a breakpoint in debugging?

A

A set point in the code where the debugger automatically pauses execution.

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

Why are diagnostic print statements sometimes not ideal?

A

They clutter the output and require editing the code, which can introduce new bugs.

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