Cplusplus Mock Test I
Cplusplus Mock Test I
Cplusplus Mock Test I
This section presents you various set of Mock Tests related to C++ Framework. You can
download these sample mock tests at your local machine and solve offline at your convenience.
Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
A - public
B - private
C - protected
A-#
B - ##
C-?
D - ??
A - Multilevel inheritance
B - Hierarchical inheritance
C - Hybrid inheritance
C - virtual void f {} = 0;
Q 6 - Abstract class is __
D - A class must contain pure virtual function defined outside the class.
#include<isotream>
A - 12
B-4
C-8
D - Compile error
#include<isotream>
abc() {
i = ++x;
}
};
int abc::x;
main() {
abc m, n, p;
cout<<m.x<<" "<<m.i<<endl;
}
A-31
B-33
C-11
D-13
A - True
B - False
A-/
B-
C - ::
D-%
A-_
B-__
C - ++ postfixversion
D-=
A - volatile
B - friend
C - extends
D - this
#include<isotream>
abc(int i) {
i = i;
}
};
main() {
abc m(5);
cout<<m.i;
}
A-5
B - Garbage
A - private
B - protected
C - public
Q 15 - From the below class choose the proper definition of the member function f.
class abc {
void f();
};
void abc<T>::f { }
B - template<class T>
void abc::f { }
C - template<T>
D - template<T>
void abc<T>::f { }
Q 16 - Choose the respective delete operator usage for the expression ptr=new
int[100].
A - delete ptr;
B - delete ptr[];
C - delete[] ptr;
D - []delete ptr;
Q 17 - cin is an __
A - Class
B - Object
C - Package
D - Namespace
Q 18 - The operator used to access member function of a structure using its object.
A-.
B - ->
C-*
A - #include file.h
B - #include <file.h>
C - #include <file>
D - #include file.h
A - unsigned char;
B - int
C - wchar_t
Q 21 - Which is the storage specifier used to modify the member variable even though
the class object is a constant object?
A - auto
B - register
C - static
D - mutable
Q 22 - The following operator can be used to calculate the value of one number raised
to another.
A-^
B - **
C - ^^
Q 23 - Pick up the valid declaration for overloading ++ in postfix form where T is the
class name.
A - T operator++;
B - T operator++int;
C - T& operator++;
D - T& operator++int;
A - True
B - False
ANSWER SHEET
1 B
2 C
3 D
4 A
5 D
6 B
7 B
8 A
9 B
10 C
11 D
12 C
13 B
14 C
15 A
16 C
17 B
18 A
19 A
20 C
21 D
22 D
23 B
24 A
25 B
Loading [MathJax]/jax/output/HTML-CSS/jax.js