C++ Assignments
C++ Assignments
----------------------------------------------------------------------------------------------------------------------------------------------------------
Practical Assignment – I
Getting Familiarity with C++
ASSIGNMENT -II
Getting familiar with C++
Class and Object
1. WAP to print your name, age and city and pin code on screen (Using Class).
2. Write a program to print the area of a rectangle by creating a class named 'Area' having two
functions. First function named as 'setDim' takes the length and breadth of the rectangle as
parameters and the second function named as 'getArea' returns the area of the rectangle. Length and
breadth of the rectangle are entered through keyboard.
3. WAP to display addition, subtraction, multiplication and division of two integers on screen.
5. Write a C++ program to create a class for student to get and print details of a student. Following are
the details of a student:
Accountno, balance;
The withdrawal function should return remaining balance to the user and should deduct withdrawal
amount from balance. If withdrawal amount > balance print appropriate message on screen (Not
enough balance)
7. Write a C++ program to create a class for student to get and print details of a student. Following are
the details of a student:
Student_id, Name, Branch,Sub1_mark,Sub2_mark,Sub3_mark,Sub4_mark,Sub5_mark
Write member function to calculate Percentage, Class (Dist,First,Second,Pass ) of student
8. C++ program to create a class for Employee to get and display following Employee information:
Empcode, Basicsalary
10. Write a program to read time in hh:mm:ss and display answer in only seconds. For example if user
enters 2:15:30 then it should display 8130 seconds.
Input:
Enter Hours:2
Enter minutes:15
Enter Seconds:30
Output:
8130 seconds
Lab Assignment || BCA || SEM II || CA129-Fundamentals of Object Oriented Programming
----------------------------------------------------------------------------------------------------------------------------------------------------------
ASSIGNMENT -III
Getting familiar with C++
Constructor
1. Write a program to print the area of a rectangle by creating a class named 'Area' having one
function. Length and breadth of the rectangle are entered through keyboard using Parameterized
constructor.
2. WAP to display addition, subtraction, multiplication and division of two integers on screen.
3. Write a C++ program to demonstrate ATM money withdrawal and deposit process by taking
following private data members:
Accountno, balance;
1. Deposit
2. Withdraw
3. Balance
4. Exit
4. Create a class “Mobile” with attributes: brand, price, color, width, height. Use constructor to set default
values of these attributes. Write function to display details of all attributes.
5. Create a class “Mobile” with attributes: brand, price, color. Enter detail of five different mobile.
(Using Array of object).
6. C++ program to create a class for Employee to get and display following Employee information:
Use getdata and show functions to input and display student data.
Create private function to calculate percentage.
Display detail of student who secured highest percentage.
Create N number of student using array of object.
8. Create a class Student with Rollno,mark1,mark2,mark3 data member and write appropriate function to
setdata .Write another class name sport with sport_mark data member and set sport_mark. Find
Resul(mark1+mark2+mark3+sport_mark) of student using Friend function
ASSIGNMENT IV
Getting familiar with Inheritance in C++
Inheritance
1. Write a program that defines a shape class with a constructor that gives value to width and height. Then
define two sub-classes triangle and rectangle, that calculate the area of the shape. In the main, define two
objects a triangle and a rectangle and then call the area () function.
2. Write a program with a mother class animal. Inside it define a name and an age variables, and set_value
() function. Then create two sub class Zebra and Dolphin which write a message telling the age and name of
animal, also giving some extra information for both sub class (e.g. place of origin).place of origin of zebra
is Earth and place of origin of dolphin is water.
Create sub classes for Math Teacher, English Teacher, and Science Teacher
Name:
Department:
College name:
Email id:
Qualification:
Expertise:
Salary:
Create one sub class TABLET derived from DRUG with following data members
Create one sub class PainReliever derived from TABLET with data member
Dosage_units: i.e( 1 or 2 or 3)
Side_effects : i.e (Nausea, Drowsiness, Dizziness.)
Use appropriate member function for setting and Getting above details and display details in main
function.
Hotel_name,
City
Hotel_rate i.e(2000,3000,5000)
Lab Assignment || BCA || SEM II || CA129-Fundamentals of Object Oriented Programming
----------------------------------------------------------------------------------------------------------------------------------------------------------
Create one base class FLIGHT with following data members
Flight_no
Source city
Destination city
Seat no
Create one sub class PASSENGER derived from HOTEL and FLIGHT with following data members
Write appropriate member functions in each class and display all information in main
Create one sub class STUDENT derived from PERSON with following data members
Member function:
Create one sub class EMPLOYEE derived from PERSON with following data members
Write appropriate setter function in each class and display detail of student and employee in main.
Lab Assignment || BCA || SEM II || CA129-Fundamentals of Object Oriented Programming
----------------------------------------------------------------------------------------------------------------------------------------------------------
ASSIGNMENT V
Getting familiar with Operator Overloading
4. Write a program to overload Binary *(multiply) operator for object of same class
5. Write a program to overload Binary * (multiply) operator for object of different class
Class student
{
Int mark;
Public:
Student (int tmark)
{
mark=tmark;
}
};
Int main() {
If(s1==s2)
If(s1==s3)
ASSIGNMENT VI
Working with File
1.Write a program to create a file “Product.txt” and write data as Product Name, Product Price
and Batch Number in a file.
2. Write a program to append Product Type and Product Weight in a file “Product.txt”.
3. Write a program to create a file “Patient.txt” and enter Patient ID, Patient Name, Disease
Name and City in a file. Now read patient details and display all the details on a terminal.
4. Write a program to append Doctor Name and Doctor Speciality in “Patient.txt” file and
display the data on a console.
5.Create a class “Mobile” with attributes: brand, price, color. Use getData() values of these
attributes and store object in file. Write function displayData() to display object from file.
Practical Set – I
Programs on Array and Linked List
1 Write a program to accept n elements and print it.
2 Write a program to accept n elements and find the summation and average of it.
3 Write a program to accept n elements and print all odd elements and count odd elements.
4 Write a program to accept n elements and find the maximum and minimum element from it.
5 Write a program to perform the following operations on a stack.
(Implement the stack using array and linked list both)
PUSH
POP
ISEMPTY
ISFULL
PEEP
6 Write a program to perform the following operation on a simple queue. (Implement the queue
using array)
Insert an element
Remove an element.
7 Write a program to perform the following operation on a circular queue.
(implement the queue using array)
Insert an element
Remove an element
8 Write a program to create a Singly Linked List in LIFO fashion.
9 Write a program to create a Singly Linked List in FIFO fashion.
10 Write a program to create a sorted Singly Linked List.
11 Write program perform the following operations on a Singly Linked List.
1. Insert an element
2. Delete an element
3. Find the sum of elements of the List
Lab Assignment || BCA || SEM IV || CA221 : Data Structure and Algorithms
----------------------------------------------------------------------------------------------------------------------------------------------------------
4. Count number of the nodes in the Linked List
5. Search a given element in the Linked List.
6. Reverse the Linked List.
7. Make a copy of the given Linked List
8. Concatenate two Linked List
9. Merge two Linked List.
10. Find the union of the two given Linked List
11. Find the intersection of the two given Linked List.
12 Write a program to create a sorted Doubly Linked List.
13 Write a program to create a Doubly Linked List in LIFO fashion.
14 Write a program to create a Doubly Linked List in FIFO fashion.
15 Write a program perform the following operations on a doubly Linked List.
1. Insert an element
2. Delete an element
3. Find the sum of element of the List
4. Count number of the nodes in the Linked List
5. Search a given element in the Linked List.
6. Reverse the Linked List
7. Make a copy of the given Linked List
8. Concatenate two Linked listed.
9. Merge two Linked List.
10. Find the union of the two given Linked List.
11. Find the intersection of the two given Linked List.
16 Write a program to create a Circular Single Linked List.
17 Write a program to create a Double Linked List.
Lab Assignment || BCA || SEM IV || CA221 : Data Structure and Algorithms
----------------------------------------------------------------------------------------------------------------------------------------------------------
Practical Set – II
Programs on Binary Tree
1 Write a program to create a binary search tree.
2 Write a program to create a binary search tree and print it’s elements in inorder. (write iterative
code)
3 Write a program to create a binary search tree and print its elements in preorder. (write iterative
code)
4 Write a program to create a binary search tree and print its elements in postorder. (write
iterative code)
5 Write a program to make another copy of a given binary search tree.
6 Write a program to count no of leaf nodes in a given binary tree.
7 Write a program to search an element in a given binary search tree.
8 Write a program to accept n elements and check particular element is present how many times.
1. Linear Search
2. Binary Search
9 Write a program to accept n elements and arrange all the elements in Ascending order.
1. Bubble Sort
2. Selection Sort
3. Insertion Sort
4. Shell Sort
5. Quick Sort
6. Merge Sort
7. Radix Sort
8. Heap Sort
9. Topological Sort
Lab Assignment || BCA || SEM IV || CA222 : Advanced Database System
----------------------------------------------------------------------------------------------------------------------------------------------------------
ASSIGNMENT-1
Objectives
Hands on with Basics of Data Definition Language (DDL) commands Like Create Table, Alter
Table, Truncate Table, Drop table etc.
Hands on with Basics of Data Manipulation Language (DML).
To understand and apply constraints to the tables.
2. Table 2: sub_master
Column Name Datatype and Size Constraints Description
Subcode varchar(10) Primary Key. Example:CA119
Should start with CA
Subject Varchar2(40) subject name
Th_credit Number(1) Should be > 0 and <7 Credits in theory portion of
the subject
Lab Assignment || BCA || SEM IV || CA222 : Advanced Database System
----------------------------------------------------------------------------------------------------------------------------------------------------------
Pr_credit Number(1) Should be > 0 and <4 Credits in practical portion
of the subject
3. Table3 : stud_subject
Name DOB
____________________________________
Vishal Patel 18-Apr-2002
Shailesh Macwan 15-Apr-2001
Queries of Expressions/Functions
Name DOB
____________________________________
Vishal Patel April 18, 2002
Shailesh Macwan April 15, 2001
Name DOB
____________________________________
Vishal Patel 18-Oct-2002
Shailesh Macwan 15-Oct-2001
Mobile Number(10)
BRANCH
VRCE NAGPUR
AJNI NAGPUR
KAROLBAGH DELHI
CHANDI DELHI
DHARAMPETH NAGPUR
M.G.ROAD BANGLORE
ANDHERI BOMBAY
VIRAR BOMBAY
NEHRU PLACE DELHI
POWAI BOMBAY
CUSTOMERS
ANIL CALCUTTA
SUNIL DELHI
MEHUL BARODA
MANDAR PATNA
Lab Assignment || BCA || SEM IV || CA222 : Advanced Database System
----------------------------------------------------------------------------------------------------------------------------------------------------------
MADHURI NAGPUR
PRAMOD NAGPUR
SANDIP SURAT
SHIVANI BOMBAY
KRANTI BOMBAY
NAREN BOMBAY
BORROW
LOANNO CNAME BNAME AMOUNT
201 ANIL VRCE 1000.00
206 MEHUL AJNI 5000.00
311 SUNIL DHARAMPETH 3000.00
321 MADHURI ANDHERI 2000.00
375 PRMOD VIRAR 8000.00
481 KRANTI NEHRU PLACE 3000.00
6. Manipulating Data
(1) Give 10% interest to all depositors.
(2) Give 10% interest to all depositors having branch vrce
(3) Give 10% interest to all depositors living in nagpur and having branch city bombay.
(4) Write a query which changes the department number of all employees with empno 7788’s job to employee
7844’current department number.
(5) Transfer 10 Rs from account of anil to sunil if both are having same branch.
(6) Give 100 Rs more to all depositors if they are maximum depositors in their respective branch.
(7) Delete depositors of branches having number of customers between 1 to 3.
(8) Delete deposit of vijay.
(9) Delete borrower of branches having average loan less than 1000.
Lab Assignment || BCA || SEM IV || CA222 : Advanced Database System
----------------------------------------------------------------------------------------------------------------------------------------------------------
ASSIGNMENT-3
Objective:
To describe constant, variable, variable initialization, and basic operations on the
variables in PL/SQL.
1. PL/SQL Block
2 Write a PL/SQL block to input and to print your personal detail in the following format using
appropriate variable.
Name: <<Name>>
Address: <<Address>>
City: <<City>>
Mobile: <<Mobile Number>>
Birth Date: <<Birth date>>
3 Write a PL/SQL block to print to initialize two number variables and print the total of it.
4 Write a PL/SQL block to swap the values of two number type of variables. Print the values
of variables before and after the swap.
8 WRITE A PL/SQL BLOCK TO PRINT 10 NUMBERS USING WHILE AND FOR LOOP
1 Write a PL/SQL block to display name and mobile number from EMP table whose
id is 101.
2 Write a PL/SQL block to insert 5 numbers in temp table, update the any number
by taking input from user, delete any number as per user choice. Also print
appropriate message.
1 Assume that EMP and DEPT table with proper records exists in your database.
5 Assume that you have EMP and DEPT table with proper records:
Find out the name of employee who has experienced in the Electrical department more
than 5 years.
6 Assume that you have EMP and DEPT table with proper records:
Write a PL-SQL block that will print the following report:
---------------------------------------------------------------------
Id NAme Gender Phone-no Designation Deptid Deptname
---------------------------------------------------------------------
1 Mahendra M 9999222234 Manager 101 MCA
2 Virat M 9873627789 Sales Manager 102 Civil
3 Rohit M 8762349087 Clerk 101 MCA
4 Renu F 7896734567 Accountant 103 Electrical
---------------------------------------------------------------------
Total Records Printed : 4
Lab Assignment || BCA || SEM IV || CA222 : Advanced Database System
----------------------------------------------------------------------------------------------------------------------------------------------------------
ASSIGNMENT-7
Objective:
To discuss Stored Procedure in PL/SQL from block or direct.
Assume that EMP and DEPT table with proper records exists in your database.
EMP(empid, fname, mname, lname, gender, salary, dob, designation, phoneno, deptid)
DEPT(deptid, dname, max_capacity)
2 Write a Procedure which pass two parameters, calculate sum of two values and display
it in procedure.
3 Write a Procedure which will display total no. of employees whose salary greater
than 10000 and execute it.
4 Write a Procedure which will display mobile number of employee whose id is given
by user. (pass as parameter)
5 Create a stored procedure that takes and input parameter as department- id and
generate an output from the procedure as number of employees who are working in
that department.
6 Write a procedure for following task:
When new employee joins in the institute, check if empid is present in the institute
or not and the no. of already registered employees not exceeding the max capacity
for that institute.
7 Write a procedure to display top five highest paid employees whose designation is
Officer.
8 Write a procedure to display name of employee from emp table in a given format:
( first name, middle name, last name), use CASE statement to have 4 options.
For example,
Display name in the format “ RLP “
Display name in the format “ R.L.Patel “
Display name in the format “ Rambhai L. Patel “
Display name in the format “ Rambhai Laxmanbhai Patel”
9 Enter the employee id from user. Check whether the name exists in table for
corresponding id. If yes, Write a PL/SQL procedure to find total no of vowels from
employee name. If no, display appropriate message.
10 To vote for Election, write a Procedure which will display the following details:
Eligible to vote( >18 years) || Not Eligible ( less than 18 years)
Id & name of employee || id & Name of Employee
Lab Assignment || BCA || SEM IV || CA222 : Advanced Database System
----------------------------------------------------------------------------------------------------------------------------------------------------------
ASSIGNMENT-8
Objective:
To discuss Stored Function and local function in PL/SQL from block.
1 Write a function to take two numbers from user and print summation of it.
2 Write a function whether given number is odd or even.
3 Write a function that returns total number of incomplete jobs, using table
JOB(jobid, type_of_job, status)
4 Write a function to which a birthdate is passed and it returns the age in terms of years
as of today and a procedure/block which calls this function to display.
5 Write a function which displays the number of items whose weight fall between a
given range for a particular color using table
ITEM(itemno, name, color, weight)
6 Create a function to return count of all employees who works in MCA department.
This function is called in procedure which displays the output in proper format.
After calculating the fine store the required information in the FINE table so
that a report can later be printed out.
Write a procedure or function for the given a table, check which students have to pay
fine and the amount of fine to be paid. A student can keep the book for 15 days. If
the number of days has exceeded 15 then, the fine is calculated as follows:
8 – 15 days : Re 1 per day (to be counted from the 8th day onwards)
More than 15 : Re 1.5 per day (to be counted from the 16th day onwards)
Write a procedure that will display name of paper which is of lowest price.
Write a function which will count total number of newspaper exists language wise.
( English language : 999 papers
Gujarati language : 999 papers )
Hindi language : 999 papers)
Lab Assignment || BCA || SEM IV || CA222 : Advanced Database System
----------------------------------------------------------------------------------------------------------------------------------------------------------
ASSIGNMENT-9
Objective:
To discuss Database Trigger in PL/SQL.
Assume above EMP and DEPT table exists with records.
1 Write a code which demonstrate simple trigger.
2 Create a trigger on EMP table that tracks the UPDATE on it. Each record being
updated on it shall be tracked and kept as backup in EMP_TRAN table
3 Create a trigger on EMP table that tracks the DELETE on it. Every record being
deleted from it shall be kept in EMP_TRAN_BACKUP table.
4 Create a trigger on EMP table that tracks UPDATE being performed on SAL column
of the table. If the UPDATE is being performed between 2.30 pm to 3.30 pm then copy
the effect on EMP_UPDATE_TRACK table
5 Write a trigger which restrict to enter or update the transaction on Saturday or Sunday
OR
Write a PL\SQL trigger which will not allow to insert records on saturday and sunday.
6 Write a trigger which restrict user to enter name in EMP table either starting with ‘X’
or is less than 2 letters
Write a trigger which only accept blood_gr in range( with +ve and –ve blood gr ) of
A ,B, AB, O.
8 Write a trigger in which accepts empid from user and check whether sal>65000 , don't
allow to insert or update emp table.
9 Create a trigger which ensures that Emp name that to be inserted is in capital.
10 Write a trigger which deletes every record from result table if student table is empty.
student(studno,fnm,mnm,lnm,degree,bdth);
result(studno,math,eng ,ss,sci )
11 Write a trigger which accepts student records whose age is between 18 to 30.
Do the following:
(a) For a given bill number, print the bill in the following format.
Prepare a report from above table taking date, shift, , doctor_id as parameters.
Shift is Morning if time are from 9.00 Am to 1.00 pm and
Shift is Evening if time are from 5.00 to 9.30 pm.
APPOINTMENT SCHEDULE
Write a PL/SQL block which will print tour details, a driver is going to take it. ( pass
driver_no as parameter)
Tour Details
Write a stored procedure for banking purpose which perform following Task :
1. Create a new account (insert)
2. Deposit funds (update)
3. Check account balance (view balance)
4. Close the account (delete)
ASSIGNMENT -I
Introduction to Software testing and Checklist preparation
Prepare the checklist for the below programs in the given format, Program Id: Program
Name:
Checklist
Table for checklist: 1.Checklist Item 2. Input 3. Expected Result
Q-2 Prepare checklist to accept a number and check whether number is Odd or Even.
Q-3 Prepare checklist to accept three numbers and find maximum and minimum numbers.
Q-4 Prepare checklist to a calculator that input two operands and one operator and perform the following
operations ADD, SUBTRACT, MULTIPLY AND DIVIDE.
Q-5 Prepare checklist to calculate Gross and Net Salary of an employee ,based on the following
criteria HRA is 3% of basic DA is 175% of basic TA is 400 Rs.
PT is 80 Rs.
PF is 10% of basic
GROSS = BASIC + HRA + DA+ TA
NET = GROSS – PT – PF
Q-6 Prepare checklist to accept marks of 5 subjects (out of 100), calculate total, percentage and
Class of a student based on the following criteria.
Percentage Grade
Above or Equal to 70 A
Between 69 and 60 B
Between 59 and 50 C
Below 50 D
If marks in any subject are below 35 then the will be F.
Q-7 Prepare checklist to a program that read a number between 1 to 7 (including both) and then
print corresponding day name from the week. For example, if entered number is 1, then
print “Today is Monday”, if entered number is 2, then print “Today is Tuesday”, and so on.
: User story:
Lab Assignment || MCA || SEM II || CA870-Software Quality Assurance
----------------------------------------------------------------------------------------------------------------------------------------------------------
As a role of supervisor in a company I can keep track of order details only after successful log in
which will ask for username, password. Logging into the system requires OTP verification via SMS.
ASSIGNMENT -II
Control Flow Testing
Total digits:4
Total alphabets:7
Total Special characters:3
Lab Assignment || MCA || SEM II || CA870-Software Quality Assurance
----------------------------------------------------------------------------------------------------------------------------------------------------------
ASSIGNMENT -III
Getting familiar with Junit using NetBeans
Total digits:4
Total alphabets:7
Total Special characters:3
ASSIGNMENT IV
Testing WebApps with Selenium WebDriver using Chrome Driver