Sei sulla pagina 1di 5

Week 2 Assignment Solution 

 
This  document  provides  solution  to  the  second  assignment  of  the  online  course 
Software  Testing  offered  by  MHRD.  The  answers   to  each  questions are marked in 
red​. Explanation for numerical problems are given below each problem. 
  
1. During unit  testing , why is it important to  test the boundary values? 
a) It reduces test costs as boundary values are easily computed by hand. 
b) Debugging is easier when testing boundary values. 
c) The correct execution of a function on all boundary values proves that the function is 
correct. 
d) Programming the boundary conditions is usually error­prone in practice. 
 
2. Which one of the following types  of bugs may not get detected in black­box testing, but  are 
very likely to be get detected  by white­box testing? 
a) Syntax  errors 
b) Behavioral errors 
c) Logic errors 
d) Performance errors 
 
   

 
3. A  function  named  ​compute-electricity-bill  was  written to compute  the electricity bill by  an 
electricity  distribution  company.  This  function  takes  two  parameters,  the  number  of  units 
consumed  by  a  customer  and  the  corresponding  customer  type.  The  customer  type  is   an 
integer  value  in  the  range  1  to  5  indicating   whether  the  customer  is  domestic,  industrial, 
commercial  establishment,  etc. The tariff depends not only the customer type, but also on the 
number  of units consumed. The  slabs for  different charges based on the  units consumed are 0 
to  100  units,  100  to  200  units,  200  to  500   units,  and  500  units  and  above.  How  many  test 
cases  are  required  for  weak  equivalence  class  test  testing  of   the  function 
compute-electricity-bill​? 
a) 4 
b) 5 
c) 8 
d) 10 
 
Explanation: There are many possible ways to find the test cases. 
  1  2  3  4  5 

0­100         

100­200       
*  * 
200­500         

500 & above         

 
 
   

 
4. For  the  function  ​compute-electricity-bill ​described  in  question 3  above,  at least how many 
test cases are required for strong equivalence class testing of the function​? 
a) 10 
b) 11 
c) 20 
d) 21 
 
Explanation:  All  the  20  cells  describe  a  test  case  required  for  strong  equivalence  class 
testing. 
  1  2  3  4  5 

0­100 
*  *  *  *  * 
100­200 
*  *  *  *  * 
200­500 
*  *  *  *  * 
500 & above 
*  *  *  *  * 
 
5. For  the  function  ​compute-electricity-bill ​described  in  question 3  above,   ​at least how many 
test cases are required for strong robust equivalence class testing? 
a) 25 
b) 26 
c) 30 
d) 31 
 
Explanation:  Similar  to  the  above  solution,  we  require  6  *  5,  i.e.  30  test  cases  for  strong 
robust equivalence class testing. 
 
6. Suppose  a  certain   function  takes  5  Integer  input  parameters.  The  valid  values  for  each 
parameter  forms  ​a  range  of  integer  values.  What  is  the  minimum  number  of  test  cases 
required for boundary value testing? 
a) 10 
b) 11 
c) 20 
d) 21 
 
Explanation:​ ​Using the formula (4n + 1) for n independent variables, where n = 5, we get 21. 

 
7. Consider  a  function  implementing  the  following   policy  for  awarding  merit  cum  means 
scholarship  to  the  students.  No  students  would  be  considered  for the  scholarship  if  he  is in 
receipt  of  any  other  scholarship  or  if  he  is  having  a  backlog  in  any  subject.   Further,  the 
parental  income  must  be  less  than  1Lakh  rupees  per  year  and  the  student’s  current  CGPA 
must be at least 7. However, a  student  with parental income upto Rs. 2 Lakhs may be awarded 
the  scholarship, if his/her current CGPA is at least 8. At least how many test cases are required 
for conditional testing? 
a) 6 
b) 7 
c) 8 
d) 9 
 
Explanation:  
The given 7 test cases are enough for condition testing. 
The  first  column  shows that  if  a  student  is  a  recipient of any  other  scholarship  then he will 
not  will   be  considered  for  scholarship  irrespective  of   any  other  condition.  Similarly,  the 
second column says that if a student is having a backlog then irrespective of other values, he 
will  not   be  considered  for  scholarship.  Thus,  all  the  7  test  cases  are  generated  using  the 
similar  approach. The dashes can  be  considered to  be  don't  cares  and  Y represent true and 
N represent false. 
 
Receipt  
Of scholarship  
Y  N  N  N  N  N  N 
Backlog   
Y  N  N  N  N  N 
Income< 1 lakh     
N  Y  Y  N  N 
7<CGPA<8     
  N  Y  N  N 
1<Income<2 lakh           
N  Y 
CGPA>8           
Y  Y 
Not considered     
         

Considered           
   
 

 
 
8. If  a  user  interface has  three checkboxes, at least how  many test cases are required to achieve 
pair­wise coverage? 
a) 3 
b) 4 
c) 5 
d) 6 
 
Explanation: ​If we use the following test cases: 
(000), (010), (101), (111)​, all pairs of check boxes can be covered. 
 
9. Consider  the  function  ​find-intersection(m1,c1,m2,c2)  that  computes  the  point  of 
intersection of two straight lines of the form y=mx+c.  For equivalence class testing, at the first 
level of  the  equivalent class hierarchy the valid and invalid equivalence classes can be formed. 
The valid set of input values can be further divided into how many equivalence classes? 
a) 1 
b) 2 
c) 3 
d) 4 
 
Explanation:​ ​The three equivalence classes are the following:  
• Parallel lines (m1=m2, c1≠c2) 
• Intersecting lines (m1≠m2) 
• Coincident lines (m1=m2, c1=c2) 
 
10. Scenario  coverage testing  can be  considered to be which one of the following types of testing 
strategies? 
a) Pair­wise testing 
b) Decision table­based testing 
c) Equivalence partitioning­based testing 
d) Boundary value­based testing 

Potrebbero piacerti anche