2018-19
SEMSESTER – 1
(a) Prepare a document called lessonscript.doc, the document on any topic must have
minimum 5 pages similar to the lesson scripts provided to you.
Solution:
Computer: Computer is an electronic device which performs arithmetic and logical operations
and process data into information.
Characteristics of computers:
Automatic: Computers are automatic machines because once started on a job, they
carry on, until the job is finished, normally without any human intervention.
Speed: A computer is a very fast device. It can perform in few seconds, the amount of
work that a human being can do in an entire year.
Accuracy: The accuracy of computer is consistently high and the degree of accuracy of a
particular computer depends upon its design.
Diligence: Unlike human beings, a computer is free from monotony, tiredness and lack
of concentration. It can continuously work for hours, without creating any error and
without grumbling.
Versatility: A computer is capable of performing almost any task, if the task can be
reduced to a series of logical steps.
CONTROL UNIT
ARITHMETIC
AND LOGICAL
UNIT
CPU
(Central Processing Unit)
All the major calculations and comparisons performed by a computer are carried out inside its
CPU.
The CPU is also responsible for activating and controlling the operations of other units of the
computer system.
Control Unit: It selects and interprets program instructions and then sees that they are
executed. It manages and coordinates the entire computer system including the input and
output units. It obtains instructions stored in the main memory, interprets the instructions and
issue signals which causes other units of the system to execute them.
Arithmetic and Logical unit: It is the place where the actual execution of the instructions takes
place, during the data processing operation. It involves the arithmetic operations like addition,
subtraction, multiplication, division and logic operation such as less than, greater than, equal
to.
Memory: Every computer has a storage space which is known as primary storage or simple
memory or main memory. It is a temporary storage area, which is built into the computer
hardware and in which the instructions and data of the program resides, mainly when the
program is being executed.
Primary Memory is accessible directly by the processing unit. RAM is an example of the primary
memory.
Secondary Memory such as floppy disks, magnetic disks etc are located outside the computer.
Cache Memory is commonly used for minimizing the memory processor speed mismatch. It is
extremely fast, small memory between CPU and main memory whose access time is closer to
the processing speed of the CPU. It acts as a high speed buffer between the CPU and main
memory.
Input Devices: An input device is an electromechanical device, which accepts the data from the
outside world and translates them into a form which the computer can interpret. They can
broadly classified into the following categories.
Keyboard devices
Point and draw devices: Mouse, Trackball, Joystick, Electronic pen, Touch screen.
Data scanning devices: Image scanner, OCR (optical character recognition) device, OMR
(optical mark reader), Bar code reader, MICR (magnetic ink character recognition).
Digitizer
Electronic card reader
Voice recognition devices
Vision Input System
Output Devices: An output device is an electrochemical device which accepts the data from a
computer and translates them into a form, which is suitable for use by the outside world (the
users). They are broadly classified into following categories:
Monitors
Printers: Dot-Matrix printers, Inkjet printers, Drum printers, laser printers.
Plotters: Drum plotter, Flatbed plotter.
Screen Image Projector
Voice Response Systems: Speech Synthesizer.
Computer Hardware:
Hardware is the term given to the machinery and the various individual pieces of the
equipment. It refers to the physical devices of a computer system. The input, storage,
processing, controlling, and output devices are hardware.
Computer Software:
The term software refers to the set of computer programs, procedures, and associated
documents which describe the programs and how they are to be used. There are two types of
software:
System Software: It is a set of one or more programs, designed to control and extend
the processing capabilities of a computer system. Examples: Operating systems,
compliers, interpreters, linkers, loaders and device drivers etc.
Application Software: It is a set of one or more programs, designed to solve a specific
problem or do a specific task.
Examples: Word processing software, spreadsheets, graphical software, entertainment
software and presentation software.
Types of computers:
Analog Computers: They use the process of measurement of continuously varying quantities
such as voltage and current for its operations.
Digital Computers: They use the process of counting for its operations. By default a computer
refers to a digital computer.
Depending upon the computation speed, memory capability and accuracy the computers are
named as personal, mainframe and super computers.
Personal Computers (PCs) are less expensive and easy to handle and maintain, have limited
speed, memory and accuracy compared to mainframe and super computers. Examples: IBM.
Mainframe computers are powerful with more speed, memory and accuracy. They are of high
initial cost and high maintenance cost. They are used in weather forecasting, satellite orbit
determination etc.
(b) Write a letter called letter.doc to the co-coordinator PGDCA asking to send the lesson
scripts as early as possible.
Solution:
The Coordinator
PGDCA Department
Respected Sir/Madam,
I am student of PGDCA for the batch year 2018-19. I have been enrolled for PGDCA course
through distance mode (USOL). My enrollment no is…………... I have not received the lesson
scripts of the above course till today.
You are humbly requested to send the lesson scripts of PGDCA as early as possible so that I can
make my comfortable time schedule. I shall be very thankful to you for this act of kindness.
Yours faithfully
Daljeet Kaur
PGDCA (USOL)
Problem 2
(a) Prepare pay slip (using MS Excel) for employees of an organization. The employee
details must include employee code, name, father’s name, age, and address, date of
joining, permanent or temporary. The pay slip must include Basic pay, dearness
allowance, city allowance etc. The destruction must include insurance, loan advance etc.
Compute net pay.
(b) Compute and display the retirement date assuming retirement age is 60 years.
Solution:
Problem 3
Solution:
Type “ ls –l testfile.txt”
Output: “ –rw-r- - r - -“
Output: “-rw-r-xr-x”
(b) To display the numbers of characters, words and lines in the file.
Solution:
Output:
(b) to find the sum, product and average of any N integers.
Solution:
read a b c d
sum=`expr $a + $b + $c + $d`
avg=`expr $sum / 4`
dec=`expr $sum % 4`
product=`expr $a \* $b \* $c \* $d`
echo Sum=$sum
echo Average=$avg.$dec
echo Product=$product
Output:
(c) to display the user names, along with the processes they created.
Solution:
ps -U pgdca4
Output:
ASSIGNMENT
SUBJECT: PGD 08
PRACTICAL RDBMS LAB
Consider the following tables.
1. List the employees arranged department number wise and then by name.
2. List all designation coded from EMPPLOYEE omitting duplicates.
3. Who is the highly paid employee in the company?
4. Which managers have salary between Rs. 4000 and Rs. 5000?
5. List all managers who are not in dept_no ‘01’ and whose name begin with ‘G’.
6. Which clerks were hired in or after Mar-2000?
7. Which employees, when starting their careers, either were not programmers first or had
starting salaries of least Rs. 5000?
8. What is the maximum, minimum, and average salary of male & female employees?
9. List the name, annual salary, commission, and total annual income for each employee
arranged in descending order of their income.
10. List the employees who have the same job as that of ‘Surinder’?
11. Which women employees earn more than average salary of men?
12. What is the name of employee Sonia’s department manager?
13. Which employees have ever got promotion into a managerial job? Show the EmpNo,
Name and current job?
Solution:
CREATE TABLE EMPLOYEE (EMPNO number, NAME varchar(100), SEX varchar(1), DESIG_CODE
number, SALARY number, COMMISSIC varchar(100), DEPTNO number);
insert into employee values (1, 'Sunil', 'M', 50, 20000,2600,104);
insert into employee values (2, 'Sweety', 'F', 60, 30000,1000,103);
insert into employee values (3, 'Happy', 'M', 60, 25000,300,103);
insert into employee values (4, 'Gurveer', 'M', 45, 21000,4000,101);
insert into employee values (5, 'Neha', 'F', 30, 23000,2300,106);
insert into employee values (6, 'Preety', 'F', 30, 10000,2100,105);
CREATE TABLE EMPHISTORY (EMPNO number, FROM_DATE date, TO_DATE date, TO_DEP
varchar(100), FROM_DESIG varchar(100), PROMO_FLAG varchar(1), SALARY number);
insert into EMPHISTORY values (1, '1-Feb-14', '1-Feb-15', 'chemistry', 'Assistant', 'N', 15000);
insert into EMPHISTORY values (2, '1-Sep-12', '4-Feb-14', 'botany', 'Teacher', 'Y', 25000);
insert into EMPHISTORY values (3, '2-Aug-13', '7-Mar-15', 'law', 'Staff', 'Y', 10000);
insert into EMPHISTORY values (4, '5-mar-14', '5-Aug-15', 'chemistry', 'Assistant', 'N', 20000);
insert into EMPHISTORY values (5, '1-Apr-14', '10-Apr-15', 'physics', 'Supervisor', 'N', 40000);
insert into EMPHISTORY values (6, '1-Feb-12', '11-Apr-15', 'law', 'Teacher', 'Y', 30000);
Solution:
#include<stdio.h>
#include<conio.h>
Int oddum(int);
Void main()
Int n,sum;
clrscr();
scanf(“%d”,&n);
if(n>=1)
sum=oddsum(n);
Else
getch();
int oddsum(int m)
Int I,res;
res=0;
for(i=1;i<m;i++)
If(i%2==1)
res=res+I;
return(res);
}
Output:
Problem 2
Write a function in C with name magic and the input parameters A and n. A is an integer matrix
of order n. The function should check if the matrix A fulfills the conditions for being a magic
square. It should return the magic number if A is “magic”. Otherwise zero should be returned.
The function should be able to handle matrices declared
int matA [10] [10]
int magic (intA [] [10], intn)
Example of a magic square of order 3 with the magic number 24
i.e. all row sums, all column sums and both the diagonal sums should be equal yo say that the
matrix is a magic square.
Solution:
#include<stdio.h>
#include<conio.h>
void main()
int matA[10][10];
int I,j,k,res;
clrscr();
scanf(“%d”,&k);
for(i=0;i<k;i++)
printf(“\n”);
for (j=0;j<k;j++)
{
scanf(“%d”,&matA[i][j]);
res=magic(matA,k);
if(res==0)
else
getch();
int p,q,row,col;
int dial=0;
int diar=0;
for(p=0;p<n;p++)
row=0;col=0;
for(q=0;q<n;q++)
{
row=row+mat[p][q];
col=col+mat[q][p];
if(p==q)
dial=dial+mat[p][q];
if((p+q)==(n-1))
diar=diar+mat[p][q];
if(row==dial&col==diar)
return diar;
else
return 0;
}
Output:
Problem 3
#include<stdio.h>
#include<conio.h>
int c;
c=x+*y;
x=c+1;
*y=c+1;
c=c=1;
void main()
int a,b;
int *c;
a=1;
b=2;
c=&b;
clrscr();
mixtra(a,&b);
Output:
b) mixtra (b, &a);
#include<stdio.h>
#include<conio.h>
int c;
c=x+*y;
x=c+1;
*y=c+1;
c=c=1;
void main()
int a,b;
int *c;
a=1;
b=2;
c=&b;
clrscr();
mixtra(a,&b);
getch();
}
Output:
c) mixtra (a, &a);
#include<stdio.h>
#include<conio.h>
int c;
c=x+*y;
x=c+1;
*y=c+1;
C=c=1;
void main()
int a,b;
int *c;
a=1;
b=2;
c=&b;
clrscr();
mixtra(a,&a);
getch();
}
Output:
d) mixtra (a,c);
#include<stdio.h>
#include<conio.h>
int c;
c=x+*y;
x=c+1;
*y=c+1;
C=c=1;
void main()
int a,b;
int *c;
a=1;
b=2;
c=&b;
clrscr();
mixtra(a,c);
getch();
}
Output:
Problem 4
Explain what the recursive function below does. Do not describe, row by row, what the function
does, rather you should explain what problem the function solves.
void secret (int number)
{
Assert (munber >=0);
If (number)
secret (number/2)
printf (“%d”, number %2);
}
Illustrate your explanation by showing what happens when the function is called by secret (12).
Solution:
#include<stdio.h>
#include<conio.h>
#include<assert.h>
void secret(int);
void main()
int n;
clrscr();
n=12;
secret(n);
getch();
assert(number>=0);
if(number)
secret(number/2);
printf(“%d”,number%2);
Output:
Problem 5
A palindrome is a string that sounds the same independent of it is read from left to right or
from right to left. The examples of the palindrome are ; “abba”, “otto”, “123321”, “I am ma I”,
“C”, “Anna”. Write a function in C++ that takes a string as the single parameter and returns the
integer 1 if the string is a palindrome. Otherwise zero should be returned. Extend this program
to read a paragraph from a file and then find out the palindromes in that paragraphs.
Solution:
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
char a[20];
int res;
clrscr();
cout<<”Enter a string:”;
gets(a);
res==palindrome(a);
if(res==1)
else
{
cout<<”\n Entered string is not a palindrome”;
getch();
return 0;
char c[20];
strcpy(c,p);
strrev(c);
if((strcmp(b,c))==0)
return 1;
else
return 0;
}
Output:
Problem 6
Write a program in C++ to create the following report. Create a class student and add functions
setData, getData and showData to set, read, and display values. The output should appear as
shown below:
List of PGDCA students
Roll# Name Marks1 Marks2 Total Marks
001 Akash 70 67 137
002 Aneesh 71 34 105
003 Baltej 57 43 100
Solution:
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
class student
int roll,marks1,marks2,tmarks;
char name[20];
public:
void getdata()
Cin>>roll;
gets(name);
cin>>marks1;
tmarks=marks1+marks2;
void showdata()
cout<<”\t”<<roll<<”\t”<<name<<”\t<<marks1<<”\t”<<marks2<<”\t”<<tmarks<<endl;
};
void main()
int I;
student s[10];
clrscr();
for(i=0;i<3;i++)
s[i].getdata();
cout<<endl;
cout<<”\t<<”Roll#”<<”\t<<”Name”<<\t”<<”Marks1”<<”\t”<<”Marks2”<<”\T”<<”Total
Marks”<<endl;
for(i=0;i<3;i++)
s[i].showdata();
}
getch();
Output:
ASSIGNMENT
SUBJECT: PGD 10
PRACTICAL WEB PROGRAMMING LAB
Problem 1
Make a web site for the ABC Institute. List the various departments present in the institute.
Insert picture of the institute on the home page. Use the different heading levels to display the
text and use different colors for the headings and text in the paragraphs.
Solution:
<html>
<head>
<title>HOME</title>
</head>
<body>
>
<hr />
<h1 style="margin-bottom:0;">ABC
INSTITUTE</h1></div>
<hr />
color:#F08080;height:500px;width:250px;float:left;">
</body>
</html>
<title>
</title>
<body>
<h1 style="margin-bottom:0;">HOME</h1>
</body>
</html>
</a>
<html>
<title>
</title>
<body>
</body>
</html>
</a>
</a>
<a href="GALLERY.html">
<html>
<title>
</title>
<body>
<h1 style="margin-bottom:0;">GALLERY</h1>
</body>
</html>
</a>
<a href="DEPARTMENT.html">
<html>
<title>
</title>
<body>
<h1 style="margin-bottom:0;">DEPARTMENTS</h1>
</body>
</html>
</a>
</div>
color:#E0FFFF;height:200px;width:400px;float:left;">
height="500">
</div>
color:#00FFFF;clear:both;text-align:center;">
</div>
<p style="background-color:rgb(255,255,0)">
</p>
</p>
</body>
</html>
<html>
<head>
</head>
<title>DEPARTMENT
</title>
<body>
<hr>
size:50px;">ABC INSTITUTE
</div>
<hr>
color:#F08080;height:800px;width:250px;float:left">
<html>
<title>
</title>
<body>
</body>
</html>
</a>
<html>
<title>
</title>
<body>
<h1 style="margin-bottom:0;">ABOUT</h1>
</body>
</html>
</a>
<a href="GALLERY.html">
<html>
<title>
</title>
<body>
<h1 style="margin-bottom:0;">GALLERY</h1>
</body>
</html>
</a>
<a href="DEPARTMENT.html">
<html>
<title>
</title>
<body>
<h1 style="margin-bottom:0;">DEPARTMENTS</h1>
</body>
</html>
</a>
</div>
color:white;height:800px;width:1080px;float:right">
<html>
<head>
<style>
table,th,td
border-collapse:collapse;
th,td
padding:5px;
</style>
</head>
<body>
<table style="width:800px">
<tr>
<th><center>SR.NO</th>
<th><center>NAME OF DEPARTMENT</th>
<th><center>NUMBER OF SEATS</th>
</tr>
<tr>
<tr>
<td><center>1</td>
<td><center>Arts</td>
<td><center>40</td>
</tr>
<tr>
<td><center>2</td>
Commerce</td>
<td><center>40</td>
</tr>
<tr>
<td><center>3</td>
<td><center>40</td>
</tr>
<tr>
<td><center>4</td>
<td><center>Law</td>
<td><center>40</td>
</tr>
<tr>
<td><center>5</td>
<td><center>Science</td>
<td><center>40</td>
</tr>
<tr>
<td><center>6</td>
<td><center>Education</td>
<td><center>40</td>
</tr>
</table>
</body>
</html>
</div>
<hr>
color:#00FFFF;clear:both;text-align:center;">
</body>
</html>
PASTE PRINTSCREEN HERE
Problem 2
Create a website for the XYZ Company. List the names of the mangers. Each name should be
linked to his/her personal information page.
Solution:
<html>
<head>
<title>XYZ Company</title>
</head>
<body bgcolor="pink">
<h1>
</h1>
<p><font size= 5 color="Blue">XYZ is India’s largest online marketplace for Small & Medium Size
Businesses, connecting global
buyers with suppliers. The company offers a platform & tools to over 1.5 million suppliers to
generate business leads from over 10
million buyers, who use the platform to find reliable & competitive suppliers. The company has
over 2600 employees located across
40+ offices in the country. Its existing investors include Intel Capital and Bennett, Coleman &
Co. Ltd.<br>
XYZcompany.com offers products that enable small & medium size businesses generate
business leads (online catalogs/store-
fronts), establish their credibility (third party verified trust profile) and use business information
(finance, news, trade shows,
tenders) for their business promotion.<br>
XYZcompany.com has won numerous awards and significant nominations over the years, which
include coveted Manthan Award,
Red Herring Award and Emerging India Award respectively among others. The company has
also been widely covered by media for
<br><center>
<br><br>
<br><br>
<br><br>
<br><br>
</h3>
</body>
</html>
For the XYZ Company site, create a table to show the details of the products they manufacture.
Format the table.
Solution:
Create your personal website giving your family details, education details, and friends’
information on different pages of the site.
Solution:
<html>
<head>
</head>
<title>MY PROFILE
</title>
<body>
<hr>
</div>
<br> <ul>
<br> <br>
<br><br>
</ul>
</font>
</body>
</html>
Problem 5
For the above created personal website, add a form to gather information (name, email
address, users’ educational qualification, his/her hobbies, how he came to know about site,
suggestions on the site) from the user.
Solution:
<html>
<head>
<title>Suggestions</title>
<head>
<body bgcolor="pink">
<b><marquee><u><h1>Suggestions</h1><u></marquee></b><br><br><br><br><br><br>
<center>
<form>
Suggestions</textarea >
</form>
</body>
</html>
class Fabonacci
{
int low=1;
int high=0;
while(high<50)
{
System.out.println(high);
int temp=high;
high=high+low;
low=temp;
}
Output:
Problem 7
Create a Java class “graphics”. Let triangle, circle and rectangle classes inherit that. Design the
relevant member functions and variable for each.
Solution:
public class graphics
{
public static void main(String args[])
{
triangle t1 = new triangle();
rectangle r1 = new rectangle();
circle c1 = new circle();
t1.tri();
r1.rect();
c1.cir();
}
}
class triangle extends graphics
{
public void tri()
{
System.out.println("\n\n------>> Here Starts triangle <<--------\n");
System.out.println("\n--------------------------");
}
}
class rectangle extends graphics
{
int height=20,width=50;
public void rect()
{
System.out.println("\n\n------>> Here Starts Rectangle <<--------\n");
System.out.println("height of rectangle:"+height);
System.out.println("width of rectangle:"+width);
System.out.println("area of rectangle:"+height*width);
System.out.println("\n--------------------------");
}
}
class circle extends graphics
{
int radius=50;
public void cir()
{
System.out.println("\n\n------>> Here Starts Circle <<--------\n");
System.out.println("cirlce is having its radius as: "+radius);
System.out.println("\n--------------------------");
}
}
Problem 8
Write a Java program to divide two numbers. Avoid division by zero by catching the exception.
Create a Java applet to display your address on the screen. Use different colors for background
and text.
import java.applet.*;
import java.awt.*;
public class app extends Applet
{
public void paint(Graphics g)
{
//Draw a rectangle width=250, height=100
g.drawRect(0,0,350,250);
//Set the color to yellow
g.setColor(Color.yellow);
setBackground(Color.blue);
//Write the message to the web page
g.drawString("my address is #2542 chandigarh",10,50);
}
}
/*
<applet code="app" width=500 height=300>
</applet>
*/
Write a program to demonstrate the usage of threads. Run two different loops through two
different threads and print the numbers from 1-20.