0% found this document useful (0 votes)
110 views

Ugrd-Ite6200a Computer Programming 1 Midterm Lab Exam

The document is a summary of quiz results. It shows that the user answered 8 multiple choice questions correctly out of 8 questions. The total time taken was 1 minute 24 seconds and the total marks scored were 40 out of 40.

Uploaded by

Kaye Cariño
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views

Ugrd-Ite6200a Computer Programming 1 Midterm Lab Exam

The document is a summary of quiz results. It shows that the user answered 8 multiple choice questions correctly out of 8 questions. The total time taken was 1 minute 24 seconds and the total marks scored were 40 out of 40.

Uploaded by

Kaye Cariño
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Started on Saturday, 19 November 2022, 8:22 PM

State Finished
Completed on Saturday, 19 November 2022, 8:23 PM
Time taken 1 min 24 secs
Marks 40.00/40.00
Grade 100.00 out of 100.00
Question 1
Correct
Mark 5.00 out of 5.00

Flag question

Question text
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.
None of the mentioned

b.
26

c.
27
d.
25
Feedback
Your answer is correct.

Question 2
Correct
Mark 5.00 out of 5.00

Flag question

Question text
Output of this program will be ____?
#include
using namespace std;
int main()
{
char str[5] = “ABC”;
cout << str[3];
cout << str;
return 0;
}

a.
AB

b.
ABCD

c.
None of the mentioned

d.
ABC
Feedback
Your answer is correct.

Question 3
Correct
Mark 5.00 out of 5.00

Flag question

Question text
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.
010

c.
110

d.
100
Feedback
Your answer is correct.

Question 4
Correct
Mark 5.00 out of 5.00

Flag question

Question text
What is the index number of the last element of an array with 9 elements?

a.
8

b.
0

c.
Programmer-defined

d.
9
Feedback
Your answer is correct.

Question 5
Correct
Mark 5.00 out of 5.00

Flag question
Question text
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,15

c.
x, 14

d.
x, 16
Feedback
Your answer is correct.

Question 6
Correct
Mark 5.00 out of 5.00

Flag question

Question text
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.
while, total, total

c.
for, total, total

d.
while, total,
Feedback
Your answer is correct.

Question 7
Correct
Mark 5.00 out of 5.00

Flag question

Question text
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, then

b.
else, if

c.
if, else

d.
if, x
Feedback
Your answer is correct.

Question 8
Correct
Mark 5.00 out of 5.00

Flag question

Question text
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.
2, default

b.
None of the mentioned

c.
y, default

d.
x, default
Feedback
Your answer is correct.

You might also like