ProgrammingHardTCS NQT · Infosys
The pairs (1,2), (3,5) and (2,5) are sorted by the second value descending, with ties broken by the first value ascending. Which pair comes first?
- A. (1,2)
- B. (3,5)
- C. (2,5)
- D. (3,2)
Correct answer: C. (2,5)
(3,5) and (2,5) tie on the second value 5, and the first value breaks the tie, so (2,5) comes before (3,5). (1,2) has the smallest second value and comes last.
More C Programming questions
- How many integers from 0 to 255 have exactly four 1 bits in binary?
- What is 0 ^ 1 ^ 2 ^ ... ^ 31, the XOR of all integers from 0 to 31?
- What is the total number of 1 bits in the binary forms of 1, 2, ..., 16 added together?
- uint16t s = 0; for (int i = 1; i <= 1000; i++) s += i; What is s at the end?
- #define CAT(a,b) a##b. After int CAT(num, 2) = 7; what does printf("%d", num2 2) print?
- int a = 1 ? 2 : 3 ? 4 : 5; What is a?