Important Web Design and Development Short Questions
Chapter: 6
Question 1:
What are the attributes of the PersonInfo class in the Address Book example?
Answer:
The attributes are name, address, and phoneNum.
Chapter: 6
Question 2:
What data structure is used in the AddressBook class to store person records?
Answer:
The ArrayList data structure is used to store person records.
Chapter: 6
Question 3:
What method is used in the AddressBook class to add a new person record?
Answer:
The addPerson() method is used to add a new person record.
Chapter: 6
Question 4:
How does the searchPerson(String n) method work in the AddressBook class?
Answer:
It iterates over the ArrayList and compares each person's name to the given name to find the matching record.
Chapter: 6
Question 5:
What is the purpose of the deletePerson(String n) method in the AddressBook class?
Answer:
It deletes a person record by name from the ArrayList.
Chapter: 6
Question 6:
How is the user input handled in the AddressBook example?
Answer:
User input is handled using JOptionPane for GUI-based input and output.
Chapter: 7
Question 7:
What are the three types of errors that can occur in software development?
Answer:
The three types of errors are Syntax Errors, Logic Errors, and Runtime Errors. Syntax errors arise from not following language rules, logic errors occur when the code doesn't produce the expected output, and runtime errors occur when the program tries to perform an impossible operation.
Chapter: 7
Question 8:
What is an exception in programming?
Answer:
An exception is an event that signals an erroneous situation at runtime. It is wrapped as an object and can be handled in the program by ignoring it, handling it where it occurs, or in another place in the program.
Chapter: 7
Question 9:
Why is it important to handle exceptions in a program?
Answer:
Handling exceptions is important to separate error handling code from the main logic. It helps to manage different types of exceptions and prevent the program from terminating unexpectedly.
Chapter: 7
Question 10:
How are exceptions represented in Java?
Answer:
In Java, exceptions are represented as objects created when an abnormal situation arises in the program. All exceptions in Java are inherited from the Throwable class.