NPTEL Software Testing Week 8 Assignment Answers 2024
1. Which of the following is a correct regular expression for the language of all binary words (over the alphabet {0, 1}) that begin with a 0 and end with a 1?
- 0+(0+1)∗+1
- 0⋅(0⋅1)∗⋅1
- 0⋅(0+1)∗⋅1
- (0⋅(0+1)∗⋅1)∗
Answer :- For Answers Click Here
2. Suppose a programming language has identifier names from the lower case English alphabet that can be exactly of length three. Which of the following is a regular expression that corresponds to these identifier names?
- (a+b+c+…+z)⋅(a+b+c+…+z)⋅(a+b+c+…+z)
- (a⋅b⋅c⋅…⋅z)+(a⋅b⋅c⋅…⋅z)+(a⋅b⋅c⋅…⋅z)
- (a+b+c+…+z)∗
- (a+b+c+…+z)⋅(a+b+c+…+z)⋅(a+b+c+…+z)∗
Answer :- For Answers Click Here
3. Which are the three levels in which the syntax of a programming language is typically given?
- Characters, tokens, words and phrases.
- Words, phrases and context that specifies types, variable references etc.
- Regular expressions and context-free languages.
- Regular expressions and context-free grammars.
Answer :- For Answers Click Here
4. State true or false: If a mutant is strongly killed, it is also weakly killed.
- True.
- False.
Answer :-
5. If an expression of the form if (a <= b) is replaced with if (true), then it is an application of which of the mutation operators below?
- Boolean constant replacement.
- Logical operator replacement.
- Relational operator replacement.
- True operator replacement.
Answer :-
For the next five questions, consider the code snippet below and the mutation given in line 4. Answer the following with reference to mutation testing of the code snippet below.
1 public static int findVal(int array_num[], int Val)
2 {
3 int findVal = -1;
4 for (i=0; i < array_num.length; i++)
4 for (i=1; i < array_num.length; i++)
5 if (array_num[i] == Val)
6 findVal = i;
7. return (findVal);
8. }
6. Identify the mutation operator that is applied at statement 4 in the above code snippet.
- Arithmetic operator replacement.
- Loop initialization replacement.
- Scalar variable replacement.
- Constant value replacement.
Answer :- For Answers Click Here
7. Can the mutant be reached if the input array is empty?
- Yes.
- No.
Answer :-
8. State Yes or No: Is it possible that infection of the mutation occurs when the input array is the empty array?
- Yes.
- No.
Answer :-
9. Which of the following test cases ensures that the mutated statement is infected but propagation does not occur?
- A test case with the value not in the array will ensure that infection occurs and propagation does not occur.
- A test case in which the last occurrence of the value is not in array num[0] will ensure infection and not propagation.
- A test case in which the element occurs exactly once in the array will ensure that infection occurs and propagation does not occur.
- A test case in which the last occurrence of the value is anywhere except in the first position will ensure that infection occurs and propagation does not occur.
Answer :-
10. Which of the following test cases will strongly kill the mutant?
- A test case in which the value is not in the array will strongly kill the mutant.
- A test case in which the value occurs exactly once at any position in the array will strongly kill the mutant.
- A test case in which the value is in the first position of the array will strongly kill the mutant.
- A test case in which the value is not in the first position of the array will strongly kill the mutant.
Answer :- For Answers Click Here