R4RIN
Articles
Java 8
MCQS
C/C MCQ Quiz Hub
C Programming MCQS Set-4
Choose a topic to test your knowledge and improve your C/C skills
1. To use external linkage we have to use which keyword?
static
extern
const
argc
2. Which is used to use a function from one source file to another?
code
declaration
prototype
variable
3. What is the use of no linkage?
make the entity visible to other programs
make the entity visible to other blocks in the same program
make the entity visible only to that block
make the entity invisible
4. What is the user-defined header file extension in c++?
cpp
h
hf
hg
5. Which of the following keyword is used to declare the header file?
include
exclude
string
namespace
6. Identify the incorrect statement.
iostream is a standard header and iostream.h is a non-standard header
iostream is a non-standard header and iostream.h is a non-standard header
iostream is a standard header and iostream.h is a standard header
iostream is a non-standard header
7. What does a default header file contain?
prototype
implementation
declarations
pointing
8. setprecision requires which of the following header file?
stdlib.h
iomanip.h
console.h
conio.h
9. Which of the following header file does not exist?
<iostream>
<string>
<sstring>
<sstream>
10. Which of the header file must be included to use stringstream?
<iostream>
<string>
<sstring>
<sstream>
11. Which of the following header files is required for creating and reading data files?
ofstream.h
fstream.h
ifstream.h
console.h
12. What does a class in C++ holds?
data
functions
both data & functions
arrays
13. Which is used to define the member of a class externally?
:
::
#
!!$
14. Which other keywords are also used to declare the class other than class?
struct
union
object
both struct & union
15. Which of the following is a valid class declaration?
class A { int x; };
class B { }
public class A { }
object A { int x; };
16. The data members and functions of a class in C++ are by default _______
protected
private
public
public & protected
17. Constructors are used to ___________
initialize the objects
construct the data members
both initialize the objects & construct the data members
delete the objects
18. When struct is used instead of the keyword class means what will happen in the program?
access is public by default
access is private by default
access is protected by default
access is denied
19. Which category of data type a class belongs to?
Fundamental data type
Derived data type
User defined derived data type
Atomic data type
20. How the objects are self-referenced in a member function of that class.
Using a special keyword object
Using this pointer
Using * with the name of that object
By passing self as a parameter in the member function
21. What does a mutable member of a class mean?
A member that can never be changed
A member that can be updated only if it not a member of constant object
A member that can be updated even if it a member of constant object
A member that is global throughout the class
22. Which keyword is used to define the user defined data types?
def
union
typedef
type
23. Where does the object is created?
class
constructor
destructor
attributes
24. How to access the object in the class?
scope resolution operator
ternary operator
direct member access operator
resolution operator
25. Which of these following members are not accessed by using direct member access operator?
public
private
protected
both private & protected
26. Pick out the other definition of objects.
member of the class
associate of the class
attribute of the class
instance of the class
27. How many objects can present in a single class?
1
2
3
as many as possible
28. Which special character is used to mark the end of class?
;
:
#
$
29. Pick the other name of operator function.
function overloading
operator overloading
member overloading
object overloading
30. Which of the following operators can’t be overloaded?
::
+
–
[]
31. How to declare operator function?
operator sign
operator
name of the operator
name of the class
32. Which of the following statements is NOT valid about operator overloading?
Only existing operators can be overloaded
The overloaded operator must have at least one operand of its class type
The overloaded operators follow the syntax rules of the original operator
None of the mentioned
33. Operator overloading is ___________
making c++ operator works with objects
giving new meaning to existing operator
making the new operator
adding operation to the existing operators
34. What is operator overloading in C++?
Overriding the operator meaning by the user defined meaning for user defined data type
Redefining the way operator works for user defined types
Ability to provide the operators with some special meaning for user defined data type
All of the mentioned
35. What is the syntax of overloading operator + for class A?
A operator+(argument_list){}
A operator[+](argument_list){}
int +(argument_list){}
int [+](argument_list){}
36. How many approaches are used for operator overloading?
1
2
3
4
37. Which of the following operator cannot be overloaded?
+
?:
–
%
38. Which of the following operator can be overloaded?
?:
::
.
==
39. Which of the following operator cannot be used to overload when that function is declared as friend function?
-=
||
==
[]
40. Choose the operator which cannot be overloaded.
/
()
::
%
41. In which direction does the assignment operation will take place?
left to right
right to left
top to bottom
bottom to top
42. Pick out the compound assignment statement.
a = a – 5
a = a / b
a -= 5
a = a + 5
43. What is the associativity of add(+);?
right to left
left to right
right to left & left to right
top to bottom
44. What is the name of | operator?
sizeof
or
and
modulus
45. Which operator is having the highest precedence in c++?
array subscript
Scope resolution operator
static_cast
dynamic_cast
46. subscript operator is used to access which elements?
string
char
array
float
47. How many arguments will the subscript operator will take for overloading?
1
2
3
as many as possible
48. Pick out the correct statement.
subscript operator has a higher precedence than the assignment operator
subscript operator has a lower precedence than the assignment operator
subscript operator is used with string elements
subscript operator is used with char elements
49. What do we need to do to pointer for overloading the subscript operator?
reference pointer
dereference pointer
store it in heap
memory locator
50. What do we need to use when we have multiple subscripts?
operator()
operator[]
operator
operator<>
51. What is the use of function call operator?
overloading the methods
overloading the objects
overloading the parameters
overloading the string
52. Pick out the correct statement.
virtual functions does not give the ability to write a templated function
virtual functions does not give the ability to rewrite a templated function
virtual functions does give the ability to write a templated function
virtual functions does not give the ability to rewrite a simple function
Submit