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

Gujarat Technological University Be - Semester-Vi (New) - Examination - Summer 2019 GTU Paper Solution

This document contains sample questions and answers related to a GTU exam on topics like DOM, TCP, XML, HTML, CSS, JavaScript and XSLT. Key concepts covered include defining common web acronyms, using frames in HTML, creating HTML forms to check prime numbers, differences between HTML and XHTML, creating HTML tables, issues in web design, JavaScript events and examples, using meta tags and search engines, comparing inline, embedded and external CSS styles, components of XML like elements and attributes, and functions of XSLT elements like value-of, for-each and sort.

Uploaded by

sv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
192 views16 pages

Gujarat Technological University Be - Semester-Vi (New) - Examination - Summer 2019 GTU Paper Solution

This document contains sample questions and answers related to a GTU exam on topics like DOM, TCP, XML, HTML, CSS, JavaScript and XSLT. Key concepts covered include defining common web acronyms, using frames in HTML, creating HTML forms to check prime numbers, differences between HTML and XHTML, creating HTML tables, issues in web design, JavaScript events and examples, using meta tags and search engines, comparing inline, embedded and external CSS styles, components of XML like elements and attributes, and functions of XSLT elements like value-of, for-each and sort.

Uploaded by

sv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

GUJARAT TECHNOLOGICAL UNIVERSITY

BE - SEMESTER–VI(NEW) – EXAMINATION – SUMMER 2019


GTU Paper Solution

Q.1 (a) Give full name of followings:


1) DOM 2) TCP 3) RSS 4) ISP 5) XSD 6) HTTP
Answer
1. DOM : Document Object Model
2. TCP :Transmission Control Protocol/Internet Protocol.
3. RSS : Really Simple Syndication
4. ISP : Internet Service Provider
5. XSD : XML Schema Definition
6. HTTP : HyperText Transfer
(b) What are frames? List out its advantages and disadvantages.
Answer
➢ Frame : A structure that allows for the dividing of a Web page into two or more
independent parts.
➢ Frames are often used to keep one or more parts of a Web page static while another
part of the page is scrolled or loaded.
➢ Benefits can include faster page loading and the ability to keep a navigation bar
present on the visible part of the page.
Advantage :

● The main advantage of frames is that it allows the user to view multiple documents
within a single Web page.
● It is possible to load pages from different servers in a single frameset.

Disadvantages
● Some smaller devices cannot cope with frames often because their screen is not big
enough to be divided up.
● Sometimes your page will be displayed differently on different computers due to
different screen resolutions.
● The browser's back button might not work as the user hopes.
● There are still few browsers that do not support frame technology.

(c) Create HTML Page with JavaScript which takes Integer number as input and tells
whether the number is Prime or Not.
Answer
Q.2 (a) XHTML is a stricter language than HTML. Justify.
Answer
Following are the reason why XHTML is stricter language.
1. An XHTML document must include an XHTML Doctype Declaration
2. In an XHTML document, you cannot nest elements improperly.
3. Unlike HTML, where we can sometimes omit the closing tag, in XHTML the
closing tag is required always and everywhere
4. Lowercase and uppercase tags are distinguished in XHTML.
5. You must write XHTML attributes in lower case
6. You must put the attribute values in quotes
(b) Write HTML code to display following irregular table.

Answer
Following is the code to create table :
(c) Describe the web design issues.
Answer
Following are the issues in web designing :
Browser and Operating System

● Web pages are written using HTML and viewed in browser window.
● Different browsers and their versions greatly affect the way a page is rendered.
● Different versions of HTML supports different tags.
● Same browser may work differently on different OS and hardware platform.
● So testing it on different browser on different os is important.
Bandwidth and Cache

● Users use different connection speed i.e. Bandwidth. Connection speed plays an
important role in designing webpages.
● User has no patience to wait longer than 10-15 seconds.
Outdated design

● The layout of a page has evolved over the past decade. These days the best sites
break up content into smaller, digestible bits.
Website accessibility

● The Web is basically designed to work for all people, irrespective of the culture,
language, location, or physical or mental ability.
● A good designer should ensure that the website is not only accessible across the
world but also its various features are fully functional as well.
Compatibility

● With the introduction of different browsers, designers are constantly facing the
challenge of building a website which is compatible with almost all the major
browsers.
● After designing a website, it should be tested on all browsers to ensure that the
website is completely functional.

