Fall 2025 — Assignment 6

Due 21-November-2025, 11am EST (before class)

Purpose:

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.


Early-submission bonus points

Purpose: To encourage students to start working on the homework assignments early and recognize students who are actively engaged in the content

You will receive

Note: The final submission timestamp shown on Gradescope will be used.


  1. [3 points]  Syntax-based testing (Grammar)

    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.

    1. (1 pt.) Is (def a true) legal? Yes or No?
    2. (2 pts.) Justify your answer (question 1.1) by showing a derivation in the grammar.

  2. [9 points]  Syntax-based testing (Program)

    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.
    1. (3 pts.) Provide reachability conditions, infection conditions, and propagation conditions to kill mutant 2
      • Specify the conditions. No test case input value(s) or expected output(s) needed.
    2. (3 pts.) Provide reachability conditions, infection conditions, and propagation conditions to kill mutant 5
      • Specify the conditions. No test case input value(s) or expected output(s) needed.
    3. (3 pts.) Provide reachability conditions, infection conditions, and propagation conditions to kill mutant 6
      • Specify the conditions. No test case input value(s) or expected output(s) needed.

  3. [8 points]  Syntax-based testing (Program)

    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);  
    1. (4 pts.) Give a test case that weakly kills the mutant but does NOT strongly kill it (i.e., causes infection but not propagation)
      HiBye( ________________, ________________, ________________, ________________ )
      
      Expected output (original): ___________________________
      
      Expected output (mutant): _____________________________
      
      If a test cannot be created, explain why. 

    2. (4 pts.) Give a test case that strongly kills the mutant (i.e., causes propagation)
      HiBye( ________________, ________________, ________________, ________________ )
      
      Expected output (original): ___________________________
      
      Expected output (mutant): _____________________________
      
      If a test cannot be created, explain why. 


Grading Rubric

[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.


Submission

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.


Copyright © 2025 Upsorn Praphamontripong
Released under the Creative Commons License CC-BY-NC-SA 4.0 license.
Last updated 2025-11-11 10:17
  Top