GATE / CS ARCHIVE

GATE CSE 2011 / QUESTION 47

Equivalence partitioning for quadratic-root tests

Engineering Mathematics & Other Topics · Software Engineering · Full GATE CSE 2011 paper

GATE 2011, Q47 2 marks · MCQ
Not in GATE 2027 syllabusReport issue

Software Engineering

Question 47, GATE 2011: A quadratic-root function for ax²+bx+c=0 specifies four cases: a=0 (regardless of discriminant); otherwise discriminant positive, zero or negative. Only positive/zero cases yield valid real roots, ordered root1≥root2, and return 0; invalid cases store two zeros and return -1. Test rows list (a,b,c;root1,root2;return): T1=(0,0,7;0,0;-1), T2=(0,1,3;0,0;-1), T3=(1,2,1;-1,-1;0), T4=(4,-12,9;1.5,1.5;0), T5=(1,-2,-3;3,-1;0), T6=(1,1,4;0,0;-1). Which set is nonredundant and covers the input equivalence classes?

(A) T1,T2,T3,T6
(B) T1,T3,T4,T5
(C) T2,T4,T5,T6
(D) T2,T3,T4,T5
Tap to enlarge
Your answer
Answer & solution

Official answer: C

The specification defines four input equivalence classes: a=0 regardless of discriminant, and, for a≠0, discriminant positive, zero or negative. T1 and T2 cover the first class. T3 and T4 both have zero discriminant. T5 has discriminant 16>0, and T6 has discriminant −15<0. A nonredundant representative set must choose one of {T1, T2}, one of {T3, T4}, and both T5 and T6. Among the supplied choices, only {T2, T4, T5, T6} does so, option C.

Compute discriminants b²-4ac only after recognizing the special a=0 class. T3 gives 4-4=0 and T4 gives 144-144=0, so they are redundant for this partition despite different numerical roots. T5 gives 4+12=16; T6 gives 1-16=-15. A repeats the a=0 class and omits positive discriminant. B and D repeat the zero-discriminant class and omit negative discriminant. C contains exactly one representative of each stated category.

Original paper, page 13 · Answer key