What is the output of following program ?
int
main()
{
int x = 5;
printf("%d %d %d\n", x, x << 2, x >> 2);
}
Answers were Sorted based on User's Feedback
Answer / shubham
5
5>>2=1(0000101=>00000001)
5<<2=20(0000101=>10100)
| Is This Answer Correct ? | 3 Yes | 0 No |
4 4 1 is the output....
here the operation of STACK involves.... for these kind of statements (ie) statements having multiple values to get printed it is used..... so the very first element that goes inside stack is x , then x<<2 , then x>>2... so from the TOP it will be operated....
and print as the order given in printf statement..... :)
thank u
| Is This Answer Correct ? | 6 Yes | 16 No |
Answer / krishna deep sharma
4,4,1
coz we shift the bit as 5=101 now shift two bit to right as
101>>2=001
now
2<<001=100
noe x=4
printf execute from right to left so ans is 4,4,1
| Is This Answer Correct ? | 11 Yes | 28 No |
How many levels of indirection in pointers can you have in a single declaration?
0 Answers Agilent, ZS Associates,
What language is lisp written in?
What is the best organizational structure?
How would you sort a linked list?
player is good if the following conditions are satisfied: He is either from “India”, “Japan” or “Korea” He has a minimum of 3 years of experience He has won at least 3 major tournaments, and one of them must be "World Championship Tournament". He must know more than 10 techniques. (but see next question) If he knows less than 10 techniques, then he must be a world champion. His name contains at least 3 words. For example "Sachin Tendulkar" will not meet this condition. Write a method: boolean isGoodPlayer(String name, String country, int yearsExperience, String[] majorTournamentsWon, String[] techniques, boolean isWorldChampion) name country yearsExperience majorTournamentsWon techniques isWorldChampion
What are the commands should be given before weiting C Program i.e, Cd.. like
4 Answers IBM, Infonet, Satyam, Tech Mahindra,
what would be the output of the following program? main() { int k = 123; char *ptr; ptr = &k; printf("%d",*ptr); }
in malloc and calloc which one is fast and why?
Explain how can you determine the size of an allocated portion of memory?
what are # pragma staments?
what is the hardware model of CFG( context free grammar)
What are the salient features of c languages?