main()

{

int i = 0xff ;

printf("\n%d", i<<2);

}

a. 4

b. 512

c. 1020

d. 1024

Answers were Sorted based on User's Feedback



main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 ..

Answer / pavan_mustyala

binary representation of 0xff is 11111111

left shift by 2 results in 1111111100 which is equivalent
to 1020 in decimal.

Is This Answer Correct ?    22 Yes 0 No

main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 ..

Answer / guest

c) 1020

Is This Answer Correct ?    19 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024

2 Answers   HCL,


main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }

2 Answers   IBM,


void func1(int (*a)[10]) { printf("Ok it works"); } void func2(int a[][10]) { printf("Will this work?"); } main() { int a[10][10]; func1(a); func2(a); } a. Ok it works b. Will this work? c. Ok it worksWill this work? d. None of the above

1 Answers   HCL,


main() { static int var = 5; printf("%d ",var--); if(var) main(); }

1 Answers  


which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.

2 Answers  






Write a C program to add two numbers before the main function is called.

11 Answers   Infotech, TC,


main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }

1 Answers   TCS,


&#8206;#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }

2 Answers  


const int perplexed = 2; #define perplexed 3 main() { #ifdef perplexed #undef perplexed #define perplexed 4 #endif printf("%d",perplexed); } a. 0 b. 2 c. 4 d. none of the above

1 Answers   emc2, HCL,


main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }

2 Answers  


PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

1 Answers  


plz tell me the solution.......... in c language program guess any one number from 1 to 50 and tell that number within 8 asking question in yes or no...............

2 Answers   Wipro,


Categories