Declarations and Initialization – General Questions

6. By default a real number is treated as a

A. float
B. double
C. long double
D. far double

Correct Answer: B. double
Advertisement

7. Which of the following is not a user-defined data type?

Which of the following is not user defined data type

A. 1
B. 2
C. 3
D. Both 1 and 2

Correct Answer: B. 2
Advertisement

8. Is the following statement a declaration or definition?

extern int i;

A. Declaration
B. Definition
C. Function
D. Error

Correct Answer: A. Declaration
Advertisement

9. Identify which of the following are declarations

1 : extern int x;
2 : float square ( float x ) { … }
3 : double pow(double, double);

A. 1
B. 2
C. 1 and 3
D. 3

Correct Answer: C. 1 and 3
Advertisement

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

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

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

Correct Answer: A. extern int a is declaration, int a = 20 is the definition
Advertisement

Leave A Comment?