What is a C++ function?
A function is a named block of code that performs a task. It supports program decomposition by dividing a large problem into smaller, focused operations.
Study 5 Functions with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is a C++ function?
A function is a named block of code that performs a task. It supports program decomposition by dividing a large problem into smaller, focused operations.
Declaration vs. definition
A declaration introduces a function to the compiler without its body; a definition supplies the function body and specifies its behavior.
When must a function be declared?
A function declaration must be visible before a call that uses the function, unless the function definition already appears before that call.
Parameter vs. argument
A parameter is a variable listed in a function declaration or definition; an argument is the value supplied when the function is called.
What does a function’s return type specify?
The return type appears before the function name. A non-void function must return a suitable value on every path that reaches its end.
What does return do?
A return statement transfers control to the caller. With an operand, it also initializes the result of the function call.
What is local scope in a function?
Function parameters and local variables are usable only within their function or enclosing block, so they are not normally available in another function.
What is name hiding?
An inner declaration can hide a name from an enclosing scope. For example, a local value can hide a global value with the same name.
What happens in pass-by-value?
Pass-by-value gives the function its own parameter object initialized from the argument. Assigning to that parameter does not change the caller’s variable.
Why does reset(original) leave original unchanged?
Changing a pass-by-value parameter does not change the caller’s variable because the function modifies its independent parameter object.
What is function overloading?
Function overloading permits functions in the same scope to share a name when their parameter lists differ in number or types.
Can return types alone overload functions?
The return type alone cannot distinguish overloads. Two functions with identical parameter lists but different return types are invalid overloads.
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.