Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

PART-A (10*2=20Marks)

1. What are the various functions of web server?


Web servers are primarily used to process and manage HTTP/HTTPS requests and
responses from the client system. A web server can also perform several other functions,
such as: Store and protect website data: A web server can store and protect critical website
data from unauthorized users.
2. List out the steps for creating the website.
 Hone and Align Relevant Skills
 Establish a Goal
 Choose a Hosting Provider
 Choose a Domain Name
 Choose a Site Template or Layout
 Build Relevant Pages
 Establish a Payment System (If Applicable)
 Test and Fine-Tune Your Site
 Promote Your Site
 Keep Your Site Up To Date
3. What is mean by absolute URLs?
An absolute URL is the full URL, including protocol ( http / https ), the optional subdomain
(e.g. www ), domain ( example.com ), and path (which includes the directory and slug).
Absolute URLs provide all the available information to find the location of a page.
4. Differentiate between server side scripting and client side scripting.
Parameters Server Side Scripting Client-Side Scripting

Script Running For server-side scripting, a web server The script for the client-side scripting runs
serves as the medium for running it. They by using a browser. It is present already in
create the pages that one would send to any user’s computer.
the browser.

Uses We use the server-side scripting at the We use the client-side scripting at the front
back-end, where the source code stays end, and any user can view it using the
hidden from the browser (client-side)- browser itself.
making it non-viewable.

Occurrence Server-side scripting occurs whenever a Client-side scripting occurs when all the
browser initiates a request for it. As a codes that a browser possesses in a page
result, many dynamic pages get created later change/ alter according to any user’s
on the basis of several conditions. input.
Operation Any server is capable of carrying out A typical browser performs the client-side
server-side scripting, but it can’t carry out scripting after it receives a page (that the
client-side scripting. server sends).

Execution The server-side scripting occurs on a The client-side scripting occurs on the local
remote computer. Thus, the response we computers. Thus, in this case, we get a
get is slower as compared to that of the comparatively quicker response in
client-side scripting. comparison with the server-side scripting.

Suitability The server-side scripting works well for The client-side scripting works well in
the areas that require the loading of a those cases that require user interaction.
dynamic type of data and information.

Connection to The server-side scripting assists a user in The client-side server doesn’t connect to
the Server connecting to the database that already those databases that exist primarily on the
Database exists in the concerned web server. concerned web server.

Access To The server-side scripting has complete The client-side scripting has no access to
Various Files access to all the files present in any web the files that exist in a web server.
server.

Languages Languages like Ruby on Rails, Perl, ASP, Languages like VB Script, CSS, HTML,
Python, ColdFusion, PHP, etc., come into Javascript, etc., are very common in the
play in the case of server-side scripting. case of client-side scripting.

Security The server-side scripting is way more The client-side scripts are much less secure
secure as compared to the client-side one. as compared to the server-side ones. It is
It is because the scripts of the server-side because these scripts don’t stay hidden
stay hidden from any random clients. from any random client’s end.

5. List and explain any two HTML elements.

Tag Description

<!DOCTYPE> Defines the document type

<html> Defines an HTML document

6. What is CSS file? Give the syntax of CSS.


A CSS Syntax rule consists of a selector, property, and its value. The selector points
to the HTML element where the CSS style is to be applied. The CSS property is separated by
semicolons. It is a combination of the selector name followed by the property: value pair that
is defined for the specific selector.
7. What do you mean by margin and padding?
Margin is the space outside of a page element. Padding defines the space surrounding
content within a web element. Margin controls the distance between separate elements on the
page. Padding sets the distance between the content and the borders of its containing element.
8. Define range selector.
The range selector is a tool for selecting ranges to display within the chart. It provides
buttons to select pre-configured ranges in the chart, like 1 day, 1 week, 1 month, etc. It also
provides input boxes where min and max dates can be manually input.
9. Write the java script code to display welcome message.
let name = prompt("Hello! What's your name?"); alert("Nice to meet you, " + name +
"!"); In this example, the prompt() method is used to display a message asking for the user's
name. The input is stored in the variable name .
10.What is mean by string literals?
A literal string is a sequence of characters enclosed in quotation marks, such as
"Hello, world!" or "12345". It is called a "literal" because the characters within the quotation
marks are interpreted exactly as they appear, without any special meaning or processing.

