81
Practical Assignment 2014-15 Submitted To: Submitted By: Chairperson Gurvir Kaur USOL PGDCA

Tomal Practical Assignment

Embed Size (px)

DESCRIPTION

PGDCA PU Practical Assignment

Citation preview

Practical Assignment2014-15

Submitted To:Submitted By:ChairpersonGurvir KaurUSOLPGDCAPanjab University,Roll no: 31026Chandigarh

ASSIGNMENTSUBJECT: PGD 07SOFTWARE LAB

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:

INFORMATIONOUTPUTINPUT ARITHMETIC AND LOGICAL UNITCONTROL UNITMEMORY

DATA

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 devicesPoint 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).DigitizerElectronic card readerVoice recognition devicesVision Input SystemOutput 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:MonitorsPrinters: Dot-Matrix printers, Inkjet printers, Drum printers, laser printers.Plotters: Drum plotter, Flatbed plotter.Screen Image ProjectorVoice 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 CoordinatorPGDCA DepartmentUniversity School of Distance LearningPunjab University, Chandigarh.

Subject: Request to send lesson scripts of PGDCA course

Respected Sir/Madam,

I am student of PGDCA for the batch year 2014-15. I have been enrolled for PGDCA course through distance mode (USOL). My enrollment no is 31026. 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

Gurvir Kaur31026PGDCA (USOL)

Problem 2(a) Prepare pay slip (using MS Excel) for employees of an organization. The employee details must include employee code, name, fathers 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(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:

Problem 4Create 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 text1. 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.txtOutput: rw-r- - r - -Now change permissions.Solution of the query:1. Type on shell chmed go+rx testfile.txt2. 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.txtOutput: 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 usernameExample:-mail purva

Problem 5Write 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 betweenread a b c dsum=`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=$sumecho Average=$avg.$dececho Product=$product

Output:

(c) to display the user names, along with the processes they created.Solution:ps -U pgdca4

Output:

ASSIGNMENTSUBJECT: PGD 08PRACTICAL 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 NWrite 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 Sonias 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=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);

ASSIGNMENTSUBJECT: PGD 09PRACTICAL PROGRAMMING LAB IN C/C++

Problem 1Write 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#includeInt 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