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 |
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
What is array in c with example?
What are header files and what are its uses in C programming?
How to swap two values using a single variable ? condition: Not to use Array and Pointer ?
What is the Difference between Class and Struct?
write a c program that prints all multiples of 3between 1 and 50.
Write a program on swapping (100, 50)
Describe the difference between = and == symbols in c programming?
What is the Purpose of 'extern' keyword in a function declaration?
Which is best book for data structures in c?
What is the need of structure in c?
Write a program in c to print 1 121 12321 1234321 123454321
11 Answers ANR, College School Exams Tests, Mu Sigma, Wipro,