Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Past paper 2015 2nd Annual

Q1: What are the pros and cons of managing session using cookies on client side and managing
session on server side?

The Session and cookies are used by different websites for storing user's data across different pages of the
site. Both session and cookies are important as they keep track of the information provided by a visitor for
different purposes. The main difference between both of them is that sessions are saved on the server-side,
whereas cookies are saved on the user's browser or client-side. Apart from this, there are also various other
differences between both.

Server Side Session Client Side Session

o A session is used to temporarily store o A cookie is a small text file that is stored
the information on the server to be on the user's computer. The maximum
used across multiple pages of the file size of a cookie is 4KB. It is also known
website. It is the total time used for an as an HTTP cookie, web cookie, or internet
activity. The user session starts when he Cookie. Whenever a user visits a website
logs-in to a particular network application for the first time, the site sends packets of
and ends when the user logs out from the data in the form of a cookie to the user's
application or shutdowns the system. computer.
o When we work on an application over the o The cookies help the websites to keep
internet, the webserver doesn't know the track of the user's browsing history or cart
user because the HTTP protocol does not information when they visit their sites.
maintain the state. The information o It stores only the "String" data type.
provided by the user on one page of the o The information stored within cookies is
application (Let's say Home) will not be not secure because this information is
transferred to another page. To remove stored in text-format on the client-side,
this limitation, sessions are used. Session which can be read by anyone.
gets started whenever a visitor first enters
o We can enable or disable the cookies as
a website.
per the requirement.
o The user information is stored in session
o The cookies generated by a user are only
variables, and these variables can store
be shown to them, and no other user can
any type of value or data type of an Object.
see those cookies.
o Session values are much secured as
o Cookies are created and shared between
these are stored in binary form or
the server and browser with the help of an
encrypted form and can only be decrypted
HTTP header.
at the server. The session values are
o The path where the cookies are saved is
automatically removed when the user
decided by the browser, as Internet
shutdowns the system or logout from the
application. To store the values
permanently, we need to store them in the explorer usually stored them in Temporal
database. Internet File Folder.
o Each session is unique for each user, and o When we visit YouTube channel and
any number of sessions can be used in an search for some songs, next time
application; there is no limitation to it. whenever we visit YouTube, cookies read
o The user is identified with the help our browsing history and shows similar
of sessionID, which is a unique number songs or last played songs.
saved inside the server. It is saved as
a cookie, form field, or URL.

Q. 3 What is the role of HTTP in protocol WWW? Also describe the difference between Get and Post Method
in HTTP?

The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative,
hypermedia information systems. This is the foundation for data communication for the World Wide Web (i.e.
internet) since 1990. HTTP is a generic and stateless protocol which can be used for other purposes as well
using extensions of its request methods, error codes, and headers.

HTTP is the primary protocol for transmission of information across the Internet.

Information is exchanged between clients and servers in the form of Hypertext documents, from which HTTP
gets its name. Hypertext is structured text that uses logical links, or hyperlinks, between nodes containing text.
Hypertext documents can be manipulated using the Hypertext Markup Language (HTML). Using HTTP and
HTML, clients can request different kinds of content (such as text, images, video, and application data) from
web and application servers that host the content.

Get VS Post Methods in HTTP

Both GET and POST method is used to transfer data from client to server in HTTP.

GET Method POST Method

1) In case of Get request, only limited amount In case of post request, large amount of data can be
of data can be sent because data is sent in sent because data is sent in body.
header.

2) Get request is not secured because data is Post request is secured because data is not exposed
exposed in URL bar. in URL bar.

3) Get request can be bookmarked. Post request cannot be bookmarked.

4) Get request is idempotent . It means Post request is non-idempotent.


second request will be ignored until response of
first request is delivered
5) Get request is more efficient and used Post request is less efficient and used less than get.
more than Post.

Past paper 2015 Annual


Q. What is MVC Architecture? Explain the benefits of MVC Architecture.

MVC Architecture

The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main
logical components: the model, the view, and the controller. Each of these components are built to handle
specific development aspects of an application. MVC is one of the most frequently used industry-standard web
development framework to create scalable and extensible projects.

MVC Components
Following are the components of MVC −

Model
The Model component corresponds to all the data-related logic that the user works with. This can
represent either the data that is being transferred between the View and Controller components or any
other business logic-related data. For example, a Customer object will retrieve the customer
information from the database, manipulate it and update it data back to the database or use it to render
data.

View
The View component is used for all the UI logic of the application. For example, the Customer view
will include all the UI components such as text boxes, dropdowns, etc. that the final user interacts with.

Controller
Controllers act as an interface between Model and View components to process all the business logic
and incoming requests, manipulate data using the Model component and interact with the Views to
render the final output. For example, the Customer controller will handle all the interactions and inputs
from the Customer View and update the database using the Customer Model. The same controller will
be used to view the Customer data.
Advantages and Features of MVC Architecture
MVC provides the following features −
• Ideal for developing complex but lightweight applications.
• Provides an extensible and pluggable framework, which can be easily replaced and customized.
• Utilizes the component-based design of the application by logically dividing it into Model, View,
and Controller components. This enables the developers to manage the complexity of large-
scale projects and work on individual components.
• MVC structure enhances the test-driven development and testability of the application, since all
the components can be designed interface-based and tested using mock objects. Hence, MVC
Framework is ideal for projects with large team of web developers.
• Supports all the existing vast ASP.NET functionalities, such as Authorization and
Authentication, Master Pages, Data Binding, User Controls, Memberships, ASP.NET Routing,
etc.
• Does not use the concept of View State (which is present in ASP.NET). This helps in building
applications, which are lightweight and gives full control to the developers.
Q. What is the meaning and purpose of CSMA/CD?

Carrier Sense Multiple Access with Collision Detection (CSMA/CD) is a network protocol for carrier
transmission that operates in the Medium Access Control (MAC) layer. It senses or listens whether the shared
channel for transmission is busy or not, and defers transmissions until the channel is free. The collision
detection technology detects collisions by sensing transmissions from other stations. On detection of a
collision, the station stops transmitting, sends a jam signal, and then waits for a random time interval before
retransmission.

Algorithms
The algorithm of CSMA/CD is:
• When a frame is ready, the transmitting station checks whether the channel is idle or busy.
• If the channel is busy, the station waits until the channel becomes idle.
• If the channel is idle, the station starts transmitting and continually monitors the channel to detect
collision.
• If a collision is detected, the station starts the collision resolution algorithm.
• The station resets the retransmission counters and completes frame transmission.
The algorithm of Collision Resolution is:
• The station continues transmission of the current frame for a specified time along with a jam
signal, to ensure that all the other stations detect collision.
• The station increments the retransmission counter.
• If the maximum number of retransmission attempts is reached, then the station aborts
transmission.
• Otherwise, the station waits for a backoff period which is generally a function of the number of
collisions and restart main algorithm.
The following flowchart summarizes the algorithms:
Q4: What is role/purpose of each of the following in web development:

A) Applet

B) HTTP

C) ODBC

D) IDEs

Applet

Web development refers to building website and deploying on the web. Web development requires use of
scripting languages both at the server end as well as at client end.

An applet is a Java program that runs in a Web browser. An applet can be a fully functional Java application
because it has the entire Java API at its disposal.

Applets are designed to be embedded within an HTML page. Applets are used to make the web
site more dynamic and entertaining.
Important points :
1. All applets are sub-classes (either directly or indirectly) of java.applet.Applet class.
2. Applets are not stand-alone programs. Instead, they run within either a web
browser or an applet viewer. JDK provides a standard applet viewer tool called
applet viewer.
3. In general, execution of an applet does not begin at main() method.
4. Output of an applet window is not performed by System.out.println(). Rather it is
handled with various AWT methods, such as drawstring().

HTTP
The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative,
hypermedia information systems. This is the foundation for data communication for the World Wide
Web (i.e. internet) since 1990. HTTP is a generic and stateless protocol which can be used for other
purposes as well using extensions of its request methods, error codes, and headers.
Basically, HTTP is a TCP/IP based communication protocol, that is used to deliver data (HTML files,
image files, query results, etc.) on the World Wide Web. The default port is TCP 80, but other ports
can be used as well. It provides a standardized way for computers to communicate with each other.
HTTP specification specifies how clients' request data will be constructed and sent to the server, and
how the servers respond to these requests.

Basic Features
There are three basic features that make HTTP a simple but powerful protocol:
• HTTP is connectionless: The HTTP client, i.e., a browser initiates an HTTP request and after
a request is made, the client waits for the response. The server processes the request and
sends a response back after which client disconnect the connection. So client and server knows
about each other during current request and response only. Further requests are made on new
connection like client and server are new to each other.
• HTTP is media independent: It means, any type of data can be sent by HTTP as long as both
the client and the server know how to handle the data content. It is required for the client as
well as the server to specify the content type using appropriate MIME-type.
• HTTP is stateless: As mentioned above, HTTP is connectionless and it is a direct result of
HTTP being a stateless protocol. The server and client are aware of each other only during a
current request. Afterwards, both of them forget about each other. Due to this nature of the
protocol, neither the client nor the browser can retain information between different requests
across the web pages.

ODBC

Open Database Connectivity (ODBC) is an open standard application programming


interface (API) that allows application programmers to access any database.

The main proponent and supplier of ODBC programming support is Microsoft, but ODBC
is based on and closely aligned with The Open Group standard Structured Query
Language (SQL) Call-Level Interface (CLI). The Open Group is sponsored by many major
vendors, including Oracle, IBM and Hewlett Packard Enterprise, and this consortium
develops and manufactures The Open Group Architecture Framework (TOGAF). In
addition to CLI specifications from The Open Group, ODBC also aligns with the ISO/IEC
for database APIs.

How ODBC works


ODBC consists of four components, working together to enable functions. ODBC allows
programs to use SQL requests that access databases without knowing the proprietary
interfaces to the databases. ODBC handles the SQL request and converts it into a request
each database system understands.

The four different components of ODBC are:

• Application: Processes and calls the ODBC functions and submits the SQL
statements;

• Driver manager: Loads drivers for each application;

• Driver: Handles ODBC function calls, and then submits each SQL request to a
data source; and

• Data source: The data being accessed and its database management system
(DBMS) OS.
IDEs
An integrated development environment (IDE) is a software application that provides comprehensive facilities
to computer programmers for software development.

An IDE normally consists of at least:


• A source code editor
• Build automation tools
• Debugger

Some IDEs, such as NetBeans and Eclipse, contain the necessary compiler, interpreter, or both; others, such
as SharpDevelop and Lazarus, do not.

Past paper 2016 Annual


Q4: a) What is uniform resource locator? Explain its component in detail?

URL stands for Uniform Resource Locator, and is used to specify addresses on the World Wide Web.
A URL is the fundamental network identification for any resource connected to the web (e.g., hypertext
pages, images, and sound files).
A URL will have the following format −
protocol://hostname/other_information
e.g.
http://www.pu.edu.pk
https://www.google.com.pk
The protocol specifies how information is transferred from a link. The protocol used for web resources
is HyperText Transfer Protocol (HTTP). Other protocols compatible with most web browsers include
FTP, telnet, newsgroups, and Gopher.
The protocol is followed by a colon, two slashes, and then the domain name. The domain name is the
computer on which the resource is located.
Links to particular files or subdirectories may be further specified after the domain name. The directory
names are separated by single forward slashes.

b) What are the benefits of MVC ? Explain it.

AS Above
Past paper 2017 2nd Annual
Q. Define Web Programming and explain what is its important factors are?

Web programming refers to the writing, markup and coding involved in Web development, which
includes Web content, Web client and server scripting and network security. The most common
languages used for Web programming are XML, HTML, JavaScript, Perl 5 and PHP.

Web programming is different from just programming, which requires interdisciplinary


knowledge on the application area, client and server scripting, and database technology.

Web programming can be briefly categorized into client and server coding. The client
side needs programming related to accessing data from users and providing information.
It also needs to ensure there are enough plug ins to enrich user experience in a graphic
user interface, including security measures.

1. To improve user experience and related functionalities on the client side,


JavaScript is usually used. It is an excellent client-side platform for designing and
implementing Web applications.
2. HTML5 and CSS3 supports most of the client-side functionality provided by other
application frameworks.

The server side needs programming mostly related to data retrieval, security and
performance. Some of the tools used here include ASP, Lotus Notes, PHP, Java and
MySQL. There are certain tools/platforms that aid in both client- and server-side
programming.

Past paper 2018 Annual


Q5: Develop at least three CSS template for menu design and table design?

1-

<!DOCTYPE html>

<html>

<head>

<style>

#customers {

font-family: Arial, Helvetica, sans-serif;

border-collapse: collapse;

width: 100%;

}
#customers td, #customers th {

border: 1px solid #ddd;

padding: 8px;

#customers tr:nth-child(even){background-color: #f2f2f2;}

#customers tr:hover {background-color: #ddd;}

#customers th {

padding-top: 12px;

padding-bottom: 12px;

text-align: left;

background-color: #04AA6D;

color: white;

</style>

</head>

<body>

<h1>A Fancy Table</h1>

<table id="customers">

<tr>

<th>Company</th>

<th>Contact</th>
<th>Country</th>

</tr>

<tr>

<td>Alfreds Futterkiste</td>

<td>Maria Anders</td>

<td>Germany</td>

</tr>

<tr>

<td>Berglunds snabbköp</td>

<td>Christina Berglund</td>

<td>Sweden</td>

</tr>

<tr>

<td>Centro comercial Moctezuma</td>

<td>Francisco Chang</td>

<td>Mexico</td>

</tr>

<tr>

<td>Ernst Handel</td>

<td>Roland Mendel</td>

<td>Austria</td>

</tr>

<tr>

<td>Island Trading</td>

<td>Helen Bennett</td>

<td>UK</td>

</tr>
<tr>

<td>Königlich Essen</td>

<td>Philip Cramer</td>

<td>Germany</td>

</tr>

<tr>

<td>Laughing Bacchus Winecellars</td>

<td>Yoshi Tannamuri</td>

<td>Canada</td>

</tr>

<tr>

<td>Magazzini Alimentari Riuniti</td>

<td>Giovanni Rovelli</td>

<td>Italy</td>

</tr>

<tr>

<td>North/South</td>

<td>Simon Crowther</td>

<td>UK</td>

</tr>

<tr>

<td>Paris spécialités</td>

<td>Marie Bertrand</td>

<td>France</td>

</tr>

</table>
</body>

</html>

<!DOCTYPE html>

<html>

<head>

<style>

