All homeworks are due before class on the due date. All homework assignments must reflect your own understanding of the topic and be communicated in your own words. You may use one of the collaborative options. You may also request help and advice from your classmates on Piazza. Any help not allowed by that policy will be an honor violation.
Purpose: To encourage students to start working on the homework assignments early and recognize students who are actively engaged in the content
You will receiveNote: The final submission timestamp shown on Gradescope will be used.
Consider the following BNF grammar
START ::= EXPRESSION
EXPRESSION ::= CONSTANT | VARIABLE | "(if " EXPRESSION EXPRESSION EXPRESSION ")" | DEFINE
CONSTANT ::= BOOLEAN | NUMBER
VARIABLE ::= IDENTIFIER
DEFINE ::= "(def" VARIABLE EXPRESSION ")"
IDENTIFIER ::= LETTER+
LETTER ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" |
"n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"
NUMBER ::= DIGIT+
DIGIT ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
BOOLEAN ::= "true" | "false"
A string is legal if it is in the language defined by the grammar.
A string is illegal if it is not in the language defined by the grammar.
(def a true) legal? Yes or No?Consider the Min method and six mutants (Figure 9.1 from textbook)
Bomb() throws an immediate runtime exception as soon as it is reached. failOnZero(B) throws an immediate runtime exception if B equals to 0. Otherwise, it returns B.
Consider the following Java method with the mutated statement:
Line 1: private static String HiBye(char c1, char c2, int n1, int n2)
Line 2: {
Line 3: int x = 15;
Line 4: if (c1 == ‘y’)
Line 5: {
Line 6: if (c2 == ‘z’)
Line 7 // x = n1 * 2; // original
Line 7’: x = n1 + 2; // AOR mutant
Line 8: else
Line 9: x = n2 * 4;
Line 10: }
Line 11: if (x >= 20)
Line 12: return ("Hello");
Line 13:
Line 14: return ("Good bye");
Line 15: }
AOR, Arithmetic Operator Replacement, replaces each occurrence
of +, -, *, /, **, and % by each of the other operators.
For this question, you only need to consider the given AOR mutant (line 7).
A test case is a call to HiBye() with parameter values,
for example, HiBye('a', 'b', 1, 1);
HiBye( ________________, ________________, ________________, ________________ ) Expected output (original): ___________________________ Expected output (mutant): _____________________________ If a test cannot be created, explain why.
HiBye( ________________, ________________, ________________, ________________ ) Expected output (original): ___________________________ Expected output (mutant): _____________________________ If a test cannot be created, explain why.
[Total: 20 points] Complete the tasks. Provide correct and clear solutions. Properly document your solutions.
( -5 points) for 24 hours late (submitted after 21-November 11am EST, by 22-November 11am EST)
(-10 points) for 48 hours late (submitted after 22-November 11am EST, by 23-November 11am EST)
(-2 points) for submitting a Word document or handwriting, or a write-up that is not a typed PDF file.
Save your write-up as a PDF file (only typed PDF is accepted) — No handwriting. No hand-drawing. No Word document.
Each team submits only one copy.
Upload your report as a PDF to Assignment 6 on Gradescope. Make sure you connect your partner to your group on Gradescope so that everyone receives credit.
Making your submission available to instructor and course staff is your responsibility; if we cannot access or open your file, you will not get credit. Be sure to test access to your file before the due date.
CC-BY-NC-SA 4.0 license.