What is iteration?
Iteration is the repeated execution of a block of statements. A loop is the control structure that performs iteration.
Study 4 Loops and Repetition with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is iteration?
Iteration is the repeated execution of a block of statements. A loop is the control structure that performs iteration.
What three parts make a loop reliable?
Initialization establishes the starting state, the condition determines whether another iteration occurs, and progress or update changes state toward termination.
When should you use a for loop?
Use a for loop when the number of repetitions or the range of values is known or easy to describe.
What is the execution rule for while?
A while loop tests its condition before the body runs, so the body may execute zero times.
Why use a do...while loop?
A do...while loop tests its condition after the body, so the body always executes at least once.
What does a counter pattern do?
A counter records how many times an event occurs. It changes only when the desired event occurs, unlike the loop-control variable, which may change every iteration.
What is an accumulator?
An accumulator combines many values into one result. A sum usually starts at 0, while a product usually starts at 1.
How does the search pattern work?
A search loop examines values until it finds a match or reaches the end. A sentinel such as -1 can represent “not found,” and break can stop the search after a match.
What does a filtering loop do?
A filtering loop processes or collects only values that satisfy a condition. For example, it can add temperatures less than or equal to 100 to a safe-temperature list.
How do break and continue differ?
break terminates the nearest enclosing loop. continue skips the rest of the current iteration and moves to the next one.
When is for...of preferable for arrays?
A for...of loop directly supplies each element of an iterable, such as an array. Use an indexed for loop when the element’s index is needed.
How does a nested loop execute?
For each outer-loop iteration, the inner loop completes all of its iterations. In the example, 3 rows multiplied by 4 columns gives 12 executions of the inner body.
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.