PART – B (4*10=40Marks)
11. a. Explain the various types of web protocols used for client server
communication.
 In networking, a communications protocol or network protocol is the specification of a
set of rules for a particular type of communication.
 Different protocols often describe different aspects of a single communication; taken
together, these form a protocol stack. The terms "protocol" and "protocol stack" also refer
to the software that implements a protocol.
 Most recent protocols are assigned by the Internet Engineering Task Force (IETF) for
internet communications, and the Institute of Electrical and Electronics Engineers
(IEEE), or the International Organization for Standardization (ISO) organizations for
other types. The ITU-T handles telecommunications protocols and formats.
 Index page for network protocols and protocol layers, categorised by the nearest
matching layers of the OSI seven layer model.
 Systems engineering principles have been applied to design network protocol

Common Internet protocols


Common Internet protocols include TCP/IP (Transmission Control Protocol/Internet
Protocol), UDP/IP (User Datagram Protocol/Internet Protocol), HTTP (HyperText Transfer
Protocol) and FTP (File Transfer Protocol).
TCP/IP
TCP/IP is a stream protocol. This means that a connection is negotiated between a client and
a server. Any data transmitted between these two endpoints is guaranteed to arrive, thus it is
a so-called lossless protocol. Since the TCP protocol (as it is also referred to in short form)
can only connect two endpoints, it is also called a peer-to-peer protocol.
HTTP
HTTP is the protocol used to transmit all data present on the World Wide Web. This includes
text, multimedia and graphics. It is the protocol used to transmit HTML, the language that
makes all the fancy decorations in your browser. It works upon TCP/IP.
FTP
FTP is the protocol used to transmit files between computers connected to each other by a
TCP/IP network, such as the Internet.
b. Discuss about the working principle of a web server with a neat
diagram.
A web server is a software application or hardware device that stores, processes, and
serves web content to users over the internet. It plays a critical role in the client-server model
of the World Wide Web, where clients (typically web browsers) request web pages and
resources, and servers respond to these requests by delivering the requested content.
Web servers operate on the Hypertext Transfer Protocol (HTTP), which is the foundation of
data communication on the World Wide Web. When you enter a website’s URL into your
browser, it sends an HTTP request to the web server hosting that website, which then sends
back the web page you requested, allowing you to view it in your browser.
Web Server Architecture
Web server architecture refers to the structure and design of web servers, outlining how they
handle incoming requests and deliver web content. There are two main approaches to web
server architecture:
Single-Tier (Single Server) Architecture:
In a single-tier architecture, a single server is responsible for both processing requests
and serving web content. This is suitable for small websites or applications with low traffic.
However, it has limitations in terms of scalability and fault tolerance. If the server goes
down, the entire service becomes unavailable.

Multi-Tier (Load-Balanced) Architecture:


In a multi-tier architecture, multiple servers are used to distribute the workload and
ensure high availability. This approach often involves load balancers that evenly distribute
incoming requests across a cluster of web servers. Each server can serve web content
independently, and if one server fails, the load balancer redirects traffic to healthy servers,
ensuring uninterrupted service.

12. a. Write and explain any five HTML form elements for online user
registration.

Type Description

<input type="text"> Displays a single-line text input field

<input type="radio"> Displays a radio button (for selecting one of many choices)

<input type="checkbox"> Displays a checkbox (for selecting zero or more of many


choices)

<input type="submit"> Displays a submit button (for submitting the form)

<input type="button"> Displays a clickable button

b. Describe any three selectors with suitable code.


Selector Example Example description

.class .intro Selects all elements with class="intro"

.class1.class2 .name1.name2 Selects all elements with both name1 and name2 set within
its class attribute

.class1 .class2 .name1 .name2 Selects all elements with name2 that is a descendant of an
element with name1

#id #firstname Selects the element with id="firstname"

* * Selects all elements

element p Selects all <p> elements

element.class p.intro Selects all <p> elements with class="intro"

element,element div, p Selects all <div> elements and all <p> elements

element element div p Selects all <p> elements inside <div> elements

element>element div > p Selects all <p> elements where the parent is a <div>
element
13. a. Briefly explain about web browser architecture with a neat diagram.
What is a web browser?
 A web browser is an application that serves as a gateway interface between
the user and the server. It loads and compiles the results from the server in the
form of an HTML web page and paints it on the screen of the user. It is an
interaction tool for using the internet.
 A web browser helps us find any information available on the internet in the
