R4RIN
MCQS
C/C MCQ Quiz Hub
C programming language MCQ Questions Set 4
Choose a topic to test your knowledge and improve your C/C skills
1. Which of the following statement is not true about preprocessor directives?
These are lines read and processed by the preprocessor
They do not produce any code by themselves
These must be written on their own line
They end with a semicolon
2. Regarding the following statement which of the statements is true? const int a = 100;
Declares a variable a with 100 as its initial value
Declares a construction a with 100 as its initial value
Declares a constant a whose value will be 100
Constructs an integer type variable with an as identifier and 100 as the value
3. The difference between x and ‘x’ is?
The first one refers to a variable whose identifier is x and the second one refers to the character constant x
The first one is a character constant x and the second one is the string literal x
Both are same
Both are string literal
4. How to declare a wide character in the string literal?
L prefix
l prefix
W prefix
Z prefix
5. Which value can we not assign to reference?
integer
floating
unsigned
null
6. 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
7. Which reference modifier is used to define the reference variable?
&
$
#
@
8. 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
9. 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
10. 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
11. 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
12. 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
13. 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
14. Which of the following operator is used while declaring references?
*
&
^
->
15. 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
16. Which of the following function must use reference.
Assignment operator function
Copy Constructor
Destructor
Parameterized constructor
17. 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
18. 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
19. The void pointer can point to which type of objects?
int
float
double
all of the mentioned
20. When does the void pointer can be dereferenced?
when it doesn’t point to any value
when it cast to another type of object
using delete keyword
using shift keyword
21. The pointer can point to any variable that is not declared with which of these?
const
volatile
both const & volatile
static
22. A void pointer cannot point to which of these?
methods in c++
class member in c++
methods & class member in c++
none of the mentioned
23. What we can’t do on a void pointer?
pointer arithmetic
pointer functions
pointer objects
pointer functions & objects
24. The data elements in the structure are also known as what?
objects
members
data
objects & data
25. What will be used when terminating a structure?
:
}
;
;;
26. What will happen when the structure is declared?
it will not allocate any memory
it will allocate the memory
it will be declared and initialized
it will be declared
27. The declaration of the structure is also called as?
structure creator
structure signifier
structure specifier
structure creator & signifier
28. Which of the following is a properly defined structure?
struct {int a;}
struct a_struct {int a;}
struct a_struct int a;
struct a_struct {int a;};
29. Which of the following accesses a variable in structure *b?
b->var;
b.var;
b-var;
b>var;
30. Which function is used to check whether a character is an alphabet?
isalpha()
isalnum()
isdigit()
isblank()
31. Which function is used to check whether a character is a number?
isalpha()
isalnum()
isdigit()
isblank()
32. Which function is used to check whether a character is a tab or space?
isalpha()
isalnum()
isdigit()
isblank()
33. Which function is used to check whether a character is tab or space or whitespace control code( , ,etc.)?
isspace()
isalnum()
iscntrl()
isblank()
34. Which function is used to check whether a character is tab or a control code?
isspace()
isalnum()
iscntrl()
isblank()
35. Which function is used to check whether a character is printable on console?
isxdigit()
isprint()
iscntrl()
ispunct()
36. Which function is used to check whether a character is hexadecimal?
isxdigit()
isprint()
iscntrl()
ispunct()
37. Which function is used to check whether a character is punctuation mark?
isxdigit()
isprint()
iscntrl()
ispunct()
38. Which operator is having the right to left associativity in the following?
Array subscripting
Function call
Addition and subtraction
Type cast
39. Which operator is having the highest precedence?
postfix
unary
shift
equality
40. What is this operator called ?:?
conditional
relational
casting operator
unrelational
41. What is the use of dynamic_cast operator?
it converts virtual base class to derived class
it converts the virtual base object to derived objects
it will convert the operator based on precedence
it converts the virtual base object to derived class
42. The if..else statement can be replaced by which operator?
Bitwise operator
Conditional operator
Multiplicative operator
Addition operator
43. The switch statement is also called as?
choosing structure
selective structure
certain structure
bitwise structure
44. Which looping process is best used when the number of iterations is known?
for
while
do-while
all looping processes require that the iterations be known
45. Where does the execution of the program starts?
user-defined function
main function
void function
else function
46. What are mandatory parts in the function declaration?
return type, function name
return type, function name, parameters
parameters, function name
parameters, variables
47. which of the following is used to terminate the function declaration?
:
)
;
]
48. How many can max number of arguments present in function in the c99 compiler?
99
90
102
127
49. Which is more effective while calling the functions?
call by value
call by reference
call by pointer
call by object
50. What is the scope of the variable declared in the user defined function?
whole program
only inside the {} block
the main function
header section
Submit