What is a method?
A method is a named, reusable block of code that performs a specific task.
Study 06 Methods and Modular Programming with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is a method?
A method is a named, reusable block of code that performs a specific task.
What does a method definition contain?
A method definition normally includes a name, parameters, and a body; it may also specify a return value.
What is a parameter?
A parameter is a named variable in a method definition, such as `name` in `def greet(name)`.
What is an argument?
An argument is the actual value supplied when a method is called, such as `"Maya"` in `greet("Maya")`.
What does a return value do?
A return value is a result sent from a method back to the code that called it.
How does returning differ from printing?
Printing displays information immediately, while returning makes the result available to the calling code for later use.
What is a local variable?
A local variable is normally accessible only within the method where it is created.
What is a method call?
A method call, or invocation, asks the program to execute a method with particular arguments.
What does `add(7, 4)` return?
`sum_value` stores `11`: `add(7, 4)` assigns the arguments to `first` and `second`, then returns their sum.
What is recursion?
Recursion occurs when a method calls itself. Every recursive method needs a base case to stop the repeated calls.
What is decomposition in programming?
Decomposition divides a complex problem into smaller subproblems, often implemented as focused methods.
Why decompose a program into methods?
Focused decomposition improves clarity, allows independent testing, supports reuse, simplifies maintenance, and helps isolate bugs.
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.
A structured guide to the main data structures, their operations, efficiency trade-offs, representations, and practical selection criteria.
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.