R4RIN
MCQS
C/C MCQ Quiz Hub
C programming language MCQ Questions Set 2
Choose a topic to test your knowledge and improve your C/C skills
1. 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]
2. Which of the following is a correct identifier in C++?
7var_name
7VARNAME
VAR_1234
$var_name
3. Which of the following is called address operator?
*
&
_
%
4. Which of the following is used for comments in C++?
// comment
/* comment */
both // comment or /* comment */
// comment */
5. What are the actual parameters in C++?
Parameters with which functions are called
Parameters which are used in the definition of a function
Variables other than passed parameters in a function
Variables that are never used in the function
6. 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
7. Which function is used to read a single character from the console in C++?
cin.get(ch)
getline(ch)
read(ch)
scanf(ch)
8. Which function is used to write a single character to console in C++?
cout.put(ch)
cout.putline(ch)
write(ch)
printf(ch)
9. 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
10. Which of the following escape sequence represents carriage return?
\r
\n
\n\r
\c
11. Which of the following escape sequence represents tab?
\t
\t\r
\b
\a
12. Who created C++?
Bjarne Stroustrup
Dennis Ritchie
Ken Thompson
Brian Kernighan
13. Which of the following is called insertion/put to operator?
<<
>>
>
<
14. Which of the following is called extraction/get from operator?
<<
>>
>
<
15. A language which has the capability to generate new data types are called _______
Extensible
Overloaded
Encapsulated
Reprehensible
16. Wrapping data and its related functionality into a single entity is known as ______
Abstraction
Encapsulation
Polymorphism
Modularity
17. 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
18. 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
19. Which concept allows you to reuse the written code?
Encapsulation
Abstraction
Inheritance
Polymorphism
20. Which of the following shows multiple inheritances?
A->B->C
A->B; A->C
A,B->C
B->A
21. 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
22. C++ is _______
procedural programming language
object oriented programming language
functional programming language
both procedural and object oriented programming language
23. What does modularity mean?
Hiding part of program
Subdividing program into small independent parts
Overriding parts of program
Wrapping things into single unit
24. Which of the following class allows to declare only one object of it?
Abstract class
Virtual class
Singleton class
Friend class
25. Which of the following is not a type of Constructor?
Friend constructor
Copy constructor
Default constructor
Parameterized constructor
26. 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
27. Out of the following, which is not a member of the class?
Static function
Friend function
Constant function
Virtual function
28. What is the other name used for functions inside a class?
Member variables
Member functions
Class functions
Class variables
29. Which of the following cannot be a friend?
Function
Class
Object
Operator function
30. 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
31. Which of the following provides a programmer with the facility of using object of a class inside other classes?
Inheritance
Composition
Abstraction
Encapsulation
32. How many types of polymorphism are there in C++?
1
2
3
4
33. How run-time polymorphisms are implemented in C++?
Using Inheritance
Using Virtual functions
Using Templates
Using Inheritance and Virtual functions
34. How compile-time polymorphisms are implemented in C++?
Using Inheritance
Using Virtual functions
Using Templates
Using Inheritance and Virtual functions
35. Which of the following is an abstract data type?
int
float
class
string
36. Which concept means the addition of new components to a program as it runs?
Data hiding
Dynamic binding
Dynamic loading
Dynamic typing
37. Which of the following explains the overloading of functions?
Virtual polymorphism
Transient polymorphism
Ad-hoc polymorphism
Pseudo polymorphism
38. Which of the following approach is used by C++?
Top-down
Bottom-up
Left-right
Right-left
39. Which operator is overloaded for a cout object?
>>
<<
<
>
40. Which of the following cannot be used with the virtual keyword?
Class
Member functions
Constructors
Destructors
41. Which concept is used to implement late binding?
Virtual functions
Operator functions
Constant functions
Static functions
42. 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
43. 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
44. Which of the following is a static polymorphism mechanism?
Function overloading
Operator overloading
Templates
All of the mentioned
45. Which of the following is not a type of inheritance?
Multiple
Multilevel
Distributive
Hierarchical
46. 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
47. Which members are inherited but are not accessible in any case?
Private
Public
Protected
Both private and protected
48. 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
49. Which of the following is correct in C++?
Classes cannot have protected data members
Structures can have member functions
Class members are public by default
Structure members are private by default
50. Which of the following is used to make an abstract class?
By using virtual keyword in front of a class declaration
By using an abstract keyword in front of a class declaration
By declaring a virtual function in a class
By declaring a pure virtual function in a class
Submit