What does a C++ selection condition evaluate to?
A condition is an expression contextually converted to bool. true selects the true branch; false selects the false branch.
Study 3 Selection and Control Structures with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What does a C++ selection condition evaluate to?
A condition is an expression contextually converted to bool. true selects the true branch; false selects the false branch.
Which operator tests equality in C++?
The equality comparison operator is ==. The single = operator assigns a value instead of testing equality.
How are numeric expressions converted to bool?
Zero converts to false, while any nonzero numeric value converts to true.
Which operator means logical AND, and when is its right operand evaluated?
The logical AND operator is &&. With A && B, B is evaluated only when A is true.
Why can direct floating-point equality be unreliable?
Use a tolerance such as std::abs(a - b) < 0.000001, because many decimal fractions cannot be represented exactly in binary floating-point.
When does an if block execute?
An if statement executes its statement or block only when its condition is true.
What happens in an if-else statement?
Only one branch executes: the if branch when its condition is true, or the else branch when it is false.
How does an else-if chain choose a branch?
An else-if chain selects the first true condition, so the order of conditions matters.
How can braces prevent a dangling else?
Use braces to make each intended block explicit and prevent a dangling else from attaching to the wrong if.
When is switch preferable to a long else-if chain?
Use switch when one integral or enumeration expression is compared with several fixed constant values.
What does break do in a switch statement?
A break exits the switch. Without it, execution continues into the following case, causing fallthrough.
What happens when no switch case matches?
A switch can use default when no case matches. If default is absent, execution continues after the switch.
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.