Attempt History
Attempt Time Score
LATEST Attempt 1 15 minutes 10 out of 10
Answers will be shown after your last attempt
Submitted Dec 8 at 5:04pm
Question 1
pts
What is the output of the following program?
#include <iostream>
using namespace std;
class A {
int a;
};
int main(void) {
A a;
a.a = 1/2;
cout << a.a << endl;
return 0;
}
0
1
0.5
The program will cause a compilation error.
, Question 2
pts
What is the output of the following program?
#include <iostream>
using namespace std;
class A {
int a;
public:
int b;
A(void) { a = b = 1; }
};
int main(void) {
A a;
a.b /= 2;
cout << a.b << endl;
return 0;
}
0
0.5
The program will cause a compilation error.
1
Question 3
pts
What is the output of the following program?
Attempt Time Score
LATEST Attempt 1 15 minutes 10 out of 10
Answers will be shown after your last attempt
Submitted Dec 8 at 5:04pm
Question 1
pts
What is the output of the following program?
#include <iostream>
using namespace std;
class A {
int a;
};
int main(void) {
A a;
a.a = 1/2;
cout << a.a << endl;
return 0;
}
0
1
0.5
The program will cause a compilation error.
, Question 2
pts
What is the output of the following program?
#include <iostream>
using namespace std;
class A {
int a;
public:
int b;
A(void) { a = b = 1; }
};
int main(void) {
A a;
a.b /= 2;
cout << a.b << endl;
return 0;
}
0
0.5
The program will cause a compilation error.
1
Question 3
pts
What is the output of the following program?