Question 41
MediumWhich value of x makes 13 ^ x equal to 10?
- A.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Data Structures and Algorithms
Which value of x makes 13 ^ x equal to 10?
7
10
23
3
Sign up free to see the answer and a step-by-step explanation.
How can two integers a and b be swapped without a temporary variable using XOR?
a = b; b = a
a ^= b; b ^= a; a ^= b
a |= b; b |= a
a &= b; b &= a
Sign up free to see the answer and a step-by-step explanation.
What does x & 1 tell you?
Whether x is odd (1) or even (0)
The highest bit of x
The number of bits in x
Whether x is negative
Sign up free to see the answer and a step-by-step explanation.
How do you toggle the k-th bit of n (0-indexed)?
n ^ (1 << k)
n & ~(1 << k)
n >> k
n | (1 << k)
Sign up free to see the answer and a step-by-step explanation.
In 8-bit two's complement, what is −5?
00000101
11111011
11111010
10000101
Sign up free to see the answer and a step-by-step explanation.
What is the value of 1 << 10?
1024
100
512
10
Sign up free to see the answer and a step-by-step explanation.
Which operation multiplies an unsigned integer by 8?
x << 3
x | 8
x >> 3
x ^ 8
Sign up free to see the answer and a step-by-step explanation.
Every element appears three times except one, which appears once. How can the single one be found in O(1) extra space?
Sort and scan
Use a hash set
XOR all elements
Count each bit position modulo 3
Sign up free to see the answer and a step-by-step explanation.
What does n & −n isolate?
The lowest set bit of n
The highest set bit
All bits except the lowest
The sign bit
Sign up free to see the answer and a step-by-step explanation.
How many bits differ between 25 and 30 (the Hamming distance)?
3
4
1
2
Sign up free to see the answer and a step-by-step explanation.