0% found this document useful (0 votes)
109 views

CS1 - Pract - Aim of Experiments

The document outlines 13 experiments with the aims of writing programs in C++ or HTML to demonstrate various programming concepts. These include: 1) Using a swap function to exchange values passed by reference, 2) Performing a binary search on a sorted array, 3) Sorting an array using bubble sort, 4) Reversing a string by swapping characters, 5) Implementing a circle class with methods for radius, area, and circumference, 6) Demonstrating use of constructors and destructors, 7) Creating a ratio class with various member functions, 8) Adding complex numbers using a constructor, 9) Using virtual functions in inheritance, 10) Implementing inheritance hierarchies, 11) Reading from text files to display country
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

CS1 - Pract - Aim of Experiments

The document outlines 13 experiments with the aims of writing programs in C++ or HTML to demonstrate various programming concepts. These include: 1) Using a swap function to exchange values passed by reference, 2) Performing a binary search on a sorted array, 3) Sorting an array using bubble sort, 4) Reversing a string by swapping characters, 5) Implementing a circle class with methods for radius, area, and circumference, 6) Demonstrating use of constructors and destructors, 7) Creating a ratio class with various member functions, 8) Adding complex numbers using a constructor, 9) Using virtual functions in inheritance, 10) Implementing inheritance hierarchies, 11) Reading from text files to display country
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Aim of all experiments:

1) Aim: Write a function in C++ that exchanges data (passing by reference) using swap
function to interchange the given two numbers.

Theory: Explain concept of call by reference.

2) Aim: Write a program in C++ that first initializes an array of given 10 sorted real numbers.
The program must verify whether a given element belongs this array or not, using Binary –
Search technique. The element (to be searched) is to be entered at the time of execution. If the
number is found, the program should print its position in the array, otherwise it should print
“The number is not found.”

Theory: Explain algorithm of Binary Search.

3) Aim: Write a program in C++ that first initializes an array of given 10 real numbers. The
program must sort numbers in ascending order using Bubble – Sort method. It should print the
given list of numbers as well as the sorted list.

Theory: Explain algorithm of Bubble-Sort.

4) Aim: Write a program in C++ to print the given string (including spaces) and reverse it
using a function, which locates the end of the string. Then swap the first character with the last
character, the second character with second last character and so on.

Theory: Explain the functions used in program [For example: gets( ) , puts( )].

5) Aim: Implement a Circle class in C++. Each object of this class will represent a circle,
storing its radius and x and y co-ordinates of its centre as float. Include a default constructor,
access functions, an area( ) function and a circumference( ) function. The program must print
the co-ordinates with radius, area and circumference of the circle.

Theory: Explain the syntax of class and access specifiers (public, private, protected) in detail.

6) Aim: Write a program in C++ that initializes a Ratio class with no parameters as a default
constructor. The program must print the message “OBJECT IS BORN” during initialization. It
should display the message “NOW X IS ALIVE’’, when the first member function ratio_x is
called. The program must display “OBJECT DIES” when the class destructor is called for the
object when it reaches the end of its scope.

Theory: Explain the concept of Constructor and Destructor.

7) Aim: Write a program in C++ with a ratio class using member functions like assign( )
function to initialize its member data (integer numerator and denominator), convert( ) function
to convert the ratio into double, invert( ) function to get the inverse of the ratio and print( )
function to print the ratio and its reciprocal.

Theory: Explain the different functions used in program.


8) Aim: Write a program in C++ with a complex constructor to add the given two complex
numbers. The program should print the given complex number and their sum.

Theory: Explain the concept of constructor and operator used in the program.

9) Aim: Write a program in C++ using virtual function. The program must declare ‘p’ to be a
pointer to objects of the base class Person. First, the program must assign ‘p’ to point an
instance x (name of the person eg. “BOB”) of class Person. The program must then assign ‘p’
to point at an instance y (name of the student, eg.”TOM”) of the derived class Student. Define
a print( ) function in the base class such that it invokes the same base class function to print the
name of the person by default. The second call for the same should invoke the derived class
function to print the name of student.

Theory: Explain the concept of Virtual function.

10) Aim: Write a program in C++ to implement the following class hierarchy: Class Student
to obtain roll number, Class Test to obtain marks scored in two different subjects, Class Sports
to accept weightage (marks) in sports and Class Result to calculate the total marks. The
program must print the roll number, individual marks obtain in two subjects, Sports and total
marks.

Student

Test Sports

Result

Theory: Explain Inheritance and its types.

11) Aim: Write a program in C++ to read the name of a country from one text file and name of
its corresponding capital city from another text file. The program must display the country
name and indicate its corresponding capital (for at least five countries) in the output.

Theory: Explain file stream classes.

12) Aim: Create a simple HTML page for Software Development Company.
The page must consist of at least 3 paragraphs of text. The page must have an appropriate title,
background color or background image, and hyperlink to other pages. The paragraphs must
have text consisting of different colors and styles in terms of alignment and Font Size.

Theory: Explain the tags used in program with suitable example.

13) Aim: Create a simple HTML page for College Profile.


The page must consist of a scrolling marquee displaying an appropriate Message. The page
must include a table with atleast 5 rows and 3 columns having merged cells atleast at 1 place.
The page must also display an image, an image such that when the same is viewed through a
browser and the mouse is placed (hovered) on the image, an appropriate text message should
be displayed. The image itself should also act as a hyperlink to another page.

Theory: Explain the tags used in program with suitable example.

You might also like