Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}

Answers were Sorted based on User's Feedback



main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / daniel

Indeed the correct answer is 5, 20, 1.
Explanation:
* the value of x is 5 so it will print out 5
* the value of x << 2, x shifted to left 2 times means x multiplied by 2 for 2 times, i.e. 5 * 2 * 2 = 20
* the value of x >> 2, x shifted to right 2 times so the result will be 5 / 2 / 2 = 5 / 4 = 1 (x is an int).

Is This Answer Correct ?    85 Yes 2 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / rahul

5,20,1

Is This Answer Correct ?    50 Yes 3 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / kamalg

5 20 1

Is This Answer Correct ?    16 Yes 2 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / abhishek rai

5201

Is This Answer Correct ?    4 Yes 3 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / a. k

20 1 5

Is This Answer Correct ?    0 Yes 3 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / mukul

5,10,2

Is This Answer Correct ?    3 Yes 11 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / anand h i

in printf functiton evaluation of variables start from
right to left so first it evaluates
x>>2
101 after right shift of 2 it will be 001=1
next it will evaluate
x<<2
1 after left shift of 2 it will be 100=4
at the last x=4
so answer is 4 4 1

Is This Answer Correct ?    3 Yes 13 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / vignesh1988i

the answer is 0 0 0 ...

thank u

Is This Answer Correct ?    1 Yes 11 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / vignesh1998i

oh oh , sorry , i didnt see the value of x is 5....


4 4 1

than k u

Is This Answer Correct ?    1 Yes 11 No

main() { int x=5; printf("%d %d %d\n",x,x<<2,x>>2); } ..

Answer / jignesh patel

5 5

Is This Answer Correct ?    1 Yes 12 No

Post New Answer

More C Interview Questions

Develop a program that computes the new price of an item. The program should receive a character variable colour and a double precision floating-point variable price from the user. Discount rate is determined based on the colour of the discount sticker, as shown in the following table. An error message should be printed if an invalid colour has been entered

1 Answers  


write a c program in such a way that if we enter the today date the output should be next day's date.

0 Answers  


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

0 Answers  


#include<stdio.h> int f(int,int); int main() { printf("%d",f(20,1)); return 0; } int f(int n,int k) { if(n==0) return 0; else if(n%2)return f(n/2,2*k)+k; else return f(n/2,2*k)-k; } how this program is working and generating output as 9....?

1 Answers  


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

1 Answers  


Why main is not a keyword in c?

0 Answers  


5. distance conversion: Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer

4 Answers  


how is the examination pattern?

0 Answers   Wipro,


difference between object file and executable file

0 Answers  


What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack

6 Answers  


Is reference used in C?

1 Answers  


how many error occurs in C language ?

22 Answers   Infosys, Wipro,


Categories