ProgrammingHardTCS NQT · Infosys
int a[] = {10, 20, 30}; printf("%d", *a + 2); What is printed?
- A. 12
- B. 30
- C. 20
- D. 32
Correct answer: A. 12
*a is a[0] = 10, and adding 2 gives 12. The dereference applies before the addition.
More C Programming questions
- 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?
- 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)?