GATE / CS ARCHIVE

GATE CSE 2015 SET 2 / QUESTION 8

GATE CSE 2015 Set 2 Q8

General Aptitude · Algebra, Equations & Number Patterns · Full GATE CSE 2015 Set 2 paper

GATE 2015 Set 2, Q8 2 marks · NAT
Report issue

Algebra, Equations & Number Patterns

Question 8, GATE 2015: For distinct integers, f returns their maximum, g their minimum, and h returns the remainder when the larger product pq or rs is divided by the smaller. Combined fg means the product of f and g. Evaluate fg(h(2, 5, 7, 3), 4, 6, 8).
Tap to enlarge
Answer & solution

Official answer: 8

The products are 2·5=10 and 7·3=21, so h=21 mod 10=1. On(1, 4, 6, 8), f=8 and g=1. Thus fg=8·1=8.

Evaluate the nested h first. Its products are 2×5=10 and 7×3=21. Dividing 21 by 10 leaves remainder 1, so the outer argument list is 1, 4, 6, 8. Its maximum is 8 and minimum is 1. The requested combined operation fg multiplies those two outputs, 8×1=8; it does not apply h again or multiply all four input values.

Original paper, page 29 · Answer key