ProgrammingHardTCS NQT · Infosys
long long x = 1000000LL * 1000000; What is x?
- A. 1000000000000
- B. 1000000
- C. 0
- D. -727379968
Correct answer: A. 1000000000000
The LL suffix makes the multiplication long long, so the exact value 10^12 is stored. Multiplying two plain ints would overflow, which is undefined.
More C Programming questions
- What does printf("%d", sizeof('a') == sizeof(int)) print?
- char words[] = {"one", "two", "three"}; char pp = words + 1; printf("%s", pp + 1); What is printed?
- int a[2][3] = {{1, 2, 3}, {4, 5, 6}}; int p = &a[0][0]; printf("%d", p[4]); What is printed?
- int a[] = {10, 20, 30}; printf("%d", a + 2); What is printed?
- int a[] = {10, 20, 30}; printf("%d", 2[a] - a[1]); What is printed?
- How many subsets of {1, 2, 3, 4, 5, 6} have an element sum equal to 7?