Top

C Constants

1.

The declaration
enum cities{ bethlehem, jericho, nazareth = 1, jerusalem }
assigns the value 1 to

Answer: D

No answer description available for this question.
 

Enter details here

2.

Comment on the output of this C code?

int const print()
{
printf("AllIndiaExams.in");
return 0;
}
void main()
{
print();
}

 

Answer: B

None

Enter details here

Answer: A

Since the constant variable has to be declared and defined at the same time, not doing it results in an error.

Hence the statement a is false.

Enter details here

4.

The C declaration
int b [100];
reserves ____________ successive memory locations,each large enough to contain single integer.

Answer: C

No answer description available for this question.
 

Enter details here

5.

What is the output of this C code?

#include 
    int main()
    {
        enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};
        printf("PEACH = %d\n", PEACH);
    }

 

Answer: C

In enum, the value of constant is defined to the recent assignment from left.

Output:
$ cc pgm1.c
$ a.out
PEACH = 5

Enter details here

Answer: C

No answer description available for this question.
 

Enter details here

Answer: B

No answer description available for this question.
 

Enter details here

8.

What is the output of this C code?

int main()
{
const int a;
a = 32;
printf("a is %d", a);
return 0;
}

 

Answer: B

Since the constant variable has to be declared and defined at the same time, not doing it results in an error.

Enter details here

Answer: A

No answer description available for this question.
 

Enter details here

10.

Consider the following statement
#define hypotenuse (a, b) sqrt (a*a + b*b);
The macro-call hypotenuse (a + 2, b + 3);

Answer: D

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