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() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

1 Answers  


main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }

1 Answers  


#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }

3 Answers   Hexaware,


How to return multiple values from a function?

7 Answers  






what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }

3 Answers   Wipro,


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates.

19 Answers   Amazon, BITS, Microsoft, Syncfusion, Synergy, Vector,


There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.

1 Answers   Nagarro,


Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)

7 Answers   Microsoft,


main() { 41printf("%p",main); }8

1 Answers  


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

1 Answers  


How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.

2 Answers  


Categories