0% found this document useful (0 votes)
10 views16 pages

wp2marks

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 16

2 MARK ANSWERS

1. HTTP vs HTTPS:

2. Static vs Dynamic Web Pages:

3. HTML Frames:
HTML frames divide a webpage into multiple sections, each capable of
loading a separate HTML document.They allow independent updates to
sections .Frames are now considered outdated due to better layout
practices like CSS grids and flexbox.
4. Internet vs World Wide Web:
2 MARK ANSWERS

5. URL Components:
A URL (Uniform Resource Locator) is a web address identifying a
resource on the web.
Its components include a scheme (e.g., https), domain, path, optional port,
query string, and fragment identifier.
It specifies the protocol, location, and details for accessing the resource.
6. Role of TCP/IP:
TCP/IP (Transmission Control Protocol/Internet Protocol) is the
foundation of Internet communication.
TCP ensures reliable data transmission by handling data segmentation
and reassembly.
IP handles addressing and routing, ensuring data packets reach their
destination.
7. Default HTTP Port:
The default port number for HTTP communication is 80.
This port is used by web browsers and servers for standard, unsecured
data exchange.
It can be changed if necessary, though it’s rarely done in typical use
cases.
8. Purpose of <form>Tag:
The <form> tag in HTML is used to collect and submit user data to a
server.
It contains input elements like text fields, checkboxes, and buttons.
Forms are essential for interactive applications like registration, search,
and feedback.
9. Semantic Elements in HTML:
Semantic elements like <header>, <footer>, <article>, and <section>
were introduced in HTML5.
They provide meaning to web content, improving accessibility and SEO.
2 MARK ANSWERS
These elements replaced generic tags like <div> for better structural
clarity.
10.Tag for Images:
The <img> tag is used to insert images into HTML documents.
It requires the src attribute for the image file URL and alt for descriptive
text.
Optional attributes like width and height allow resizing within the layout.

Answers

1. Cascading Style Sheet Categories:


CSS has three main categories:

 Inline CSS
 Internal CSS
 External CSS

2. Features of CSS:

 Separation of content and design


 Reusable styles
 Customizable Designs
 Styling capabilities
 Support for Animations and Interactivity
 Cross-Browser Compatibility

3. JavaScript Features and Applications:

Features:
* Lightweight and Interpreted
* Platform Independence
* Dynamic Typing
* Object-Oriented and Functional
Applications:
* Data Visualization
* Mobile Application Development
* Desktop Application Development
* Game Development
2 MARK ANSWERS
4. Three Ways to Apply CSS:

 Inline CSS: Written directly in the style attribute of HTML elements.


 Internal CSS: Written within the <style> tag in the HTML document's
<head>.
 External CSS: Written in a separate .css file and linked via <link> tag.

5. CSS Box Model:

6. Pseudo-classes in CSS:
Pseudo-classes define the special states of elements, like :hover or :nth-
child.
For example, a:hover { color: blue; } changes a link’s color when
hovered over.
They enhance interactivity without JavaScript.
7. Client-side vs Server-side Scripting:

 Client-side scripting runs in the user's browser (e.g., JavaScript),


providing immediate interactivity.
 Server-side scripting runs on the server (e.g., PHP, Node.js), handling
databases and backend logic.
 Client-side scripts are faster but less secure compared to server-side
scripts.
2 MARK ANSWERS
8. Difference Between let and var in JavaScript:

9. Use of typeof Operator in JavaScript:


The typeof operator determines the data type of a variable or value.
For example, typeof 42 returns "number", and typeof "Hello" returns
"string".
It’s useful for debugging and type checking.

10.JavaScript for Form Input Verification:


