Discussion
What is the value of x after these three lines run?
uint8_t x = 0xF0; x = x >> 2; x |= 0x03;
Answer: A
Shifting 0xF0 right by two gives 0x3C, and setting the two low bits with an inclusive or gives 0x3F. Working in binary rather than hex makes such manipulations far less error-prone: 1111 0000 becomes 0011 1100 and then 0011 1111.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development