Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Chapter: 33
Q501:
What does the data layer in the Address Book case study interact with?
A. User interface
B. Business logic
C. Database
D. Presentation layer
Correct Answer:
C
Chapter: 33
Q502:
What is the purpose of the PersonDAO class in the Address Book case study?
A. To display data
B. To interact with the database
C. To manage user sessions
D. To handle HTTP requests
Correct Answer:
B
Chapter: 33
Q503:
Which layer is responsible for handling transactions in the Address Book case study?
A. Presentation Layer
B. Data Layer
C. Business Layer
D. Network Layer
Correct Answer:
C
Chapter: 33
Q504:
What method in the PersonDAO class retrieves a person's information?
A. searchPerson
B. updatePerson
C. deletePerson
D. insertPerson
Correct Answer:
A
Chapter: 33
Q505:
What does the SearchPersonServlet do?
A. Displays a form for user input
B. Retrieves data from the database
C. Updates user information
D. Deletes user records
Correct Answer:
A
Chapter: 33
Q506:
What Java class is used to represent a person in the Address Book case study?
A. PersonDAO
B. PersonInfo
C. SearchPersonServlet
D. ShowPersonServlet
Correct Answer:
B
Chapter: 33
Q507:
In Java, what is the purpose of a package?
A. To organize classes into directories
B. To increase execution speed
C. To manage database connections
D. To handle user input
Correct Answer:
A
Chapter: 33
Q508:
How is a package created in Java?
A. By using the 'import' keyword
B. By specifying the 'package' keyword in the source file
C. By compiling the code
D. By setting the CLASSPATH variable
Correct Answer:
B
Chapter: 33
Q509:
Which package is used to avoid class name collision in Java?
A. java.util
B. world
C. com.mycompany
D. All of the above
Correct Answer:
D
Chapter: 33
Q510:
What is the main advantage of JSP over servlets?
A. JSPs offer better language for dynamic content
B. JSPs are slower than servlets
C. JSPs do not support HTML
D. JSPs cannot be used with Java code
Correct Answer:
A
Chapter: 33
Q511:
What is the role of the toString() method in the PersonInfo class?
A. To create a new PersonInfo object
B. To retrieve data from the database
C. To display person information in a readable format
D. To update person information
Correct Answer:
C
Chapter: 33
Q512:
What keyword is used to import all classes from a package in Java?
A. include
B. require
C. import
D. use
Correct Answer:
C
Chapter: 34
Q513:
Which method in the ShowPersonServlet is used to display search results?
A. doGet
B. doPost
C. processRequest
D. searchPerson
Correct Answer:
C
Chapter: 34
Q514:
What does the JSP technology primarily help with?
A. Generating HTML
B. Managing database connections
C. Handling user sessions
D. Performing arithmetic operations
Correct Answer:
A
Chapter: 34
Q515:
What should you do to use a Java class from a different package?
A. Add the class to the same directory
B. Use the 'import' keyword
C. Compile the class again
D. None of the above
Correct Answer:
B
Chapter: 34
Q516:
What is the main purpose of JSP?
A. To display static content
B. To handle HTTP requests
C. To generate dynamic content
D. To compile Java code
Correct Answer:
C
Chapter: 34
Q517:
Which of the following is a benefit of using JSP?
A. Requires learning new languages
B. Slow execution time
C. Extensive infrastructure for web applications
D. Limited portability
Correct Answer:
C
Chapter: 34
Q518:
What is the first phase a JSP undergoes?
A. Compilation
B. Execution
C. Parsing
D. Request Handling
Correct Answer:
C
Chapter: 34
Q519:
What is the equivalent of a JSP page after it is processed?
A. HTML page
B. Servlet code
C. Java code
D. XML document
Correct Answer:
B
Chapter: 34
Q520:
What tag is used for JSP comments that are not visible in the browser?
A. <!-- comment -->
B. <%-- comment --%>
C. jsp:comment
D. <%= comment %>
Correct Answer:
B