Navigational structure

● Navigational structure is one of the vital aspects of any website, as the usability of
the website is based on an excellent navigational structure.
● Designers have to ensure that they provide a proper navigational structure to the
users.

OR
(c) What do you mean by event in JavaScript? Give at least two examples of events
with their handling.
● Event Handling is a software routine that processes actions, such as keystrokes and
mouse movements.
● It is the receipt of an event at some event handler from an event producer and
subsequent processes.
Functions of Event Handling
● Event Handling identifies where an event should be forwarded.
● It makes the forward event.
● It receives the forwarded event.
● It takes some kind of appropriate action in response, such as writing to a log,
sending an error or recovery routine or sending a message.
● The event handler may ultimately forward the event to an event consumer.

Event Handlers
Event Description
Handler

onAbort It executes when the user aborts loading an image.

onBlur It executes when the input focus leaves the field of a text, textarea or a select
option.

onChange It executes when the input focus exits the field after the user modifies its text.

onClick In this, a function is called when an object in a button is clicked, a link is


pushed, a checkbox is checked or an image map is selected. It can return false
to cancel the action.

Example : Simple Program on onload() Event handler


Q.3 (a) What is meta tag? How it is useful by search engine?
Answer
1. Meat tag :Meta tags provide information about the webpage in the HTML of the
document. This information is called "metadata" and while it is not displayed on the
page itself, it can be read by search engines and web crawlers.
2. Search engines such as Google use metadata from meta tags to understand
additional information about the webpage. They can use this information for
ranking purposes, to display snippets in search results, and sometimes they can
ignore meta tags.
3. Example of meta tags include the <title> and <description> elements.

(b) What is Cascading Style Sheet? Compare inline, embedded and external style
sheet with example.
Answer
CSS :Cascading Style Sheets (CSS) is a markup language responsible for how your web
pages will look like. It controls the colors, fonts, and layouts of your website elements.

The Difference Between Inline, External and Internal CSS Styles


Internal CSS
● Internal or embedded CSS requires you to add <style> tag in the <head> section of
your HTML document.
● This CSS style is an effective method of styling a single page.
● However, using this style for multiple pages is time-consuming as you need to put
CSS rules to every page of your website.
● Example :
<style type="text/css">
body
{
background-color: blue;
}
</style>

External CSS
● With external CSS, you’ll link your web pages to an external .css file, which can be
created by any text editor in your device
● This CSS type is a more efficient method, especially for styling a large website. By
editing one .css file, you can change your entire site at once.
● Follow these steps to use external CSS:
○ Create a new .css file with the text editor, and add the style rules.
○ In the <head> section of your HTML sheet, add a reference to your external
.css file right after <title> tag:

(c) Explain the key components of the XML with suitable examples.
Answer
The most basic components of an XML document are elements, attributes, and comments.
XML documents must contain one root element that is the parent of all other elements

XML Elements

XML elements can be defined as building blocks of an XML. Elements can behave as
containers to hold text, elements, attributes, media objects or all of these.
Each XML document contains one or more elements, the scope of which are either
delimited by start and end tags, or for empty elements, by an empty-element tag.
Following is the syntax to write an XML element :
<element-name attribute1 attribute2>
....content
</element-name>
where,
● element-name is the name of the element. The name its case in the start and end
tags must match.
● attribute1, attribute2 are attributes of the element separated by white spaces. An
attribute defines a property of the element. It associates a name with a value, which
is a string of characters
Following rules are required to be followed for XML elements
● An element name can contain any alphanumeric characters. The only punctuation
mark allowed in names are the hyphen (-), under-score (_) and period (.).
● Names are case sensitive. For example, Address, address, and ADDRESS are different
names.
● Start and end tags of an element must be identical.
● An element, which is a container, can contain text or elements as seen in the above
example.

XML Attributes

● XML elements can have attributes, just like HTML.


