Friday 5 August 2016

Week 2 Assignment Solution

This post 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.

Note: Please post any queries regarding the solution in the course forum only.

  1. During unit  testing , why is it important to  test the boundary values?
  1. It reduces test costs as boundary values are easily computed by hand.
  2. Debugging is easier when testing boundary values.
  3. The correct execution of a function on all boundary values proves that the function is correct.
  4. Programming the boundary conditions is usually error-prone in practice.


  1. 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?
    1. Syntax  errors
    2. Behavioral errors
    3. Logic errors
    4. Performance errors


  1. 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?
    1. 4
    2. 5
    3. 8
    4. 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



*



  1. 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?
    1. 10
    2. 11
    3. 20
    4. 21


Explanation: All the 20 cells describes a test case required for strong equivalence class testing.

1
2
3
4
5
0-100
*
*
*
*
*
100-200
*
*
*
*
*
200-500
*
*
*
*
*
500 & above
*
*
*
*
*


  1. 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?
    1. 25
    2. 26
    3. 30
    4. 31

Explanation: Similar to the above solution, we require 6 * 5, i.e. 30 test cases for strong robust equivalence class testing.


  1. 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?
    1. 10
    2. 11
    3. 20
    4. 21


Explanation: Using the formula (4n + 1) for n independent variables, where
n = 5, we get 21.


  1. 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?
    1. 6
    2. 7
    3. 8
    4. 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








  1. If a user interface has three checkboxes, at least how many test cases are required to achieve pair-wise coverage?
    1. 3
    2. 4
    3. 5
    4. 6


Explanation: If we use the following test cases:
(000), (010), (101), (111), all pairs of check boxes can be covered.


  1. 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?
    1. 1
    2. 2
    3. 3
    4. 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)

  1. Scenario coverage testing can be  considered to be which one of the following types of testing strategies?
    1. Pair-wise testing
    2. Decision table-based testing
    3. Equivalence partitioning-based testing
    4. Boundary value-based testing


You can download the pdf version of the solution here.
Share:

Contact Me

Name

Email *

Message *

Popular Posts