Anda di halaman 1dari 69

PRACTICAL ASSIGNMENT

2018-19
SEMSESTER – 1

Submitted To: Submitted By:

Chairperson DALJEET KAUR


USOL PGDCA
Panjab University, Roll no:
Chandigarh
ASSIGNMENT
SUBJECT: PGD PR-1105
COMPUTER FUNDAMENTALS(PGD-1101)
Problem 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.

Four Basic Operations performed by computer:

Input: For purpose of inserting data of computer by means of input devices.


Process: Transform data into information by CPU.
Output: Produce output on output device that shows the result of processing
operations.
Storage: Stores the result of processing operation at secondary memory.
Bock Diagram of Computer:

DATA INPUT MEMORY OUTPUT INFORMATION

CONTROL UNIT

ARITHMETIC
AND LOGICAL
UNIT

CPU
(Central Processing Unit)

The CPU is the brain of a computer system.

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.

There are two types of computer memory: Primary and Secondary.

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

University School of Distance Learning

Punjab University, Chandigarh.

Subject: Request to send lesson scripts of PGDCA course

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:

(CD IS ATTACHED WITH FILE FOR PROBLEM NO -2 A+B)

Problem 3

(a) Prepare a multimedia presentation using MS PowerPoint package. The presentation


must have at least 10 slides for any of the lessons in your subjects PGD01, PGD02 ...or
PGD06.
(b) Create a custom animation for a drawing, image or a picture.

Solution:

(CD IS ATTACHED WITH FILE FOR PROBLEM NO -3 A+B)


Problem 4

Create a text file called test using vi editor.


(a) Allow the file to be read and executed by group and others.
(b) Display the number of characters, words and lines in the file.
(c) Send the file to another user.

Solution: (a) To create a file called text

1. Open the shell.


2. Type “vi testfile.txt”.
3. Go to insert mode by pressing “i” .
4. Type text you want to & press “Esc”.
5. Type “:wq” & press enter button.

File will be created.


Now check default permissions.

Type “ ls –l testfile.txt”

Output: “ –rw-r- - r - -“

Now change permissions.

Solution of the query:

1. Type on shell “ chmed go+rx testfile.txt”


2. Press enter & permissions will be set.
3. Now check them by typing “ls –l testfile.txt”

Output: “-rw-r-xr-x”

(b) To display the numbers of characters, words and lines in the file.

Type on shell “wc –mlw testfile.txt”

Output: 8 17 84 (where 8 is the number of lines, 17 is the number of words & 84


is the number of characters.)

(c) To send the file to another user .

Syntax: - mail username


Example:-mail purva
Problem 5

Write a shell script.


(a) to find the number of days between two dates.

Solution:

echo $(($(($(date -d "2010-06-01" "+%s") - $(date -d "2010-05-15" "+%s"))) / 86400))

Output:
(b) to find the sum, product and average of any N integers.

Solution:

echo Enter four integers with space between

read a b c d

sum=`expr $a + $b + $c + $d`

avg=`expr $sum / 4`

dec=`expr $sum % 4`

