Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
19 Cards in this Set
- Front
- Back
How many ways can we decide something?
|
One way, or two ways.
|
|
What can we use to determine a decision?
|
If constructs, or Switch constructs.
|
|
What are the arguments of an ‘if’ statement?
|
The condition is the argument.
|
|
What is an ‘else’ statement used for?
|
The ‘else’ statement is used to execute a different statement if the condition in the ‘if’ statement is false.
|
|
What are RELOPS?
|
Relational Operators:
|
|
List some RELOPS.
|
> greater than
>= greater than or equal to <= less than or equal to < less than == equal to != not equal to |
|
If we use Conditional Statements in Java what is needed?
|
Logical operators are needed to ‘connect’ each condition.
|
|
List some Logical Operators.
|
! NOT Reverses the current evaluation
&& AND Both conditions must be true for the eval. to be true || OR At least one condition must be true for the eval. to be true. |
|
What is the only way an evaluation is TRUE with the && logic operator?
|
Both conditions must be true.
|
|
What is the only way an evaluation is FALSE with the || logic operator?
|
Both conditions must be false.
|
|
What is the most used/preferred data type when using logic operators?
|
Boolean
|
|
Including the math operators, relops, and logic operators, what is the order or priority?
|
1. ()
2. ! 3. *, /, % 4. +, - 5. <, <=, >, >= 6. == != 7. && 8. || |
|
Should you group like ‘if’ and ‘else’ statements?
|
Yes, it is considered good software engineering practice to group ‘if’ and ‘else’ statements.
|
|
What is a Switch Construct and why should you use it?
|
Another way to make multiple decisions besides complex conditionals and nesting. It can be used when the variable being tested is an int or a char data type.
|
|
How do you represent the argument for a switch?
|
switch(if condition is)
{ case 1: statement; break; } |
|
Is there something needed to stop each section of a switch?
|
Yes, you need to stop each section with a ‘break’.
|
|
What is the default used for?
|
It tells the system what to do if there is no matching case.
|
|
What are local variables?
|
Variables that are only used inside the method in which they have been declared.
|
|
Where should we declare them?
|
At the beginning of the method.
|