What makes an algorithm good?
An algorithm is a finite, precise procedure for solving a problem; it should be correct, terminating, clear, efficient, and generally applicable.
Study 8 Fundamental Programming Techniques with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What makes an algorithm good?
An algorithm is a finite, precise procedure for solving a problem; it should be correct, terminating, clear, efficient, and generally applicable.
What is a loop invariant?
An invariant is a condition that remains true at a particular point during every loop iteration.
How do Python collections differ?
A list is ordered and mutable; a tuple is ordered and immutable; a set stores unique values; a dictionary maps identifying keys to values.
What does a function contract specify?
A function contract specifies its inputs, returned output, side effects, and possible errors.
Why return results instead of printing them?
A calculation function should generally return its result rather than print it, separating computation from presentation.
How do sorted() and list.sort() differ?
sorted() returns a new list, whereas list.sort() changes the existing list in place.
Why use with for file access?
A with statement closes the file automatically, even if an exception occurs during file processing.
Why catch specific exceptions?
Catch specific exceptions so expected failures can be handled without hiding unrelated programming errors.
What do boundary tests examine?
Boundary tests cover cases such as empty collections, zero, one item, and minimum or maximum values.
What does a traceback reveal?
A traceback identifies where execution failed, but not necessarily where the incorrect value was originally created.
How is the word-frequency program modular?
The word-frequency program extracts words, counts them, orders the results, formats a report, and handles file access and user interaction in separate functions.
How are ties resolved in top_words()?
For equal word counts, top_words() orders words alphabetically, making the report deterministic and easy to test.
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
Learn how Boolean expressions, logical operators, and conditional structures let programs make reliable decisions, including how to handle boundaries, branch order, and testing.
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.