Fall 2025 — Assignment 1

Due 15-September-2025, 11am EST (before class)
Purpose:

All homework assignments 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 as long as the help/advice follows the course's collaborative policy. 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. No extension/exception on the early submission bonus points.


[Total: 20 points]

[Reminder: Two mandatory components of each test case: input value(s) and expected output — point(s) will always be deducted if any of these is missing]

  1. (10 points) Consider the following faulty program. The test input that results in a failure is given.
    /**
     * Find last index of element
     *
     * @param x array to search
     * @param y value to look for
     * @return last index of y in x; -1 if absent
     * @throws NullPointerException if x is null
     */
    line  1  public static int findLast(int[] x, int y)  
    line  2  { 
    line  3     if (x == null)  
    line  4        throw new NullPointerException();
    line  5     for (int i=x.length-1; i>0; i--) 
    line  6     {
    line  7        if (x[i] == y) 
    line  8           return i; 
    line  9     }
    line 10     return -1; 
    line 11   }
    // test: x = [2, 3, 5]; y = 2; 
    // expected = 0 
    Answer the following questions.

    Hint: What is the fault?

    1. (2 points) If possible, give a test case that does not execute the fault. If not, briefly explain why not.
    2. (2 points) If possible, give a test case that executes the fault, but does not result in an error state. If not, briefly explain why not.
    3. (2 points) If possible, give a test case that results in an error, but not a failure. If not, briefly explain why not.
    4. (2 points) If possible, give a test case that results in a failure. If not, briefly explain why not. Note: for credit, your test case must not be the same as the given test case.
    5. (2 points) For the given test case
      // test input: x = [2, 3, 5]; y = 2; 
      // expected = 0
      Describe the first error state. Be sure to describe the complete state. Note: Use the format introduced in class; refer to the slides and the Fault, Error, Failure activity.
  2. (8 points) Consider the following faulty program.
    /**
     * Raises left to the power of right 
     * precondition: right >= 0
     * postcondition: return left**right
     */
    line  1:  public static int power(int left, int right)  
    line  2:  { 
    line  3:     int rslt = 0;  
    line  4:     rslt = left;
    line  5:      
    line  6:     if (right < 0)
    line  7:        throw new IllegalArgumentException();        
    line  8: 
    line  9:     if (right == 0) 
    line 10:        rslt = 1;
    line 11:     else
    line 12:     {
    line 13:        for (int i=2; i<=right; i++)
    line 14:         // rslt = rslt * left;        // correct version
    line 14:            rslt = rslt + left;        // fault
    line 15:     }
    line 16:     return rslt;
    line 17:  }
    
    Reminder: Setting up an input value that causes a compilation error is not useful and 
    thus no credit will be awarded.
    Answer the following questions.
    1. (2 points) If possible, give a test case that does not execute the fault. If not, briefly explain why not.
    2. (2 points) If possible, give a test case that executes the fault, but does not result in an error state. If not, briefly explain why not. If not, briefly explain why not.
    3. (2 points) If possible, give a test case that results in an error, but not a failure. If not, briefly explain why not.
    4. (2 points) If possible, give a test case that results in a failure. If not, briefly explain why not.
  3. (2 points): Answer one of the following questions, depending on your background. Be sure to justify your answer. Why do you think that way?

    Question 1: If you do, or have, worked for a software development company, how much effort did your testing or QA team put into each of the four test activities (test design, automation, execution, evaluation)

    Question 2: If you have never worked for a software development company, which of the four test activities do you think you are best qualified for? (test design, automation, execution, evaluation)

    We are looking for a paragraph or two here. This is an introspective exercise without a "correct" answer; it is mainly to get you to think. You will receive credit if you turn in something reasonable.

    Refer to MDTD for the four test activities


What to submit:

  1. Your report, saved as a PDF file
  2. If you collaborated, in your report, include a brief collaboration summary: names of all collaborators (refer to the collaborative options) and a summary of what each contributed.

(  -5 points) for 24 hours late (submitted after 15-September 11am EST, by 16-September 11am EST)
(-10 points) for 48 hours late (submitted after 16-September 11am EST, by 17-September 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 assignment as a PDF file. — No handwriting.  No hand-drawing.  No Word document.

Log in to Canvas, then upload your report as a PDF to Assignment1 on Gradescope. Make sure you connect your partner to your group on Gradescope so that everyone receives credit.

Each team submits only one copy.

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-08-31 17:41
  Top