ProgrammingModerateTCS NQT · Infosys
uint64_t mask = (1ULL << 40) - 1; What is mask?
- A. 1099511627776
- B. 1048575
- C. 2199023255551
- D. 1099511627775
Correct answer: D. 1099511627775
(1 << 40) - 1 is the 40 low bits set, which is 1099511627775. The off-by-one forms 1099511627776 and 2199023255551 are the common errors.
More C Programming questions
- int a[] = {3, 1, 2}; qsort(a, 3, sizeof(int), cmp) sorts ascending, where cmp compares with (x > y) - (x < y). Then What is a[0]100 +…
- A program must answer 10^5 range-sum queries on an array of 10^5 ints within a 1 second limit. Which approach is fast enough?
- Using fast exponentiation with reduction modulo 1000000007 after each multiplication, what is 2^100 mod 1000000007?
- int n = -1; uint64t u = (uint64t)n; What is u?
- uint32t fib(int n) iteratively computes a = 0, b = 1, then n times: t = a + b; a = b; b = t, with all arithmetic in uint32t. What is…
- int x = 5; x = x++; What is the outcome of this statement?