ProgrammingHardGATE CS · Campus placements
int a[] = {10, 20, 30}; printf("%d", 2[a] - a[1]); What is printed?
- A. 10
- B. 20
- C. 30
- D. 0
Correct answer: A. 10
2[a] means a[2] = 30 because the subscript form is commutative. The difference 30 - 20 is 10.
More C Programming questions
- How many subsets of {1, 2, 3, 4, 5, 6} have an element sum equal to 7?
- In a 3 x 3 grid, a walker can move only right or down from the top-left corner to the bottom-right corner. How many distinct paths exist?
- T(0) = 0 and T(n) = T(n-1) + n for n >= 1. What is T(10)?
- What is gcd(48, 180) by Euclid's recursion?
- What is lcm(12, 18)?
- unsigned int u = 3; int s = -4; printf("%d", (int)u + s); What is printed?