ProgrammingVery hard
printf("%d", pow_mod(2, 100, 1000000007)); where pow_mod is standard binary exponentiation with 64-bit intermediates. What is printed?
- A. 976371285
- B. 976371284
- C. 1024
- D. 2147483647
Correct answer: A. 976371285
2^100 mod (10^9 + 7) = 976371285, which a correct square-and-multiply loop produces.
More C Programming questions
- printf("%lld", (999999999LL 999999999LL) % 1000000007LL); What is printed?
- printf("%d %d", -17 % 5, 17 % -5); What is printed in C99?
- printf("%d", (-17 % 5 + 5) % 5); What is printed in C99?
- What is printed? c #include <stdio.h> int main(void) { int a[] = {1, 2, 3, 4, 5, 6}; int l = a, r = a + 5; while (l < r) { int t = l; l++…
- What is printed? c #include <stdio.h> int main(void) { int a[] = {4, 1, 7, 3, 9}, p[6] = {0}; for (int i = 0; i < 5; i++) p[i + 1] = p[i]…
- A qsort comparator must order the uint16t values by high byte descending and, for equal high bytes, by low byte ascending. What is…