1. A)
* ID – Test Case 001
Input values
Array (a) = [8]
Expected Output
Max = a [0] = 8
* ID – Test Case 002
Input values
Array (a) = [] (array a is empty)
Expected Output
Max = a [0] = null
* ID – Test Case 003
Input values
Array (a) = [1,3,5,7,9]
Expected Output
Max = a [4] = 9
* ID – Test Case 004
Input values
Array (a) = [9,7,5,3]
Expected Output
Max = a [0] = 9
* ID – Test Case 005
Input values
Array (a) = [5,6,1]
Expected Output
Max = a [1] = 6
* ID – Test Case 006
Input values
Array (a) = [1,3,8,6]
Expected Output
Max = a [2] = 8
B)
* ID – Test Case 007
Input values
Array (a) = [2]
Expected Output
...view middle of the document...
As the algorithm moves on to check the other indexes and compares it. If the max value is more then the value in the index, the algorithm moves on to the next index and compares it s described. Then it returns the max value.
Input values
Array (a) = [1,3,5,8]
Expected Output
Max = a [3] = 8
* ID – Test Case 010
Input values
Array (a) = [4,3,2]
Expected Output
Max = a [0] = 4
* ID – Test Case 011
Input values
Array (a) = [2,8,1]
Expected Output
Max = a [1] = 8
* ID – Test Case 012
Input values
Array (a) = [1,3,5,9]
Expected Output
Max = a [3] = 9
* ID – Test Case 013
Input values
Array (a) = [4,3,2,1]
Expected Output
Max = a [0] = 4
* ID – Test Case 014
Input values
Array (a) = [1,2,5,4,5]
Expected Output
Max = a[4] = 5
2) A) compound (multiple) condition adequacy: Cover all possible combinations of compound conditions and cover all branches of a selection statement.
Test Case | n < max_size | & (c = getc(yyin)) != EOF | c != ‘\n’ | Outcome |
1 | T | T | T | T |
2 | T | F | T | F |
3 | T | T | F | F |
4 | F | F | F | F |
5 | F | T | T | F |
B)
Test Case | n < max_size | (c = getc(yyin)) != EOF | c != ‘\n’ | Outcome |
1 | T | T | T | T |
2 | T | F | T | F |
3 | F | T | T | F |
4 | T | T | F | F |
5 | F | F | T | F |
6 | T | F | F | F |
7 | F | T | F | F |
3)
Test Case | Room | Open | Close | Bar | Outcome |
1 | T | T | T | T | T |
2 | T | F | T | T | T |
3 | T | T | F | T | T |
4 | F | T | T | T | T |
5 | T | F | F | F | F |
6 | T | F | F | T | T |
7 | T | T | F | F | T |
8 | F | T | T | F | F |
9 | F | F | F | F | F |