C++ Quiz 1 Flashcards
Which feature of OOPS described the reusability of code?
A. Abstraction
B. Encapsulation
C. Polymorphism
D. Inheritance
A. Abstraction
B. Encapsulation
C. Polymorphism
D. Inheritance
The feature of OOPS that describes the reusability of code is Inheritance.
Which of the following is not an OOP?
A. Java
B. C#
C. C++
D. C
A. Java
B. C#
C. C++
D. C
The language that is not OOP is C.
OOP acronym for
A. Object of Programming
B. Object Original Programming
C. Object Oriented Programming
D. Operating Original Programming
A. Object of Programming
B. Object Original Programming
C. Object Oriented Programming
D. Operating Original Programming
OOP stands for Object Oriented Programming.
Which feature of OOPS derives the class from another class?
A. Inheritance
B. Data hiding
C. Encapsulation
D. Polymorphism
A. Inheritance
B. Data hiding
C. Encapsulation
D. Polymorphism
The OOPS feature that derives a class from another class is Inheritance.
Which of the following is correct about class?
A. class can have member functions while structure cannot.
B. class data members are public by default while that of structure are private.
C. Pointer to structure or classes cannot be declared.
D. class data members are private by default while that of structure are public by default
A. class can have member functions while structure cannot.
B. class data members are public by default while that of structure are private.
C. Pointer to structure or classes cannot be declared.
D. class data members are private by default while that of structure are public by default
The correct statement is class data members are private by default while that of structure are public by default.
Which of the following is not an access specifier?
A. Public
B. Char
C. Private
D. Protected
A. Public
B. Char
C. Private
D. Protected
The one that is not an access specifier is Char.
Which of the following OOP concept is not true for the C++ programming language?
A. A class must have member functions
B. C++ Program can be easily written without the use of classes
C. At least one instance should be declared within the C++ program
D. C++ Program must contain at least one class
A. A class must have member functions
B. C++ Program can be easily written without the use of classes
C. At least one instance should be declared within the C++ program
D. C++ Program must contain at least one class
The concept that is not true for C++ is C++ Program must contain at least one class.
What is the extra feature in classes which was not in the structures?
A. Member functions
B. Data members
C. Public access specifier
D. Static Data allowed
A. Member functions
B. Data members
C. Public access specifier
D. Static Data allowed
The extra feature in classes is Member functions.
Which operator is used to define a member function outside the class?
A. *
B. ( )
C. +
D. ::
A. *
B. ( )
C. +
D. ::
The operator used to define a member function outside the class is ::.
Nested member function is
A. A function that call itself again and again.
B. A member function may call another member function within itself.
C. Same as Class in the program
D. Accessed using * operator
A. A function that call itself again and again.
B. A member function may call another member function within itself.
C. Same as Class in the program
D. Accessed using * operator
A nested member function is when a member function may call another member function within itself.
Which of the following is syntax of C++ class member function?
A. class_name,function_name
B. return_type class_name :: member_function
C. datatype_class_name,function_name
D. class_name_function_name
A. class_name,function_name
B. return_type class_name :: member_function
C. datatype_class_name,function_name
D. class_name_function_name
The correct syntax of a C++ class member function is return_type class_name :: member_function.
Which among the following feature does not come under the concept of OOPS?
A. Platform independent
B. Data binding
C. Data hiding
D. Message passing
A. Platform independent
B. Data binding
C. Data hiding
D. Message passing
The feature that does not come under OOPS is Platform independent.
The combination of abstraction of the data and code is viewed in________.
A. Inheritance
B. Class
C. Object
D. Interfaces
A. Inheritance
B. Class
C. Object
D. Interfaces
The combination of abstraction of data and code is viewed in Object.
Which is private member functions access scope?
A. Member functions which can used outside the class
B. Member functions which can only be used within the class
C. Member functions which are accessible in derived class
D. Member functions which can’t be accessed inside the class
A. Member functions which can used outside the class
B. Member functions which can only be used within the class
C. Member functions which are accessible in derived class
D. Member functions which can’t be accessed inside the class
Private member functions can only be used within the class, meaning their access scope is within the class.
Which syntax among the following shows that a member is private in a class?
A. private::Name(parameters)
B. private: function Name(parameters)
C. private(function Name(parameters))
D. private function Name(parameters)
A. private::Name(parameters)
B. private: function Name(parameters)
C. private(function Name(parameters))
D. private function Name(parameters)
The correct syntax to declare a private member in a class is private: function Name(parameters).
Which of the followings is/are automatically added to every class, if we do not write our own?
A. Copy Constructor
B. Assignment Operator
C. A constructor without any parameter
D. All of the above
A. Copy Constructor
B. Assignment Operator
C. A constructor without any parameter
D. All of the above
All of the above are automatically added to every class if we do not write our own All of the above.
Which of the following gets called when an object is being created?
A. Constructor
B. Virtual Function
C. Destructors
D. Main
A. Constructor
B. Virtual Function
C. Destructors
D. Main
When an object is being created, the Constructor is called.
Can we define a class without creating constructors?
A. True
B. False
A. True
B. False
Yes, we can define a class without creating constructors, so the answer is True.
Which constructor function is designed to copy object of same class type?
A. Copy constructor
B. Create constructor
C. Object constructor
D. Dynamic constructor
A. Copy constructor
B. Create constructor
C. Object constructor
D. Dynamic constructor
The constructor function designed to copy object of same class type is called Copy constructor.
Allocation of memory to objects at the time of their construction is known as ……………. of objects.
A. Run time construction
B. Dynamic construction
C. Initial construction
D. Memory allocator
A. Run time construction
B. Dynamic construction
C. Initial construction
D. Memory allocator
The allocation of memory to objects at the time of their construction is known as Dynamic construction.
If new operator is used, then the constructor function is
A. Parameterized constructor
B. Copy constructor
C. Dynamic constructor
D. Default constructor
A. Parameterized constructor
B. Copy constructor
C. Dynamic constructor
D. Default constructor
If the new operator is used, then the constructor function is Dynamic constructor.
Which among the following best describes constructor overloading?
A. Defining one constructor in each class of a program
B. Defining more than one constructor in single class
C. Defining more than one constructor in single class with different signature
D. Defining destructor with each constructor
A. Defining one constructor in each class of a program
B. Defining more than one constructor in single class
C. Defining more than one constructor in single class with different signature
D. Defining destructor with each constructor
Constructor overloading is best described as Defining more than one constructor in single class with different signature.
Does constructor overloading include different return types for constructors to be overloaded?
a. Yes, if return types are different, signature becomes different
b. Yes, because return types can differentiate two functions
c. No, return type can’t differentiate two functions
d. No, constructors doesn’t have any return type
a. Yes, if return types are different, signature becomes different
b. Yes, because return types can differentiate two functions
c. No, return type can’t differentiate two functions
d. No, constructors doesn’t have any return type
No, return type can’t differentiate two functions.
In C++, if a base class has a parameterized constructor, then the derived class must call it using ……………..
A. Default constructor
B. Scope resolution operator
C. Constructor initialization list
D. None of the above
A. Default constructor
B. Scope resolution operator
C. Constructor initialization list
D. None of the above
In C++, if a base class has a parameterized constructor, then the derived class must call it using Constructor initialization list.
The special character related to destructor is ___
A. +
B. !
C. ?
D. ~
A. +
B. !
C. ?
D. ~
The special character related to destructor is ~.
A destructor is used to destroy the objects that have been created by a ………………..
A. Class
B. Object
C. Constructor
D. Destructor
A. Class
B. Object
C. Constructor
D. Destructor
A destructor is used to destroy the objects that have been created by a Constructor.
……………… Provides the flexibility of using different format of data at runtime depending upon the situation.
A. Dynamic initialization
B. Run time initialization
C. Static initialization
D. Variable initialization
A. Dynamic initialization
B. Run time initialization
C. Static initialization
D. Variable initialization
Dynamic initialization provides the flexibility of using different format of data at runtime depending upon the situation.