Equivalence partitioning and Boundary value analysis Objective question answer:

What is Equivalence partitioning?

Equivalence partitioning is a method for deriving test cases. In this method, equivalence classes (for input values) are identified such that each member of the class causes the same kind of processing and output to occur.

What is Boundary value analysis?

The values at the extremes (start/end values or lower/upper end values) of such class are known as Boundary values. Analyzing the behavior of a system using such values is called Boundary value analysis (BVA).

1. One of the fields on a form contains a text box which accepts numeric values in the range of 18 to 25. Identify the invalid Equivalence class.

a)    17
b)    19
c)    24
d)    21

Answer is ‘A’

Solution: The text box accepts numeric values in the range 18 to 25 (18 and 25 are also part of the class). So this class becomes our valid class. But the question is to identify invalid equivalence class. The classes will be as follows:

Class I: values < 18   => invalid class
Class II: 18 to 25       => valid class
Class III: values > 25 => invalid class
17 fall under invalid class. 19, 24 and 21 fall under valid class.

2. In an Examination a candidate has to score minimum of 24 marks in order to clear the exam. The maximum that he can score is 40 marks.  Identify the Valid Equivalence values if the student clears the exam.

a)    22, 23, 26
b)    21, 39, 40
c)    29, 30, 31
d)    0, 15, 22

Answer is ‘C’

Solution: The classes will be as follows:
Class I: values < 24   => invalid class
Class II: 24 to 40       => valid class
Class III: values > 40 => invalid class
We have to identify Valid Equivalence values. Valid Equivalence values will be there in Valid Equivalence class. All the values should be in Class II.

3. One of the fields on a form contains a text box which accepts alpha numeric values. Identify the Valid Equivalence class

a)    BOOK
b)    Book
c)    Boo01k
d)    Book

Answer is ‘C’

Solution: Alpha numeric is combination of alphabets and numbers. Hence we have to choose an option which has both of these. A valid equivalence class will consist of both alphabets and numbers. Option ‘c’ contains both alphabets and numbers.  

4. The Switch is switched off once the temperature falls below 18 and then it is turned on when the temperature is more than 21. When the temperature is more than 21. Identify the Equivalence values which belong to the same class.

a)    12, 16, 22
b)    24, 27, 17
c)    22, 23, 24
d)    14, 15, 19

Answer is ‘C’

Solution: we have to choose values from same class (it can be valid or invalid class). The classes will be as follows:
Class I: less than 18 (switch turned off)
Class II: 18 to 21
Class III: above 21 (switch turned on)
Only in Option ‘c’ all values are from one class.

5. A program validates a numeric field as follows: values less than 10 are rejected, values between 10 and 21 are accepted, values greater than or equal to 22 are rejected. Which of the following input values cover all of the equivalence partitions?

a. 10, 11, 21
b. 3, 20, 21
c. 3, 10, 22
d. 10, 21, 22

Answer is ‘C’

Solution: We have to select values which fall in all the equivalence class (valid and invalid both). The classes will be as follows:
Class I: values <= 9   => invalid class
Class II: 10 to 21       => valid class
Class III: values >= 22 => invalid class
All the values from option ‘c’ fall under all different equivalence clas

6. A program validates a numeric field as follows: values less than 10 are rejected, values between 10 and 21 are accepted, values greater than or equal to 22 are rejected. Which of the following covers the MOST boundary values?

a. 9,10,11,22
b. 9,10,21,22
c. 10,11,21,22
d. 10,11,20,21

Answer is ‘B’

Solution: We have already come up with the classes as shown in question 5. The boundaries can be identified as 9, 10, 21, and 22. These four values are in option ‘b’.

7. In a system designed to work out the tax to be paid:
An employee has £4000 of salary tax free.
The next £1500 is taxed at 10%.
The next £28000 after that is taxed at 22%.
Any further amount is taxed at 40%.

To the nearest whole pound, which of these groups of numbers fall into three DIFFERENT equivalence classes?
a)    £4000; £5000; £5500
b)    £32001; £34000; £36500
c)    £28000; £28001; £32001
d)    £4000; £4200; £5600

Answer is ‘D’

Solution: The classes will be as follows:
Class I   : 0 to £4000          => no tax
Class II  : £4001 to £5500   => 10 % tax
Class III : £5501 to £33500 => 22 % tax
Class IV : £33501 and above => 40 % tax

Select the values which fall in three different equivalence classes. Option‘d’ has values from three different equivalence classes.

8. In a system designed to work out the tax to be paid:
An employee has £4000 of salary tax free.
The next £1500 is taxed at 10%.

The next £28000 after that is taxed at 22%.
Any further amount is taxed at 40%.

To the nearest whole pound, which of these is a valid Boundary Value Analysis test case?
a)    £28000
b)    £33501
c)    £32001
d)    £1500

Answer is ‘B’

Solution: The classes are already divided in question # 7. We have to select a value which is a boundary value (start/end value). 33501 is a boundary value.

9. Given the following specification, which of the following values for age are in the SAME equivalence partition?
If you are less than 18, you are too young to be insured.
Between 18 and 30 inclusive, you will receive a 20% discount.Anyone over 30 is not eligible for a discount.
a)    17, 18, 19
b)    29, 30, 31
c)    18, 29, 30
d)    17, 29, 31

Answer is ‘C’

