Midterm Lab Quiz 1 and Lab Quiz 2 Computer Programming 1
Midterm Lab Quiz 1 and Lab Quiz 2 Computer Programming 1
Flag question
Question text
Each pass through a loop is called a/an -
a.
culmination
b.
pass through
c.
enumeration
d.
iteration
Feedback
Your answer is correct.
Question 2
Incorrect
Mark 0.00 out of 2.00
Flag question
Question text
Which looping process checks the test condition at the end of the loop?
a.
for
b.
while
c.
do-while
d.
no looping process checks the test condition at the end
Feedback
Your answer is incorrect.
Question 3
Incorrect
Mark 0.00 out of 2.00
Flag question
Question text
A continue statement causes execution to skip to -
a.
the next iteration of the loop
b.
the statement following the continue statement
c.
the first statement after the loop
d.
the return 0; statement
Feedback
Your answer is incorrect.
Question 4
Incorrect
Mark 0.00 out of 2.00
Flag question
Question text
In a group of nested loops, which loop is executed the most number of times?
a.
the outermost loop
b.
the innermost loop
c.
cannot be determined without knowing the size of the loops
d.
all loops are executed the same number of times
Feedback
Your answer is incorrect.
Question 5
Correct
Mark 2.00 out of 2.00
Flag question
Question text
The statement i++; is equivalent to -
a.
i = i - 1;
b.
i --
c.
i = i + 1;
d.
i = i + i;
Feedback
Your answer is correct.
Question 6
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which looping process is best used when the number of iterations is known?
a.
do-while
b.
while
c.
for
d.
all looping processes require that the iterations be known
Feedback
Your answer is correct.
Question 7
Incorrect
Mark 0.00 out of 2.00
Flag question
Question text
What's wrong? for (int k = 2, k <=12, k++)
a.
there should be a semicolon at the end of the statement
b.
the variable must always be the letter i when using a for loop
c.
the commas should be semicolons
d.
the increment should always be ++k
Feedback
Your answer is incorrect.
Question 8
Incorrect
Mark 0.00 out of 2.00
Flag question
Question text
What's wrong? while( (i < 10) && (i > 24))
a.
the test condition is always false
b.
the while loop is an exit-condition loop
c.
the test condition is always true
d.
the logical operator && cannot be used in a test condition
Feedback
Your answer is incorrect.
Question 9
Correct
Mark 2.00 out of 2.00
Flag question
Question text
If there is more than one statement in the block of a for loop, which of the following
must be placed at the beginning and the ending of the loop block?
a.
parentheses
b.
arrows<>
c.
braces{}
d.
brackets [ ]
Feedback
Your answer is correct.
Question 10
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What's wrong? (x = 4 && y = 5) ? (a = 5) ; (b = 6);
a.
there are too many variables in the statement
b.
the conditional operator is only used with a strings
c.
the question mark should be an equal sign
d.
the first semicolon should be a colon
Feedback
Your answer is correct.
Question text
An array can contain how many kinds of elements ?
a.
All of them have same type
b.
Only char type
c.
Only int type
d.
Char and int type
Feedback
Your answer is correct.
Question 2
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Array is defined as -
a.
An array is a series of elements of the same type in contiguous memory locations
b.
An array is a series of elements of the same type placed in non-contiguous memory
locations
c.
None of the mentioned
d.
An array is a series of element
Feedback
Your answer is correct.
Question 3
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the header file is used for array type manipulation?
a.
std namespace
b.
<iostream>
c.
<type_traits>
d.
<array>
Feedback
Your answer is correct.
Question 4
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Arrays elements can be accessed?
a.
Logarithmically
b.
Randomly
c.
Exponentially
d.
Both B and C
Feedback
Your answer is correct.
Question 5
Correct
Mark 2.00 out of 2.00
Flag question
Question text
Which of the following correctly declares an array?
a.
array array[10];
b.
array{10};
c.
int array;
d.
int array[10];
Feedback
Your answer is correct.
Question 6
Correct
Mark 2.00 out of 2.00
Flag question
Question text
if you have to make decision based on multiple choices, which of the following is
best suited?
a.
if-else-if
b.
All of the above
c.
if-else
d.
if
Feedback
Your answer is correct.
Question 7
Incorrect
Mark 0.00 out of 2.00
Flag question
Question text
In situations where we need to execute body of the loop before testing the
condition, we should use_____.
a.
For loop
b.
do-while loop
c.
while loop
d.
nested for loop
Feedback
Your answer is incorrect.
Question 8
Correct
Mark 2.00 out of 2.00
Flag question
Question text
What is the way to suddenly come out of or quit any loop in C++?
a.
leave; statement
b.
break; statement
c.
quit; statement
d.
continue; statement
Feedback
Your answer is correct.
Question 9
Correct
Mark 2.00 out of 2.00
Flag question
Question text
The switch statement is also called as?
a.
bitwise structure
b.
selective structure
c.
certain structure
d.
choosing structure
Feedback
Your answer is correct.
Question 10
Incorrect
Mark 0.00 out of 2.00
Flag question
Question text
What is the index variable for the element at the first row and first column in array?
a.
a[1][1]
b.
a[0][1] (mali to cow na manghula. Btw single ako, kung babae ka pm mo.)
c.
a[1][0]
d.
a[0][0]
Feedback
Your answer is incorrect.