
Incorrect
Marks for this submission: 0/1.
Question 24
Marks: 1
What is the output of the program?
#include <iostream>
struct BS { unsigned int color; };
struct car : public BS { };
struct truck : public BS { };
struct city : public car, public truck { };
int main(int argc, char** argv) { city c;
c.color = 3;
std::cout << c.color << std::endl;
return 0; }
Choose one answer.
|
a. 0 |
|
|
b. 3
|
|
|
c. ill-formed |
|
Incorrect
Marks for this submission: 0/1.
Question 25
Marks: 1
The ________ enables access to a global variable with the same name as a variable in the current scope
Choose one answer.
|
a. unary scope resolution operator (: |
|
|
b. name |
|
|
c. local
|
|
|
d. register |
|
|
e. var |
|
Incorrect
Marks for this submission: 0/1.
Question 26
Marks: 1
Identify and correct the errors in the following statement (assume that the statement using std::cout; is used): if ( c => 7 ) cout << "c is equal to or greater than 7\n";
Choose at least one answer.
|
a. if ( c !> 7 ) cout << "c is equal to or greater than 7\n"; |
|
|
b. if ( c >> 7 ) cout << "c is equal to or greater than 7\n"; |
|
|
c. if ( c = 7 ) cout << "c is equal to or greater than 7\n"; |
|
|
d. if ( c >< 7 ) cout << "c is equal to or greater than 7\n"; |
|
|
e. if ( c >= 7 ) cout << "c is equal to or
greater than 7\n";
|
|
Correct
Marks for this submission: 1/1.
Question 27
Marks: 1
Which conversion is not possible?
Choose one answer.
|
a. All are possible |
|
|
b. float to int |
|
|
c. double to float |
|
|
d. int to float |
|
|
e. char to float
|
|
Incorrect
Marks for this submission: 0/1.
Question 28
Marks: 1
The ________ qualifier is used to declare read-only variables
Choose one answer.
|
a. read |
|
|
b. read-only |
|
|
c. const |
|
|
d. static
|
|
|
e. unchangeable |
|
Incorrect
Marks for this submission: 0/1.
Question 29
Marks: 1
What is the maximum number of implicitly defined constructors that this struct will have?
struct A { A(A& a) { } A(double d) {} int val; };
Choose one answer.
|
a. 2
|
|
|
b. 0 |
|
|
c. implementation specified |
|
|
d. 1 |
|