6. By default, a real number is treated as a
C Programming : Declarations and Initializations – General Questions
7. Which of the following is not a user-defined data type?
1 : struct book
{
char name[10];
float price;
int pages;
};
{
char name[10];
float price;
int pages;
};
2 : long int l = 2.35;
3 : enum day {Sun, Mon, Tue, Wed};
A. 1
B. 2
C. 3
D. Both 1 and 2
8. Is the following statement a declaration or definition?
extern int I;
A. Declaration
B. Definition
C. Function
D. Error
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. 3
D. 1 and 3
10. 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 a declaration, int a = 20 is the definition
B. int a = 20 is a declaration, extern int a is the definition
C. int a = 20 is the definition, a is not defined
D. a is declared, a is not defined