Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

\"Software testing\" related problem: Answer the following questions for the met

ID: 3848713 • Letter: #

Question

"Software testing" related problem:

Answer the following questions for the method search() below: public static int search (List list, Object element) //Effects: if list or element is null throw NullPointerException //else if element is in the list, return an index //of element in the list: else return -1 //for example, search ([3, 3, 1], 3) = either 0 or 1//search ([1, 7, 5], 2) = - 1 Base your answer on the following characteristic partitioning: Characteristic: Location of element in list Block 1: element is first entry in list Block 2: element is last entry in list Block 3: element is in some position other than first or last (a) "Location of element in list" fails the disjointness property. Give an example that illustrates this. (b) "Location of element in list" fails the completeness property. Give an example that illustrates this. (c) Supply one or more new partitions that capture the intent of "Location of e in list" but do not suffer from completeness or disjointness problems.

Explanation / Answer

a.) "location of element in the list" fails the disjointness property:

yes it fails the disjointness property.

disjointess property states that no element of domain is in more than one block.

ex:let us consider a list with only 1 element:

list-->[4] so block1=first entry in list = 4

block2:last entry in list=4

so since 4 is in 2 blocks therefore it does not satisfy disjointness property.

b.)"location of elements in the list" fails the completeness property:

yes,it fails the completeness property.

completeness property states that together all the blocks are complete,i.e they do not miss any element in domain.

exmaple is if our list is null then neither block 1 will have any element and neither block 2 or 3, so it fails the completeness property.

we have to make sure that even null is included in some partition.

c.)below partion will not suffer from completeness or disjointness problems:

block 1: null list

block2:first element in list

block 3: all the element in list other than 1st if list contain more than 1 element else null