Assignment Solutions Iwt
Assignment Solutions Iwt
Key Points
1. When client sends request for a web page, the web server search for the requested page if requested
page is found then it will send it to client with an HTTP response.
2. If the requested web page is not found, web servers will the send an HTTP response: Error 404 not
found.
3. If client has requested for some other resources then the web server will contact to the application
server and data store to construct the HTTP response
Web Server Architecture follows the following two approaches:
1. Concurrent Approach.
2. Single-Process-Event-Driven Approach.
Concurrent Approach:-
Concurrent approach allows the web server to handle multiple client requests at the same time. It can be
achieved by following methods:
Multi-processing:-
In this a single process (parent process) initiates several single-threaded child processes and distribute
incoming requests to these child processes. Each of the child processes are responsible for handling single
request. It is the responsibility of parent process to monitor the load and decide if processes should be killed
or forked.
Multi-threaded:-
Unlike Multi-process, it creates multiple single-threaded processes.
Hybrid:-
It is combination of above two approaches. In this approach multiple process are created and each process
initiates multiple threads. Each of the threads handles one connection. Using multiple threads in single
process results in less load on system resources.
UNIT-2
Q1: Write the Format of HTML program. (Mark-4)
Ans: HTML is the standard mark-up language for creating Web pages.
HTML stands for Hyper Text Mark-up Language
HTML describes the structure of a Web page
HTML consists of a series of elements
HTML elements tell the browser how to display the content
HTML elements are represented by tags
HTML tags label pieces of content such as "heading", "paragraph", "table", and so on
Browsers do not display the HTML tags, but use them to render the content of the page
The Unordered HTML List- An unordered list starts with the “ul” tag. Each list item starts with the “li”
tag. The list items are marked with bullets i.e small black circles by default.
Example:
<!DOCTYPE html>
<html>
<body>
<h2>Grocery list</h2>
<ul>
<li>Bread</li>
<li>Eggs</li>
<li>Milk</li>
<li>Coffee</li>
</ul>
</body>
</html>
Output:
Note: A link does not have to be text. It can be an image or any other HTML element.
HTML Links - Syntax
Hyperlinks are defined with the HTML <a> tag:
<a href="url">link text</a>
Example
<a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
Local Links
A local link (link to the same web site) is specified with a relative URL (without https://www....).
Example
<a href="html_images.asp">HTML Images</a>
Q4: what is the uses of Frames in html. Give the syntax of frames. (Mark-4)
Ans: Definition and Usage
The <frameset> tag is not supported in HTML5.
The <frameset> tag defines a frameset.
The <frameset> element holds one or more <frame> elements. Each <frame> element can hold a separate
document.
The <frameset> element specifies HOW MANY columns or rows there will be in the frameset, and HOW
MUCH percentage/pixels of space will occupy each of them.
Note: If you want to validate a page containing frames, be sure the <! DOCTYPE> is set to either "HTML
Frameset DTD" or "XHTML Frameset DTD".
Browser Support
UNIT -3
Q1: What are style sheet?
Ans- A style sheet is a file or form that is used in word processing and desktop publishing to define the
layout style of a document. A style sheet contains the specifications of a document's layout, such as the page
size, margins, fonts and font sizes. In modern word processors such as Microsoft Word, a style sheet is
known as a template. The most well-known form of style sheet is the Cascading Style Sheet (CSS), which is
used for styling Web pages.
The font tag deprecated and it is supposed to be removed in a future version of HTML. So they should not
be used rather, it's suggested to use CSS styles to manipulate your fonts. But still for learning purpose, this
chapter will work with an example using the font tag.
Example-
Live Demo
<! DOCTYPE html>
<html>
<head>
<title>HTML CSS</title>
</head>
<body>
<pstyle="color: green; font-size: 24px ;"> Hello, World! </p>
</body>
</html>
Ans- HTML is quite limited when it comes to the presentation of a web page. It was originally designed as
a simple way of presenting information.
With CSS, it becomes very easy to specify the things like, size and typeface for the fonts, colors for the text
and backgrounds, alignment of the text and images, amount of space between the elements, border and
outlines for the elements, and lots of other styling properties.
Style information can either be attached as a separate document or embedded in the HTML document itself.
These are the three methods of implementing styling information to an HTML document.
Inline styles — Using the style attribute in the HTML start tag.
Embedded style — using the <style> element in the head section of the document.
External style sheet — Using the <link> element, pointing to an external CSS files.
1. CSS describes how HTML elements are to be displayed on screen, paper, or in other media
2. CSS saves a lot of work. It can control the layout of multiple web pages all at once
3. External style sheets are stored in CSS files
Popularity- JavaScript is used everywhere in the web. The resources to learn JavaScript are numerous.
Stack Overflow and GitHub have many projects that are using JavaScript and the language as a whole has
gained a lot of traction in the industry in recent years especially.
Interoperability- JavaScript plays nicely with other languages and can be used in a huge variety of
applications. Unlike PHP or SSI scripts, JavaScript can be inserted into any web page regardless of the file
extension. JavaScript can also be used inside scripts written in other languages such as Perl and PHP.
Server Load-Being client-side reduces the demand on the website server.
Rich interfaces- Drag and drop components or slider may give a rich interface to your website.
Extended Functionality- Third party add-ons like Grease monkey enable JavaScript developers to write
snippets of JavaScript which can execute on desired web pages to extend its functionality.
Versatility- Nowadays, there are many ways to use JavaScript through Node.js servers. If you were to
bootstrap node.js with express, use a document database like mongodb, and use JavaScript on the front-end
for clients, it is possible to develop an entire JavaScript app from front to back using only JavaScript.
Updates- Since the advent of EcmaScript 5 (the scripting specification that JavaScript relies on), Ecma
International has dedicated to updating JavaScript annually. So far, we have received browser support for
ES6 in 2017 and look forward to ES7 being supported in future months.
UNIT-4
Q1: What is XML? How it is different from HTML?
Ans. XML stands for Extensible Mark-up Language. It is a text-based mark-up language derived from
Standard Generalized Mark-up Language (SGML).
XML tags identify the data and are used to store and organize the data, rather than specifying how to
display it like HTML tags, which are used to display the data. XML is not going to replace HTML in the
near future, but it introduces new possibilities by adopting many successful features of HTML.
XML and HTML were designed with different goals:
1. XML was designed to carry data - with focus on what data is.
2. HTML was designed to display data - with focus on how data looks.
3. XML tags are not predefined like HTML tags are.
Q2: What the differences are between require and include, include once, require once?
Ans. require :- when the file is required by your application, e.g. an important message template or a file
containing configuration variables without which the app would break.
require_once :- when the file contains content that would produce an error on subsequent inclusion,
e.g. function important () { /* important code */} is definitely needed in your application but since functions
cannot be redeclared should not be included again.
include :- when the file is not required and application flow should continue when not found, e.g.
great for templates referencing variables from the current scope or something
include_once :- optional dependencies that would produce errors on subsequent loading or maybe remote
file inclusion that you do not want to happen twice due to the HTTP overhead
1) Parse error or Syntax Error: It is the type of error done by the programmer in the source
code of the program. The syntax error is caught by the compiler. After fixing the syntax
error the compiler compile the code and execute it. Parse errors can be caused dues to
unclosed quotes, missing or Extra parentheses, Unclosed braces, Missing semicolon etc
2) Fatal Error: It is the type of error where PHP compiler understands the PHP code but it
recognizes an undeclared function. This means that function is called without the definition
of function.
3) Warning Errors: The main reason of warning errors is including a missing file. This
means that the PHP function call the missing file.
4) Notice Error: It is similar to warning error. It means that the program contains something
wrong but it allows the execution of script.
Advantages of triggers:-
1. Integrity of data.
2. Useful for catching errors.
3. Alternative way to run scheduled tasks.
4. Auditing.
5. Prevention of invalid transactions.
6. Logging of event.
Advantages of indexes:-
1. Searching For Records.
2. Sorting Records.
3. Grouping Records.
4. Maintaining a Unique Column.
Persistent cookies are also capable of providing the browsing behaviour of users. Persistent cookies help
websites remember your information and settings when you visit them in the future. This result in faster and
more convenient access since, for example, you don't have to login again.
Besides authentication, other website features made possible by persistent cookies include: language
selection, theme selection, menu preferences, internal site bookmarks or favourites, among many others. On
your first visit, the website is presented in default mode. During your visit, you select your preferences and
these preferences are remembered, through the use of the persistent cookie, the next time you visit the site.