Free Online Flashcard Deck

8 Fundamental Programming Techniques Free Online FlashCards

Study 8 Fundamental Programming Techniques with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What makes an algorithm good?

Back

An algorithm is a finite, precise procedure for solving a problem; it should be correct, terminating, clear, efficient, and generally applicable.

02
Front

What is a loop invariant?

Back

An invariant is a condition that remains true at a particular point during every loop iteration.

03
Front

How do Python collections differ?

Back

A list is ordered and mutable; a tuple is ordered and immutable; a set stores unique values; a dictionary maps identifying keys to values.

04
Front

What does a function contract specify?

Back

A function contract specifies its inputs, returned output, side effects, and possible errors.

05
Front

Why return results instead of printing them?

Back

A calculation function should generally return its result rather than print it, separating computation from presentation.

06
Front

How do sorted() and list.sort() differ?

Back

sorted() returns a new list, whereas list.sort() changes the existing list in place.

07
Front

Why use with for file access?

Back

A with statement closes the file automatically, even if an exception occurs during file processing.

08
Front

Why catch specific exceptions?

Back

Catch specific exceptions so expected failures can be handled without hiding unrelated programming errors.

09
Front

What do boundary tests examine?

Back

Boundary tests cover cases such as empty collections, zero, one item, and minimum or maximum values.

10
Front

What does a traceback reveal?

Back

A traceback identifies where execution failed, but not necessarily where the incorrect value was originally created.

11
Front

How is the word-frequency program modular?

Back

The word-frequency program extracts words, counts them, orders the results, formats a report, and handles file access and user interaction in separate functions.

12
Front

How are ties resolved in top_words()?

Back

For equal word counts, top_words() orders words alphabetically, making the report deterministic and easy to test.