1/9
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
How can you detect ranges implicitly in C++?
By using multi-branch if/else statements to check if a value falls within certain intervals.
What is a switch statement in C++?
A control structure that tests a variable against multiple constant values (cases) and executes the matching case's code block.
What is the purpose of the break statement in a switch?
It stops the execution of the current case and exits the switch statement to prevent fall-through.
What is switch case fall-through?
When a case does not have a break statement, and execution continues into the next case.
Can multiple cases share the same code in a switch statement?
Yes, multiple cases can be grouped together before a shared block of code.
How are char and string values compared in C++?
Using relational operators (==, !=, <, >, etc.); comparisons are based on ASCII or lexicographical order.
What does the .at() function do for strings?
Returns the character at a specific index in the string with bounds checking.
What does .size() or .length() return for a string?
The number of characters in the string.
What does .append() do for strings?
Adds another string or character(s) to the end of an existing string.
Why should you be careful when comparing floating-point numbers?
Because of rounding errors; use a tolerance (epsilon) to check if values are "close enough" instead of exactly equal.