main()

{

float f=5,g=10;

enum{i=10,j=20,k=50};

printf("%d\n",++k);

printf("%f\n",f<<2);

printf("%lf\n",f%g);

printf("%lf\n",fmod(f,g));

}



main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); prin..

Answer / susie

Answer :

Line no 5: Error: Lvalue required

Line no 6: Cannot apply leftshift to float

Line no 7: Cannot apply mod to float

Explanation:

Enumeration constants cannot be modified, so you cannot
apply ++.

Bit-wise operators and % operators cannot be applied on
float values.

fmod() is to find the modulus values for floats as %
operator is for ints.

Is This Answer Correct ?    12 Yes 6 No

Post New Answer

More C Code Interview Questions

How to swap two variables, without using third variable ?

104 Answers   AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,


main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,


main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

9 Answers   CSC, GoDB Tech, IBM,


hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  


int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }

1 Answers  






Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,


main() { char *p = "hello world"; p[0] = 'H'; printf("%s", p); } a. Runtime error. b. “Hello world” c. Compile error d. “hello world”

5 Answers   HCL,


Write a routine to implement the polymarker function

0 Answers   TCS,


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }

1 Answers  


why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?

0 Answers  


Sir... please give some important coding questions asked by product companies..

0 Answers  


Categories