union u

{

struct st

{

int i : 4;

int j : 4;

int k : 4;

int l;

}st;

int i;

}u;

main()

{

u.i = 100;

printf("%d, %d, %d",u.i, u.st.i, u.st.l);

}

a. 4, 4, 0

b. 0, 0, 0

c. 100, 4, 0

d. 40, 4, 0



union u { struct st { int i : 4; int j : 4; int k : 4; ..

Answer / guest

c) 100, 4, 0

Is This Answer Correct ?    10 Yes 1 No

Post New Answer

More C Code Interview Questions

write the function. if all the character in string B appear in string A, return true, otherwise return false.

11 Answers   Google,


main() { clrscr(); } clrscr();

2 Answers  


There were 10 records stored in “somefile.dat” but the following program printed 11 names. What went wrong? void main() { struct student { char name[30], rollno[6]; }stud; FILE *fp = fopen(“somefile.dat”,”r”); while(!feof(fp)) { fread(&stud, sizeof(stud), 1 , fp); puts(stud.name); } }

1 Answers  


union u { union u { int i; int j; }a[10]; int b[10]; }u; main() { printf("\n%d", sizeof(u)); printf(" %d", sizeof(u.a)); // printf("%d", sizeof(u.a[4].i)); } a. 4, 4, 4 b. 40, 4, 4 c. 1, 100, 1 d. 40 400 4

3 Answers   HCL,


main() { int a[10]; printf("%d",*a+1-*a+3); }

1 Answers  






void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }

1 Answers  


main() { int i =10, j = 20; clrscr(); printf("%d, %d, ", j-- , --i); printf("%d, %d ", j++ , ++i); } a. 20, 10, 20, 10 b. 20, 9, 20, 10 c. 20, 9, 19, 10 d. 19, 9, 20, 10

4 Answers   HCL,


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

1 Answers  


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


main() { extern out; printf("%d", out); } int out=100;

1 Answers  


how can i cast a char type array to an int type array

2 Answers  


Categories