Discussion
Bitwise | can be used to set multiple bits in number.
Answer: A
Correct answer: Yes
OR with a mask forces every position named by the mask to 1 and leaves the others as they were, and a mask may name any number of positions at once.
So item |= MOBILE | LAPPY sets both flags in a single operation. This is why OR is the natural operator for accumulating flags: each |= adds to the set without disturbing what is already there, and the operation is idempotent, so setting a bit that is already on changes nothing.
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