form of texts, photos, and videos. Examples of web browsers are Chrome (one
of the most popular browsers used all over the world), Firefox, Safari, Edge,
Brave, and many more.
Browser Architecture
 Browser architecture is designed to provide a faster, more secure, and more
feature-rich platform that helps users interact easily with the internet. The
browser architecture is broadly divided into seven parts.

 The user interface of a browser is designed such that it allows personalization,


as every individual has different interests. This personalization is achieved by
providing basic features like groups, collections, bookmarks, and themes.
Each browser can have a different user interface and features.
 Browser Engine: The browser engine is responsible for coordinating web
content that is fetched from the server and user interactions. It keeps a note of
which button is clicked, which URL is asked to parse, and how the web
content will be processed and displayed on the browser.
 Rendering Engine: The rendering engine, on the other hand, interprets and
renders web content. In most browsers, both the browser engine and the
rendering engine work together to provide better results to the user.
 Networking Layer: This layer handles the communication part. When the user
enters or clicks on a URL, the network layer initiates an HTTP request to the
webserver to load the requested web page. It also manages fetching resources
from HTML files, images, stylesheets, and more. Have you seen those cookie
notifications while searching for information on the internet? Mostly, the
network layer works behind the scenes for those cookies and cache.
 JavaScript Engine: The JavaScript Engine is the core component of browser
architecture, with the ability to manipulate web content and introduce
dynamic behavior in web pages.
 Data Storage: A large part of the browser goes into storing various types of
data, which include not only user preferences, browsing history, passwords,
and other regular data updates as well (address, name, and contact).
 UI backend: The UI backend provides dynamic and interactive behavior on
the web page and enhances the overall functionality and performance of the
browser.

b. Explain the box modeling of CSS with suitable code.


 In CSS, the term "box model" is used when talking about design and layout.
 The CSS box model is essentially a box that wraps around every HTML
element. It consists of: content, padding, borders and margins. The image
below illustrates the box model:

 Explanation of the different parts:


 Content - The content of the box, where text and images appear
 Padding - Clears an area around the content. The padding is transparent
 Border - A border that goes around the padding and content
 Margin - Clears an area outside the border. The margin is transparent

14. a. write a java script to generate ARMSTRONG NUMBERS between 1 to


100
function isArmstrongNumber(num) {
let sum = 0;
let temp = num;
const numberOfDigits = num.toString().length;

while (temp > 0) {


let digit = temp % 10;
sum += Math.pow(digit, numberOfDigits);
temp = Math.floor(temp / 10);
}

return sum === num;


}

function displayArmstrongNumbers(start, end) {


for (let i = start; i <= end; i++) {
if (isArmstrongNumber(i)) {
console.log(i);
}
}
}

displayArmstrongNumbers(1, 100);
b. Discuss and explain about java script handles the arrays with examples.
 An array in JavaScript is a data structure used to store multiple values in a
single variable. It can hold various data types and allows for dynamic resizing.
Elements are accessed by their index, starting from 0.

 You have two ways to create JavaScript Arrays: using the Array
constructor or the shorthand array literal syntax, which is just square
brackets. Arrays are flexible in size, so they can grow or shrink as you add or
remove elements.

PART-A (10*2=20Marks)
1. List any four methods of data object.

Name Description
AddGroup Creates a new data group and returns it as a Group object.
Clear Deletes all existing data groups and all variables that belong to them.
DeleteGroup Deletes the specified group and all variables that belong to this group.
Run Walks down the hierarchy of custom objects starting from the very beginning.

2. How exceptions are handled in javaScript?


A throw statement is used to raise an exception. It means when an abnormal condition
occurs, an exception is thrown using throw.
3. When should the super global arrays in PHP be used? Which super global
array in c PHP would contain a HTML form’s POST data?
PHP $_POST is a PHP superglobal variable which is used to collect form data after
submitting an HTML form with method="post". $_POST is also widely used to pass
variables.
4. Name any four built in functions in PHP.
 Function
 Abs
 Ceiling
 Count
5. What are cookies? Give its uses.
 Cookies are small pieces of text sent to your browser by a website you visit.
They help that website remember information about your visit, which can both make
it easier to visit the site again and make the site more useful to you
6. Explain the two ways by which arrays can be created in PHP.
 There are several methods of declaring an array in PHP. The array() function can be
