Professional Documents
Culture Documents
Internet Technology Questions THEORY
Internet Technology Questions THEORY
Sample Question
Topic-HTML, Web Technology, CSS, JavaScript
Q. Topic Page
No. Nos
1. State different type of lists with example in HTML 02 - 08
2. State the use of <pre> and <del> tags 09 - 09
3. Usage of hover, active, focus dynamic pseudo classes 10 - 11
4. Difference between class selector and id selector is CSS 12 - 12
5. Given coding example for inline style of CSS 13 - 13
6. Distinguish between GET and POST method in HTML 14 - 18
7. & 8. Features of scripting language. Difference with mark-up 19 - 20
9. Why XML is superior to HTML. 21 - 22
10. Static & Dynamic webpages; External CSS; META Tag 23 - 27
11. Different technology for making dynamic webpage 28 - 29
12. Role of JavaScript in client-side data validation 30 - 30
13. HTML DOM 31 - 33
14. HTML image map 34 - 41
15. JavaScript program to validate email id 42 - 43
16. basic tags of a HTML 43 - 43
17. Cookies and Session 44 - 45
18. Client-side scripting V/S Server-side scripting 45 - 46
19. CSS Types 46 - 46
20. Section where we can write Java Script 47 - 48
21. Frame 49 - 50
22. CGI 50 - 53
HTML Lists help to display a list of information semantically. There are three types of lists
in HTML:
• Unordered list or Bulleted list (ul)
• Ordered list or Numbered list (ol)
• Description list or Definition list (dl)
Syntax:
<ul>List of Items</ul>
Example of HTML Unordered List
<!DOCTYPE html>
<html>
<head>
<title>HTML Unordered List</title>
</head>
<body>
<h2>List of Fruits</h2>
<ul>
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
<li>Grapes</li>
<li>Orange</li>
</ul>
</body>
</html>
Output:
Syntax:
<ol>List of Items</ol>
Example of HTML Ordered List
<!DOCTYPE html>
<html>
<head>
<title>HTML Ordered List</title>
</head>
<body>
<h2>List of Fruits</h2>
<ol>
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
<li>Grapes</li>
<li>Orange</li>
</ol>
</body>
</html>
Output:
Instead of numbers, you can mark your list items with the alphabet: A, B, C or a,b,c, or
roman numerals: i, ii, iii, etc. You can do this by using the type attribute in the <ol> tag. Let’s
explore how to order lists with alphabets and roman numbers.
Here is an example to show the use of Upper case letters to list the items.
<!DOCTYPE html>
<html>
<head>
<title>HTML Ordered List</title>
</head>
<body>
<h2>List of Fruits</h2>
<ol type="A">
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
</ol>
</body>
</html>
Output:
Here is an example to show the use of Lower case letters to list the items.
<!DOCTYPE html>
<html>
<head>
<title>HTML Ordered List</title>
</head>
<body>
<h2>List of Fruits</h2>
<ol type="a">
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
</ol>
</body>
Here is an example to show the use of Roman numerals to list the items.
<!DOCTYPE html>
<html>
<head>
<title>HTML Ordered List</title>
</head>
<body>
<h2>List of Fruits</h2>
<ol type="i">
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
</ol>
</body>
</html>
Output:
Output:
Example:
<!DOCTYPE html>
<html>
<body>
<h1>The pre element</h1>
<pre>
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks
</pre>
</body>
</html>
O/P:
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both spaces and
line breaks
The <del> tag defines text that has been deleted from a document. Browsers
will usually strike a line through deleted text.
Example:
Syntax
selector:pseudo-class {
property: value;
}
Anchor Pseudo-classes
Example
<html>
<head>
<style>
/* unvisited link */
a:link {
color: red;
}
/* visited link */
a:visited {
color: green;
}
/* selected link */
a:active {
color: blue;
}
• a:hover MUST come after a:link and a:visited in the CSS definition in order to be
effective.
• a:active MUST come after a:hover in the CSS definition in order to be effective.
The difference between Class and ID: A Class name can be used by multiple
HTML elements, while an ID name must only be used by one HTML element
within the page.
Class selector
The class selector selects elements with a specific class attribute. It matches all
the HTML elements based on the contents of their class attribute. The . symbol,
along with the class name, is used to select the desired class.
Syntax
ID selector
The ID selector matches an element based on the value of its id attribute. In
order for the element to be selected, its ID attribute must exactly match the value
given in the selector. The # symbol and the id of the HTML element name are
used to select the desired element.
Syntax
Using CSS
CSS can be added to HTML documents in 3 ways:
The most common way to add CSS, is to keep the styles in external CSS
files. However, in this tutorial we will use inline and internal styles, because
this is easier to demonstrate, and easier for you to try it yourself.
Inline CSS
An inline CSS is used to apply a unique style to a single HTML element.
The following example sets the text color of the <h1> element to blue, and
the text color of the <p> element to red:
Example
<h1 style="color:blue;">A Blue Heading</h1>
What is HTTP?
The Hypertext Transfer Protocol (HTTP) is designed to enable communications
between clients and servers.
Example: A client (browser) sends an HTTP request to the server; then the
server returns a response to the client. The response contains status
information about the request and may also contain the requested content.
HTTP Methods
• GET
• POST
• PUT
• HEAD
• DELETE
• PATCH
• OPTIONS
• CONNECT
• TRACE
The two most common HTTP methods are: GET and POST.
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
The data sent to the server with POST is stored in the request body of the
HTTP request:
name1=value1&name2=value2
GET POST
Restrictions on Yes, when sending data, the GET method adds the No restrictions
data length data to the URL; and the length of a URL is limited
(maximum URL length is 2048 characters)
The difference between POST and PUT is that PUT requests are idempotent.
That is, calling the same PUT request multiple times will always produce the
same result. In contrast, calling a POST request repeatedly have side effects
of creating the same resource multiple times.
In other words, if GET /users returns a list of users, then HEAD /users will
make the same request but will not return the list of users.
HEAD requests are useful for checking what a GET request will return before
actually making a GET request - like before downloading a large file or
response body.
8.
scripting language:
That is because they are considerably easier to learn and use than
traditional languages. This means that you can quickly implement the
scripts you need without them requiring a lot of time and resources to be
invested in them.
All they have to do is learn them and implement their capabilities into their
structure. They are all open-source, which means anybody can
contribute to their development on a global scale.
Scripting Language: As the name suggest, it’s all about giving the script to
perform some certain task. Scripting languages are basically the subcategory
of programming languages which is used to give guidance to another program
or we can say to control another program, so it also involves instructions. It
basically connects one language to one another languages and doesn’t work
standalone. Javascript, PHP, Perl, Python, VBScript these all are the
examples of scripting language. Scripting languages need to be interpreted
(Scanning the code line by line, not like compiler in one go) instead of
compiled. There is no scope of compiler in scripting languages. Scripting
languages are most widely used to create a website.
XML stands for eXtensible Markup Language and the full form of HTML is
Hypertext Markup Language.
The key difference between HTML and XML is that HTML displays data and
describes the structure of a webpage, whereas XML stores and transfers
data. XML is a standard language which can define other computer
languages, but HTML is a predefined language with its own implications.
HTML XML
HTML stands for Hyper Text XML stands for extensible Markup
Markup Language. Language.
HTML is static in nature. XML is dynamic in nature.
XML provides framework to define
HTML is a markup language. markup languages.
HTML can ignore small
errors. XML does not allow errors.
HTML is not Case sensitive. XML is Case sensitive.
HTML tags are predefined
tags. XML tags are user defined tags.
There are limited number of
tags in HTML. XML tags are extensible.
HTML does not preserve
white spaces. White space can be preserved in XML.
HTML tags are used for XML tags are used for describing the
displaying the data. data not for displaying.
In HTML, closing tags are
not necessary. In XML, closing tags are necessary.
HTML is used to display the
data. XML is used to store data.
HTML does not carry data it XML carries the data to and from
just display it. database.
HTML offers native object IN XML , the objects are expressed by
support. conventions using attributes.
XML document size is relatively large
as the approach of formatting
HTML document size is
and the codes both are lengthy.
relatively small.
Example:
• html
<!DOCTYPE html>
<html>
<head>
<title>IT</title>
</head>
<body>
<h1>Internet Technology</h1>
</body>
</html>
Example:
• xml
Output:
EM4/1
TECHNO
1234567890
Benefits
• Little everyday maintenance. The content remains the same
until it is updated.
• Faster loading speed. The website doesn’t have to contact the
back-end system every time a web page loads.
• Accommodates any kind of user traffic
Disadvantages
• Usually lack components such as logins and real time
notifications.
• User interactivity is limited. This discourages user retention.
• Can be time consuming and prone to technical errors. Each
time a new component is added, the entire website must be rebuilt
and redeployed to the server.
Benefits
• Easy to add new elements. Adding new content to the website
as dynamic websites can be updated easily and quickly
• Easy to redesign entire website. Site-wide changes to design
can be made instantly. If you want a new colour theme or choice
of font, it’s a lot easier to change this on a dynamic website.
Usually one click is made and the whole website has the change,
unlike a static website where each page would have to be changed
individually.
• More interactive. A dynamic website can allow for personalised
user experience. Logging into an account and personalised product
suggestions are some great ways to incorporate user
personalisation.
Disadvantages
• Prone to slow load times. The server processes user input and
then renders the result page.
• Can be costly. Creating a dynamic website requires technically
skilled programmers who understand how to build a website.
• Database and server must be purchased
External Styles
External style sheets are the most common method of applying styles to a
website. Most modern websites use an external stylesheet to apply site-
wide styles to the whole website.
External styles refer to creating a separate file that contains all style
information. This file is then linked to from as many HTML pages as you
like. This will often be the whole website.
To add an external stylesheet to a web page, use the <link> tag, providing
the URL of the style sheet in the href attribute, as well as rel="stylesheet".
For the following example, I've taken the styles from the above (embedded)
example, moved them to an external style sheet, then linked to that file.
<!DOCTYPE html>
<html>
<head>
<title>My Example</title>
<link rel="stylesheet" href="/css/tutorial/example.css">
</head>
<body>
<h1>Embedded Styles</h1>
<p id="intro">Allow you to define styles for the whole
document.</p>
<p class="colorful">This has a style applied via a
class.</p>
</body>
</html>
<meta> tags always go inside the <head> element, and are typically used
to specify character set, page description, keywords, author of the
document, and viewport settings.
There is a method to let web designers take control over the viewport (the
user's visible area of a web page), through the <meta> tag
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<p>All meta information goes in the head section...</p>
</body>
</html>
O/P:-
Web pages that use server-side scripting are often created with the help of
server-side languages such as PHP, Perl, ASP, ASP.NET, JSP,
ColdFusion and other languages. These server-side languages typically
use the Common Gateway Interface (CGI) to produce dynamic web pages.
Angular:
Features of Angular:
ReactJS:
Features of React.js:
• Speed: Since the developer can write code for an individual part of
the application that doesn’t affect any other part of the code, it results
in boosting the development process.
• Flexibility: Compared to other frameworks, ReactJS tends to be
more flexible due to its modular framework.
• Reusable components: One of the main advantages of using
ReactJS is its ability to reuse components. Developers can save time
as they do not have to write a variety of different codes for the same
features. Additionally, any changes made to one part of the
application will not affect other parts.
Laravel Framework:
Features of Laravel:
WordPress:
Features of WordPress:
JavaScript Example
function validateForm() {
let x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
When a web page is loaded, the browser creates a Document Object Model
of the page.
Example
var myElement = document.getElementById("intro");
If the element is found, the method will return the element as an object (in
myElement).
Example
var x = document.getElementsByTagName("p");
This example finds the element with id="main", and then finds all <p>
elements inside "main":
Example
var x = document.getElementById("main");
var y = x.getElementsByTagName("p");
Example
var x = document.querySelectorAll("p.intro");
With HTML image maps, you can create clickable areas on an image.
Image Maps
The HTML <map> tag defines an image map. An image map is an image with
clickable areas. The areas are defined with one or more <area> tags.
Try to click on the computer, phone, or the cup of coffee in the image below:
Example
Here is the HTML source code for the image map above:
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer" href="comput
er.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.h
tm">
<area shape="circle" coords="337,300,44" alt="Coffee" href="coffee.ht
To create an image map you need an image, and some HTML code that
describes the clickable areas.
The Image
The image is inserted using the <img> tag. The only difference from other
images is that you must add a usemap attribute:
The usemap value starts with a hash tag # followed by the name of the image
map, and is used to create a relationship between the image and the image
map.
The <map> element is used to create an image map, and is linked to the
image by using the required name attribute:
<map name="workmap">
The name attribute must have the same value as the <img>'s usemap attribute
.
The Areas
Then, add the clickable areas.
Shape
You must define the shape of the clickable area, and you can choose one of
these values:
You must also define some coordinates to be able to place the clickable area
onto the image.
Shape="rect"
The coordinates for shape="rect" come in pairs, one for the x-axis and one
for the y-axis.
So, the coordinates 34,44 is located 34 pixels from the left margin and 44
pixels from the top:
Example
<area shape="rect" coords="34, 44, 270, 350" href="computer.htm">
This is the area that becomes clickable and will send the user to the page
"computer.htm":
337,300
44 pixels
This is the area that becomes clickable and will send the user to the page
"coffee.htm":
Shape="poly"
The shape="poly" contains several coordinate points, which creates a shape
formed with straight lines (a polygon).
How can we make the croissant in the image below become a clickable link?
The coordinates come in pairs, one for the x-axis and one for the y-axis:
Example
<area shape="poly" coords="140,121,181,116,204,160,204,222,191,270,140,
329,85,355,58,352,37,322,40,259,103,161,128,147" href="croissant.htm">
This is the area that becomes clickable and will send the user to the page
"croissant.htm":
Example
Here, we use the onclick attribute to execute a JavaScript function when the
area is clicked:
<map name="workmap">
<area shape="circle" coords="337,300,44" href="coffee.htm" onclick="m
yFunction()">
</map>
<script>
function myFunction() {
alert("You clicked the coffee cup!");
}
</script>
function ValidateEmail(mail)
{
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emailAddr.value))
{
return (true)
}
alert("You have entered an invalid email address!")
return (false)
}
JavaScript Code
function ValidateEmail(inputText)
{
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(inputText.value.match(mailformat))
{
alert("Valid email address!");
COMPILED BY: TMSL 42
document.form1.text1.focus();
return true;
}
else
{
alert("You have entered an invalid email address!");
document.form1.text1.focus();
return false;
}
}
CSS Code
li {list-style-type: none;
font-size: 16pt;
}
.mail {
margin: auto;
padding-top: 10px;
padding-bottom: 10px;
width: 400px;
background : #D8F1F8;
border: 1px soild silver;
}
.mail h2 {
margin-left: 38px;
}
input {
font-size: 20pt;
}
input:focus, textarea:focus{
background-color: lightyellow;
}
input submit {
font-size: 12pt;
}
.rq {
color: #FF0000;
font-size: 10pt;
}
Cookie Session
19. What are the different ways of adding style (CSS) to a webpage?
For example, a function can be called when an event occurs, like when the
user clicks a button.
JavaScript in <head>
Example
<!DOCTYPE html>
<html>
<body>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph changed.";
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h1>The iframe element</h1>
<iframe src="https://www.TMSL.com" title=" Engineering College">
</iframe>
</body>
</html>
• 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.
• The concern that older browsers do not support frames can be addressed
using the <noframe> tag. This tag provides a section in an HTML
document to include alternative content for browsers without support
for frames. However, it requires that the Web designer provide two
formats for one page.
Features of CGI:
Advantages of CGI:
• The advanced tasks are currently a lot easier to perform in CGI than in
Java.
• It is always easier to use the code already written than to write your
own.
• CGI specifies that the programs can be written in any language, and
on any platform, as long as they conform to the specification.
• CGI-based counters and CGI code to perform simple tasks are available
in plenty.
The script interpreter include a file from the file system and sends the
i content to the web browser.
The script files need to use the reserved filename extension of cgi, for the
HTTP server's script interpreter to recognize and process the files
accordingly.
Application Example
t <script language=JavaScript>
t function changeConfirm(f){
t f.submit();
t }
t </script></head>
i pg_header.inc
t <tr bgcolor=#aaccff>
t <th width=40%>Item</th>
t <th width=60%>Setting</th></tr>
t </font></table>
t </p></form>
i pg_footer.inc
i pg_header.inc
i pg_footer.inc
This is how the generated web page looks like, with the dynamically
generated items in the Setting column: