Chapter 4 Flashcards

(25 cards)

1
Q

What are the 2 most common control structures?

A

Selection and Repetition.

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

What is selection?

A

When the program executes a particular statement depending on some conditions.

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

What is repetion?

A

When the program repeats particular statements a certain number of times based on some conditions.

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

What is a logical expression?

A

An expression that evaluates to true or false.

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

What operator is this: ==

A

equal to

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

what operator is this: !=

A

not equal to

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

what operator is this:

A

less than

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

what operator is this: >

A

greater than

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

what operator is this: <=

A

less than or equal to

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

what operator is this: >=

A

greater than or equal to

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

How are one way selectors incorporated ?

A

Using an if statement
if (expression) {
statement;
}

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

What is two-way selection?

A

Choosing between two alternatives.

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

How are two-way selectors incorporated ?

A
if...else statements.
if (expression) {
statement;
}
else {
statement;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a compund statement.

A

A statement that consist of a sequence of statement enclosed in curly braces
{
statement 1, statement 2, statement n;
}

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

What is it called when control staement are located within each other?

A

Nesting

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

What is the pairing else with an if rule?

A

An else statement is assocaited with most recent if statement.

17
Q

What is the conditional operator (or ternary operator)?

A

”?” the 3 arguments that explain what the condition is, what the results will be if the condition is true and result when the condition is false.
expression 1 ? expression 2 : expression 3

18
Q

What is short curciut evaluation (of a logical operator)?

A

A process in which a computer evaulates a logical expression from left to right and stops as soon as a final value is of the expression is known.

19
Q

‘R’ > ‘T’ Is the statement true of false why?

A

False, because ‘R’ comes before ‘T’ in alphabet and in is a lesser number in ASCII Characters

20
Q

What opperator is this: &&

21
Q

What opperator is this: ||

22
Q

What opperator is this: !

23
Q

What hold opperators hold the highest precedence?

A

!, +, - (unary operators)

24
Q

What is the rest of the precedence order?

A

*, /, % second
+, - third
=, > fourth
==, != fifth
&& sixth
|| seventh
= (assignment operator) last

25
What is a switch statement?
Switch, case, break, and default are reserved words. In a switch structure, first the expression is evaluated. The value of the expression is then used to choose and perform the actions specified in the statements that follow the reserved word case.