used, either with key-value pairs, or with values alone. Single brackets, [...] can also
be used in place of the array() keyword. If any key value is omitted, the key will be
found by incrementing the largest prior integer key.
7. What are services?
 Services are intangible, value-added activities that a company provides to its
customers. They are the core of what a company does to create value for its customers
and generate revenue.
 Services can be physical or digital. Physical services are those that you can touch,
feel, or see, such as a haircut or a massage. Digital services are those that exist in the
digital world, such as an app or a website.
8. Explain the difference between get request type and post request type.
 GET is for fetching data, appending parameters in the URL, ideal for searches. POST,
used for updates, sends data securely in the request body, perfect for forms. Each has
specific use cases based on security and data size needs.
9. What are the two methods used to send a request to a server?
 The two most common HTTP methods are: GET and POST.
10.Write the application of servlets.
 Read the explicit data sent by the clients (browsers). This includes an HTML form on
a Web page or it could also come from an applet or a custom HTTP client program.
 Read the implicit HTTP request data sent by the clients (browsers). This includes
cookies, media types and compression schemes the browser understands, and so forth.
 Process the data and generate the results. This process may require talking to a
database, executing an RMI or CORBA call, invoking a Web service, or computing
the response directly.
 Send the explicit data (i.e., the document) to the clients (browsers). This document
can be sent in a variety of formats, including text (HTML or XML), binary (GIF
images), Excel, etc.
 Send the implicit HTTP response to the clients (browsers). This includes telling the
browsers or other clients what type of document is being returned (e.g., HTML),
setting cookies and caching parameters, and other such tasks.
PART – B (4*10=40Marks)
11. a. Classify the properties of intrinsic event handlers associated with
DOM2 with an example.
 A JavaScript can be executed when an event occurs, like when a user clicks on an
HTML element.
 To execute code when a user clicks on an element, add JavaScript code to an HTML
event attribute:
onclick=JavaScript
 Examples of HTML events:
 When a user clicks the mouse
 When a web page has loaded
 When an image has been loaded
 When the mouse moves over an element
 When an input field is changed
 When an HTML form is submitted
 When a user strokes a key
 In this example, the content of the <h1> element is changed when a user clicks on it:

Example
<!DOCTYPE html>
<html>
<body>

<h1 onclick="this.innerHTML = 'Ooops!'">Click on this text!</h1>

</body>
</html>

Try it Yourself »
In this example, a function is called from the event handler:
Example
<!DOCTYPE html>
<html>
<body>

<h1 onclick="changeText(this)">Click on this text!</h1>

<script>
function changeText(id) {
id.innerHTML = "Ooops!";
}
</script>

</body>
</html>
b. Write a javascript program to illustrate the exception handling
mechanism.
 An error is an action that is inaccurate or incorrect. There are three types of errors in
programming which are discussed below:
 Syntax error
 Logical error
 Runtime error
 Syntax error: According to computer science, a syntax error is an error in the syntax
of a sequence of characters or tokens that is intended to be written in a particular
programming language or it is also a compile-time error if the syntax is not correct
then it will give an error message.
 Example:
 HTML
<script type="text/javascript">

// An runtime error here

window.printme();

</script>

 As the syntax is not correct of the JavaScript it will affect only the thread that is under
this JavaScript and the rest of the code in other threads gets executed as nothing in
them depends on the code containing the error.
 Logical error: It is the most difficult error to be traced as it is the error on the logical
part of the coding or logical error is a bug in a program that causes it to operate
incorrectly and terminate abnormally (or crash).
 Runtime Error: A runtime error is an error that occurs during the running of the
program, also known as the exception. In the example that is given below the syntax
is correct, but at runtime, it is trying to call a method that does not exist.
 Example:
 Javascript

// An runtime error here

window.printme();

 As in runtime errors, there are exceptions and these exceptions can be handled with
the help of the try-and-catch method
 try-catch method
 JavaScript uses the try catch and finally to handle the exception and it also uses the
throw operator to handle the exception. try have the main code to run and in the catch
block if any error is thrown by try block will be caught and the catch block will
execute. Finally block will always occur even if an error is thrown
 Note:- We can create our own errors using throw but error thrown can only be
 String, Number, Boolean, or an object
 Syntax:
 Javascript

