Câu 1
Đáp án và lời giải
Đáp án: D
Đáp án: D
Đáp án: A
Đáp án: D
Đáp án: A
Đáp án: A
Đáp án: B
Đáp án: B
Đáp án: C
What is a base class?
Đáp án: D
Đáp án: D
What is a destructor?
Đáp án: B
In protected inheritance:
Đáp án: B
Đáp án: B
Đáp án: D
Đáp án: C
Đáp án: B
Đáp án: B
Static member functions ___
Đáp án: C
mmmmmmmmmm
Đáp án: C
Đáp án: B
In the following code what would be the values of i1 and i2
#include <iostream>
using namespace std; namespace N1 { int f(int n) { return n * 2; } } namespace N2 { int f(double n) { return n * 3; } } void main() { using N1::f; int i1 = f(1.0); cout << "i1 = " << i1; using N2::f; int i2 = f(1.0); cout << "i1 = " << i2; system("pause"); }
Đáp án: B
In the following code, which of the following variables can be accessed in “Friend”? class Base { public: int a; protected: int b; private: int c; }; class Derived : Base { int d; friend Friend; }; class Friend { Derived derived; };
Đáp án: D
What is the output of the following code? #include int count = 0; class obj { public: obj() { count++; } ~obj() { count--; } }; int main() { obj A, B, C, D, E; obj F; { obj G; } std::cout << count; return 0; }
Đáp án: C
What is wrong in the following code? #include class Base { public: Base() {}; virtual ~Base() {}; }; class Derived : protected Base { public: virtual ~Derived() {}; }; int main() { Base *pb = new Derived(); return 0; }
Đáp án: B
Đáp án: B