● Attributes are designed to contain data related to a specific element.
● Attribute values must always be quoted. Either single or double quotes can be used.
● For a person's gender, the <person> element can be written like this:
<person gender="female">
● If the attribute value itself contains double quotes you can use single quotes, like in
this example:
<gangster name='George "Shotgun" Ziegler'>
OR
Q.3 (a) Define the following with reference to XSL: 1) value-of 2) for-each 3) sort
Answer
● Value-of
○ The <xsl:value-of> element is used to extract the value of a selected node.
● For-each
○ The <xsl:for-each> element allows you to do looping in XSLT.
● Sort
○ The <xsl:sort> element is used to sort the output
(b) List and explain various list tags in HTML with example.
Answer
Refer answer 3-b(december-19).

(c) Write and explain rules for well formed XML document.
Answer
A Well-formed XML document is a document that conforms to the XML syntax rules.
An XML document is called well-formed if it satisfies certain rules, specified by the W3C.

These rules are:

● A well-formed XML document must have a corresponding end tag for all of its start
tags.
● Nesting of elements within each other in an XML document must be proper. For
example, <tutorial><topic>XML</topic></tutorial> is a correct way of nesting but
<tutorial><topic>XML</tutorial></topic> is not.
● In each element two attributes must not have the same value. For example, <tutorial
id="001"><topic>XML</topic></tutorial> is right,but <tutorial id="001"
id="w3r"><topic>XML</topic></tutorial> is incorrect.
● Markup characters must be properly specified. For example, <tutorial
id="001"><topic>XML</topic></tutorial> is right, not <tutorial id="001"
id="w3r"><topic>XML</topic></tutorial>.
● An XML document can contain only one root element. So, the root element of an xml
document is an element which is present only once in an xml document and it does
not appear as a child element within any other element.

Q.4 (a) List features of Web 2.0.


Answer
1. Major features of Web 2.0 allow users to collectively classify and find dynamic
information that flows two ways between site owner and site user by means of
evaluation, comments, and reviews.
2. Site users can add content for others to see. Web 2.0 sites provide APIs to allow
automated usage by an app or mashup like it provides location metadata that can be
processed by a simple browser tool.
(b) Briefly explain following: 1) Web server 2) Blogs
Answer
Web Server
Web server is a computer where the web content is stored. Basically web server is used to
host the web sites but there exists other web servers also such as gaming, storage, FTP,
email etc.
Web server respond to the client request in either of the following two ways:
● Sending the file to the client associated with the requested URL.
● Generating response by invoking a script and communicating with database
Key points :
● 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.
● If the requested web page is not found, web server will the send an HTTP
response:Error 404 Not found.
● 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.

Blogs
● A blog (a shortened version of “weblog”) is an online journal or informational
website displaying information in the reverse chronological order, with the latest
posts appearing first, at the top.
● It is a platform where a writer or a group of writers share their views on an
individual subject.
(c) Develop XML File for book record and also write a DTD and XSL for it.
Answer
XML document (bookstore.xml)
<bookstore>
<book>
<title>web programming</title>
<author>chrisbates</author>
<ISBN>123-456-789</ISBN>
<publisher>wiley</publisher>
<edition>3</edition>
<price>350</price>
</book>
<book>
<title>internet worldwideweb</title>
<author>ditel&amp;ditel</author>
<ISBN>123-456-781</ISBN>
<publisher>person</publisher>
<edition>3</edition>
<price>450</price>
</book>
</bookstore>

XML document Validation using DTD


DTD document (bookstore.dtd)

<?xml version="1.0" encoding="UTF-8"?>


