Object
Oriented Programming with C++
Classes
and objects
Evaluation
PART I
Choose the correct answer
1. The variables declared inside
the class are known as data members and the functions are known as
(A)
data functions
(B)
inline functions
(C) member functions
(D)
attributes
2. Which of the following
statements about member functions are True or False?
i) A member function can call
another member function directly with using the dot operator.
ii) Member function can access the
private data of the class.
(A)
i-True, ii-True
(B) i-False, ii-True
(C)
i-True, ii-False
(D)
i-False, ii-False
3. A member function can call
another member function directly, without using the dot operator called as
(A)
sub function
(B)
sub member
(C) nesting of member function
(D)
sibling of member function
4. The member function defined within
the class behave like
(A) inline functions
(B)
Non inline function
(C)
Outline function
(D)
Data function
5. Which of the following access
specifier protects data from inadvertent modifications?
(A) Private
(B)
Protected
(C)
Public
(D)
Global
6.
class x
{
int
y;
public:
x(int z){y=z;}
} x1[4];
int
main()
{
x x2(10); return 0;}
How many objects are created for
the above program
(A)
10
(B) 14
(C)
5
(D)
2
7. State whether the following
statements about the constructor are True or False.
i) constructors should be declared
in the private section.
ii) constructors are invoked
automatically when the objects are created.
(A)
True, True
(B)
True, False
(C) False, True
(D)
False, False
8. Which of the following
constructor is executed for the following prototype ?
add display( add &); // add is
a class name 248
(A)
Default constructor
(B)
Parameterized constructor
(C) Copy constructor
(D)
Non Parameterized constructor
9. What happens when a class with
parameterized constructors and having no default constructor is used in a
program and we create an object that needs a zero-argument constructor?
(A) Compile-time error
(B)
Domain error
(C)
Runtime error
(D)
Runtime exception.
10. Which of the following create a
temporary instance?
(A)
Implicit call to the constructor
(B) Explicit call to the
constructor
(C)
Implicit call to the destructor
(D)
Explicit call to the destructor
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2026 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.