C Programming: Declarations and Initializations – Point Out Correct Statements

0
899
C Programming: Declarations and Initializations - Point Out Correct Statements
C Programming: Declarations and Initializations - Point Out Correct Statements

C Programming: Declarations and Initializations – Point Out Correct Statements

  • 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 declaration is correct?

A. int length;
B. char int;
C. int long;
D. float double;

Answer: Option A

 

2. Which of the following operations are INCORRECT?

A.  int i = 35; i = i%5;
B.  short int j = 255; j = j;
C.  long int k = 365L; k = k;
D.  float a = 3.14; a = a%3;

Answer: Option D

 

3. Which of the following correctly represents a long double constant?

A. 6.68
B. 6.68L
C. 6.68f
D. 6.68LF

Answer: Option B

 

4. Which of the structure is incorrcet?
1 : struct aa
{
int a;
float b;
};

2 : struct aa
{
int a;
float b;
struct aa var;
};

3 : struct aa
{
int a;
float b;
struct aa *var;
};

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

Answer: Option B

 

5. Which of the structure is correct?

1 : struct book
{
char name[10];
float price;
int pages;
};

2 : struct aa
{
char name[10];
float price;
int pages;
}

3 : struct aa
{
char name[10];
float price;
int pages;
}

A. 1
B. 2
C. 3
D. All of above

Answer: Option A