wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

What does the following 'C' program do?
main ()
{
unsigned int num;
int i;
scanf("%u", & num);
for(i=0;i<16;i++)
Printf("%d",(num<<i&1<<15)?1:0);
}

A
It prints all even bits from num.
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
It prints all odd bits from num.
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
It prints binary equivalent num.
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
D
None of the above
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is C It prints binary equivalent num.

The following 'C' program do.
main ()
{
unsigned int num;
int i;
scanf("%u", & num);
for(i=0;i<16;i++)
Printf("%d",(num<<i&1<<15)?1:0);
}

Ans. C



943816_917973_ans_adb4d62e200d43fbb5916f91be44f0bb.PNG

flag
Suggest Corrections
thumbs-up
0
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Number Sequences in Math
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon