Qb Solution.pdf

  • Uploaded by: Kajol
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Qb Solution.pdf as PDF for free.

More details

  • Words: 4,822
  • Pages: 42
Q1. List five tags in HTML. Write HTML code to generate following table:

Answer : Table

A
B C D
E F G
H I J


Q2.Explain CSS and its type with example. -CSS Stands for cascading Style sheet -CSS describe how HTML elements are to be displayed on the screen. -CSS can control the layout of multiple web pages all at once. -Using CSS we can decorate web sites with different fonts,color,graphics,etc. Advantages : - Saves time -Easy to change -Keep consistency -Give you more control over layout -Use styles with JavaScript => DHTML -Make it easy to create a common format for all the Web pages

Types of CSS: 1.Inline CSS 2. Embedded or internal CSS 3.External CSS

1.Inline CSS : -Add styles to each tag within the HTML file -Use it when you need to format just a single section in a web page

Example :

IU



2. Embedded or internal CSS -A style is applied to the entire HTML file - Use it when you need to modify all instances of particular element (e.g., h1) in a web page Example : <style> h1 {color:red; font-family:sans-serif}

3. External CSS -An external style sheet is a text file containing the style definition (declaration) - Use it when you need to control the style for an entire web site Example -h1, h2, h3, h4, h5, h6 {color:red; fontfamily:sans-serif}  -Save this in a new document using a .css extension -URL is the file.css -Relation_type=“stylesheet” -Link_type=“text/css”



Q3. What is Document Object Model? Explain the various objects in Document Object Model. The DOM is a W3C (World Wide Web Consortium) standard. The DOM defines a standard for accessing documents: "The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document." The W3C DOM standard is separated into 3 different parts: document types .

Core DOM - standard model for all

XML DOM - standard model for XML documents . HTML DOM - standard model for HTML documents . When a web page is loaded, the browser creates a Document Object Model of the page. Document Object: If you want to access any element in an HTML page, you always start with accessing the document object. Method Description : document.getElementById(): Finding an element by element id document.getElementsByTagNam e(): Finding elements by tag name document.getElementsByClassNa me(): Finding elements by class name . document.forms[]: Finding elements by HTML element objects.

Changing HTML Elements: element.innerHTML = new html content Change the inner HTML of an element. element.attribute = new value Change the attribute value of an HTML element. element.setAttribute(attribute, value): Change the attribute value of an HTML element. element.style.property = new style Change the style of an HTML element.

Adding and Deleting Elements: document.createElement(element) :Create an HTML element document.removeChild(element) :R Adding and Deleting Elemen document.appendChild(element) :Add an HTML element. document.replaceChild(element) :Replace an HTML element. document.write(text): Write into the HTML output stream.

For example,

document.getElementById() : document.getElementById()- Finding an element by element id

Hello World!

<script> txt=document.getElementById("intro").innerHTML; alert(txt);

Q4.Give the full names of the following acronym: (1) WML (2) DOM (3) DHTML (4) ISP (5) XML (6) HTTP (7) XSL (8) FTP (9) CGI (10) WAP (11) DTD (12) RSS (13) TCP (14) SOAP 1.WML : Wireless Markup language 2.DOM : Document Object Model 3.DHTML : Dynamic Hypertext Markup Language 4.ISP : Internet Service Provider 5.XML:Extensiblemarkup language 6.HTTP:Hypertext transfer protocol 7.XSL: Extensible Stylesheet language 8.FTP:File Transfer Protocol 9.CGI:Common Gateway Interface 10.WAP : Wireless Application Protocol 11.DTD : Document Type Defination 12.RSS: Rich Site Summary 13.TCP : Transmission Control Protocol 14.SOAP : Simple Object Access Protocol

Q5. Explain different type of HTML list with suitable example. Types of list 1.Ordered List 2.Unordered List 3.Description List 1.Ordered List : - Used to display information in a numeric order. -Using type attribute we can set different numbers. - The syntax for creating an ordered list is:
  1. Item 1
  2. Item 2
Where ol = orederlist Li = list item 2.Unordered List : - list items are not listed in a particular order. -The syntax for creating an unordered list is:
  • Item 1
  • Item 2
Where ul = onordered list Li=list item 3.Description List : -Description list is used to describe various terms -The tag is supported in all major browsers. - Definition and Usage -The
tag defines a description list. -The
tag is used in conjunction with
(defines terms/names) and
(describes each term/name).

