ProgrammingHardTCS NQT · Infosys
int g[2][3] = {1, 2, 3, 4}; What is g[1][1] + g[0][2]?
- A. 4
- B. 7
- C. 0
- D. 3
Correct answer: D. 3
Brace-less initialisation fills row 0 with 1, 2, 3 and row 1 with 4, 0, 0. So g[1][1] is 0 and g[0][2] is 3, giving 3.
More C Programming questions
- uint8t a = 200; a = a + a; What is a?
- Which statement about pointer relations in C is well defined?
- How many subsets of {0, 1, 2, 3, 4, 5} contain exactly three elements?
- #define DOUBLE(x) (x + x). What does printf("%d", DOUBLE(2) 3) print?
- uint8t x = 0x90; uint8t y = x & (uint8t)(x - 1); What is y?
- int f(int n) { if (n == 0) return 0; return n % 2 + f(n / 2); } What is f(37)?