Free Online Flashcard Deck

9 Programming Problem-Solving Techniques Free Online FlashCards

Study 9 Programming Problem-Solving Techniques with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is the first step in a reliable programming problem-solving process?

Back

Identify the required inputs, outputs, rules, and constraints before designing a solution.

02
Front

Why decompose a programming problem?

Back

Decomposition breaks a complex problem into smaller tasks that can be solved independently.

03
Front

What does a variable’s type determine?

Back

A variable’s type determines which operations are meaningful. The string "87" is text, not automatically the integer 87.

04
Front

Why should grade thresholds be checked from largest to smallest?

Back

Check the largest threshold first because the first true branch executes and prevents later branches from being reached.

05
Front

When should you use `for` versus `while`?

Back

Use a `for` loop for each item in a known collection; use a `while` loop when repetition depends on a condition.

06
Front

What is a good design principle for a method?

Back

A method should generally package one clear responsibility and communicate through parameters and a return value.

07
Front

What do classes and instances represent?

Back

A class bundles related state and behavior; instances represent particular objects created from that design.

08
Front

When is inheritance preferable to composition?

Back

Inheritance is appropriate for a genuine “is-a” relationship; composition is clearer when one object merely uses or contains another.

09
Front

What invariant does `best_student` maintain?

Back

After each iteration, `best` refers to the highest-scoring student examined so far.

10
Front

What is `total` after tracing the values [3, 8, 2]?

Back

The final value of `total` is 10 because the loop adds the even values 8 and 2, but not 3.

11
Front

How do syntax, runtime, and logic errors differ?

Back

A syntax error prevents parsing; a runtime error occurs during execution; a logic error runs but produces the wrong result.

12
Front

What does boundary-value testing target?

Back

Boundary-value testing focuses on edge cases such as 0, 1, the maximum allowed value, and values just outside the valid range.