Olete.in
Articles
Mock Tests
🧪 C/C MCQ Quiz Hub
C Multiple Choice Questions Set-2
Choose a topic to test your knowledge and improve your C/C skills
1. The statement i++; is equivalent to
i = i + I;
i = i + 1;
i = i - 1;
i --;
2. In C language, a hexadecimal number is represented by writing
x
xo
ox
h
3. Which of the following library function below by default aborts the program?
Terminate()
end()
Abort()
exit()
4. If a member needs to have unique value for all the objects of that same class, declare the member as
Global variable outside class
Local variable inside constructor
Static variable inside class
Dynamic variable inside class
5. Value of ix+j, if i,j are integer type and ix long type would be
integer
float
long integer
double percision
6. Which of the following below can perform conversions between pointers to related classes?
A. cast_static
B. dynamic_cast
C.static_cast
D.cast_dynamic
7. How do we define a constructor?
x~() {}
B. X() {}~
C. X() ~{}
~X() {}
8. Vtables
creates a static table per class
creates a static table per object
creates a dynamic table per class
creates a dynamic table per object
9. When class B is inherited from class A, what is the order in which the constructers of those classes are called
Class A first Class B next
Class B first Class A next
Class B's only as it is the child class
Class A's only as it is the parent class
10. Which of the following is the most general exception handler that catches exception of any type?
catch(std::exception)
catch(std::any_exception)
catch(…)
catch()
11. Which of the following is the correct syntax of including a user defined header files in C++?
#include <userdefined.h>
#include <userdefined>
#include “userdefined”
#include [userdefined]
12. Which of the following is a correct identifier in C++?
7var_name
7VARNAME
VAR_1234
$var_name
13. Which of the following is called address
operator?
*
&
%
14. Which of the following is used for comments in C++?
// comment
/* comment */
both // comment or /* comment */
// comment */
15. What are the formal parameters in C++?
Parameters with which functions are called
Parameters which are used in the definition of the function
Variables other than passed parameters in a function
Variables that are never used in the function
16. What are the formal parameters in C++?
Parameters with which functions are called
Parameters which are used in the definition of the function
Variables other than passed parameters in a function
Variables that are never used in the function
17. Which function is used to read a single character from the console in C++?
cin.get(ch)
getline(ch)
read(ch)
scanf(ch)
18. Which function is used to write a single character to console in C++?
cout.put(ch)
cout.putline(ch)
write(ch)
printf(ch)
19. What are the escape sequences?
Set of characters that convey special meaning in a program
Set of characters that whose use are avoided in C++ programs
Set of characters that are used in the name of the main function of the program
Set of characters that are avoided in cout statements
20. Which of the following escape sequence represents carriage return?
\r
\n
\n\r
\c
21. Which of the following escape sequence represents tab?
\t
\t\r
\b
\a
22. Who created C++?
Bjarne Stroustrup
Dennis Ritchie
Ken Thompson
Brian Kernighan
23. Which of the following is called insertion/put to operator?
<<
>>
>
<
24. Which of the following is called extraction/get from operator?
<<
>>
>
<
25. A language which has the capability to generate new data types are called ___________
Extensible
Overloaded
Encapsulated
Reprehensible
26. Wrapping data and its related functionality into a single entity is known as _____________
Abstraction
Encapsulation
Polymorphism
Modularity
27. How structures and classes in C++ differ?
In Structures, members are public by default whereas, in Classes, they are private by default
In Structures, members are private by default whereas, in Classes, they are public by default
Structures by default hide every member whereas classes do not
Structures cannot have private members whereas classes can have
28. What does polymorphism in OOPs mean?
Concept of allowing overiding of functions
Concept of hiding data
Concept of keeping things in differnt modules/files
Concept of wrapping things into a single unit
29. Which concept allows you to reuse the written code?
Encapsulation
Abstraction
Inheritance
Polymorphism
30. Which of the following shows multiple inheritances?
A->B->C
A->B; A->C
A,B->C
B->A
31. How access specifiers in Class helps in Abstraction?
They does not helps in any way
They allows us to show only required things to outer world
They help in keeping things together
Abstraction concept is not used in classes
32. C++ is ______________
procedural programming language
object oriented programming language
functional programming language
both procedural and object oriented programming language
33. What does modularity mean?
Hiding part of program
Subdividing program into small independent parts
Overriding parts of program
Wrapping things into single unit
34. Which of the following class allows to declare only one object of it?
Abstract class
Virtual class
Singleton class
Friend class
35. Which of the following is not a type of Constructor?
Friend constructor
Copy constructor
Default constructor
Parameterized constructor
36. Which of the following is correct?
Base class pointer object cannot point to a derived class object
Derived class pointer object cannot point to a base class object
A derived class cannot have pointer objects
A base class cannot have pointer objects
37. Out of the following, which is not a member of the class?
Static function
Friend function
Constant function
Virtual function
38. What is the other name used for functions inside a class?
Member variables
Member functions
Class functions
Class variables
39. Which of the following cannot be a friend?
Function
Class
Object
Operator function
40. Why references are different from pointers?
A reference cannot be made null
A reference cannot be changed once initialized
No extra operator is needed for dereferencing of a reference
All of the mentioned
41. Which of the following provides a programmer with the facility of using object of a class inside other classes?
Inheritance
Composition
Abstraction
Encapsulation
42. How many types of polymorphism are there in C++?
1
2
3
4
43. How run-time polymorphisms are implemented in C++?
Using Inheritance
Using Virtual functions
Using Templates
Using Inheritance and Virtual functions
44. How compile-time polymorphisms are implemented in C++?
Using Inheritance
Using Virtual functions
Using Templates
Using Inheritance and Virtual functions
45. Which of the following is an abstract data type?
integer
float
class
string
46. Which concept means the addition of new components to a program as it runs?
Data hiding
Dynamic binding
Dynamic loading
Dynamic typing
47. Which of the following explains the overloading of functions?
Virtual polymorphism
Transient polymorphism
Ad-hoc polymorphism
Pseudo polymorphism
48. Which of the following approach is used by C++?
Top-down
Bottom-up
Left-right
Right-left
49. Which operator is overloaded for a cout object?
>>
<<
<
>
50. Which of the following cannot be used with the virtual keyword?
Class
Member functions
Constructors
Destructors
51. Which concept is used to implement late binding?
Virtual functions
Operator functions
Constant functions
Static functions
52. Which of the following is correct?
C++ allows static type checking
C++ allows dynamic type checking.
C++ allows static member function to be of type const.
C++ allows both static and dynamic type checking
53. Which of the following supports the concept that reusability is a desirable feature of a language?
It reduces the testing time
It reduces maintenance cost
It decreases the compilation time
It reduced both testing and maintenance time
54. Which of the following is a static polymorphism mechanism?
Function overloading
Operator overloading
Templates
All of the mentioned
55. Which of the following is true? I) All operators in C++ can be overloaded. II) The basic meaning of an operator can be changed.
I only
II only
Both I and II
Neither I nor II
56. Which of the following is not a type of inheritance?
Multiple
Multilevel
Distributive
Hierarchical
57. What happens if a class does not have a name?
It will not have a constructor
It will not have a destructor
It is not allowed
It will neither have a constructor or destructor
58. Which of the following statement is true? I) In Procedural programming languages, all function calls are resolved at compile-time II) In Object Oriented programming languages, all function calls are resolved at compile-time
I only
II only
Both I and II
Neither I nor II
59. Which members are inherited but are not accessible in any case?
Private
Public
Protected
Both private and protected
60. Which of the following is correct?
Friend functions can access public members of a class
Friend functions can access protected members of a class
Friend functions can access private members of a class
All of the mentioned
Submit