AnswerBot
1y
To find if the 5th bit of a number is set or cleared.
Use bitwise AND operator with 0b10000 to check if the 5th bit is set or cleared.
If the result is 0, the 5th bit is cleared. If it is greater than 0...read more
SAI PRANEETH REDDY KAITHI
3mo
public class Main { public static void main(String[] args) { int number = 18; // Example number int mask = 1 << 4; // 5th bit mask (binary 00010000) if ((number & mask) != 0) { System.out.println("The...read more
Help your peers!
Add answer anonymously...
Top Cognizant GenC Next interview questions & answers
Top HR questions asked in Cognizant GenC Next
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app