try {
// Here the main Code runs

[break;]

catch ( exception e ){

// The code will run when there is an exception

[break;]

12. a. Explain different types of Operators used in PHP.


 In this article, we will see how to use the operators in PHP, & various available
operators along with understanding their implementation through the examples.
 Operators are used to performing operations on some values. In other words, we can
describe operators as something that takes some values, performs some operation on
them, and gives a result. From example, “1 + 2 = 3” in this expression ‘+’ is an
operator. It takes two values 1 and 2, performs an addition operation on them to give
3.
 Just like any other programming language, PHP also supports various types of
operations like arithmetic operations(addition, subtraction, etc), logical
operations(AND, OR etc), Increment/Decrement Operations, etc. Thus, PHP provides
us with many operators to perform such operations on various operands or variables,
or values. These operators are nothing but symbols needed to perform operations of
various types. Given below are the various groups of operators:
 Arithmetic Operators
 Logical or Relational Operators
 Comparison Operators
 Conditional or Ternary Operators
 Assignment Operators
 Spaceship Operators (Introduced in PHP 7)
 Array Operators
 Increment/Decrement Operators
 String Operators

b. What is string? Explain various operations that can be performed on


strings.
Traditional
Operation Free-Form Syntax
Syntax

CAT (Concatenate
Concatenate + operator
Two Strings)

%CONCAT (Concatenate with


Concatenate strings with a separator
Separator)

Concatenate array elements with a %CONCATARR (Concatenate


separator Array Elements with Separator)

%LOWER (Convert to Lower


Convert to lower case
Case)

%UPPER (Convert to Upper


Convert to upper case
Case)

CHECK (Check
Check %CHECK (Check Characters)
Characters)

CHECKR (Check
Check Reverse %CHECKR (Check Reverse)
Reverse)

%STR (Get or Store Null-


Create
Terminated String)

%REPLACE (Replace Character


Replace
String)

SCAN (Scan
Scan %SCAN (Scan for Characters)
String)

%SCANR (Scan Reverse for


Scan Reverse
Characters)

%SCANRPL (Scan and Replace


Scan and Replace
Characters)

%SPLIT (Split String into


Split a string
Substrings)

Substring SUBST (Substring)%SUBST (Get Substring)


%LEFT (Get Leftmost
Characters)
%RIGHT (Get Rightmost
Traditional
Operation Free-Form Syntax
Syntax

Characters)

Translate XLATE (Translate)%XLATE (Translate)

%TRIM (Trim Characters at


Edges)
%TRIML (Trim Leading
Trim Blanks
Characters)
%TRIMR (Trim Trailing
Characters)

Return the leftmost characters of a %LEFT (Get Leftmost


string Characters)

Return the number of bytes for


alphanumeric or double bytes for %LEN (Get or Set Length)
UCS-2 and graphic

Return the number of natural %CHARCOUNT (Return the


characters Number of Characters)

Return the rightmost characters of a %RIGHT (Get Rightmost


string Characters)

%STR (Get or Store Null-


Work with a null-terminated string
Terminated String)

13. a. Describe the servlet architecture and various information invoked by


the servlet container.
 Servlets are grouped under the Advanced Java tree that is used to create dynamic web
applications. Servlets are robust, well scalable, and are primarily used in
developing server-side applications. If we go a little back in time, we would be able
to witness that before the introduction of servlets, CGI (Common Gateway
Interface) was used. Among several indigenous tasks that a servlet is capable of
doing, dynamically performing client requests and responses are most common. Other
tasks that a servlet can do effectively are:
 Can easily manage/control the application flow.
 Suitable to implement business logic.
 Can effectively balance the load on the server side.
 Easily generate dynamic web content.
 Handle HTTP Request and Response
 Also act as an interceptor or filter for a specific group of requests.

b. Compare and contrast HTTP-GET and HTTP-POST request.


HTTP Methods

 GET
 POST
 PUT
 HEAD
 DELETE
 PATCH
 OPTIONS
 CONNECT
 TRACE

The two most common HTTP methods are: GET and POST.

The GET Method

GET is used to request data from a specified resource.

Note that the query string (name/value pairs) is sent in the URL of a GET request:

/test/demo_form.php?name1=value1&name2=value2

Some notes on GET requests:

 GET requests can be cached


 GET requests remain in the browser history
 GET requests can be bookmarked
 GET requests should never be used when dealing with sensitive data
 GET requests have length restrictions
 GET requests are only used to request data (not modify)

The POST Method

POST is used to send data to a server to create/update a resource.

You might also like