main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
ABCDCBA ABC CBA AB BA A A
What is the difference between text and binary i/o?
a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static Which of the Following Statements are true w.r.t Bit-Fields A)a,b&c B)Only a & b C)Only c D)All
3 Answers Accenture, Digg.com,
accept character from keyboard untill the user presses the enter key.If the user enters any character other than upper case(A-Z)alphabets program should stop taking any input
how can i sort numbers from ascending order and descending order using turbo c..
44.what is the difference between strcpy() and memcpy() function? 45.what is output of the following statetment? 46.Printf(“%x”, -1<<4); ? 47.will the program compile? int i; scanf(“%d”,i); printf(“%d”,i); 48.write a string copy function routine? 49.swap two integer variables without using a third temporary variable? 50.how do you redirect stdout value from a program to a file? 51.write a program that finds the factorial of a number using recursion?
What is formal argument?
what is the difference between <stdio.h> and "stdio.h"
14 Answers Invendis, Kanbay, Mastek, MathWorks,
Are enumerations really portable?
Explain 'far' and 'near' pointers in c.
What are structural members?
What are the 3 types of structures?