Top

C Constants

81.

If abc is the input, then the following program fragment
char x, y, z ;
printf ("% d" , scanf ("%c%c%c" , &x , &y , &z )) ;
results in

Answer: D

No answer description available for this question.
 

Enter details here

82.

The constants are also called as _____________

Answer: C

No answer description available for this question.

Enter details here

Answer: C

No answer description available for this question.
 

Enter details here

84.

The minimum number of temporary variables needed to swap the contents of two variables is

Answer:

Enter details here

85.

The statement 

printf( " % f ", ( float )9/5) ;

prints

Answer: A

No answer description available for this question.
 

Enter details here

86.

Comment on the output of this C code?

#include 
    void main()
    {
        int k = 4;
        int *const p = &k;
        int r = 3;
        p = &r;
        printf("%d", p);
    }

 

Answer: C

Since the pointer p is declared to be constant, trying to assign it with a new value results in an error.

Output:
$ cc pgm11.c
pgm11.c: In function ‘main’:
pgm11.c:7: error: assignment of read-only variable ‘p’
pgm11.c:8: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int * const’

Enter details here

Answer: A

In a C++ code, names with quotes like ‘x’ represent a character or string(in case of a collection of characters) whereas without quotes they represent an identifier.

Enter details here

88.

------not a secondry constant.

Answer: A

No answer description available for this question.
 

Enter details here

89.

What is the output of this C code?

#include 
    #define a 10
    int main()
    {
        const int a = 5;
        printf("a = %d\n", a);
    }

 

Answer: C

The #define substitutes a with 10 leaving no identifier and hence compilation error.

Output:
$ cc pgm3.c
pgm3.c: In function ‘main’:
pgm3.c:5: error: expected identifier or ‘(’ before numeric constant

Enter details here

90.

C programming language provides operations which deal directly with objects such as

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