Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
  1. A Class is __________ .
  • a user-defined data type
  • a pointer to a method
  • also know as an object
  • special variable
  1. The __________ of a class is used to initialize object of that class type.
  • destructor
  • initializer
  • assignment operator
  • constructor
  1. Class member attributes can be accessed with the __________ operator.
  • dot .
  • insertion <<
  • extraction >>
  • sizeof
  1. If not user-defined constructor are provided for a class, C++ will automatically generate a __________ constructor.
  • useful
  • default
  • local
  • global
  1. __________ and __________ determine the access allowed to class members.
  • new, delete
  • public, private
  • open, closed
  • viewable, non-viewable
  1. The copy semantics provided by the default C++ Copy Constructor is __________ .
  • dynamic access
  • static access
  • deep copy
  • memberwise copy
  1. __________ are associated with the C++ Move Constructor.
  • L-values
  • R-values
  • L-value references
  • R-value references
  1. The class __________ is called when an object goes out of scope.
  • deconstructor
  • deleter
  • destructor
  • destroyer
  1. What does the following code display?
#include <iostream>

using namespace std;

class Test{
    private:
        int num;
        void increment_num() {
            num++;
        }
    public:
        Test(int num) : num{num} {}
};

int main() {
    Test object{100};
    cout << object.increment_num() << endl;
    return 0;
}
  • the code won't compile
  • 100
  • 101
  • gargabe data
  1. Given the following class declaration, which statment is NOT true?
class Test{
    private:
        int num;
        void increment_num() {
            num++;
        }
    public:
        Test(int num) : num{num} {}
        void decrement_num() {
            num--;
        }
};
  • num is not accessible outside the class declaration
  • the class name is Test
  • decrement_num() is accessible outside the class declaration
  • the class has a default compiler generated copy constructor
  • the class has a default compiler generate default constructor