Day 4 Flashcards
1
Q
What are the compound statements?
A
! – NOT – inverts the truth
&& - AND – both must be true
Double bar – OR – at least one must be true
2
Q
Four essential actions of LOOPS
A
- Initialization – assigns initial value of control variable
- Condition – evaluates the control to determine whether the loop will execute.
- Change- changes the value of the control to ensure loops has a means of exiting.
- Body- statements defined between the opening and closing curly braces of loop.
3
Q
While loops
A
If condition fails the first time, loop never executes.
4
Q
For loop
A
Counting loop; updated until condition specified is no longer true.
5
Q
FOR EACH loop
A
Pushes value into identifier. Used to iterate through a set of items I.e – { For (int x : 1, 2, 3, 4, 5} //note that the colon is why it is a for each and value is pushed into x { Cout << x << “!”;} Return 0; ANSWER IS 1!2!3!4!5!
6
Q
Explain: Jump Statements
A
- Break: a way to immediately exit from a loop statement and continue executing the program with the next statement following the loop body.
- Continue: terminates the current iteration of loop and control jumps to the beginning of the loop for the next iteration
- Return: terminates execution of a function and returns control to the calling function
7
Q
Which is the most popular debugging tool?
A
GNU debugger