NAME

### Question limit

of 13 available terms

### 13 Matching questions

1. What is the cause of the bug that is known as the infinite loop?
2. Is the do while loop frequently used in practice?
3. How many times will the following loop execute?

int i = 1;
do {
printf("looping");
}
while ( i < 1 ) ;
4. What is a loop?
5. What is inside the parenthesis?

for (int i=0; i<12; i++)
6. What are the drawbacks of the while and do while loops?
7. Which is a valid for loop that will execute exactly 5 times?
8. How many times will the following loop execute?

int i = 0;
while ( i < 1 ) {
printf("looping");
}
9. Which of the following is not a looping construct?
10. How would you access the second element from a character array named "letters".

char letters[] = {'a','b','c','d'};
11. What are the While and do while loops?
12. Explain this for loop.
{
for (int i=0; i<12; i++)
{sum += evens[i];
printf("sum %d \n", sum);

}
return 0;

}
13. What is the purpose of a do while conditional expression?
1. a It is a construct that allows you to repeatedly execute a block of code.
2. b for ( int = 0 ; i < 5; i++ ) {}
3. c once
4. d Simply allow for executing a block of code without providing any construct for keeping a counter.
5. e No it is not. The for loop and while loop are used for when you want to traverse arrays or do any other type of looping.
6. f do-until loop
7. g Infinite because it neglects the auto incrementation of the variable within the conditional expression.
8. h The code within the block will always be evaluated once before the condition is reached.
This is why it is used.

#include <stdio.h>

int main()
{
char letters[] = {'a','b','c'};
int w = 0;
do
{
printf("letter %d is %c \n", w, letters[w]);
} while (w<4);

return 0;
}
9. i The variable is not auto incremented, so it repeatedly traverses the same index value in the array.

#include <stdio.h>

int main()
{
char letters[] = {'a','b','c'};
int w = 0;
do
{
printf("letter %d is %c \n", w, letters[w]);
++w; }
while (w<4);

return 0;
}
10. j The for loop has three statements within the set of parentheses.
a. First we are initializing an integer variable "i" to "0"
b. Second a Boolean expression which "i", to the number of items in the array (3).
c. Thirdly we are auto incrementing "i" if the value of the index is <12.

(i) Then within the code block {} we are incrementally summing the values that are in the array "even".

(ii) w/in the block we are indexing the variables using the variable "i".
11. k The conditional expression.
12. l It is easy to make the common error of the "infinite death loop".
13. m letters[1];