C Language MCQ’S | Declarations and Initializations

Exercise :: Declarations and Initializations – General Questions
Declarations and Initializations – General Questions
Declarations and Initializations – Find Output of Program
Declarations and Initializations – Point Out Errors
Declarations and Initializations – Point Out Correct Statements
Declarations and Initializations – True / False Questions
Declarations and Initializations – Yes / No Questions

1.
Which of the following special symbol is allowed in a variable name?

A. * (asterisk)
B. | (pipeline)
C. – (hyphen)
D. _ (underscore)

2.
Is there any difference between following declarations?
1 : extern int fun();
2 : int fun();

A. Both are identical
B. No difference, except extern int fun(); is probably in another file
C. int fun(); is overrided with extern int fun();
D. None of these

3.
How would you round off a value from 1.66 to 2.0?

A. ceil(1.66)
B. floor(1.66)
C. roundup(1.66)
D. roundto(1.66)

4.
In the following program where is the variable a getting defined and where it is getting declared?

#include<stdio.h>
int main()
{
extern int a;
printf(“%d\n”, a);
return 0;
}
int a=20;
A. extern int a is declaration, int a = 20 is the definition
B. int a = 20 is declaration, extern int a is the definition
C. int a = 20 is definition, a is not defined
D. a is declared, a is not defined

5.
When do we mention the prototype of a function?

A. Defining
B. Declaring
C. Prototyping
D. Calling

Visitor Counter

0051022