Top

Expressions

1.

What is the output of this C code?    

void main()
    {
        int x = 4;
        int *p = &x;
        int *k = p++;
        int r = p - k;
        printf("%d", r);
    }

 

Answer: C

No answer description available for this question.

Enter details here

2.

What is the output of this C code?    

int main()
    {
        int i = -5;
        int k = i %4;
        printf("%d\n", k);
    }

 

Answer: B

No answer description available for this question.

Enter details here

3.

What is the value of the below assignment expression
      (x = foo())!= 1 considering foo() returns 2

Answer: A

No answer description available for this question.

Enter details here

4.

What will be the output of the following program?
 

#include < stdio>
int main()
{
int num = 0, z = 3;
if ( ! (num <= 0) || ++z )
printf( “%d %d ”, ++num + z++, ++z );
else
printf( “%d %d”, - -num + z- -, - - z);
return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

5.

for c = 2, value of c after c <<= 1;

Answer: D

No answer description available for this question.

Enter details here

6.

What will be the output of the following program?

#include< stdio>

int main()
{
static unsigned int a = 23;
register unsigned char c = ‘R’;
auto long unsigned q = 345L;
static long signed p = 345L;
printf(“a = %u c = %c”, a ,c);
printf(“\nq = %ld p = %ld”, q, p);
return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

7.

Relational operators cannot be used on:

Answer: A

No answer description available for this question.

Enter details here

8.

Does logical operators in C language are evaluated with short circuit?

Answer: A

No answer description available for this question.

Enter details here

9.

What is the output of this C code?    

int main()
    {
        int a = 10, b = 10;
        if (a = 5)
        b--;
        printf("%d, %d", a, b--);
    }

 

Answer: C

No answer description available for this question.

Enter details here

10.

Which of the following data type will throw an error on modulus operation(%)?

Answer: C

No answer description available for this question.

Enter details here

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