Thursday, August 6, 2009
LINUX commands
2.. cat
3.. Date
4.. echo
5.. pwd
6.. cp
7.. mkdir
8.. mv
9.. rm
10.. rmdir
11.. head
12.. wc
13.. whoami
14.. who
15.. vi
16.. uname
17.. umount
18.. tty
19.. tar
20..tee
21..tail
22.. rpm
23.. sh
24.. sort
25.. more
26.. find
27.. clear
28.. cal
29.. chmod
30.. merge
31.. sudo
32.. talk
33.. touch
34.. write
35.. last
36.. od
37.. gcc
38.. g++
39.. cut
40.. cmp
41.. cc
42.. banner
43.. bc
44.. join
Wednesday, April 15, 2009
LAB TEST OOPS
2. Concatenate 2 strings by overloading + operator
3. WAP to add 2 complex numbers by returning objects
4. WAP to swap private data of 2 classes.
5. Create a base class called shape .Use this class to store two double type values that could be used to compute the area of figures. Derive two specific classes’ triangle & rectangle from the base class shape. Add to the base class a member function get_data () to initialize base class data members and another member function display_area () to compute and display the area of the figure. Make display_area () as a virtual function & redefine this function in the derived class to suit their requirements.
6. To read a value of distance from one object and add with a value in another object using friend function.
7. WAP to implement addition operations on complex numbers using constructor overloading
8. String concatenation using dynamic memory allocation concept.
9. To compute the area of triangle and rectangle using inheritance and virtual function.
10. Design a class from which only one object can be created. If more than one object is created, then the program should terminate.
Friday, March 13, 2009
OOPS ASSIGNMENT - 9
1. Write a program which should have two classes A and B,A contain two data members and 3 methods and B class is inherited by class A, Class B contains one data member and two methods. Now multiply the two values of class A by using the object of class B and display the result.
2. Write a program which having 3 classes student, test and result, student class having method to accept enrollment number, test class accept student marks in 3 subjects which is inherited by class student and result class having methods to find sum of marks and displays, which is inherited by class test. Now by using the object of result class call the methods from other classes.
3. Create a class Basic_info having data members Player ID, Name, Age. Derive a class Add_info from Basic_info having data members player_type, height & weight. Include suitable member functions to input and display the data?
4. A bank maintains two types of accounts
Saving: includes
Compound interest
Withdrawal
Current
Minimum balance required
Create a class “account” that stores customer name, account number and type of account. From account derive cur_acc and sav_acc. Include necessary data members and member function to perform following tasks.
i. Accept deposit and update balance
ii. Display the balance
iii. Compute and deposit interest
iv. Check for minimum balance
5. Create a class student which includes name and roll number of the student. Derive classes test and sport out of class student which include test marks and sport marks respectively.
Derive a class result out of test and sport where total marks are calculates and displayed
Test the class result.
Friday, February 27, 2009
OOPS ASSIGNMENT - 8
1.Write a program to find the factorial of a number using recursive member function.
2.write a program to find the sum of the digits of a number using recursive member function.
3.write a program to find the sum of n numbers using recursive member function.
4.write a program to find the gcd of two numbers using recursive member function.
Recursive constructor
1.write a program to find the factorial of a number using recursive constructor.
2.write a program to find the sum of n numbers using recursive constructor.
3.write a program to find the sum of the digits using recursive constructor.
4.write a program to find the gcd of two numbers using recursive constructor.
OOPS ASSIGNMENT - 7
1.write a program using constructor to find the area of a rectangle. This includes two data members(length and width), two member functions one is to display the length and width, other is to calculate the area and display that area.
2.Create a class to store a string. Include member functions to input and output the data member. Write the above program using constructor and destructor.
3. Write a C++ program by using the parameterized constructor.
4. Write a program by using the copy constructor concept to accept a number display that number.
5. Implement and test a class complex to store
.Real
.Imaginary
Include following constructors
.Default (to initialize both data members by zero value)
. One argument (to initialize both data members by a single value)
.Multiple argument (to initialize both data members by different value)
· Copy
Include destructor
6. Create a class to store string dynamically
Include following constructors
· Default (to initialize string to null value)
· One argument (to initialize string by a given value)
· Copy
7. WAP to implement a polynomial class having data members’ coefficient, base and power. For example, the polynomial 2x5 has the coefficient 2, base x and power 5. Include default and parameterized constructor and also include a member function evaluate () to find the value of the polynomial.
For example, if the polynomial is 2x5.
X=2, 2x5=64 is the answer.
Monday, February 16, 2009
Assignment-6
Q.1: Program to add two complex numbers using objects as arguments.
Q.2: Program to add time in hour and min using objects as argument.
Q.3. Create a class using friend function to calculate the mean of two values and parameter for the mean function should be object of the same class.
Q4.Create two classes using friend function i.e max to find the maximum value and parameters for the max function are two objects of the two classes.
Q.5.A library uses computer based information system for keeping track of its collection. With each book the information system stores the following information.
(i) Accession no of the book (an integer)
(ii) issue code with I,B,L,A indicating issued to a member, send for binding, Issued to another library and available respectively
(iii) Identity of the member which is an alphanumeric quantity.
The services extended by the library are
(a) Provides status of a requested book
(b) Provides list of all issued book
Q.6. Create two classes A & B with data members i and j respectively. Include friend function swap () to swap the values in the data members of the two classes.
Q.7.WAP to count and display the number of objects created in a class. (Use static variable)
(c) Provides list of books issued to a member
Friday, January 30, 2009
OOPS ASSIGNMENT- 5
2. WAP to calculate simple interest by passing the principal amount, rate of interest and time period as argument to function. Make rate of interest and time period default argument with default values 1.2 and 3 respectively
3. Raising a number n to power p is the same as multiplying by itself t times. Write a function called power ( ) that makes a double value for n and an int value for p and returns the result as double value. Use default argument of 2 for p, so that if this argument is omitted, the number will be squared. Write a main( ) function that gets values
from the user to test this function.
4 Write a function “increment” which takes two arguments and increment the first argument by second pass the argument to this function from main and print the increment value in the main function (use reference variable).
Friday, January 23, 2009
OOP ASSIGNMENT - 4
2. Implement a class “number” having data members value This class has a member function FindDigit() to count the occurrences of each digit in number object. Ex-If value = 1123, O/P = 1-Two times, 2 – One times and 3- One times
3.Define a class named Complex for representing complex numbers. A complex
number has the general form a + ib, where a is the real part and b is the imaginary
part (i stands for imaginary). Complex arithmetic rules are as follows:
(a + ib) + (c + id) = (a + c) + i(b + d)
(a + ib) – (c + id) = (a + c) – i(b + d)
(a + ib) * (c + id) = (ac – bd) + i(bc + ad)
Define these operations as member functions of Complex.
4. Create a string by using class , encrypt it & display it according to given instructions. A-Z, a-z, 0-9,’=’, ’,’, ’.’------- No changes. The space is replaced by ‘+’. Any other character is replaced by ‘%’ followed by ASCII value of that character.
Wednesday, January 21, 2009
OOPS ASSIGNMENT - 3
2. WAp to calculates the weekly gross pay for a worker, based on the total number of hours worked and the hourly payrate.
Hint. weeklyPay = workDays * workHours * payRate
3. Write a program which inputs a temperature reading expressed in Fahrenheit and outputs its equivalent in Celsius, using the formula:
°C = 5/9 (° F - 32)
Compile and run the program. Its behavior should resemble this:
Temperature in Fahrenheit: 41
41 degrees Fahrenheit = 5 degrees Celsius
4. Create a class to find the sum of two numbers. This includes two data members, three member functions to input , output the data members and to find the sum of two data members.
5. Create a class to find the multiplication of two matrices. This include three data members of type arrays, three member functions, one is to accept two matrices, other to display two matrices and 3rd one is to find the multiplication of two matrices and display the result.
6. Create a class time with data members to store hours, minutes and seconds. WAP to input two times and find their sum.
7. Implement a class “number” having data members value and include following member functions
(i) IsEven()->Checks whether the value is even or odd
(ii) Findfactorial()->to calculate the factorial of the number
Saturday, January 17, 2009
OOPS Concepts-1
2.Explain the advantages of OOPs with the examples.
3.What are OOPS concepts? Explain with examples?
4.what do you mean by Generalization & realization in oops
5.What is method Overriding ? What is it in OOPS
6. What is method Overriding ? What is it in OOPS
7.what are the advantages of oops over traditional programming?
8.What are the advantages of inheritance?
Wednesday, January 14, 2009
OOPS ASSIGNMENT-2
1. Input student Name, Rollno, Branch, Age and telephoneno as a record through structure and display all the information.
2. Input Name, Degignation, Basic Salary of employee into the employee record and calculate
TA = 55% of Basic
DA = 65% of Basic
HRA = 35% of Basic
PF = 12% of Basic
Also calculate Group Salary and net salary
a) Use Array to structure to input minimum 3 records (3 persons data) and display all the records sequentially.
b Use pointer to structure to input minimum 3 records (3 persons data) and display all the records sequentially.
3. Input your date of Birth and current date through structure and calculate your age in Year, Month and days assume that 1 year = 365 days and 1 month = 30 days.
4. Create a student structure having data members roll, class & address, mark structure having data members roll, sub1, sub2, sub3 and a student detail structure having data members roll, class total marks, no of subject pass & overall pass. Those students who have appeared the exam, their information only stored in the mark structure array. Write a program which will collect the information & fill the data in student detail array depending on the pass criteria.
Saturday, January 10, 2009
OOPS ASSIGNMENT-1
1. WAP to swap two numbers using function.
2. WAP using function which outputs all the prime numbers between 2 and a given positive integer n:
Hint:
void Primes (unsigned int n);
A number is prime if it is only divisible by itself and 1.
3. WAP to define an enumeration called Month for the months of the year and use it to define a function which takes a month as argument and returns it as a constant string.
4. WAP to define a recursive version of the Power function
5. WAP to write a function which returns the sum of a list of real values
Hint:
double Sum (int n, double val ...);
where n denotes the number of values in the list.
6. The following table specifies the major contents of four brands of breakfast cereals.
Define a two-dimensional array to capture this data:
------------Fiber ----Sugar-----Fat------Salt
Top Flake--12g------25g -------16g-----0.4g
Cornabix---22g-------4g --------8g-----0.3g
Oatabix-----28g ------5g---------9g-----0.5g
Ultrabran---32g------7g---------2g------0.2g
Write a function which outputs this table element by element.