dec=`expr \( $dec \* 1000 \) / 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.

 DEPARTMENT (DEPTNO, DEPTNAME, MANAGER_ID)


 EMPLOYEE (EMPNO, NAME, SEX, DESIGN_CODE, SALARY, COMMISSIC DEPT_NO)
 EMPHISTORY (EMPNO, FROM_DATE, TO_DATE, FROM_DEPT, TO_DEPT, FROM_DESIG,
TO_DESIG, PROMO_FLAG, SALARY)
 DESIGNATION (DESIG_CODE, DESIG_NAME, MINSALARY, MAXSALARY, MANAGER_FLAG)

Write PROMO_FLAG and MANAGER_FLAG contain values “Y” or “N”


Write either SQL code or the FoxPro program/programs to answer the following queries.
Create above tables, add rows to tables and answer the following business queries.

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 Command:


CREATE TABLE DEPARTMENT (DEPTNO number, DEPTNAME varchar(100), MANAGER_ID
number);
Insert into department values (101, ‘Law’, 3);
Insert into department values (102, ‘chemistry’, 4);
Insert into department values (103, ‘physics’, 05);
Insert into department values (104, ‘chemistry’, 6);
Insert into department values (105, ‘english’, 7);
Insert into department values (106, ‘punjabi’, 8);

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);

CREATE TABLE DESIGNATION (DESIGN_CODE number, DESIG_NAME varchar(100), MINSALARY


number, MAXSALARY number, MANAGER_FLAG varchar(1));
insert into DESIGNATION values (1001, ‘Teacher’, 30000, 70000, ‘N’);
insert into DESIGNATION values (1002, ‘Assistant’, 11000, 65000, ‘N’);
insert into DESIGNATION values (1003, ‘Staff’, 5000, 79000, ‘N’);
insert into DESIGNATION values (1004, ‘Supervisor’, 30000, 70000, ‘N’);
insert into DESIGNATION values (1005, ‘Manager’, 40000, 90000, ‘Y’);
insert into DESIGNATION values (1006, ‘Clerk’, 35000, 100000, ‘N’);
Queries:

1. SELECT * FROM EMPLOYEE ORDER BY DEPTNO, NAME;


2. SELECT DISTINCT DESIG_CODE FROM EMPLOYEE;
3. SELECT MAX(SALARY)FROM EMPLOYEE;
4. SELECT * FROM EMPLOYEE WHERE DESIG_CODE IN (SELECT DESIG_CODE FROM
DESIGNATION WHERE MANAGER_FLAG = ‘Y’) AND SALARY >=4000 AND SALARY<=5000;
5. SELECT * FROM EMPLOYEE WHERE DESIG_CODE IN (SELECT DESIG_CODE FROM
DESIGNATIONWHERE MANAGER_FLAG = ‘Y’) AND DEPT_NO <> ‘01’ AND NAME LIKE
‘G%’;
6. SELECT EMPNO FROM EMPHISTORY WHERE FROM_DATE >=’2000/03/01’ AND
FROM_DESIG IN (SELECT DESIG_CODE WHERE DESIG_NAME = ‘CLERK’);
7. SELECT EMPNO FROM EMPHISTORY WHERE (FROM_DESIG <> ‘PROGRAMMER’ OR
SALARY >= 5000) AND PROMO_FLAG = ‘N’;
8. SELECT EMPNO, SEX, MAX(SALARY), MIN(SALARY), AVG(SALARY) FROM EMPLOYEE
GROUP BY EMPNO, SEX;
9. SELECT NAME, SALARY, COMMISSIC, SALARY+COMMISSIC FROM EMPLOYEE ORDER BY
SALARY+COMMISSIC DESC;
10. SELECT * FROM EMPLOYEE WHERE DESIG_CODE = (SELECT DESIG_CODE FROM
EMPLOYEE WHERE NAME = ‘Surinder’);
11. SELECT * FROM EMPLOYEE WHERE SALARY > (SELECT AVG(SALARY) FROM EMPLOYEE
WHERE SEX = ‘M’) AND SEX = ‘F’;
12. SELECT NAME FROM EMPLOYEE WHERE EMPNO = (SELECT MANAGER_ID FROM
DEPARTMENT WHERE DEPTNO = (SELECT DEPTNO FROM EMPLOYEE WHERE NAME =
‘Sonia’));
13. SELECT EMPNO, NAME, DESIG_CODE FROM EMPLOYEE WHERE EMPNO = (SELECT
DISTINCT EMPNO FROM EMPHISTORY WHERE FROM_DESIG = ‘MANAGER’ AND
PROMO_FLAG = ‘Y’);
ASSIGNMENT
SUBJECT: PGD 09
PRACTICAL PROGRAMMING LAB IN C/C++
Problem 1

Write the program oddsum () in C with function head


int oddsum (int n)
The function should return the sum of all odd numbers between 1 and n (including 1 and n and
you may assume that n=>1). For example, the call oddsum (7) should give the result
1+3+5+7=16 while the call oddsum (12) should give the result 1+3+5+7+9+11=36.
Write a main function that tests oddsum () by reading an integer from the keyboard, and if the
integer is positive oddsum () should be called and the returned value is written on the screen.

Solution:

#include<stdio.h>

#include<conio.h>

Int oddum(int);

Void main()

Int n,sum;

clrscr();

block:printf(“\n Enter a number \n”);

scanf(“%d”,&n);

if(n>=1)

sum=oddsum(n);

printf(“\n The sum of odd numbers between 1 & %d is %d.”,n,sum);

Else

printf(“\n Please enter a positive number”);


goto block;

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>

int magic(int a[][10],int);

void main()

int matA[10][10];

int I,j,k,res;

clrscr();

printf(“\n Please enter the order of matrix: “);

scanf(“%d”,&k);

printf(“\n Please enter the elements of matrix \n”);

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)

printf(“\n This is not a Magic Square. \n”);

else

printf(“\n This is a Magic Square with Magic number %d”,res);

getch();

int magic(int mat[][10],int n)

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

Study the following program and answer the following questions.


# include <stdio.h>
void mixtra (int x, int *y);
{
int c;
c = x+ *y;
x = c+1;
*y = c+1;
c = c = 1;
printf (“\n%d %d %d\n”,x, *y,c);
}
void main (void)
int a, b;
int *c;
a = 1;
b = 2;
c = &b;
printf (“\n%d %d %d\n”,a, b, *c);
/* */
printf (“\ \~%d %d/n”,a, b, *c);
At /* */ a call to mixtra is done. What is written by the program if the call is:
a. mixtra (a, &b);
b. mixtra (b, &a);
c. mixtra (a, &a);
d. mixtra (a,c);
Solution:

a) mixtra (a, &b);

#include<stdio.h>

#include<conio.h>

void mixtra(int x,int*y)

int c;

c=x+*y;

x=c+1;

*y=c+1;

c=c=1;

printf(“\n %d%d%d \n”,x,*y,c);

void main()

int a,b;

int *c;

a=1;

b=2;

c=&b;

clrscr();

printf(“\n %d%d%d \n”,a,b,*c);

mixtra(a,&b);

printf(“\n %d%d%d \n”,a,b,*c);


getch();

Output:
b) mixtra (b, &a);

#include<stdio.h>

#include<conio.h>

void mixtra(int x,int*y)

int c;

c=x+*y;

x=c+1;

*y=c+1;

c=c=1;

printf(“\n %d%d%d \n”,x,*y,c);

void main()

int a,b;

int *c;

a=1;

b=2;

c=&b;

clrscr();

printf(“\n %d%d%d \n”,a,b,*c);

mixtra(a,&b);

printf(“\n %d%d%d \n”,a,b,*c);

getch();
}

Output:
c) mixtra (a, &a);

#include<stdio.h>

#include<conio.h>

void mixtra(int x,int*y)

int c;

c=x+*y;

x=c+1;

*y=c+1;

C=c=1;

Printf(“\n %d%d%d \n”,x,*y,c);

void main()

int a,b;

int *c;

a=1;

b=2;

c=&b;

clrscr();

printf(“\n %d%d%d \n”,a,b,*c);

mixtra(a,&a);

printf(“\n %d%d%d \n”,a,b,*c);

getch();
}

Output:
d) mixtra (a,c);

#include<stdio.h>

#include<conio.h>

void mixtra(int x,int*y)

int c;

c=x+*y;

x=c+1;

*y=c+1;

C=c=1;

Printf(“\n %d%d%d \n”,x,*y,c);

void main()

int a,b;

int *c;

a=1;

b=2;

c=&b;

clrscr();

printf(“\n %d%d%d \n”,a,b,*c);

mixtra(a,c);

printf(“\n %d%d%d \n”,a,b,*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();

void secret(int number)

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 palindrome(char a[20]);

int main()

char a[20];

int res;

clrscr();

cout<<”Enter a string:”;

gets(a);

res==palindrome(a);

if(res==1)

Cout<<”\n Entered string is a palindrome”;

else

{
cout<<”\n Entered string is not a palindrome”;

getch();

return 0;

int palindrome(char b[20])

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()

Cout<<”\n Enter roll no.:”;

Cin>>roll;

cout<<”\n Enter name:”;

gets(name);

cout<<”\n Enter marks1:”;

cin>>marks1;

cout<<”\n Enter marks2:”;


cin>>marks2;

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<<”List of PGDCA students”<<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>

<div id="container" style="width:1350px";height="500"

>

<div id="header" style="background-color:#00FFFF;">

<hr />

<h1 style="margin-bottom:0;">ABC

INSTITUTE</h1></div>

<hr />

<div id="menu" style="background-

color:#F08080;height:500px;width:250px;float:left;">

<a href="HOME PAGE.html">

</body>

</html>

<title>
</title>

<body>

<h1 style="margin-bottom:0;">HOME</h1>

</body>

</html>

</a>

<a href="ABOUT US.html">

<html>

<title>

</title>

<body>

<h1 style="margin-bottom:0;">ABOUT US</h1>

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

<div id="content" style="background-

color:#E0FFFF;height:200px;width:400px;float:left;">

<img src="E:\bii.jpg" alt="inst" width="1090"

height="500">

</div>

<div id="footer" style="background-

color:#00FFFF;clear:both;text-align:center;">

All the information is available on this site.<br>Enquiry

No(s): 18000-1800-2064, +91 172 3534818, 3534866


(from 9:30 am to 1:00 pm & 2:30 pm to 5:00 pm on

working days including Saturday)</div>

</div>

<p style="background-color:rgb(255,255,0)">

</p>

</p>

</body>

</html>

PASTE PRINTSCREEN HERE

<html>

<head>

</head>

<title>DEPARTMENT

</title>

<body>

<hr>

<div id="header" style="background-


color:#00FFFF;height:100px;width:1350px;font-

size:50px;">ABC INSTITUTE

</div>

<hr>

<div id="menu" style="background-

color:#F08080;height:800px;width:250px;float:left">

<a href="HOME PAGE.html">

<html>

<title>

</title>

<body>

<h1 style="margin-bottom:0;">HOME </h1>

</body>

</html>

</a>

<a href="ABOUT US.html">

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

<div id="contect" style="background-

color:white;height:800px;width:1080px;float:right">

<h1 style="color:#820000 ;">DEPARTMENTS OF


INSTITUTE</h1>

<html>

<head>

<style>

table,th,td

border:1px solid black;

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>

<td><center>Business Management and

Commerce</td>

<td><center>40</td>

</tr>

<tr>

<td><center>3</td>

<td><center>Engineeering and Technology</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>

<div id="footer" style="background-

color:#00FFFF;clear:both;text-align:center;">

All the information is available on this site.<br>Enquiry

No(s): 18000-1800-2064, +91 172 3534818, 3534866

(from 9:30 am to 1:00 pm & 2:30 pm to 5:00 pm on

working days including Saturday)</div>

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

<marquee> <b> <u> XYZ Company </u> </b> </marquee>

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

its pioneering role in promoting SME business in the country.

</p></h2><a href="detail.html">Company's products and thier details:</a>

<br><center>

<h3>You can also go through the details of our company's managers:

<br><br><a href="Dinesh Agarwal.html">Dinesh Agarwal (Product & Technology)</a>

<br><br>

<a href="Prateek Chandra.html">Prateek Chandra (Client Servicing Division) </a>

<br><br>

<a href="Sudhir Gupta.html">Sudhir Gupta (Finance and Accounts)</a>

<br><br>

<a href="Vinita Tikoo Koul.html">Vinita Tikoo Koul (HR & Administration)</a>

<br><br>

<a href="Vikram Khanna.html">Vikram Khanna (Sales Division)</a>

</h3>

</body>

</html>

PASTE PRINTSCREEN HERE


Problem 3

For the XYZ Company site, create a table to show the details of the products they manufacture.
Format the table.

Solution:

PASTE PRINTSCREEN HERE


Problem 4

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 id="header" style="background-color:#00FFFF;height:100px;width:1350px;font-


size:50px;">MY PROFILE

</div>

<h1><marquee> <b> My Personal Web Site </h1></b> </marquee></h1>

<font size=5><div style="color:#DC143C; font-weight:bold; text-align:center"></div>

This is <b><I>Mallika Arora</I></b> pursuing PGDCA from Panjab University.<br><br>

<U>MY EDUCATIONAL QUALIFICATION:</U><br>

Graduation - B.Sc (Hons.)in Botany from Panjab University<br>

Post Graduation - M.Sc(Hons.) Botany from Panjab University<br>

<br>You can know more about me by clicking on the following links:

<br> <ul>

<li> <a href="family.html">About My Family </a>

<br> <br>

<li> <a href="education.html">About My Education Details </a>


<br> <br>

<li> <a href="friends.html">About My Friends</a>

<br><br>

<li> <a href="SuggestionForm.html">Suggestion Form<br><br></a>

</ul>

</font>

</body>

</html>

PASTE PRINTSCREEN HERE

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>

<font size=5 color="blue">

<form>

First name: <input type="text" name="firstname"><br>

Last name: <input type="text" name="lastname"><br>

E-mail:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="emailid"><br>

Qualification/Education: <input type="checkbox" name="qualification-education"


value="Graduation"> Graduation <input

type="checkbox" name="qualification-education" value="Post Graduation"> Post


Graduation<br>

Hobbies: <input type="text" name="Hobbies"><br><br><br>

<textarea name="message" rows="8" cols="30">

How you came to know about me</textarea><br><br><br>

<textarea name="message" rows="8" cols="30">

Suggestions</textarea >

<input type="submit" value="Submit">

</form>

</body>

</html>

PASTE PRINTSCREEN HERE


Problem 6

Write a Java program to print the Fabonacci series.

Solution: Java program to print the Fabonacci series:

class Fabonacci
{

public static void main(String[] args)


{

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.

Solution: Java program to divide two numbers:


import java.util.Scanner;
class Division
{
public static void main(String[] args)
{
int a, b, result;
Scanner input = new Scanner(System.in);
System.out.println("Input two integers");
a = input.nextInt();
b = input.nextInt();
// try block
try
{
result = a / b;
System.out.println("Result = " + result);
}
// catch block
catch (ArithmeticException e)
{
System.out.println("Exception caught: Division by zero.");
}
}
}
Output:
Problem 9

Create a Java applet to display your address on the screen. Use different colors for background
and text.

Solution: Java applet to display address on the screen:

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

One HTML file is required


<html>
<applet code="app.class" height=200 width=320>
</applet>
</html>
Output:

CHANGE PRINTSCREEN HERE


Problem 10

Write a program to demonstrate the usage of threads. Run two different loops through two
different threads and print the numbers from 1-20.

Solution: Program to demonstrate the usage of threads:

class MyThread extends Thread


{
@Override
public void run()
{
for(int i = 1; i <= 20; i ++)
{
System.out.println("[ID " + this.getId() + "] " + i);
}
}
}
public class threads
{
public static void main(String [] args)
{
MyThread t1 = new MyThread();
MyThread t2 = new MyThread();
t1.start();
t2.start();
}
}
Output:

Anda mungkin juga menyukai