Last Updated on November 1, 2019 by Admin
CPA Chapter 5 Assessment Online
CPA -- Chapter 5 Assessment
Quiz-summary
0 of 20 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
Information
CPA — Chapter 5 Assessment
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 20 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- Answered
- Review
-
Question 1 of 20
1. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class A {
public: string a(string b) {
return b.substr(0,2);
}};
class B {
public: string a(string b) {
return b.substr(2,2);
}};
int main() {
A a;
B b;
cout << a.a(b.a(“ABCD”));
return 0;
}Correct
Incorrect
-
Question 2 of 20
2. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
int data[3];
public:
int cnt;
void put(int v) { data[cnt++] = v; }
};
int main() {
A a;
a.cnt = 0;
a.put(1);
a.put(1);
cout << a.cnt;
return 0;
}Correct
Incorrect
-
Question 3 of 20
3. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
int data[3];
private:
int cnt;
public:
void put(int v) { data[cnt++] = v; }
int take() { int c = cnt; cnt = 0; return c; }
};
int main() {
A a;
a.take();
a.put(a.take());
a.put(1);
cout << a.data[0];
return 0;
}Correct
Incorrect
-
Question 4 of 20
4. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
int cnt;
void put(int v) { cout << cnt++; }
};
int main() {
A a;
a.cnt = 0;
a.put(1);
a.put(1);
return 0;
}Correct
Incorrect
-
Question 5 of 20
5. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
int cnt;
void put(int v);
};
void A::put(int v) { cout << ++cnt; }
int main() {
A a[2];
a[0].cnt = 0;
a[1].cnt = 1;
a[a[0].cnt].put(a[1].cnt);
return 0;
}Correct
Incorrect
-
Question 6 of 20
6. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
float v;
float set(float v) {
v += 1.0;
this -> v = v;
return v;
}
float get(float d) {
v += 1.0;
return v;
}
};
int main() {
A a;
cout << a.get(a.set(a.set(0.5)));
return 0;
}Correct
Incorrect
-
Question 7 of 20
7. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
float v;
float set(float v) {
A::v += 1.0;
A::v = v + 1.0;
return v;
}
float get(float v) {
v += A::v;
return v;
}
};
int main() {
A a;
cout << a.get(a.set(a.set(0.5)));
return 0;
}Correct
Incorrect
-
Question 8 of 20
8. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
float v;
float set(float v) {
A::v += 1.0;
return v;
}
float set(void) {
A::v = v + 1.0;
return 0.0;
}
float get(float v) {
v += A::v;
return v;
}
};
int main() {
A a;
cout << a.get(a.set(a.set(a.set())));
return 0;
}Correct
Incorrect
-
Question 9 of 20
9. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
A() { v = 2.5; }
float v;
float set(float v) {
A::v += 1.0;
return v;
}
float get(float v) {
v += A::v;
return v;
}
};
int main() {
A a;
a.A();
cout << a.get(a.set(1.5));
return 0;
}Correct
Incorrect
-
Question 10 of 20
10. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
A() { v = 2.5; }
float v;
float set(float v) {
A::v += 1.0;
return v;
}
float get(float v) {
v += A::v;
return v;
}
};
int main() {
A a;
cout << a.get(a.set(1.5));
return 0;
}Correct
Incorrect
-
Question 11 of 20
11. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
A() { v = 2.5; }
A(float v) { A::v = v + 1.0; }
float v;
float set(float v) {
A::v += 1.0;
return v;
}
float get(float v) {
v += A::v;
return v;
}
};
int main() {
A a,b(1.0);
cout << a.get(b.set(1.5));
return 0;
}Correct
Incorrect
-
Question 12 of 20
12. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
A(float v) { A::v = v; }
float v;
float set(float v) {
A::v += v;
return v;
}
float get(float v) {
return A::v + v;
}
};
int main() {
A a,b(1.0);
cout << a.get(b.set(1.5));
return 0;
}Correct
Incorrect
-
Question 13 of 20
13. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
A(A &a) { v = a.get(0.0); }
A(float v) { A::v = v; }
float v;
float set(float v) {
A::v += v;
return v;
}
float get(float v) {
return A::v + v;
}
};
int main() {
A a(0.), b = a;
cout << a.get(b.set(1.5));
return 0;
}Correct
Incorrect
-
Question 14 of 20
14. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
A(A &a) { v = a.get(0.0); }
A(float v) { A::v = v; }
float v;
float set(float v) {
A::v += v;
return v;
}
float get(float v) {
return A::v + v;
}
};
int main() {
A *a = new A(1.0), *b = new A(*a);
cout << a->get(b->set(a->v));
return 0;
}Correct
Incorrect
-
Question 15 of 20
15. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
A(float v) { A::v = v; }
float v;
float set(float v) {
A::v = v;
return v;
}
float get(float v) {
return A::v;
}
};
int main() {
A *a = new A(1.0), *b = new A(*a);
cout << a->get(b->set(a->v));
return 0;
}Correct
Incorrect
-
Question 16 of 20
16. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
A(A *v) { A::v = v; }
A() { A::v = 1.0; }
float v;
float set(float v) {
A::v = v;
return v;
}
float get(float v) {
return A::v;
}
};
int main() {
A a,*b = new A(a);
cout << a->get(b->set(a->v));
return 0;
}Correct
Incorrect
-
Question 17 of 20
17. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
float v;
A() { v = 1.0; }
A(A &a) { A::v = a.v; cout << “1”; }
~A() { cout << “0”; }
float set(float v) {
A::v = v;
return v;
}
float get(float v) {
return A::v;
}
};
int main() {
A a,*b = new A(a),*c = new A(*b);
c->get(b->get(a.set(1.0)));
delete b;
delete c;
return 0;
}Correct
Incorrect
-
Question 18 of 20
18. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
float v;
A() { v = 1.0; }
A(A &a) { A::v = a.v; cout << “1”; }
~A() { cout << “0”; }
float set(float v) {
A::v = v;
return v;
}
float get(float v) {
return A::v;
}
};
int main() {
A a, b = a;
return 0;
}Correct
Incorrect
-
Question 19 of 20
19. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
float v;
A() : v(1.0) {}
A(A &a) : v(2.0) {}
A(float f) : v(3.0) {}
float get() {
return A::v;
}
};
int main() {
A a, b(a.get()), c(b);
cout << a.v + b.v + c.v;
return 0;
}Correct
Incorrect
-
Question 20 of 20
20. Question
1 pointsWhat happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
class A {
public:
float v;
A(float x) : v(x) {}
};
class B {
public:
A a;
float b;
B(float x) : a(x + 1) { b = a.v; }
};
int main() {
B b(2.0);
cout << b.b;
return 0;
}Correct
Incorrect