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