JavaScript can validate form inputs by checking values before
submission.
For example, using if (input.value === "") alert("Field cannot be
empty!");.
It improves user experience by providing instant feedback.

UNIT 3

1. Categories of JavaScript Objects


JavaScript objects can be broadly categorized into two types:
 Built-in Objects: These are provided by JavaScript itself, such as Array,
Object, Date, Math, and String.
2 MARK ANSWERS
 User-defined Objects: These are custom objects created by developers
using constructors or object literals.

2. Display Various Elements in JSP


In JSP, elements can be broadly classified as:
o Directives: Controls overall structure (e.g., page, include, taglib).
o Scriptlets: Java code within <% ... %>.
o Expressions: Shorter code evaluations within <%= ... %>.
o Declarations: Variables or methods defined in <%! ... %>.
o Actions: Tags for tasks like jsp:include, jsp:forward.

3. Purpose of the Document Object Model (DOM)


The DOM is a programming interface for web documents. It represents the
structure of a document as a tree of objects and allows scripts to:
 Access and manipulate the structure, content, and styling of web pages
dynamically.
 React to user interactions by handling events.
 Enable dynamic updates to the content without reloading the page (e.g.,
through JavaScript).

4. Intrinsic Event Handling in the DOM


Intrinsic event handling refers to directly specifying event handlers within
HTML elements using attributes. For example:
<button onclick="alert('Button clicked!')">Click Me</button>
 Here, the onclick attribute is an intrinsic event handler.

5. Event Propagation in the DOM


Event propagation is the process of how events flow through the DOM tree. It
has three phases:
2 MARK ANSWERS
1. Capturing Phase: The event moves from the root to the target element.
2. Target Phase: The event reaches the target element.
3. Bubbling Phase: The event bubbles up from the target element back to
the root.

6. Difference Between doGet and doPost Methods in Servlets


Feature doGet doPost
Purpose Handles HTTP GET requests. Handles HTTP POST requests.
Data Length Limited to the URL length. No limitation on data length.
Data Visibility Data is visible in the URL. Data is not visible in the URL.
Usage Used for retrieving data. Used for sending sensitive data.

7. Session in Servlet-Based Web Applications


A session in servlets is a way to store and track user-specific data across
multiple requests. It allows a server to maintain state information for a user
during their interaction with the web application. Sessions are often
implemented using HttpSession objects.

8. Role of the MVC Paradigm in JSP Applications


The Model-View-Controller (MVC) paradigm separates an application into
three interconnected components:
 Model: Represents the business logic and data.
 View: Handles the presentation layer (e.g., JSP pages).
 Controller: Manages user requests and updates the model and view
accordingly (e.g., servlets).
This separation enhances maintainability, scalability, and testability.
2 MARK ANSWERS
9. How JSP Differs from Servlets
Feature JSP Servlet
High-level, simplifies HTML Low-level, focused on
Nature
generation. processing logic.
Easier for designing presentation More complex for generating
Ease of Use
layers. HTML.
Compiled into servlets by the
Compilation Written and compiled manually.
container.
Focus Primarily for views. Primarily for controllers.

10. JSP Standard Tag Library (JSTL)


The JSP Standard Tag Library (JSTL) is a collection of tag libraries that
provide standard functionality to JSP pages. It includes support for:
 Core Tags: Iteration, conditionals, and variable management.
 Formatting Tags: Formatting numbers, dates, and internationalization.
 SQL Tags: Database access.
 XML Tags: Parsing and manipulating XML data.
Example:
<c:if test="${user != null}">
Welcome, ${user.name}!
</c:if>
UNIT 4

1. Classify the different types of PHP Built-in String functions


Functions include
 strlen(),
 strpos(),
 substr(),
 strtolower(),
 strtoupper(),
2 MARK ANSWERS
 trim(),
 str_replace().
.
2.Sort the different PHP magic constants into categories
Magic Constants:
Special constants that change depending on their context (e.g.,
__LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__,
__METHOD__, __NAMESPACE__).
.
3.What is the difference between a variable and a constant in PHP?
2 MARK ANSWERS

4. Name two types of operators in PHP.


Two types of operators in PHP are:
1. Arithmetic Operators: Used for mathematical operations like addition,
subtraction, multiplication, etc.
Example: +, -, *, /, %
Example usage: $result = 5 + 3;
2. Comparison Operators: Used to compare two values.
Example: ==, ===, !=, >, <
Example usage: $isEqual = (5 == 3);
5. List two flow control statements in PHP.
Two flow control statements in PHP are:

1. if statement:
Used to execute code if a condition is true.
Example:

if ($age >= 18) {


2 MARK ANSWERS
echo "You are an adult.";
}

2. for loop:

Used to execute a block of code a specific number of times.

Example:

for ($i = 0; $i < 5; $i++) {


echo $i;
}
6. Compare for in and for each loop in PHP.

7. Explain the working principle of PHP in web development.


Working Principle of PHP in Web Development
1. Server-Side Execution:
PHP code is executed on the web server, and the output (usually HTML)
is sent to the client's browser. The PHP code itself is not visible to the
user.
2. Dynamic Content Generation:
PHP can interact with databases, process user inputs, and dynamically
generate web pages based on the logic in the script.
8. Name two differences between DOM and SAX in XML processing.
2 MARK ANSWERS

9.What are well-formed XML documents


Well-Formed XML Documents:
1. Definition:
A well-formed XML document follows the correct syntax rules of XML, such
as having a single root element, properly nested tags, and attributes enclosed in
quotes.
2. Example:
<note>
<to>John</to>
<message>Hello</message>
</note>
10.Name two methods of displaying XML in browsers.
1. Using Browser's Built-in XML Viewer:
Simply open the .xml file in a web browser (e.g., Chrome, Firefox), and the
browser will automatically format and display the XML content.

2. XSLT (Extensible Stylesheet Language Transformations):


2 MARK ANSWERS
Apply an XSLT stylesheet to transform the XML data into a more readable
format like HTML, and display it in the browser.
Example:
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
11. What is the difference between XML and HTML?

Unit 5
1.What is a web service (WS)?
Web services are methods that enable communication between
applications over the internet using protocols like HTTPand SOAP. They
are necessary because they facilitate interoperability and allow different
systems to exchange data seamlessly
2.Identify the names of the four main web services components.
The four main standards for web services are SOAP, WSDL,
UDDI, and XML.

3 Outline the features of WSDL


WSDL provides a way to describe web services, including their operations,
data types, message formats, and protocols,allowing for standardized
communication.
Here are two features of WSDL (Web Services Description Language) for a
1. Service Description: WSDL defines the operations, input/output
messages, and data types of a web service.
2 MARK ANSWERS
2. Interoperability: It allows web services to communicate across
different platforms and programming languages.

4.List any two standards used in web services.


Here are two widely used standards in web services:
1. SOAP (Simple Object Access Protocol):
A protocol used for exchanging structured information in the
implementation of web services, using XML as the message format.
SOAP is known for its robustness and ability to handle complex
operations.
2. REST (Representational State Transfer):
An architectural style for designing networked applications. RESTful
web services use standard HTTP methods like GET, POST, PUT, and
DELETE, and typically exchange data in lightweight formats like JSON
or XML.
Both are foundational for building and consuming web services.
5 What is the difference between SOAP and REST web services?
Here is a comparison of SOAP and REST web services:
Feature SOAP REST
A protocol with strict An architectural style, not a
Protocol
standards for communication. protocol.
Supports various formats like
Data Uses XML exclusively for
JSON, XML, HTML, and plain
Format message exchange.
text.
More complex and Lightweight and simpler to
Complexity
heavyweight with strict rules. implement.
Maintains state in Stateless; each request is
State
communication (stateful). independent.
Operates over various
Transport Relies primarily on HTTP.
protocols (HTTP, SMTP, etc.).
Better for complex operations Suitable for simple CRUD
Flexibility
and enterprise needs. operations.
2 MARK ANSWERS

6 Name two key components of a WSDL file.


1. Types: Defines the data types used in the web service, typically using
XML Schema (XSD).
2. PortType: Describes the operations (functions) that the web service
provides and their input/output messages.

7 What is the role of the UDDI in web services?


The UDDI (Universal Description, Discovery, and Integration) serves as a
directory for web services, enabling:
1. Discovery: Allows clients to find web services by providing a registry of
service descriptions.
2. Integration: Facilitates seamless integration by providing detailed
information about services, including their functionalities and access
points.

8. Why are web services needed in modern applications?

Interoperability: Web services allow applications built on different


platforms to communicate with each other.

Integration: They enable seamless integration of various systems and


applications.

9.What is the primary purpose of SOAP in web services?


The primary purpose of SOAP (Simple Object Access Protocol) in web
services is to:
1. Facilitate Communication: Enable the exchange of structured
information between applications over a network.
2. Ensure Standardization: Provide a standardized protocol for message
formatting and communication using XML.
2 MARK ANSWERS
10. What does "consuming a web service" mean?
 Consuming a web service" refers to the process of using a web service in a
client application to access its functionality or data. It involves the client
sending a request to the web service and receiving a response. Essentially, the
client "consumes" the service's provided resources, typically through protocols
like SOAP or REST.

You might also like