A2-Debugging_Questions_Answers[1]

docx

School

Centennial College *

*We aren’t endorsed by this school

Course

202

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

5

Uploaded by DoctorMosquitoPerson619

Report
COMP311 Assignment 2 - Debugging Questions for Debugging Assignment Student Name: Ashutosh Kansal Student ID: 3012 Student Name: Rahul Garg Student ID: 301241213 Instructions Work in teams of at most two. Do the class work. Discuss and answer the following questions together. Marks This assignment is marked out of 10. Team The team (group) can be created of at most two students. Only one is required to post the answers using the associated A2_Debugging_Questions_Answers.docx document as a template. Questions 1. What class is the driver for this slice of the application? (0.5) Ans. Manifest. 2. What major part of the application is replaced by a stub ? Name the class(es) that make up this stub. (0.5) Ans. The major part of the application replaced by a stub is the user interface. The class that make up this stub is User Prompter. 3. List three defects that you located in the original code, and describe then as you would in a tester’s defect report. Describe where user is in using the system and what the user input . Then state how the system response deviated from expected output. (6). a. Where: The bug exists in UserPrompter.java file. The logic of the function “getYesNoAnswer ”starting line 35 is not coded correctly. The user encounters the bug when the program asks the question “Do you want to purchase a ticket?”.
User input: The user input ’n’ or any string starting other than ‘y’ System response: If the user input “No” or anything else not starting with “y”. The programs prompts the question 3 times. The system does not properly handle the user's input. When the user answers ”no" or any string starting other than ‘y’, the program does not stop as expected whereas it repeats the question 3 times. This results in incorrect program behaviour where the user's choice to purchase a ticket is not effectively carried out. b. Where: The second bug exists in StaffPassenger.java file. The logic of the function “discountPrice” starting line 15 is not coded correctly. The user encounters the bug when the program asks the question “Do you want to purchase a ticket?”.
User input: The user being an airline employee entered all the details to buy an business class seat as seem in the below screenshot System response: As seen in the above screenshot, the system applies discount for the airline employee even he is buying a business class ticket whereas in the business requirements it is mentioned that business class ticket has no discount even if someone is an airline employee. c. Where: : The third bug is encountered in the Manifest.java file. When the system prints the list of seats and their occupancy status. Even if some seats are bought, all the seats are shown available. User input: System response: 4. Briefly define the term Step in, Step out, Step over and Breakpoint : (2) Ans. Step In: When debugging, "Step In" allows you to move to the next line of code, and if the current line contains a method or function call, it will enter that method and continue debugging within it.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Step Out: "Step Out" is used when you are already inside a method or function during debugging. It allows you to execute the remaining code within the current method and then return to the caller method. Step Over: "Step Over" is used to execute the current line of code during debugging without entering any methods or functions that might be called on that line. It's useful for quickly advancing through the code. Breakpoint: A breakpoint is a marker that you can set in your code while debugging. When the debugger reaches a breakpoint during execution, it pauses the program's execution, allowing you to inspect variables, step through code, and analyze the program's state at that point. a. Give the Screenshots for the import of jar file into the java IDE , Debug mode and fix of no error. (1) Ans. Page 1 of 2 COMP311 Assignment 2 - Debugging Glossary: Driver => https://glossary.istqb.org/en/search/drive r Stub => https://glossary.istqb.org/en/search/stu b
Page 2 of 2