0% found this document useful (0 votes)
103 views3 pages

C++ Mock CDAC MET

Uploaded by

White Devil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views3 pages

C++ Mock CDAC MET

Uploaded by

White Devil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MET-IIT

8). Which of the following is a valid destructor of the class name


C++_Mock_2
“Country" ?
1). If 5 th argument of a function has a default value then
A: int ~Country().
________ argument must also have a default value.
B: void Country().
(a) 4 th
C: int ~Country(Country obj) .
(b) 6 th
D: void ~Country().
(c) 3 rd
(d) None of the above
9). If default constructor is not defined, then how the objects of
the class will be created?
2). C++ can be best described as ________ language.
A: The compiler will generate error.
A: Structured
B: Error will occur at run-time.
B: object oriented
C: Compiler provides its default constructor to build the object.
C: Multiparadigm
D: None of these.
D: Procedural

10). Which of the following correctly describes the meaning of


3). In C++, _________ operators are used for Memory
‘namespace’ feature in C++?
Deallocating.

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

12). The relationship between Customer and Order is


C: Bottom-up
co

________.
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

19). Function overloading is also similar to which of the (a) A


following? (b) B
ys

A: Operator overloading. (c) D


ra

B: Constructor overloading. (d) none of above


ar

C: Destructor overloading.
D: None of the mentioned. 27). Class B defines a virtual member function m() which is
ith

invoked from its another


w

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

B: Must be a non-member function. In the following code


C: Can be both (A) & (B) above. B* b = new C;
D: Cannot be overloaded. b->n();
member function m will ________.
21). Scope resolution operator is used______ . (a) be invoked from C
A: To resolve the scope of global variables only. (b) be invoked from B
B: To resolve the scope of functions of the classes only. (c) not be invoked
C: To resolve scope of global variables as well as functions of (d) Both A & B
the classes.
D: None of above. 28). Syntax for Pure Virtual Function is ______________ .
A: virtual void show()==0.
22). What does inheritance allows you to do? B: void virtual show()==0.
A: Create a class. C: virtual void show()=0.
B: Create a hierarchy of classes. D: void virtual show()=0
C: Access methods
D: Create a hierarchy of interfaces. 29). Run time polymorphism can be achieved with______ .
A: Virtual Base class
B: Container class.
C: Virtual function.
D: Both a and c
37). A and B are abstract classes. Class C inherits from both A
30). What does the following statement mean? and B
int (*fp)(char*) and implements their pure virtual member functions. In the
A: pointer to a pointer following code
B: pointer to an array of chars A* a = new C;
C: pointer to function taking a char* argument and returns an int B* b = X<B*>(a);
D: function taking a char* argument and returning a pointer to the correct replacement for X is ________.
int (a) const_cast
(b) static_cast
31). Identify the correct statement. (c) dynamic_cast
A: typedef does not create different types. It only creates (d) None of the above
synonyms of existing types.
B: typedef create different types.
38). The ________ STL container stores keys in their sorted
C: Both a & b
order.
D: none of the mentioned
(a) std::vector

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

33). What is use of eof() ? (b) std::list


A: Returns true if a file open for reading has reached the next
ys

(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

40). The * operator of an STL iterator returns a ________ the


D: Returns true if a file open for reading has reached the container's element.
w

middle.. (a) copy of


de

(b) reference of
co

34). What is the validity of template parameters?


A: inside that block only (c) pointer to
B: inside the class
(d) none of above
C: whole program
D: any of the mentioned.

35). Compile-time generation of code from a template is known as its


________.
(a) Generalization
(b) instantiation
(c) specialization
(d) None of the above

36). Which are done by compiler for templates?


A: type-safe
B: portability
C: code elimination
D: all of the mentioned

You might also like