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

M.Sc. Bio Sem-I 2024-25 C - Lab Assignments

Uploaded by

12 yashika pal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

M.Sc. Bio Sem-I 2024-25 C - Lab Assignments

Uploaded by

12 yashika pal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Lab Assignments

M.Sc. (BI) Sem –I, 2024-25


MBI-17: Lab-II (C++)

Last date of submission : November 10, 2024

1. Write a program to calculate final velocity using the formula: v=u + a*t, with initial velocity,
acceleration and time as input.
2. Write a program to the largest of three numbers.
3. Write a function called hms_to_secs() that takes three int values—for hours,
minutes, and seconds—as arguments, and returns the equivalent time in seconds
(type long). Create a program that exercises this function by repeatedly obtaining a
time value in hours, minutes, and seconds from the user (format 12:59:59), calling
the function, and displaying the value of seconds it returns.
4. Write a program to find the frequency of nucleotides in a given DNA Sequence. Also
find the %GC content.
5. Write a program to check whether the two given sequences are reverse
complementary to each other or not.
6. Define a class to represent a bank account. It contains
Data Members:
Name of the depositor
Account Number
Type of account
Balance
Member Functions:
To assign initial values
To deposit an amount
To withdraw an amount < amount available
Display the name and balance.
7. Create a bank account by supplying a user id and password.
Login using their id and password.
Quit the program.
Now if login was successful the user will be able to do the following:
Withdraw money.
Deposit money.
Request balance.
Quit the program.
If login was not successful (for example the id or password did not match) then the
user will be taken back to the introduction menu.
8. To write a C++ program to add two complex numbers using object as argument.
class as complex.
Data members as real and imag
Member functions:
void getdata()
void show()
void sum(complex c1,complex c2) getdata() method is used to get the values .
show() method is used to display the values.
sum() method is used to perform addition operation using object as argument.
9. To write a C++ program to display the student details using class and array of
objects.

1
Class as student.

Data members: rollno, name, mark1, mark2, mark3, total and average.
Member functions as getdata() and displaydata().getdata() method used to get the
student details.
displaydata() function is used to display the student details.
Create an object array for the student class and write a Program to get the following
information:
Get the number of students.
Enter student details
Display the student details
8. Re-write the time addition program using friend function.
9. Write a C++ program to add two complex numbers.
i) The class Complex contains three constructors.
a) One with no parameter. (Used for the object for storing result.)
b) With one parameter(Same value for real and imaginary part)
c) With two parameters.
and
ii) Two friend functions
a) One to add two complex number by taking two reference variables of class
complex and returning another reference.
b) To display the result.
10. A Bank gives 4% interest on current account and 6% interest on savings account. An
additional 3% interest is provided for savings duration of 5 years and above. Using
dynamic initialization of constructor write banking program using C++.
11. Add two complex number by overloading + operator
a) Using Member function.
b) Using Friend Function.
12. Class student contains roll number, name and course as data members and
Input_student and display_student as member functions. A derived class exam is
created from the class student with publicly inherited. The derived class contains
mark1, mark2, mark3 as marks of three subjects and input_marks and display_result as
member function. Create an array of object of the exam class and display the result of
5 students.
13. Write a C++ program to implement the following levels of inheritance.

2
14. Base1 and Base2 contains a public, protected and private data member. Base1 is a
friend of Base2. class Derived is inherited from Base1 a Base2. Write a C++ program
to check the accessibility of the data members of Base1 and Base2 from the Derived
class.

15. Class polygon contains data member width and height and public method
set_value() to assign values to width and height.
Class Rectangle and Triangle are inherited from polygon class. Both the classes
contain public method calculate_area() to calculate the area of Rectangle and
Triangle. Use base class pointer to access the derived class object and show the area
calculated to illustrate virtual functions.
16. Write a program to implement the exception handling of division by zero in the
division of two integers.
17. Design a templateor generic function to find the largest among three numbers of
different data types.

----------------------------------------------------------------------------------------------------------------------------------

You might also like