Module 5: Control Flow Logic Flashcards

1
Q

What is an if statement?

A

The command that allows you to make a decision based on true or false conditions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an else statement?

A

A statement that follows an if statement in which the contained code will be executed if the if condition is not true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a switch statement?

A

The switch statement is Java’s multiway branch statement. It provides an easy way to dispatch execution to different parts of your code based on the value of an expression. As such, it often provides a better alternative than a large series of if-else-if statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the brake keyword used for?

A

Used to end the execution in the current loop body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you prevent fall through logic in a switch statement?

A

Using the break keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Boolean expression?

A

An expression that can be evaluated as either true or false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

else if statement

A

The most general way of writing a multi-way decision.

  1. The expressions are evaluated in order.
  2. If any expression is true, the block associated with it is executed and then it breaks out of the chain of statements.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Conditional Operations

A

Computer algorithms that perform a test, then perform another operation based on the results of the test
< less than
<= less than or equal to
> greater than
>= greater than or equal
== equal to
!= not equal to
&& short-circuit AND
|| short-circuit OR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly