0% found this document useful (0 votes)
35 views7 pages

Unit 3 Imp Web Technology

Most important questions for upcoming examination

Uploaded by

pathak639326
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)
35 views7 pages

Unit 3 Imp Web Technology

Most important questions for upcoming examination

Uploaded by

pathak639326
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/ 7

Unit-3

Q1. What is AJAX ? Explain its advantage and its working.Explain with example.

Ans:

AJAX:

AJAX stands for Asynchronous JavaScript and XML.

It is a set of web development techniques that allows web applications to


communicate with a server asynchronously without interfering with the current state of
the page.

This means that parts of a web page can be updated without having to reload the entire
page.
Example of AJAX:

<!DOCTYPE html>

<html>

<body>

<div id=“demo”>

<h2>The XMLHttpRequest Object</h2>

<button type=“button” onclick=“loadDoc()”>Change Content</

button>

</div>

<script>

function loadDoc() {

var xhttp = new XMLHttpRequest();

xhttp.onreadystatechange = function() {

if (this.readyState == 4 && this.status == 200) {

d o c u m e n t . g e tE l e m e n tB y Id (“ d e m o ”) . i n n e r H T M L =

this.responseText;

};

xhttp.open(“GET”, “ajax_info.txt”, true);

xhttp.send();

</script>

</body>

</html>

Output:
Q2.

Design a JavaScript program to display the current day and time in the

following format.

Today is : Monday.

Current time is : 11 AM : 50 : 58

Ans:

<!DOCTYPE html>

<html>

<head>

<title>Display Current Day and Time</title>

<style>

body {

font-family: Arial, sans-serif;

margin: 50px;

.time-container {

font-size: 20px;

</style>

</head>

<body>

<div class="time-container">

<p id="day"></p>
<p id="time"></p>

</div>

<script>

function displayDateTime() {

var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",


"Friday", "Saturday"];

var now = new Date();

var day = days[now.getDay()];

var hours = now.getHours();

var minutes = now.getMinutes();

var seconds = now.getSeconds();

var ampm = hours >= 12 ? 'PM' : 'AM';

hours = hours % 12;

hours = hours ? hours : 12; // the hour '0' should be '12'

// Add leading zeros to minutes and seconds

minutes = minutes < 10 ? '0' + minutes : minutes;

seconds = seconds < 10 ? '0' + seconds : seconds;

var dayString = "Today is : " + day + ".";

var timeString = "Current time is : " + hours + " " + ampm + " : " + minutes + " : "
+ seconds;

document.getElementById('day').textContent = dayString;

document.getElementById('time').textContent = timeString;

// Update the time every second


setInterval(displayDateTime, 1000);

// Initial call to display the time immediately

displayDateTime();

</script>

</body>

</html>

Output:

Today is : Tuesday.

Current time is : 8 PM : 18 :35

Q3. Explain the following terms in Brief;-

(i) Scoket Programming

(ii) TCP/IP Server

Ans:

(i) Socket Programming:


Socket Programming refers to the practice of using network sockets to enable
communication between different processes over a network.

It is fundamental to network programming and involves using APIs provided by


the operating system to create, configure, and manage connections between
software applications.

Socket: A socket is an endpoint for sending or receiving data across a computer


network. It is defined by an IP address and a port number.

Types of Sockets:

Stream Sockets (TCP):

Provide reliable, connection-oriented communication. Data is read in a continuous


stream, ensuring no data is lost or out of order.
Datagram Sockets (UDP):

Provide connectionless, unreliable communication. Data is sent as discrete


packets, which may arrive out of order, be duplicated, or not arrive at all.

Common Use Cases:

Web servers and clients

File transfer applications

Chat applications

Real-time multiplayer games

ii) TCP/IP Server

TCP/IP Server refers to a server that uses the TCP/IP protocol suite to
communicate over a network.

TCP/IP (Transmission Control Protocol/Internet Protocol) is the foundational


protocol suite for the internet and most local networks, providing end-to-end
communication specifying how data should be packetized, addressed, transmitted,
routed, and received.

TCP (Transmission Control Protocol):

Ensures reliable, ordered, and error-checked delivery of data between applications


running on hosts communicating over an IP network.

IP (Internet Protocol):

Responsible for addressing and routing packets of data so that they can travel
across networks and arrive at the correct destination.

Key Characteristics:

Reliability:

TCP ensures that data sent from a source to a destination is delivered accurately
and in the same order it was sent.

Connection-Oriented:

A TCP server establishes a connection with the client before data transfer begins,
ensuring a secure and reliable communication channel.

Error Detection and Recovery:


TCP uses checksums, acknowledgments, and retransmissions to detect and correct
errors that occur during data transmission.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy