R4RIN
Articles
Java 8
MCQS
C/C MCQ Quiz Hub
C Programming MCQS Set-3
Choose a topic to test your knowledge and improve your C/C skills
1. Which value can we not assign to reference?
integer
floating
unsigned
null
2. Identify the incorrect statement.
Reference is the alternate name of the object
A reference value once defined can be reassigned
A reference value once defined cannot be reassigned
Reference is the alternate name of the variable
3. Which reference modifier is used to define the reference variable?
&
$
#
@
4. What does a reference provide?
Alternate name for the class
Alternate name for the variable
Alternate name for the pointer
Alternate name for the object
5. Identify the correct sentence regarding inequality between reference and pointer.
we can not create the array of reference
we can create the Array of reference
we can use reference to reference
we can use variable
6. What are the references in C++?
An alternative name for already existing variables
A pointer to a variable
A new type of variables
A new type of constant variable
7. What is the difference between references and pointers?
References are an alias for a variable whereas pointer stores the address of a variable
References and pointers are similar
References stores address of variables whereas pointer points to variables
Pointers are an alias for a variable whereas references stores the address of a variable
8. Pick the correct statement about references in C++.
References stores the address of variables
References and variables both have the same address
References use dereferencing operator(*) to access the value of variable its referencing
References were also available in C
9. Pick the correct statement about references.
References can be assigned value NULL
References once assigned cannot be changed to refer another variable
Reference should not be initialized when created
Reference is the same as pointers
10. Which of the following operator is used while declaring references?
*
&
^
>
11. Which of the following is incorrect?
References cannot be NULL
A reference must be initialized when declared
Once a reference is declared it cannot be modified later to reference another object i.e. it cannot be reset
References cannot refer to a constant value
12. Which of the following function must use reference.
Assignment operator function
Copy Constructor
Destructor
Parameterized constructor
13. How a reference is different from a pointer?
A reference cannot be null
A reference once established cannot be changed
The reference doesn’t need an explicit dereferencing mechanism
All of the mentioned
14. Which of the following statement(s) is/are correct?
operator is used to declare a reference
A reference variable defined to refer a particular variable can refer to any other variable also
References must always be initialized inside classes
A variable can have more than one references
15. To which does the function pointer point to?
variable
constants
function
absolute variables
16. What will we not do with function pointers?
allocation of memory
deallocation of memory
both allocation & deallocation of memory
finds memory status
17. What is the default calling convention for a compiler in c++?
__cdecl
__stdcall
__pascal
__fastcall
18. What is the mandatory part to present in function pointers?
&
return values
data types
$
19. which of the following can be passed in function pointers?
variables
data types
functions
objects
20. What is the meaning of the following declaration? int(*ptr[5])();
ptr is pointer to function
ptr is array of pointer to function
ptr is pointer to such function which return type is array
ptr is pointer to array of function
21. which keyword is used to define the macros in c++?
macro
define
#define
#macro
22. Which symbol is used to declare the preprocessor directives?
#
$
*
^
23. How many types of macros are there in c++?
1
2
3
4
24. What is the mandatory preprocessor directive for c++?
#define <iostream>
#include <iostream>
#undef <iostream>
#macro <iostream>
25. What is the other name of the macro?
scripted directive
executed directive
link directive
executed & link directive
26. which of the following is used to implement the c++ interfaces?
absolute variables
abstract classes
constant variables
default variables
27. What is the ability to group some lines of code that can be included? in the program?
specific task
program control
modularization
macros
28. How many types do functions fall depends on modularization?
1
2
3
4
29. How many types of modularization are there in c++?
4
3
1
2
30. What does the client module import?
macro
records
interface
instance
31. Identify the correct statement.
c++ does not have built-in interfaces
c++ does have built-in interfaces
c++ have no concept of interfaces
c++ does have built-in interfaces & classes
32. What is similar to the interface in c++?
methods
instance of a class
pure abstract class
methods & instance of a class
33. Which of the following implements the module in the program?
macro
header files
macro & header files
interfaces
34. Which operator is used to signify the namespace?
conditional operator
ternary operator
scope operator
bitwise operator
35. Identify the correct statement.
Namespace is used to group class objects and functions
Namespace is used to mark the beginning of the program
A namespace is used to separate the class objects
Namespace is used to mark the beginning & end of the program
36. What is the use of Namespace?
To encapsulate the data
To structure a program into logical units
Encapsulate the data & structure a program into logical units
It is used to mark the beginning of the program
37. What is the general syntax for accessing the namespace variable?
namespace::operator
namespaceoperator
namespace#operator
namespace$operator
38. Which keyword is used to access the variable in the namespace?
using
dynamic
const
static
39. Pick the incorrect statement for namespaces in C++.
Namespace declarations are always global scope
Keyword namespace is used at the starting of a namespace definition
Namespace has access specifiers like private or public
Namespace definitions can be nested
40. Which operator is used for accessing a member of namespace?
:
::
->
.
41. What is the correct syntax of defining a namespace?
namespace name{}
Namespace name{};
namespace name{};
typedef namespace name{} NAME
42. To where does the program control transfers when the exception is arisen?
catch
handlers
throw
try
43. Which keyword is used to check exception in the block of code?
catch
throw
try
handlers
44. What will happen when the exception is not caught in the program?
error
program will execute
block of that code will not execute
program will execute & displays wrong output
45. What will happen when the handler is not found for an exception?
calls the standard library function terminate()
raise an error
executes the remaining block
raise an error and executes the remaining block
46. How many types of linkages are there in C++?
1
2
3
4
47. To use internal linkage we have to use which keyword?
static
extern
static or extern
public
48. Which one is used to refer to program elements in any translation units?
internal linkage
external linkage
no linkage
internal & external linkage
49. What is the default type of linkage that is available for identifiers?
internal
external
no linkage
single linkage
Submit