Web programming basics: HTML, DHTML, XML, scripting, Java, servlets and applets. - Question Bank

1. What is the main purpose of XML namespaces?
A) To define the visual presentation of XML elements.
B) To provide a method for qualifying element and attribute names in an XML document, preventing naming conflicts.
C) To specify the scripting language used within an XML document.
D) To create hyperlinks between XML documents.
2. Which attribute is used to define a unique ID for an HTML element?
A) class
B) style
C) id
D) name
3. What is the process of converting HTML, CSS, and JavaScript code into visual representations on a web page called?
A) Server-side rendering
B) Client-side rendering
C) Database querying
D) Network protocol negotiation
4. In XML, what is a root element?
A) Any element in the document.
B) The first element in the document that contains all other elements.
C) An element that contains other elements.
D) An element that has no content.
5. Which HTML tag is used to create a form?
A) <input>
B) <form>
C) <button>
D) <action>
6. What is a common characteristic of Java Applets that limits their modern usage?
A) They are exclusively server-side technologies.
B) They require a specific plugin (like Java Plugin) that is often disabled or unsupported by modern browsers.
C) They are incompatible with JavaScript.
D) They can only display text content.
7. Which attribute is used to specify the character encoding for an HTML document?
A) <meta charset='UTF-8'>
B) <encoding='UTF-8'>
C) <charset='UTF-8'>
D) <meta name='charset' content='UTF-8'>
8. What is the purpose of the `title` tag in HTML?
A) To define the main content of the page.
B) To specify the URL of an image.
C) To set the title that appears in the browser tab or window.
D) To create a hyperlink.
9. Which of the following is a benefit of using Servlets over traditional CGI scripts?
A) Servlets are platform-dependent.
B) Servlets are more efficient as they run within the server process and avoid process creation overhead.
C) Servlets are primarily used for client-side rendering.
D) Servlets do not support Java's object-oriented features.
10. What is the purpose of a Servlet Container?
A) To provide a secure environment for running Applets.
B) To manage the lifecycle and execution of Servlets and JSPs.
C) To render XML documents in a browser.
D) To handle client-side JavaScript execution.
11. Which HTML tag is used to create a line break?
A) <break>
B) <lb>
C) <br>
D) <newline>
12. What is the primary role of CSS (Cascading Style Sheets) in DHTML?
A) To define the structure and content of the page.
B) To add interactivity and dynamic behavior.
C) To control the presentation and layout of HTML elements.
D) To handle server-side logic.
13. In Java Servlets, what is the `HttpServletResponse` object used for?
A) To receive data from the client's request.
B) To send data back to the client as a response.
C) To manage the client's session.
D) To log server-side errors.
14. What is the purpose of the `id` attribute in HTML?
A) To group multiple elements with similar styling.
B) To assign a unique identifier to an element for scripting or styling.
C) To define the main heading of a section.
D) To link to an external resource.
15. Which of the following is a key advantage of using XML for data?
A) It is inherently designed for presentation.
B) It is a proprietary format only usable with specific software.
C) It is platform-independent and human-readable.
D) It automatically enforces data validation without schemas.
16. What is the role of a Web Server in the context of Servlets?
A) To execute the Servlet code on the client's machine.
B) To manage the client's browser interface.
C) To host and run the Servlet container, which manages Servlets.
D) To display static HTML content only.
17. Which HTML tag is used to create an ordered list?
A) <ul>
B) <ol>
C) <li>
D) <list>
18. What does DHTML typically involve combining?
A) HTML, CSS, and JavaScript
B) HTML, Java, and XML
C) XML, Servlets, and Applets
D) JavaScript, Python, and CSS
19. What is the main difference between `GET` and `POST` methods in HTTP requests, often handled by Servlets?
A) `GET` sends data in the URL, `POST` sends data in the request body.
B) `POST` is faster than `GET`.
C) `GET` is used for sensitive data, `POST` for non-sensitive.
D) `POST` can only send text, `GET` can send files.
20. Which attribute specifies the target window for a hyperlink?
A) href
B) src
C) target
D) link
21. What is the purpose of the `<a>` tag in HTML?
A) To create an image
B) To create a paragraph
C) To create a hyperlink
D) To define a section of the document
22. What is a common use case for Java Servlets?
A) Creating interactive games within a browser
B) Processing form submissions and interacting with databases
C) Designing user interfaces for desktop applications
D) Performing client-side data validation
23. Which HTML tag is used to create a paragraph?
A) <para>
B) <p>
C) <paragraph>
D) <text>
24. What is the primary function of JavaScript in DHTML?
A) To define the structure of the page
B) To style the elements of the page
C) To manipulate the Document Object Model (DOM) for dynamic changes
D) To manage server-side data
25. In XML, what defines the structure and content rules for an XML document?
A) HTML Schema
B) CSS Stylesheet
C) Document Type Definition (DTD) or XML Schema (XSD)
D) JavaScript Object Notation (JSON)
26. What does `alt` attribute in an `<img>` tag represent?
A) Alternative text for the image, displayed if the image cannot be loaded
B) Alignment of the image on the page
C) The source file of the image
D) An animation effect for the image
27. Which of the following is a scripting language used for dynamic content generation on the server-side, often alongside Java Servlets?
A) JavaScript
B) VBScript
C) PHP
D) Perl
28. What is the purpose of the `<head>` section in an HTML document?
A) To contain the main content of the web page
B) To define links to external resources and meta-information
C) To create navigation menus
D) To display images and videos
29. Which HTML element is used to create a table?
A) <tr>
B) <td>
C) <table>
D) <th>
30. What is the primary characteristic of a Java Applet that distinguishes it from a Servlet?
A) Applets run on the server, Servlets run on the client.
B) Applets run on the client's browser, Servlets run on the server.
C) Applets are used for database operations, Servlets for UI.
D) Applets require a JVM, Servlets do not.
31. Which method is typically used by Servlets to handle incoming HTTP requests?
A) doGet()
B) handleRequest()
C) processRequest()
D) service()
32. What is the main advantage of using XML over HTML for data representation?
A) XML is faster to render in browsers.
B) XML allows for custom tags, enabling semantic meaning.
C) XML is simpler to write than HTML.
D) XML does not require a browser for interpretation.
33. Which attribute is used to define an inline style in HTML?
A) class
B) id
C) style
D) font
34. What is the purpose of the `DOCTYPE` declaration in an HTML document?
A) To define the document's title
B) To specify the character encoding
C) To inform the browser about the HTML version being used
D) To link to external stylesheets
35. Which of the following is NOT a valid HTML tag?
A) <p>
B) <div>
C) <center>
D) <br>
36. What is the role of a Servlet?
A) To render client-side interfaces
B) To process requests and generate responses on the server
C) To manage client-side cookies
D) To perform client-side validation
37. Which Java technology is used to create dynamic web pages on the server-side?
A) Applets
B) Servlets
C) Swing
D) AWT
38. What is a Java Applet?
A) A standalone Java application
B) A small Java program embedded within a web page
C) A server-side Java component
D) A database connectivity tool
39. Which tag is used to create an unordered list in HTML?
A) <ol>
B) <ul>
C) <li>
D) <list>
40. What is the fundamental difference between HTML and XML?
A) HTML is for display, XML is for data storage and transport.
B) HTML is case-sensitive, XML is not.
C) XML is always rendered by browsers, HTML is not.
D) HTML can contain scripts, XML cannot.
41. Which attribute is used to specify the URL of an image in the `<img>` tag?
A) href
B) src
C) link
D) url
42. What is the purpose of the `<img>` tag in HTML?
A) To create a paragraph
B) To insert an image
C) To create a link
D) To define a table
43. Which scripting language is most commonly used for client-side web development?
A) Python
B) Java
C) JavaScript
D) Ruby
44. What is a script in web programming?
A) A type of web browser
B) A server-side program
C) A set of commands executed by the web browser or server
D) A database query language
45. Which tag is used to define the main heading in an HTML document?
A) <h1>
B) <heading>
C) <head1>
D) <title>
46. What does XML stand for?
A) Extensible Markup Language
B) Extra Markup Language
C) Electronic Markup Language
D) Express Markup Language
47. Which of the following is a markup language used for structuring and displaying content on the World Wide Web?
A) JavaScript
B) Python
C) HTML
D) CSS
48. What is the primary purpose of DHTML?
A) To create static web pages
B) To add dynamic and interactive elements to web pages
C) To manage databases for web applications
D) To secure web communications
49. Which tag is used to create a hyperlink in HTML?
A) <link>
B) <a>
C) <href>
D) <hyperlink>
50. What does HTML stand for?
A) Hyper Transfer Markup Language
B) HyperText Markup Language
C) High Transfer Markup Language
D) HighText Markup Language