0% found this document useful (0 votes)
106 views7 pages

Midterm Lab Exam - ComProg1

The document summarizes a student's attempt at a midterm lab exam on C++ programming. The exam consisted of 8 multiple choice questions testing concepts like arrays, strings, loops, conditionals, and switch statements. The student answered all questions correctly and received a perfect score of 40 out of 40 or 100% on the exam.

Uploaded by

Yolanda Riguer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views7 pages

Midterm Lab Exam - ComProg1

The document summarizes a student's attempt at a midterm lab exam on C++ programming. The exam consisted of 8 multiple choice questions testing concepts like arrays, strings, loops, conditionals, and switch statements. The student answered all questions correctly and received a perfect score of 40 out of 40 or 100% on the exam.

Uploaded by

Yolanda Riguer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

11/16/22, 7:08 PM Midterm Lab Exam: Attempt review

Home / My courses / UGRD-ITE6200A-2213T / Midterm Exam / Midterm Lab Exam

Started on Wednesday, 16 November 2022, 5:50 PM


State Finished
Completed on Wednesday, 16 November 2022, 5:55 PM
Time taken 5 mins 17 secs
Marks 40.00/40.00
Grade 100.00 out of 100.00

Question 1
Correct

Mark 5.00 out of 5.00

Output of the this program will be _____

#include

using namespace std;

int main ()

int array[] = {0, 2, 4, 6, 7, 5, 3};

int n, result = 0;

for (n = 0 ;n < 8 ;n++) {

result += array[n];

cout << result;

return 0;
}

a. 27

b. 26

c. 25

d. None of the mentioned

Your answer is correct.

trimestralexam.amaesonline.com/2213/mod/quiz/review.php?attempt=124838&cmid=5217 1/7
11/16/22, 7:08 PM Midterm Lab Exam: Attempt review

Question 2

Correct

Mark 5.00 out of 5.00

Output of this program will be ____?

#include

using namespace std;

int main()

char str[5] = “ABC”;

cout << str[3];

cout << str;

return 0;
}

a. ABC

b. None of the mentioned

c. AB

d. ABCD

Your answer is correct.

trimestralexam.amaesonline.com/2213/mod/quiz/review.php?attempt=124838&cmid=5217 2/7
11/16/22, 7:08 PM Midterm Lab Exam: Attempt review

Question 3

Correct

Mark 5.00 out of 5.00

What will be the output of the following C++


code?

#include
<iostream>
#include
<string>

using namespace std;

int
main()
{

         cout<<is_array<int>::value;
         cout<<is_array<char[10]>::value;

         cout<<is_array<string>::value;
         return 0;

a. 011

b. 110

c. 100

d. 010

Your answer is correct.

Question 4
Correct

Mark 5.00 out of 5.00

What is the index number of


the last element of an array with 9 elements?

a. Programmer-defined

b. 0

c. 8

d. 9

Your answer is correct.

trimestralexam.amaesonline.com/2213/mod/quiz/review.php?attempt=124838&cmid=5217 3/7
11/16/22, 7:08 PM Midterm Lab Exam: Attempt review

Question 5

Correct

Mark 5.00 out of 5.00

Fill in the blanks to print "this is a loop" to


the screen 15 times.
int x = 1;

do {
  cout <<
"this is a loop" << endl;

  x++;
}

while (_____<= _____);

a. 15,x

b. x, 16

c. x, 14

d. x,15

Your answer is correct.

trimestralexam.amaesonline.com/2213/mod/quiz/review.php?attempt=124838&cmid=5217 4/7
11/16/22, 7:08 PM Midterm Lab Exam: Attempt review

Question 6

Correct

Mark 5.00 out of 5.00

Fill in the blanks to enter five numbers from the user and
print their sum. Store the sum in the variable named total.
 

int x = 1;
int number;

int total = 0;
_______ (x <= 5) {

  cin >> number;

_______= total + number;


  x++;

}
cout << "Sum: " << _____ <<
endl;

a. None of the mentioned

b. for, total, total

c. while, total, 

d. while, total, total

Your answer is correct.

trimestralexam.amaesonline.com/2213/mod/quiz/review.php?attempt=124838&cmid=5217 5/7
11/16/22, 7:08 PM Midterm Lab Exam: Attempt review

Question 7

Correct

Mark 5.00 out of 5.00

Fill in the missing parts of the following code:


 int x = 22;

 ______(x > 33) {


 cout << "x
is greater than 33" << endl;

}
 ______ {

 cout << "x


is not greater than 33" << endl;

a. if, x

b. if, else

c. if, then

d. else, if

Your answer is correct.

trimestralexam.amaesonline.com/2213/mod/quiz/review.php?attempt=124838&cmid=5217 6/7
11/16/22, 7:08 PM Midterm Lab Exam: Attempt review

Question 8

Correct

Mark 5.00 out of 5.00

Fill in the blanks to test the value of the variable x; if x


is 2, print "it's 2" to the screen; otherwise (the default case),
print "the default case" to
the screen.
 

int x;

cin >> x;
switch (____) {

case 2:
 cout <<
"it's 2" << endl;

 break;
 ______:

 cout <<
"the default case" << endl;
}

a. y, default

b. 2, default

c. None of the mentioned

d. x, default

Your answer is correct.

◄ Midterm Exam

Jump to...

trimestralexam.amaesonline.com/2213/mod/quiz/review.php?attempt=124838&cmid=5217 7/7

You might also like