Question
C++ questions 1. Consider the following array, what is the value of total after the following loops complete? int z[12] = { 5, 4, 3,
C++ questions
1. Consider the following array, what is the value of total after the following loops complete?
int z[12] = { 5, 4, 3, 2, 1, 0, -1, -2, -3, -4};
int total = 0;
for (int j = 0; j < 12; j++) {
total = z[j] + total;
}
Select one:
a.1
b.0
c.5
D.4
2. The definition statement Date birth, current; reserves storage for ____.
Select one:
a.two current structure variables
b.two birth structure variables
c.two Date structure variables
d.a birth and a current structure variable
3. Which is TRUE for looping in C++?
i. dowhile loops are posttest loops, in contrast to for loops, which is pretest loops
ii. Number of repetitions known in advance in for loops
iii. while loops may not execute at all
iv. dowhile loops can replace while loops which execute at least once.
Select one:
a.i, iii
b.i, ii, iv
c.i, ii, iii, iv
d.ii, iii, iv
4. Given the following declarations, what will be the values of i, j and m in the program?
int a[]={1,2,3,4,5};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
Select one:
a.3, 2, 4
b.3, 3, 4
c.3, 2, 3
d.4, 3, 4
5. Given the function prototype:
double testAlpha(int u, char v, string t);
Which of the following statements is legal?
Select one:
a.cout << testAlpha( A, 10, 2.0);
b.cout << testAlpha(A, "A, abc);
c.cout << testAlpha(5.2, 'A', 2);
d.cout << testAlpha(5.2, 2.0, abc);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started