CS FundamentalsHardService-company placement · ISTQB-style
A program classifies three side lengths as equilateral, isosceles, scalene or 'not a triangle' (when the two shorter sides sum to no more than the longest). Which test set covers all four output classes?
- A. (3,3,3), (3,3,6), (3,4,5), (1,2,4)
- B. (3,3,3), (3,3,5), (3,4,5), (1,2,3)
- C. (4,4,4), (2,2,3), (2,3,6), (5,5,9)
- D. (2,2,2), (4,4,7), (4,5,9), (1,1,5)
Correct answer: B. (3,3,3), (3,3,5), (3,4,5), (1,2,3)
(1,2,3) is degenerate (1 + 2 = 3), so it is 'not a triangle', and the others are equilateral, isosceles and scalene. In the first set (3,3,6) is not a triangle, so no isosceles case; the last two sets have no scalene triangle ((4,5,9) and (2,3,6) are degenerate or invalid).
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A class has fields a, b, c, d and methods m1 (uses a, b), m2 (uses b), m3 (uses c), m4 (uses c, d) and m5 (uses no field but calls m1)…
- A package has 10 classes, 2 of them abstract. 3 outside classes depend on it (Ca = 3) and it depends on 9 outside classes (Ce = 9). Using…
- What happens when this builder code runs? python class QB: def init(self): self.parts = [] def where(self, c): self.parts.append(c)…
- What does this plugin-registry code print? python class Plugin: registry = [] def init(self, name): self.registry.append(name) class…
- What does this Template Method code print? python class Base: def run(self): return self.a() + self.b() def a(self): return 'A' def…
- Why do many agile teams estimate story points on a Fibonacci-like scale (1, 2, 3, 5, 8, 13, …) instead of 1 to 10?