GATE 2015 CS (CS2) – Question 8
For distinct integers p,q,r,s, f(p,q,r,s)=max(p,q,r,s), g(p,q,r,s)=min(p,q,r,s), and h(p,q,r,s) is the remainder when the larger of pq and rs is divided by the smaller. Products of function names denote products of values, for example fgh=f×g×h; the operations also apply to two arguments. Find fg(h(2,5,7,3),4,6,8).
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 8
Explanation
First pq=10 and rs=21, so h(2,5,7,3)=21 mod 10=1. The outer inputs are one,four,six,eight. Their maximum is eight and minimum one, so fg is 8×1=8. The requested expression is fg, not fgh; therefore no outer remainder is multiplied in.
More Quantitative Aptitude: Data Interpretation, Arithmetic and Number Computation questions
- GATE 2015 CS (CS2) Q10
- GATE 2015 CS (CS3) Q8
- GATE 2021 CS (CS2) Q9
- GATE 2026 CS (CS1) Q3
- GATE 2026 CS (CS1) Q4
- GATE 2026 CS (CS1) Q8
All Quantitative Aptitude: Data Interpretation, Arithmetic and Number Computation questions →