Top

C Constants

61.

What is the output of this C code?
 

#define a 20
int main()
{
const int a = 50;
printf("a = %d\n", a);
}

 

Answer: D

The #define substitutes a with 20 leaving no identifier and hence compilation error.
Complilation Error: expected identifier or ‘(’ before numeric constant

Enter details here

Answer: A

No answer description available for this question.
 

Enter details here

63.

Comment on the output of this C code?

#include 
    void main()
    {
        int const k = 5;
        k++;
        printf("k is %d", k);
    }

 

Answer: D

Constant variable has to be declared and defined at the same time. Trying to change it results in an error.

Output:
$ cc pgm12.c
pgm12.c: In function ‘main’:
pgm12.c:5: error: increment of read-only variable ‘k’

Enter details here

Answer: C

No answer description available for this question.
 

Enter details here

Answer: D

No answer description available for this question.
 

Enter details here

Answer: A

No answer description available for this question.
 

Enter details here

67.

Which of the following 'C' type is not a primitive data structure?

Answer: D

No answer description available for this question.

Enter details here

Answer: C

No answer description available for this question.

Enter details here

69.

The value of an automatic variable that is declared but not initialized will be

Answer: C

No answer description available for this question.
 

Enter details here

Answer: C

No answer description available for this question.
 

Enter details here

Loading…
Tags: C Constants Questions and Answers || C Constants MCQ Questions and Answers || C Constants GK Questions and Answers || C Constants GK MCQ Questions || C Constants Multiple Choice Questions and Answers || C Constants GK || GK on C Constants || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming