Discussion
What is the value of x after executing the following statement?
int x = 011 | 0x10;
Answer: C
Correct answer: 25
The two literals are in different bases: a leading 0 marks octal and 0x marks hexadecimal.
The bitwise OR sets every bit that is set in either, giving \(11001_2 = 25\).
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