ProgrammingHardTCS NQT · Infosys
The sorted array is {1, 3, 5, 7, 7, 9}. What is the index of the first element greater than 7?
- A. 4
- B. 5
- C. 6
- D. 3
Correct answer: B. 5
Indices 0 to 4 hold values up to 7, and index 5 holds 9, the first value greater than 7. This is the upper-bound index.
More C Programming questions
- int n = 0; reading the expression as C does: What is the value of ~5 + 1?
- int n = 0; while (n++ < 3) ; What is n after the loop?
- unsigned char x = 100; x += 200; What is x?
- int x = 12; x &= x - 1; What is x?
- What does printf("%d", sizeof(int) > sizeof(char)) print?
- char p = "abc" + 1; printf("%c", p); What is printed?