R4RIN
MCQS
C/C MCQ Quiz Hub
C programming language MCQ Questions Set 1
Choose a topic to test your knowledge and improve your C/C skills
1.  Which of the following is correct?
A class is an instance of its objects
An object is an instance of its class
A class is an instance of the data type that the class have
An object is an instance of the data type of the class
2. Which of the following is correct about new and malloc?
Both are available in C
Pointer object initialization of a class with both new and malloc calls the constructor of that class
Pointer object initialization of a class using new involves constructor call whereas using malloc does not involve constructor call
Pointer object initialization of a class using malloc involves constructor call whereas using new does not involve constructor call
3. What is virtual inheritance?
C++ technique to avoid multiple copies of the base class into children/derived class
C++ technique to avoid multiple inheritances of classes
C++ technique to enhance multiple inheritance
C++ technique to ensure that a private member of the base class can be accessed somehow
4. What is the difference between delete and delete[] in C++?
delete is used to delete normal objects whereas delete[] is used to pointer objects
delete is a keyword whereas delete[] is an identifier
delete is used to delete single object whereas delete[] is used to multiple(array/pointer of) objects
delete is syntactically correct but delete[] is wrong and hence will give an error if used in any case
5. What is the correct syntax of declaring array of pointers of integers of size 10 in C++?
int arr = new int[10];
int **arr = new int*[10];
int *arr = new int[10];
int *arr = new int*[10];
6. Which of the following type is provided by C++ but not C?
int
bool
float
double
7. Which of the following feature is not provided by C?
Pointers
Structures
References
Functions
8. Which of the following is not a fundamental type is not present in C but present in C++?
int
float
bool
void
9. What is the size of a boolean variable in C++?
1 bit
1 byte
4 bytes
2 bytes
10. Which of the following is C++ equivalent for scanf()?
cin
cout
print
input
11. Which of the following is C++ equivalent for printf()?
cin
cout
print
input
12. Which of the following is the correct difference between cin and scanf()?
both are the same
cin is a stream object whereas scanf() is a function
scanf() is a stream object whereas cin is a function
cin is used for printing whereas scanf() is used for reading input
13. Which of the following is an exit-controlled loop?
for
while
do-while
all of the mentioned
14. Which of the following is an entry-controlled loop?
for
while
do-while
both while and for
15. In which part of the for loop termination condition is checked? for(I;II;III) {IV}
I
II
III
IV
16. What is dynamic binding?
The process of linking the actual code with a procedural call during run-time
The process of linking the actual code with a procedural call during compile-time
The process of linking the actual code with a procedural call at any-time
All of the mentioned
17. What is static binding?
The process of linking the actual code with a procedural call during run-time
The process of linking the actual code with a procedural call during compile-time
The process of linking the actual code with a procedural call at any-time
All of the mentioned
18. What is name mangling in C++?
The process of adding more information to a function name so that it can be distinguished from other functions by the compiler
The process of making common names for all the function of C++ program for better use
The process of changing the names of variable
The process of declaring variables of different types
19. Which of the following syntax for declaring a variable of struct STRUCT can be used in both C and C++?
struct STRUCT S;
STRUCT S;
Both struct STRUCT S; and STRUCT S;
Both C and C++ have different syntax
20. What if we define the below structure in C and C++?
Error in C but not in C++
Error in C++ but not in C
No error in both C and C++
Error in both C and C++
21. Which of the following is the scope resolution operator?
.
*
::
~
22. Which of the following operator has left to right associativity?
Unary operator
Logical not
Array element access
addressof
23. Which of the following is accessed by a member function of a class?
The object of that class
All members of a class
The public part of a class
The private part of a class
24. What is the size of a character literal in C and C++?
4 and 1
1 and 4
1 and 1
4 and 4
25. What is the size of a character type in C and C++?
4 and 1
1 and 4
1 and 1
4 and 4
26. Which of the following is correct?
struct tag is required in both C and C++ while declaring an object of the structure
struct is not required in C but required in C++ while declaring an object of the structure
struct is not required in C++ but required in C while declaring an object of the structure
struct tag is not required in both C and C++ while declaring an object of the structure
27. Which of the following is correct?
struct cannot have member function in C but it can in C++
struct cannot have member function in C++ but it can in C
struct cannot have member function in both C and C++
struct can have member function in both C and C++
28. Which of the following statement is correct?
Structure in C allows Constructor definition
Structure in C++ allows Constructor definition
Both allow Constructor definition
C allows constructor definition while C++ does not
29. Which of the following is correct about this pointer in C++?
this pointer is passed as a hidden argument in all the functions of a class
this pointer is passed as a hidden argument in all non-static functions of a class
this pointer is passed as a hidden argument in all static functions of a class
this pointer is passed as a hidden argument in all static variables of a class
30. Which of the following operator is used with this pointer to access members of a class?
.
!
->
~
31. Why this pointer is used?
To access the members of a class which have the same name as local variables in that scope
To access all the data stored under that class
To access objects of other class
To access objects of other variables
32. What is the other name of compile-time polymorphism?
Static polymorphism
Dynamic polymorphism
Executing polymorphism
Non-executing polymorphism
33. What is the other name of run-time polymorphism?
Static polymorphism
Dynamic polymorphism
Executing polymorphism
Non-executing polymorphism
34. Which of the following is correct about static polymorphism?
In static polymorphism, the conflict between the function call is resolved during the compile time
In static polymorphism, the conflict between the function call is resolved during the run time
In static polymorphism, the conflict between the function call is never resolved during the execution of a program
In static polymorphism, the conflict between the function call is resolved only if it required
35. Which of the following is correct about dynamic polymorphism?
In dynamic polymorphism, the conflict between the function call is resolved during the compile time
In dynamic polymorphism, the conflict between the function call is resolved during the run time
In dynamic polymorphism, the conflict between the function call is never resolved during the execution of the program
In dynamic polymorphism, the conflict between the function call is resolved at the beginning of the program
36. What is std in C++?
std is a standard class in C++
std is a standard namespace in C++
std is a standard header file in C++
std is a standard file reading header in C++
37. Which of the following syntax can be used to use a member of a namespace without including that namespace?
namespace::member
namespace->member
namespace.member
namespace~member
38. What is the size of wchar_t in C++?
2
4
2 or 4
Based on the number of bits in the system
39. Pick the odd one out.
array type
character type
boolean type
integer type
40. Which data type is used to represent the absence of parameters?
int
short
void
float
41. What does ‘\a’ escape code represent?
alert
backslash
tab
form feed
42. Which type is best suited to represent the logical values?
integer
boolean
character
float
43. Identify the user-defined types from the following?
enumeration
classes
both enumeration and classes
int
44. The value 132.54 can be represented using which data type?
double
void
int
bool
45. When a language has the capability to produce new data type mean, it can be called as
overloaded
extensible
encapsulated
reprehensible
46. Pick the odd one out.
integer, character, boolean, floating
enumeration, classes
integer, enum, void
arrays, pointer, classes
47. Is bool a fundamental data type in C++?
Yes
No, it is a typedef of unsigned char
No, it is an enum of {false, true}
No, it is expanded from macros
48. Find the odd one out.
std::vector<int>
std::vector<short>
std::vector<long>
std::vector<bool>
49. What happens when a null pointer is converted into bool?
an error is flagged
bool value evaluates to true
bool value evaluates to false
the statement is ignored
50. What is the value of the bool? bool is_int(789.54)
TRUE
FALSE
1
2
51. What happens when a null pointer is converted into bool?
an error is flagged
bool value evaluates to true
bool value evaluates to false
the statement is ignored
Submit