<!ELEMENT bookstore (book+)>
<!ELEMENT book (title,author,ISBN,publisher,edition,price)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT ISBN (#PCDATA)>
<!ELEMENT publisher (#PCDATA)>
<!ELEMENT edition (#PCDATA)>
<!ELEMENT price (#PCDATA)>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


<xsl:template match="/">
<html>
<body>
<h2> My Books collection</h2>
<table border="1">
<tr bgcolor="red">
<th align="left">title</th>
<th align="left">author</th>
</tr>
<xsl:for-each select="bookstore/book">
<tr>
<td><xsl:value-of select="title"/></td>
<xsl:choose>
<xsl:when test="price &gt; 30">
<td bgcolor="yellow"><xsl:value-of select="author"/></td>
</xsl:when>
<xsl:when test="price &gt; 10">
<td bgcolor="magneta"><xsl:value-of select="author"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="author"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Q.4 (a) What is FTP? Mention functionality of various FTP commands in brief.
Answer

● FTP stands for File transfer protocol.

● FTP is a standard internet protocol provided by TCP/IP used for transmitting the files
from one host to another.

● It is mainly used for transferring the web page files from their creator to the
computer that acts as a server for other computers on the internet.

● It is also used for downloading the files to computer from other servers.
FTP Command Description of Command

! Escape to the Shell

$ Execute macro

? print local help information

account Send account command to remote server

append Append to a file

ascii set ascii transfer type

beep beep when command completed

binary Set Binary transfer type

bye Terminate ftp session and exit

case toggle mget upper/lower case id mapping

cd Change remote working directory

(b) Briefly explain following: 1) SOAP 2) Web Feeds


Answer
SOAP
SOAP is an acronym for Simple Object Access Protocol.
It is an XML-based messaging protocol for exchanging information among computers. SOAP
is an application of the XML specification.
● SOAP is a communication protocol designed to communicate via Internet.
● SOAP can extend HTTP for XML messaging.
● SOAP provides data transport for Web services.
● SOAP can exchange complete documents or call a remote procedure.
● SOAP can be used for broadcasting a message.
● SOAP is platform- and language-independent.

Web Feeds
● A web feed (or news feed) is a data format used for providing users with frequently
updated content.
● Content distributors syndicate a web feed, thereby allowing users to subscribe to it.
● Making a collection of web feeds accessible in one spot is known as aggregation,
which is performed by an aggregator.
● A web feed is also sometimes referred to as a syndicated feed.

(c) Write a Java Script to read data from XML File and print it in tabular manner.
Answer

Q.5 (a) Explain cookie in PHP with example.


Answer
Refer answer 5-b (december 19).

(b) Explain index and associative arrays in PHP.


Answer
Index array in php :
● PHP indexed array is an array which is represented by an index number by default.
● All elements of array are represented by an index number which starts from 0.
● PHP indexed array can store numbers, strings or any object.
● PHP indexed array is also known as numeric array.
There are two ways to define indexed array:
● 1st way:
$size=array("Big","Medium","Short");
● 2nd way:
$size[0]="Big";
$size[1]="Medium";
$size[2]="Short";

Associative array in php - Refer answer 4 - b (december 19).

(c) Write a PHP program to store user registration (user-name, address, Date
of Birth, age, pan card, gender) with mysql database.
Answer
Refer answer 5-c (december 19).
Q.5 (a) Explain session in PHP with example.
Answer
What is a PHP Session?
● A session is a way to store information (in variables) to be used across multiple
pages.
● Unlike a cookie, the information is not stored on the users computer.
● When you work with an application, you open it, do some changes, and then you
close it. This is much like a Session.
● The computer knows who you are. It knows when you start the application and
when you end.
● But on the internet there is one problem: the web server does not know who you are
or what you do, because the HTTP address doesn't maintain state.
● Session variables solve this problem by storing user information to be used across
multiple pages (e.g. username, favorite color, etc). By default, session variables last
until the user closes the browser.
● So; Session variables hold information about one single user, and are available to all
pages in one application.
● A session is started with the session_start() function.
● Session variables are set with the PHP global variable: $_SESSION.
● all session variable values are stored in the global $_SESSION variable

(b) Explain the use of following arrays in PHP.1) $_REQUEST [ ] 2) $_SERVER[ ]


Answer

1)PHP $_REQUEST

PHP $_REQUEST is a PHP super global variable which is used to collect data
after submitting an HTML form.

2)PHP $_SERVER

$_SERVER is a PHP super global variable which holds information about


headers, paths, and script locations.

Example :
<?php
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo $_SERVER['SERVER_NAME'];
echo "<br>";
echo $_SERVER['HTTP_HOST'];
?>

The following table lists the most important elements that can go inside
$_SERVER:
Element/Code Description

$_SERVER['PHP_SELF'] Returns the filename of the currently executing


script

$_SERVER['SERVER_NAME'] Returns the name of the host server

$_SERVER['HTTP_HOST'] Returns the Host header from the current


request

2)

(c) Write PHP program to print following pattern:


1
01
101
0101
10101
Answer
<?php
$n=5;
for ($row = 0; $row < $n; $row++)
{
for ($col = 0;$col <= $row; $col++)
{
if ((($row + $col) % 2) == 0)
echo("1");
else
echo("0");
echo("\t");
}
echo("<br>");
}
?>

You might also like