2. PART-A
Q1 Java Script is a client side Scripting language or Server side Scripting Language. Give
reasons in Support of Your answer?
Sol. JavaScript is most commonly used as a client side scripting language. This means that
JavaScript code is written into an HTML page. When a user requests an HTML page with
JavaScript in it, the script is sent to the browser and it's up to the browser to do something with
it.
Client sides: Client-slides scripting offers an easy way to provide additional fuctionality &
flexibility to your project. HTML is very limited, it’s main purpose is to display & format content.
It allows little or no interaction with the visitors of your site .
Scripting technologies like javascript , jscript, Vbscript & others are used on many sites to add
extra functionality to a website.
Server sides: The use of server-side scripting is often less visible to users . it is mostly used for
content management , where the site’s content is stored in a database , & presented to the user on
request . server-side technologies like PHP, ASP, JSP,PERL& many others have nearly become a
requirement for successful websites today.
Q2 Cascading Style Sheets has a crucial role to play in maintaining uniform appearance of
a website. Discuss?
Sol. Cascading Style Sheets (CSS) are used to control the appearance (font, colours, layout, etc) of
web pages. Your pages already link to central style sheets that are part of the template. You
cannot change these, but you can add local style sheets to control the presentation of the content
area of your pages. For example if you use a lot of data tables in your site, you may want to style
them consistently.
Cascading style sheets (CSS) are a collection of formating rules that control the apperence of the
content in the webpage. They are very useful for maintaing a website since its apperance can be
managed from just one file. . CSS Styles also enhance your site's look, accessibility and reduces
file size. Another main advantage is reusability - instead of defining the properties of fonts,
backgrounds, borders, bullets, uniform tags, etc. each time you use them you can just assign the
corresponding css style in the class property.
Adding cascading style sheets (CSS) to web pages is a relatively simple process, although the
topic as a whole is fairly sizeable. Therefore cascading style sheets has a crucial rule to play in
maintaining uniform appearance of a website.
Q3 Java Script follows Object Oriented paradigm or not? Support your answer with
suitable reasons.
Sol. Java Script follows Object Oriented paradigm because Object-oriented programming is a
3. programming paradigm that uses abstraction to create models based on the real world. It uses
several techniques from previously established paradigms, including modularity, polymorphism,
and encapsulation. Today, many popular programming languages (such as Java, JavaScript, C#, C+
+, Python, PHP, Ruby and Objective-C) support object-oriented programming (OOP).
Object-oriented programming may be seen as the design of software using a collection of
cooperating objects, as opposed to a traditional view in which a program may be seen as a
collection of functions, or simply as a list of instructions to the computer. In OOP, each object is
capable of receiving messages, processing data, and sending messages to other objects. Each
object can be viewed as an independent little machine with a distinct role or responsibility.
Object-oriented programming is intended to promote greater flexibility and maintainability in
programming, and is widely popular in large-scale software engineering. By virtue of its strong
emphasis on modularity, object oriented code is intended to be simpler to develop and easier to
understand later on, lending itself to more direct analysis, coding, and understanding of complex
situations and procedures than less modular programming methods. Therefore java script
follows object oriented paradigm.
PART-B
Q4 Illustrate the process of handling the DOM Object by a Javascript enabled browser.
Sol. A document object model (DOM) is an application programming interface (API) for
representing a document (such as an HTML document) and accessing and manipulating the
various elements (such as HTML tags and strings of text) that make up that document. JavaScript-
enabled web browsers have always defined a document object model; a web-browser DOM may
specify.
DOM, which stands for Document Object Model is the foundation of JavaScript. Don't panic. Just
focus on the word object. You know what an object is. It's a thing. Your computer is an object.
Your desk is an object. Let's look into the computer screen, and you will see other objects. A
browser window is an object. A web page is a document, and a document is an object. A graphic
on a web page is an object.
The majority of DOM based scripting is the same--most of the time you'll be using
getElementById or getElementsByTagName, which work in every browser on the planet
(basically). The major differences for application development, in my opinion, are in event
handling and Ajax calls, but of course those can be wrapped in another object. Prototype does
this automatically for you if you're feeling lazy.
Q5 There are three different ways of associating Style Sheets with a HTML Document.
Discuss the role played by each of them by Quoting there Pros and Cons alongwith.
Sol. Style sheets offer a new and powerful mechanism for supplying presentational information
to a user agent displaying structured documents.
There are three different ways of associating Style Sheets with a HTML Document :
4. 1.Using Embedded Style Sheet: This means you include the style sheet at the beginning of a
specific web page. This will define the look of a single page.Embedded style sheets are most
effective when you have a single HTML Document to format. In such cases, if you want to update
your document, you just need to adjust the style block. But if you working with multiple
documents that you will update frequently,however you will use some another method. If you
embed the style sheet in every document, you will have to adjust it in every document.
Advantages of using Embedded Style Sheets:
1. Can control style for a document in one place.
2. No additional download time for style information.
Disadvantages:
1. Need to reapply style information for other documents.
2.Using External Style Sheets: Suppose you are working with multiple documents and they
share similar formatting. In this case, if you use embedded style sheets in each of the document,
when in order to upload the documents you need to adjust each and every style sheet. The best
way is to have a separate style sheet file, which includes all the style definitions and associate it
with the HTML document.
Advantage of using External Style Sheets:
1.It can set style for many documents with one style sheet.
Disadvantages:
1. Require extra download time for the style sheet, which may delay page rendering.
3.Using Inline Style Sheets: This allows you to apply styles to a section or group of tags on a
page. Inline style definitions can be applied to any of the tags within and including <BODY> tag
.Although you would n’t use this method to apply styles throughout an HTML document, its time
consuming, you might use it to make exceptions to an existing style sheet.
Advantages of using Inline style :
1. It can control style to a single character instance.
2. Overrides any external or document styles.
Disadvantages:
1. Need to reapply style information throughout the document and outside document.
2. Bound too closely to HTML difficult to update.
Q6 List and Discuss the Various types of Script Tags used in Java Script.
5. Sol. There are the Various types of Script Tags used in Java Script.
1. The <SCRIPT>tag: the area between the <SCRIPT>and the </SCRIPT>tags defines the script
program.
• Language- Defines the script language . choices are Javascript and VBScript.
• SRC-Defines an external file containing the source code of the javascript. It may be a
URL with complete path to the script which may reside at another website. An example
is:
<script language=”JavaScript” SRC=”testscript.js”>
2.The <NOSCRIPT>tag: The area between the < NOSCRIPT> and the </NOSCRIPT> tag is run by
browsers that can’t run JAVA script or have the feature turned off
3.The <HTML> tag: This tag comes after <!DOCTYPE> tag and identifies the document as an Java
script with HTML document. This tag is optional and even if it is not explicitly included, most
browsers assume its existence.
4.The <HEAD>tag: This tag contains information about the document, including its title, scripts
used, style definitions and document descriptions. this portion enclosed between the <HEAD>
and </HEAD> tag is called the header. In Java Script, the elements allowed within the <HEAD>
tag includes:
<BASE> This elements specifies an absolute URL address that is used to provide server
and directory information for partially specified URL addresses, called relative URL’s used
within the document.
<ISINDEX> This element indicates that a special relationship between the current
document and another document.
<LINK> This element specifies a special relationship between the current document and
another document.
<META> This element uses name/values pairs to provide meta-information about a
document.
<OBJECT> This element allows programs and other binary object to be directly embedded
in a web page.
<STYLE>This element encloses style specifications covering fonts, color positioning and
other aspects of content presentation.
5.The <TITLE>tag: This tag gives an JAVA SCRIPT MODULE a title by which it is known to
browsers and indexing robots. The title does not appear within the browser window, since it is
visible in the browser’s title bar. The title is given between the tags <TITLE> and </TITLE>.
6.The <BODY>tag: This tag encloses all tags ,attributes and information that one wants the
browser to display. To use the <BODY> tag ,enter it below the closing </HEAD> tag and above the