Solution: The classes will be as follows:
Class I: age < 18       => not insured
Class II: age 18 to 30 => 20 % discount
Class III: age > 30     => no discount
Here we cannot determine if the above classes are valid or invalid, as nothing is mentioned in the question. (But according to our guess we can say I and II are valid and III is invalid. But this is not required here.) We have to select values which are in SAME equivalence partition. Values from option ‘c’ fall in same partition.

10. Which of the following statements is NOT correct?
a)    A minimal test set that achieves 100% LCSAJ coverage will also achieve 100% branch coverage.
b)    A minimal test set that achieves 100% path coverage will also achieve 100% statement coverage.
c)    A minimal test set that achieves 100% path coverage will generally detect more faults than one that achieves 100% statement coverage.
d)    A minimal test set that achieves 100% statement coverage will generally detect more faults than one that achieves 100% branch coverage.

Ans: D

p3

********************************************************************************

11. Analise the following highly simplified procedure:

Ask: “What type of ticket do you require, single or return?”
IF the customer wants ‘return’
Ask: “What rate, Standard or Cheap-day?”
IF the customer replies ‘Cheap-day’
Say: “That will be £11:20″
ELSE
Say: “That will be £19:50″
ENDIF
ELSE
Say: “That will be £9:75″
ENDIF

Now decide the minimum number of tests that are needed to ensure that all the questions have been asked, all combinations have occurred and all
replies given.
a)    3
b)    4
c)    5
d)    6

Ans:A

12. In a system designed to work out the tax to be paid:
An employee has £4000 of salary tax free. The next £1500 is taxed at 10% The next £28000 is taxed at 22% Any further amount is taxed at 40% To the nearest whole pound, which of these is a valid Boundary Value Analysis test case?
a)    £1500
b)    £32001
c)    £33501
d)    £28000

Ans:C

13. Given the following fragment of code, how many tests are
required for 100% decision coverage?

If width > length
thenbiggest_dimension = width
if height > width
thenbiggest_dimension = height
End if
elsebiggest_dimension = length
If height > length
thenbiggest_dimension = height
end if
End if

Ans: 4

14. In a system designed to work out the tax to be paid:
An employee has £4000 of salary tax free. The next £1500 is taxed at 10%
The next £28000 is taxed at 22%
Any further amount is taxed at 40%
Which of these groups of numbers would fall into the same equivalence class?
a) £4800; £14000; £28000
b) £5200; £5500; £28000
c) £28001; £32000; £35000
d) £5800; £28000; £32000

Ans: D

15. Order numbers on a stock control system can range between 10000 and 99999 inclusive. Which of the following inputs might be a result of designing tests for only valid equivalence classes and valid boundaries?
a) 1000, 50000, 99999
b) 9999, 50000, 100000
c) 10000, 50000, 99999
d) 10000, 99999, 100000

Ans: C

16. Given the following code, which statement is true about the minimum number of test cases required for full statement and branch coverage?
Read p
Read q
IF p+q > 100 THEN
Print “Large”
ENDIF
IF p > 50 THEN
Print “p Large”
ENDIF
a) 1 test for statement coverage, 3 for branch coverage
b) 1 test for statement coverage, 2 for branch coverage
c) 1 test for statement coverage, 1 for branch coverage
d) 2 tests for statement coverage, 2 for branch coverage

Ans: B

17. Consider the following statements:
i.100% statement coverage guarantees 100% branch coverage.
ii.100% branch coverage guarantees 100% statement coverage.
iii.100% branch coverage guarantees 100% decision coverage.
iv.100% decision coverage guarantees 100% branch coverage.
v.100% statement coverage guarantees 100% decision coverage.
a) ii is True; i, iii, iv & v are False
b) i & v are True; ii, iii & iv are False
c) ii & iii are True; i, iv & v are False
d) ii, iii & iv are True; i & v are False

Ans: D

18. If the pseudo code below were a programming language, how many tests are required to achieve 100% statement coverage?
If x=3 then
Display_messageX;
If y=2 then
Display_messageY;
Else
Display_messageZ;
Else
Display_messageZ;
a. 1
b. 2
c. 3
d. 4

Ans: C

19. Using the same code example as question 17, how many tests are required to achieve 100% branch/decision coverage?
a. 1
b. 2
c. 3
d. 4

Ans: C

20. A program validates a numeric field as follows:
Values less than 10 are rejected, values between 10 and 21 are accepted, values greater than or equal to 22 are rejected. Which of the following input values cover all of the equivalence partitions?
a. 10, 11, 21
b. 3, 20, 21
c. 3, 10, 22
d. 10, 21, 22

Ans: C

p4

 

********************************************************************************

21. Using the same specifications as question 29, which of the following covers the MOST boundary values?
a. 9,10,11,22
b. 9,10,21,22
c. 10,11,21,22
d. 10,11,20,21

Ans: B

22. An input field takes the year of birth between 1900 and 2004.
The boundary values for testing this field are:

a. 0,1900,2004,2005
b. 1900, 2004
c. 1899,1900,2004,2005
d. 1899, 1900, 1901,2003,2004,2005

Ans: C

23. Given the Following program
IF X < Y
THEN Statement 1;
ELSE IF Y >= Z
THEN Statement 2;
END
Cyclomatic Complexity is :

a. 2
b. 3
c. 4
d. 5

Ans: B

p

 

****************************C.O.M.P.L.E.T.E********************************

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s