0% found this document useful (0 votes)
47 views

Bit Manipulation Questions

This document contains 5 questions about bit manipulation. The questions ask how to calculate x^x for any value of x, swap two numbers without a third variable, add 1 to an integer using bit manipulation, convert uppercase characters to lowercase using bits, and provides a link about additional bit manipulation hacks and tricks.

Uploaded by

itinerant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Bit Manipulation Questions

This document contains 5 questions about bit manipulation. The questions ask how to calculate x^x for any value of x, swap two numbers without a third variable, add 1 to an integer using bit manipulation, convert uppercase characters to lowercase using bits, and provides a link about additional bit manipulation hacks and tricks.

Uploaded by

itinerant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

BIT MANIPULATION QUESTIONS

[email protected]
NOTE - Some of these questions will teach you something new as some of
these might be useful hacks (which can be difficult to think of on your
own). Even if you are not able to come up with a solution on your own. Try
to learn something new from these questions & write down the logic of the
solution in your notes.

Question 1 : What is the value of x^x for any value of x?

Question 2 : Swap two numbers without using any third variable.

Question 3 : Add 1 to an integer using Bit Manipulation.


(Hint : try using Bitwise NOT Operator)

Question 4 : This question is based on a trick, please directly look at the solution.
Convert uppercase characters to lowercase using bits.

Question 5 : A Good read of hacks using bits (you can check this out in your free time) :
http://graphics.stanford.edu/~seander/bithacks.html

You might also like