QUESTION IMAGE
Question
case
please check this logic and brief how many test case can be provided?
read p
read q
if p+q > 100
then print \large\
else print \small\
endif
if p > 50
then print \p large\
else print \p small\
endif
pick one option
0
2
4
6
clear selection
Step1: Analyze the first IF condition ($p + q > 100$)
This condition has 2 possible outcomes: True (print "Large") or False (print "Small").
Step2: Analyze the second IF condition ($p > 50$)
This condition also has 2 possible outcomes: True (print "p Large") or False (print "p Small").
Step3: Calculate total test cases
Since the two IF conditions are independent, we multiply the number of outcomes of each condition. So, $2\times2 = 4$ total test cases. These test cases cover all combinations of the two conditions: (1) $p + q > 100$ and $p > 50$, (2) $p + q > 100$ and $p \leq 50$, (3) $p + q \leq 100$ and $p > 50$, (4) $p + q \leq 100$ and $p \leq 50$.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
4