IT 2022 Paper Solution
IT 2022 Paper Solution
Solution
SECTION A
ipconfig– It is used to displays all current TCP/IP network configuration values and
refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System
(DNS) settings. Used without parameters, ipconfig displays Internet Protocol version
4 (IPv4) and IPv6 addresses, subnet mask, and default gateway for all adapters.
A proxy server acts as a gateway between you and the internet. It’s an intermediary
server separating end users from the websites they browse. Proxy servers provide
varying levels of functionality, security, and privacy depending on your use case,
needs, or company policy.
setTimeout() - The setTimeout() method executes a block of code after the specified
time. The method executes the code only once.
The commonly used syntax of JavaScript setTimeout is:
setTimeout(function, milliseconds);
setInterval() - The setInterval() method repeats a block of code at every given timing
event.
The commonly used syntax of JavaScript setInterval is:
setInterval(function, milliseconds);
Any example like given below:
<!DOCTYPEhtml>
<htmllang="en">
<head>
<metacharset="UTF-8">
<metahttp-equiv="X-UA-Compatible"content="IE=edge">
<metaname="viewport"content="width=device-width, initial-scale=1.0">
<title>Use of setinterval and settimeout</title>
<style>
.text {
text-align: center;
}
</style>
</head>
<body>
<h1class="text">SET INTERVAL EXAMPLE</h1>
<divid="background"style="height: 200px;"></div>
<h1class="text">SET TIME OUT EXAMPLE</h1>
if (i>color.length - 1) {
i = 0;
}
}
setInterval(change, 2000);
constpdisplay = document.getElementById("myp");
functionmyMessage() {
pdisplay.innerHTML = "Now the text appears";
console.log("message appeared");
}
setTimeout(myMessage, 15000);
</script>
</body>
</html>
e. Write ANY FOUR differences between Forum and Blog. ( 1+1+1+ 1+ 1) =4
Forum Blog
Forum is User Generated Content. Blog is an Author Generated Content.
Members participate in the discussion to share Author share views and ideas on the
views and ideas. blog topic.
Apart from comments, interaction
The discussions are more real-time provided
with the blogger can have a lag
member content doesn’t need to pass the
depending on the availability of the
moderation queue.
blogger.
For questions, one has to ask the
Can take the form of question and answers. blogger, and he may answer readers’
questions.
Only the author (or in case of a multi-
Any user can ask a question and other experts in the
author blog – authors) responds to
area can answer the question,
readers’ questions.
The responses in the forum may not be from an As a blog author, one tends to reply to
expert in the field and often is the case. questions with thorough research.
Blog authors who get a lot of
Forum answers aren’t from an authority in the
questions from readers are considered
domain.
an authority in the subject matter.
Bloggers tend to build the trust of the
One can’t trust the worthiness of the forum replies. readers and share views and ideas that
are trustworthy.
Blogs are one-to-many discussion
Forums are a many-to-many discussion platform.
platforms, even if you consider guest
Any member can create a discussion, and others
article contribution. Readers express
can reply.
views on the article in comments only.
Forums are tough to manage. One may need to
Blogs, on the other hand, are much
monitor for spam, content, reply to topics to make it
easier to manage.
look active, etc.
Blogs need a lot of time on research
Forums are much easier to generate content. before an author can write about the
topic.
Forums are tough to get rolling. Members will be Blogs, on the other hand, are much
interested in creating discussions only when they easier to start rolling. Even if you
see an active community. In short, members will don’t have an active reader-base, all
create content when they see the others getting their one needs is a motivation to keep
reply or having fruitful discussions. blogging.
Forums contain user-generated queries, which
Blog authors need to answer readers’
means there are chances others will have the same
queries and generate the blog archives
questions. Archives will serve the purpose of SEO
to be able to rank well in Google.
traffic.
Google doesn’t make forum discussion as Blog authors have an edge when it
authoritative content. The trustworthiness of the comes to the authoritativeness and
content is also questionable. trustworthiness of the content.
Forums support social media features like
membership, private messages, visitor messages,
Blog lack social media features.
friends and followers, social groups, member
birthdays, etc
You always need to monitor the forum for
You don’t always need to be blogging.
moderation.
For a blog, it is the blogger who starts
In forums, members are all equal. Anyone can start
the topic, and discussion may continue
a discussion on a topic.
in comments.
g. Write a JavaScript program to Greet the user based on the current time.
3
<html>
<body>
<script>
varwelcome;
vardate = newDate();
varhour = date.getHours();
varminute = date.getMinutes();
varsecond = date.getSeconds();
if (minute<10) {
minute = "0" + minute;
}
if (second<10) {
second = "0" + second;
}
if (hour<12) {
welcome = "good morning";
} elseif (hour<17) {
welcome = "good afternoon";
} else {
welcome = "good evening";
}
document.write("<h2>" + "<font color='red'>" + welcome + "</font>" + "
welcome to our website");
document.write("<br>" + hour + ":" + minute + ":" + second);
</script>
</body>
</html>
In static routing, user-defined routes are In dynamic routing, routes are updated as per
used in the routing table. the changes in network.
Static routing may not follow any Dynamic routing follows protocols like BGP,
specific protocol. RIP and EIGRP.
Static routing does not require any Dynamic routing requires additional resources
additional resources. like memory, bandwidth etc.
i. You need to subnet a network that has 5 subnets, each with at least 16 hosts. Which classful of
the following subnet masks are valid in the above situation?
2
i. 255.255.255.192 -Valid
ii. 255.255.255.224
iii. 255.255.255.240
iv. 255.255.255.248
Subnets are represented by 1 and thus require at least 3 one’s in subnet mask for 5
subnets. Similarly 16 hosts needed so at least 4 zero’s are required in subnet mask.
Various methods can be applied for implementing sessions in cookies such as:
Starting a Session
Ending a Session
Setting a Timeout
Session Security
To transfer data from one program to another or from the server to the client-side, it is
best to convert the JSON object back to a JSON string. For these conversions,
JavaScript provides two functions JSON.parse() &JSON.stringify().
JSON.stringify():
The JSON.stringify() method converts a JavaScript value to a JSON string, optionally
replacing values if a replacer function is specified or optionally including only the
specified properties if a replacer array is specified.
Syntax:
JSON.stringify(value)
JSON.stringify(value, replacer)
JSON.stringify(value, replacer, space)
JSON.parse():
The JSON.parse() method parses a JSON string, constructing the JavaScript value or
object described by the string. An optional reviver function can be provided to
perform a transformation on the resulting object before it is returned.
Syntax:
JSON.parse(text)
JSON.parse(text, reviver)
SECTION B
Answer 2:
a) Crawling: Crawler" (sometimes also called a "robot" or "spider") is a generic term for any
program that is used to automatically discover and scan websites by following links from one
webpage to another. Crawling can take anywhere from a few days to a few weeks.
b) Indexing: Web indexing, or internet indexing, comprises methods for indexing the contents
of a website or of the Internet as a whole. Search engines usually use keywords and
metadata to provide a more useful vocabulary for Internet or onsite searching. For example,
With the increase in the number of periodicals that have articles online, web indexing is also
becoming important for periodical websites.Google can index the content of most types of
pages and files. The most common file types we index include:
Adobe Portable Document Format (.pdf)
Adobe PostScript (.ps)
Google Earth (.kml, .kmz) and many more.
c) Internet Protocols: Internet Protocol is the set of rules required to be followed for sending
data packets from source to destination across different network boundaries. HTTP stands
for Hypertext Transfer Protocol, and is the foundation of data communication for the World
Wide Web, where hypertext documents include hyperlinks to other resources that the user
can easily access.Simple Mail Transfer Protocol (SMTP) is a text-based protocol usually used
by two mail servers to exchange e-mail. File Transfer Protocol (FTP) allows user to transfer
files from one host to another.
d) Internet VS Intranet:
Internet:
Internet is a public network of computers connected simultaneously and can be accessed by
any one and anywhere.
Intranet:
Intranet is the type of internet that is used privately. There are limited users connected to
Intranet and is usually used within an organization.
e) Domain Name Server: When you type an address into a browser and hit Enter, you expect
to arrive at the intended website. Without the Domain Name System (DNS), that wouldn't
happen. Whether simple or very complex, networks worldwide rely on the DNS to connect
client and target.DNS has a number of capabilities, but one of its most fundamental is
translating an easy-to-remember site name into an Internet address (IP).
Answer 3:
Given list
John
Merry
Martian
Ketty
$("ul").prepend("<li>Matt</li>");
$("ul").append("<li>Damon</li>");
var surname=["Jonas","Mathew","Lane","steven","lane","gadot","Hartley"];
$(document).ready(function(){
$("button").click(function(){
i=0;
$("li").each(function(){
$(this).append(surname[i]);
i++;
});
});
});
$("li").addClass("MyName");
$("li").each(function(){
$(this).css("background-color","#333333");
});
$("ul").click(function(){
$("li").css("background-color","blue");
});
Answer 4:
a) The original intention of NAT was to slow the depletion of available IP address space
by allowing many private IP addresses to be represented by some smaller number of
public IP addresses. Network Address Translation allows a single device, such as a
router, to act as an agent between the Internet (or "public network") and a local (or
"private") network.
b) Data can be formatted using JSON. It looks very similar to object literal syntax, but it
is not an object. JSON data looks like the object literal notation, however, it is just
plain text data (not an object).JSON object holds key/value pair. Each key is
represented as a string in JSON and value can be of any type. The keys and values are
separated by colon. Each key/value pair is separated by comma.
{
"name":"Rahul",
"roll number":1001,
"course":"BSC",
"mobile":210021,
"email":"abc@ced.com"
};
Answer 5
Pagination:
Bootstrap pagination is a component used to indicate the existence of a series of related content
across multiple pages and enables navigation across them.
For example:
List Groups:
List Groups are used to display a series of content. We can modify them to support any content as
per our needs. The use of List-Groups is just to display a series or list of content in an organized way.
<p>To do list</p>
<ul class="list-group">
<li class="list-group-item">study</li>
<li class="list-group-item">pay bills</li>
<li class="list-group-item">call mom</li>
<li class="list-group-item">drop an email</li>
</ul>
Panels:
A panel in bootstrap is a bordered box with some padding around its content:
Panels are created with the .panel class, and content inside the panel has a .panel-body class:
<div class="container">
<h2>Basic Panel</h2>
</div>
</div>
Navbars:
A navigation bar is a navigation header that is placed at the top of the page. With Bootstrap, a
navigation bar can extend or collapse, depending on the screen size. A standard navigation bar is
created with <nav class="navbar navbar-default">.
For example:
A dropdown menu is a toggleable menu that allows the user to choose one value from a predefined
list:
For Example:
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" data-
toggle="dropdown">Dropdown Example
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="#">HTML</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">JavaScript</a></li>
</ul>
</div>
(b)
Create Server.js file:
// server.js
const express = require("express");
app.listen(8000, ()=>{
console.log("Server running on port 4000");
});
Register.html:
<!--register.html-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Login and register form with Node.js, Express.js and MySQL</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<div class="container">
<h2>Login and register form with Node.js, Express.js and MySQL</h2>
<h3>Register form</h3>
<form action="/register" method="POST">
<div class="form-group mb-3">
<label>First name</label>
<input type="text" class="form-control" placeholder="First name"
name="firstName">
</div>
<div class="form-group mb-3">
<label>Last name</label>
<input type="text" class="form-control" placeholder="Last name"
name="lastName">
</div>
<div class="form-group mb-3">
<label>Username</label>
<input type="text" class="form-control" placeholder="Username"
name="userName">
</div>
<div class="form-group mb-3">
<label>Password</label>
<input type="password" class="form-control" placeholder="Password"
name="password">
</div>
<div class="d-grid mt-3">
<button type="submit" class="btn btn-primary form-control">Submit</button>
</div>
</form>
</div>
</body>
</html>
Login.html:
<!--login.html-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Login and register form with Node.js, Express.js and MySQL</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<div class="container">
<h2>Login and register form with Node.js, Express.js and MySQL</h2>
<h3>Login form</h3>
<form action="/dashboard" method="POST">
<div class="form-group mb-3">
<label>Username</label>
<input type="text" class="form-control" placeholder="Username"
name="userName">
</div>
<div class="form-group mb-3">
<label>Password</label>
<input type="password" class="form-control" placeholder="Password"
name="password">
</div>
<div class="d-grid mt-3">
<button type="submit" class="btn btn-primary form-control">Submit</button>
</div>
</form>
</div>
</body>
</html>
SQL form:
//session middleware
app.use(sessions({
secret: "thisismysecrctekey",
saveUninitialized:true,
cookie: { maxAge: 1000 * 60 * 60 * 24 }, // 24 hours
resave: false
}));
app.use(cookieParser());
con.connect(function(err) {
if (err){
console.log(err);
};
// checking user already registered or no
con.query(`SELECT * FROM users WHERE username = '${userName}' AND
password = '${password}'`, function(err, result){
if(err){
console.log(err);
};
if(Object.keys(result).length > 0){
res.sendFile(__dirname + '/failReg.html');
}else{
//creating user page in userPage function
function userPage(){
// We create a session for the dashboard (user page) page and save the user data to
this session:
req.session.user = {
firstname: firstName,
lastname: lastName,
username: userName,
password: password
};
res.send(`
<!DOCTYPE html>
<html lang="en">
<head>
<title>Login and register form with Node.js, Express.js and MySQL</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body>
<div class="container">
<h3>Hi, ${req.session.user.firstname} ${req.session.user.lastname}</h3>
<a href="/">Log out</a>
</div>
</body>
</html>
`);
}
// inserting new user data
var sql = `INSERT INTO users (firstname, lastname, username, password)
VALUES ('${firstName}', '${lastName}', '${userName}', '${password}')`;
con.query(sql, function (err, result) {
if (err){
console.log(err);
}else{
// using userPage function for creating user page
userPage();
};
});
});
});
});
app.listen(8000, ()=>{
console.log("Server running on port 4000");
});
Answer 6 A: A HTML program which implements radio button functionality. Step marks
may be given.
B. A HTML program which implements form and also log the inputted value using
JSON and AJAX concepts.
Answer 7. A
What are the various components of an email? Define the mail message format of
SMTP. Also discuss the functionalities of any TWO mail access protocols.
Simple Mail Transfer Protocol (SMTP) is a text-based protocol usually used by two mail
servers to exchange e-mail. Users can then retrieve e-mail from the servers via mail clients
such as Outlook, Eudora, or Pine. SMTP is composed of four key components:
a. Local user or client-end utility known as the mail user agent (MUA)
b. Server known as mail submission agent (MSA)
c. Mail transfer agent (MTA)
d. Mail delivery agent (MDA)
body
o the “message”, ASCII characters only
header
body
blank
line
OR
1. POP3
Post Office Protocol, version 3 (POP3) is simple and limited in functionality. Theclient
POP3 software is installed on the recipient computer; the server POP3 softwareis
installed on the mail server.
Mail access starts with the client when the user needs to download e-mail from
themailbox on the mail server. The client opens a connection to the server on TCP port.It
then sends its user name and password to access the mailbox. The user can then listand
retrieve the mail messages, one by one.
2. IMAP3
Another mail access protocol is Internet Mail Access Protocol, version 4 (IMAP4).IMAP4 is
similar to POP3, but it has more features; IMAP4 is more powerful and morecomplex.IMAP4
provides the following extra functions:
A user can check the e-mail header prior to downloading.
A user can search the contents of the e-mail for a specific string of characters priorto
downloading.
A user can partially download e-mail. This is especially useful if bandwidth is
limitedand the e-mail contains multimedia with high bandwidth requirements.
A user can create, delete, or rename mailboxes on the mail server.
A user can create a hierarchy of mailboxes in a folder for e-mail storage.
Answer 7. B
Syntax:
element.addEventListener(event, listener, useCapture);
<!DOCTYPEhtml>
<html>
<body>
<buttonid="try">Click here to show text</button>
<h1id="text"></h1>
<script>
document.getElementById("try").addEventListener("click", function(){
document.getElementById("text").innerText = "Now the text appears";
});
</script>
</body>
</html>