ul {

list-style-type: none;

margin: 0;

padding: 0;

overflow: hidden;

li {

float: left;

li a {

display: block;

padding: 8px;

background-color: #dddddd;

</style>

</head>

<body>
<ul>

<li><a href="#home">Home</a></li>

<li><a href="#news">News</a></li>

<li><a href="#contact">Contact</a></li>

<li><a href="#about">About</a></li>

</ul>

<p><b>Note:</b> If a !DOCTYPE is not specified, floating items can produce unexpected results.</p>

<p>A background color is added to the links to show the link area. The whole link area is clickable, not just the
text.</p>

<p><b>Note:</b> overflow:hidden is added to the ul element to prevent li elements from going outside of the
list.</p>

</body>

</html>

<!DOCTYPE html>

<html>

<head>

<style>

body {

margin: 0;

ul {

list-style-type: none;

margin: 0;
padding: 0;

width: 25%;

background-color: #f1f1f1;

position: fixed;

height: 100%;

overflow: auto;

li a {

display: block;

color: #000;

padding: 8px 16px;

text-decoration: none;

li a.active {

background-color: #04AA6D;

color: white;

li a:hover:not(.active) {

background-color: #555;

color: white;

</style>

</head>

<body>
<ul>

<li><a class="active" href="#home">Home</a></li>

<li><a href="#news">News</a></li>

<li><a href="#contact">Contact</a></li>

<li><a href="#about">About</a></li>

</ul>

<div style="margin-left:25%;padding:1px 16px;height:1000px;">

<h2>Fixed Full-height Side Nav</h2>

<h3>Try to scroll this area, and see how the sidenav sticks to the page</h3>

<p>Notice that this div element has a left margin of 25%. This is because the side navigation is set to 25%
width. If you remove the margin, the sidenav will overlay/sit on top of this div.</p>

<p>Also notice that we have set overflow:auto to sidenav. This will add a scrollbar when the sidenav is too
long (for example if it has over 50 links inside of it).</p>

<p>Some text..</p>

<p>Some text..</p>

<p>Some text..</p>

<p>Some text..</p>

<p>Some text..</p>

<p>Some text..</p>

<p>Some text..</p>

</div>

</body>

</html>
Q6: Define Web Engineering. Draw a diagram to categorize web applications.

Web engineering focuses on the methodologies, techniques, and tools that are the foundation of Web application
development and which support their design, development, evolution, and evaluation. Web application development
has certain characteristics that make it different from traditional software, information system, or computer
application development.
Web engineering is multidisciplinary and encompasses contributions from diverse areas: systems
analysis and design, software engineering, hypermedia/hypertext engineering, requirements engineering, human-
computer interaction, user interface, information engineering, information indexing and retrieval, testing, modelling
and simulation, project management, and graphic design and presentation. Web engineering is neither a clone nor a
subset of software engineering, although both involve programming and software development. While Web
Engineering uses software engineering principles, it encompasses new approaches, methodologies, tools,
techniques, and guidelines to meet the unique requirements of Web-based applications.
Categories of Web Applications

1. Static web applications


This is the most basic type of web application and has little content or room for movement.
These web applications are often created using CSS and HTML and can handle animated
content such as GIFS and videos. Modifying the content included on static web
applications can be tricky, and in order to make any serious changes, you’ll need to
download the HTML code, as well as modify and upload it to the server. Further, if the
app wasn’t designed by yourself or your company alone, you will likely need to seek out
the person who planned and designed the static web application.
A common example of static web apps includes an online portfolio or digital curriculums.
In the same vein, you could think of a landing page as a static web application, with the
contact and relative information displayed.

2. Dynamic web applications


This style web app is more technically complex in comparison with the aforementioned
static application. In the case of dynamic web applications, they are in place to hold
databases or forums with a constant ability to update or change the available information.
This is usually as a result of a CMS or Content Management System.

A CMS will generally accompany a dynamic web app so that administrators or


users can easily update or edit the content that is included. Many different web
languages can be used with dynamic web applications. However, PHP and ASP are the
most common, as they are the easiest to understand when it comes to structuring content.
Editing the content is easier with dynamic web applications and upgrading the content
itself can be fairly simple. However, the backend or programming part can be more
complex depending on the server and other factors. With this said, design elements can
easily be modified to match your personal preferences.

3- E-commerce apps
If you’ve ever bought something online, you’re likely familiar with one of the most common
web applications, and that’s e-commerce. If a web application is in the form of a store or
shop, this type of development is classified as e-commerce. This app development
process is more complex than the two aforementioned, as it requires a way to
collect electronic payments. Orders, payments as well as posting and deleting items will
need to be maintained by way of a management panel coded into the website by a
developer. Also, in many cases, a mobile application of equivalence will need to be
considered. If you’re curious about getting started in the e-commerce business, consider
checking out our article here.
4- Portal web application
A portal web application simply refers to an application in which many different sections or
categories as accessible by way of a home page. This type of page can range from
forums, chats, emails, a browser page and so on.

5- Animated web application


For web applications to be animated, they must be compatible with FLASH technology.
This can be complicated for those without any experience with these technologies.
However, if you’re looking for a web application with fairly modern capabilities or any
movement whatsoever, then working with FLASH is essential.
Unfortunately, there are a few drawbacks involved when with this technology, as it will not
work with SEO optimization as well as web positioning since Google and other search
engines are unable to read its information properly. So, if you’re just starting out with your
business website or developing a landing page, it may be important to wait for the later
stages.

OTHER TOPICS:
1. User Interface

2. Website Development Methodology.

3. Web Publishing

4. ODBC.

AS Above

You might also like