Syntax :
Coffee
Black hot drink
Milk
White cold drink


Q6. Differentiate following. a.HTML and XHTML b.GET and POST a.HTMLvs XHTML HTML 1.HTML is main markup language for creating web pages and other information that can be displayed in a web browser. 2.Extension : .html, .html 3.Internet Media Type : text/html 4.Type of Format : Document file format 5. Stands for: HyperTextMarkup Language 6. Function: Web pages are written in HTML. 7. Versions: HTML 2, HTML 3.2, HTML 4.0, HTML 5

XHTML 1.XHTML is a family of XML markup language that mirror or extend versions of the widly used HTML language in which web pages are written. 2.Extension : .xhtml , .xml , .html, .htm 3.Internet Media Type :application/xhtml+xml 4.Type of Format: Markup language 5. Stands for: Extensible HyperTextMarkup Language 6. Function: Extended version of HTML that is stricter and XML-based 7. Versions: XHTML 1, XHTML 1.1, XHTML 2, XHTML 5

b.GETvs POST GET 1.Parameter remain in browser history because they are part of the URL. 2.Can be bookmarked. 3.Easier to hack. 4.Only ASCII Characters allowed. 5.GET is less secure compared to the post because data sent is part of the URL.

POST 1.Parameter are nit saved in browser history. 2.Cannot be bookmarked. 3.Difficult to hack 4.Norestriction.Binary Data is also allowed. 5.POST is a little secure than GET because the parameter are not stored ib browser history.

Q.7 what is an HTML form? Discuss the different form attributes and design a simple form to register for a new semester. Ans: An HTML form is a section of a document which contains controls such as text fields, password fields, checkboxes, radio buttons, submit button, menus etc. An HTML form facilitates the user to enter data that is to be sent to the server for processing. HTML forms are required if you want to collect some data from of the site visitor. HTML forms are required if you want to collect some data from of the site visitor. For example,If a user want to purchase some items on internet, he/she must fill the form such as shipping address and credit/debit card details so that item can be sent to the given address. Html form syntax
//input controls e.g. textfield, textarea, radiobutton, button
Attributes: Here are few attributes that’s use in form.  Action  Method  Name Action: After submit the form, details should be go to server side. Action is an attribute through which we can transfer the control to the server side. action=”server_url” method: details go to the server side. Method is an attribute through which method details should go to the server side. It has two values get & post. Name: name attribute gives a name to form which we can use future in javascript.

Register.html: Register

Name :


semester :



Email :



Phone Number :



Pin Code :



Gender: male female
Output:

Q.8 what do you mean by meta tag? Explain with example. Ans:

Metadata is data (information) about data. The <meta> tag provides metadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable. Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata. The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services. <meta> tags always go inside the element. Metadata is always passed as name/value pairs. The content attribute MUST be defined if the name or the http-equiv attribute is defined. If none of these are defined, the content attribute CANNOT be defined. Meta.html <meta charset="UTF-8"> <meta name="description" content="Free Web tutorials"> <meta name="keywords" content="HTML,CSS,XML,JavaScript"> <meta name="author" content="HegeRefsnes">

Hello,User





Output:

Q-9)What is the role of cache and cookies in the browser? ANS: Cache: Web browsers a can cache (store) pages for quick reviewing without having to request them again. Each page has a Time to Live ( TTL), the time it is kept in the cache without going back and reloading it. A browser can be stopped from caching a page, if it support the „http-equiv‟ attribute. To do this value „pragma‟ is assigned to http-equiv attribute. Example –Force browser to ignore the cache page <meta http-equiv=“pragma" content=“no-cache“/> Example -Refresh document every 30 seconds: <meta http-equiv="refresh" content="30“ /> Cookie A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With the help of code we can set and retrieve cookies.

Q-10)How an inline frame be embedded on a page with graphics and text? ANS: The <iframe> tag specifies an inline frame. An inline frame is used to embed another document within the current HTML document. <iframesrc="index.html">

Your browser does not support iframes.



Q.11 EXPLAIN DIFFERENT WEBSITE DESIGNING ISSUES. ANSWER:BROWSER AND OPERATING SYSTEMS  Before writing any web page, you should check compatibility with popular browser.  Different browser may have different view of same page.  Many of old HTML tags( deprecated tags) may not be supported by modern browsers. So watchful before using old version of html.  Technology is moving from HTML to XHTML. Still many users do not use newer version of browser.  Furthermore, Usage of CSS and its compatibility with different browsers need to be assessed before using it.

