ProgrammingHardTCS NQT · Infosys
char *words[] = {"one", "two", "three"}; char **pp = words + 1; printf("%s", *pp + 1); What is printed?
- A. wo
- B. two
- C. one
- D. hree
Correct answer: A. wo
pp points to words[1], which is "two", and *pp + 1 starts one character later. The output is wo.
More C Programming questions
- 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?
- 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)?