What does a conditional statement control?
A conditional statement controls which instructions execute by evaluating a condition as true or false and selecting an appropriate branch.
Study 04. Conditional Statements with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What does a conditional statement control?
A conditional statement controls which instructions execute by evaluating a condition as true or false and selecting an appropriate branch.
What syntax defines an `if` block in Python?
Python uses a colon after the condition and indentation to define the statements controlled by an `if` statement.
How does an `if-else` statement choose a branch?
An `if-else` statement chooses between two alternatives: the `if` branch runs when its condition is true; otherwise, the `else` branch runs.
What happens in an `elif` chain?
Python tests `elif` conditions from top to bottom and executes only the first branch whose condition is true.
How should chained conditions be ordered?
Put more specific or higher-priority conditions before broader ones; otherwise, the broad branch may match first and make later branches unreachable.
What is the difference between `==` and `=`?
Use `==` to compare values. A single `=` assigns a value to a variable rather than testing equality.
When is an `and` expression true?
`and` is true only when both of its conditions are true.
What do `or` and `not` do?
`or` is true when at least one condition is true, while `not` reverses a Boolean result.
Which Python values are generally false in conditions?
Values such as `0`, `None`, and empty collections are generally treated as false in Python conditions.
When is a nested condition evaluated?
A nested condition is an `if` statement inside another conditional block; the inner condition is evaluated only after the outer condition succeeds.
What is the purpose of validation?
Validation checks input form and allowed range before use, reports failures, and continues only when the input is valid.
What is a guard clause?
A guard clause handles an invalid or exceptional case immediately, often with `return`, so the main operation needs less nesting.
A practical review of the integrated Java skills, debugging habits, algorithm reasoning, and free-response strategies needed for AP Computer Science A.
A progressive guide to designing, operating, and testing systems that continue useful service despite component faults, overload, data loss, and recovery challenges.
A medium-difficulty quiz on how independently operated networks, protocols, addresses, naming systems, transport services, and routing mechanisms work together to form the Internet.
Learn how to create, modify, traverse, and analyze Java lists with ArrayList, wrapper types, standard algorithms, and the Collections utility class for AP Computer Science A.
Build a clear understanding of Java Boolean expressions, logical operators, selection statements, nested branching, equivalent logic, and systematic code tracing for AP Computer Science A.
A practical introduction to Java program structure, data types, operators, input and output, problem-solving strategy, testing, and debugging for AP Computer Science A.
A practical guide to Java inheritance, constructor chaining, method overriding, polymorphism, access control, and object behavior for tracing and writing AP Computer Science A programs.
A focused guide to Java classes, object references, constructors, methods, strings, wrapper classes, and API usage for AP Computer Science A.
A focused guide to Java primitive types, expression evaluation, numeric conversion, floating-point behavior, integer overflow, and common methods in the Math class for AP Computer Science A.
A focused review of Java primitive types, expression evaluation, numeric conversion, arithmetic behavior, Math methods, randomness, and tracing techniques for AP Computer Science A.
A progressive guide to how packet-switched networks encapsulate data, move it across links, and manage delay, throughput, queues, and congestion.
A structured guide to designing parallel and distributed systems through decomposition, communication, coordination, state management, scalability, and fault tolerance.