BANDWIDTH AND CACHE  According to available bandwidth and connection speeds, user will be able to view your web site.  You have to consider such physical constraints while web site designing.  Heavy graphics loaded page may take more time to load at low bandwidth users.  Keep graphics less than 30 kilobytes to make them download reasonably on a home modem.Keep animated gifs to a minimum.  The site home page should load in < 15‐20 seconds with a 28k modem. Hence, the size of all files on the home page should be <60k. DISPLAY RESOLUTION  Display resolution always affect in visualization of web site.  While designing web site, you have to consider possible display resolutions of your expected users client.  Display resolution is measured in terms of pixels. 800 X 600 and 1024 X 786 are common resolutions.  Use relative size to page layout if possible to manage flexible width and height of your pages.  To make flexible design using HTML layout, divide page into no. of columns, where you can set certain columns with variable width.

LOOK AND FEEL  Look and feel of the web site decide the overall appearance of the website. It includes all the design aspects such as website theme, web typography, graphics, visual structure, navigation etc.  Website Theme  Website theme emphasizes on the unification of design that should be reflected in each element of the design such that all pages of website hold together and give the impression of a single unit.  Website theme should reflect the objective of the organization and convey the message of it.  Use logo of the company as theme. Use logo on each page at appropriate location.  Use appropriate color and graphics to create theme which suites company’s domain.

FONT, GRAPHICS AND COLORS  On paper, we are all used to reading serif fonts and Times New Roman.

    

On screens, however, sans‐serif fonts are easier to read. The most readable screen font is Verdana, Century Gothic, Tahoma and Arial. Be careful with the choice of font. Some font might not viewed the same in other browser. Choose simple colors that compliment each other & work on most web browsers. Keep graphics less than 30 kilobytes to make them download reasonably on a home modem.

MAKE YOUR SITE EASY TO NAVIGATE  The visitor should be able to get to any page or link in minimum num of clicks (ideally within 3 mouse clicks) from the home page.  The visitor should always know what site he/she is on.  Lead your visitors in the right direction.  Keep scrolling down to a minimum by keeping individual Web pages short.  Always have links back to your home or major sections.

Q 12 Write the following styles in separate CSS file and also show how to link this CSS file in HTML file and show use of styles. b. The headings should have normal font style and font’s size should be 120% c. Define a class Arial for paragraph which defines font family Arial and font style bold. Apply a background color yellow and apply a background image “apple.jpg”.

Step 1: Create an external style sheet named ex1.css :-

h1,h2,h3 { font-size:120% } p.arial { font-family:Ariel; font-weight:bold; } body { background-color:yellow; background-image:url(apple.jpg); }

Step 2: Create an HTML document which makes use of the external style sheet created in above step.

This text is created using header tag.

This text is also created using header tag.

Now the para is created having the font of type Arial. This text is in bold.

The background is yellow colored having the image of apple over it.



Q 13 Write a JavaScript, that uses a loop, that searches a word in sentence held in an array, returning the index of the word. <script type=”text/javascript”> function Search(form1) { var Sentence=form1.input.value; var pattern=prompt(“Enter the word to be searched for:”,””); alert(pattern); temp=Sentence.split(“ “); for(i=0;i
Enter the sentence


Q 14 What is javascript event? List out the major events and show use of at least one event by writing javascript code.   

Event is activity that represents a change of the state. For example mouse clicks, pressing a particular key of the keyboard represent the events. Such events are called the intrinsic events. Event handler is a script that gets executed in response to these events. Thus event handler enables the web document to respond the user activities through the browser window. Events are specified in lowercase letters and are case sensitives.

List of events: Blur

onblur

Losing the focus

Change

onchange

On occurrence of some change

Click

onclick

Dblclick

ondblclick

When user clicks the mouse button When user double clicks the mouse button

Focus

onfocus

When user acquires the input focus

Keyup

onkeyup

When user releases the key from the keyboard

Keydown

onkeydown

When user presses the keydown

Keypress

onkeypress

When user presses the key

Mousedown

onmousedown

When user clicks the left mouse button

Mouseup

onmouseup

When user releases the left mouse button

Mousemove

onmousemove

When user moves the mouse

Mouseout

onmouseout

Mouseover

onmouseover

When the user moves the mouse away from some element When the user moves