Category Archives: Bit Magic

Written Test: 1) 15 Aptitude Questions 2) 25 CS Fundamentals & Couple of output questions. 3) Coding Question: A thief trying to escape from a… Read More
Write a function which returns 1 that 2 is passed and return 2 when 1 is passed.Source: Adobe Interview Experience | Set 19 (For MTS)A… Read More
Round 1 : Written : Q1. Given a stream of around billion numbers in an array, which has approximately only 1000 unique numbers. Print the… Read More
Checking your coding capabilities and thinking level is their main motive. Hence the whole procedure I was involved in dealt only with coding questions. 😀… Read More
Given an integer ‘x’, write a C function that returns true if binary representation of x is palindrome else return false.For example a numbers with… Read More
A nibble is a four-bit aggregation, or half an octet. There are two nibbles in a byte. Given a byte, swap the two nibbles in it.… Read More
Given a number n and a value k, turn off the k’th bit in n. Please note that k = 1 means the rightmost bit.Examples:  … Read More
Given a number n, write a function that returns true if n is divisible by 9, else false. The most simple way to check for… Read More
In C, the following 6 operators are bitwise operators (work at bit-level)     The & (bitwise AND) in C or C++ takes two numbers as… Read More
Given two variables, x, and y, swap two variables without using a third variable.  Method 1 (Using Arithmetic Operators)  The idea is to get… Read More
Given two integers, write a function to multiply them without using multiplication operator.There are many other ways to multiply two numbers (For example, see this).… Read More
Travelling Salesman Problem (TSP): Given a set of cities and distance between every pair of cities, the problem is to find the shortest possible route… Read More
Given a number N having only one ‘1’ and all other ’0’s in its binary representation, find position of the only set bit. If there… Read More
Given an unsigned integer, swap all odd bits with even bits. For example, if the given number is 23 (00010111), it should be converted to… Read More
Given a number N, generate bit patterns from 0 to 2^N-1 such that successive patterns differ by one bit.  Examples: Input: N = 2 Output:… Read More