C++ Mock CDAC MET
C++ Mock CDAC MET
4
A: Namespaces refer to the memory space allocated for names
A: Release()
9
used in a program.
21
B: malloc() and calloc()
B: Namespaces refer to space between the names in a
C: Free()
59
program.
D: delete
C: Namespaces refer to packing structure of classes in a
07
program.
4). Which of the following is not an OOP feature in C++?
80
D: Namespaces provide facilities for organizing the names in a
A: Encapsulation.
program to avoid name clashes.
B: Abstraction.
.in
C: Polymorphism.
11). Which keyword is used to access the variable in
ys
D: Exceptions.
namespace?
ra
A: using.
ar
B: dynamic.
5). Object oriented programming employs_________
C: const.
ith
programming approach.
D: static.
A: Top-down
w
B: Procedural
de
________.
D: All of these.
(a) Inheritance
(b) Composition
6). A struct is the same as a class except that
(c) Aggregation
Answer Choices
(d) none of above
A: There are no member functions.
B: All members are public.
13). The relationship between Hotel and Guest is ________.
C: Cannot be used in inheritance hierarchy.
(a) Inheritance
D: It does have this pointer.
(b) Composition
(c) Aggregation
7). How do we declare an abstract class?
(d) none of above
A: By providing at least one pure virtual method (function
signature followed by ==0;) in a class
14). All the classes in C++ standard library are included in
B: By declaring at least one method abstract using the keyword
_______ namespace.
‘abstract’ in a class
(a) std
C: By declaring the class abstract with the keyword ‘abstract’
(b) object
D: It is not possible to create abstract classes in C++
(c) io
(d) none of above
23). Which of the following relationship is known as inheritance
15). A copy constructor takes relationship?
A: No argument. A: ‘has-a’ relationship.
B: One argument. B: ‘is-a’ relationship.
C: Two arguments. C: association relationship.
D: Arbitrary no. of arguments. D: None of the mentioned.
16). The default copy constructor performs
A: Deep copy. 24). Which of the following advantages we lose by using
B: Shallow copy. multiple inheritance?
C: Hard copy. A: Dynamic binding.
D: Soft copy. B: Polymorphism.
C: Both A & B
17 What is polymorphism? D: None of the mentioned.
A: Ability to take more than one form.
B: Ability to destroy destructor. 25). class derived: public base1, public base2 { } is an example
C: Ability to create constructor. of
D: None of above. A: Polymorphic inheritance.
4
B: Multilevel inheritance
9
18). Which of the following permits function overloading on C: Hierarchical inheritance.
21
c++? D: Multiple inheritance.
59
A: Type.
B: Number of arguments. 26).Classes B and C inherit virtually from class A. Class D
07
C: Both of the mentioned. inherits from both B and C.
80
D: None of the mentioned. When an instance of class D is created, the constructor of
class ________ is invoked first.
.in
C: Destructor overloading.
D: None of the mentioned. 27). Class B defines a virtual member function m() which is
ith
20). The operator << when overloaded in a class. non-virtual member function n ().
de
A: Must be a member function. Class C inherits from B and overrides member function m().
co
9 4
32). To perform File I/O operations, we must use (b) std::list
21
_____________ header file. (c) std::set
59
A: < ifstream>
(d) std::map
B: < ofstream> 07
39). The ________ STL container provides random access and
C: < fstream>
efficient insertion of elements at any location.
80
D: Any of these
(a) std::deque
.in
(c) std::vector
character.
ra
B: Returns true if a file open for reading has reached the end. (d) std::hash
ar
C: Returns true if a file open for reading has reached the next
word.
ith
(b) reference of
co