Writing template class binarytree to search-insert element


Answer the following questions

Question1)  

Describe the term Class and Object using example of a student class. Student class represents name, enrolment number, father’s name, telephone number, programme code and date of birth of a student. The class has the function to illustrate the information about student except date of birth, and to modify information of telephone number and programme. Name the private and public members (data members as well as member functions) for the class student. Define the data types of member variables using C++ and create few objects of the class. Could you put information in those objects? Give reasons.                                    

Question2)                            

Describe the following terms in context of object oriented programming using student class of question 1. You should use C++ to define student class. Additionally, suppose that student class has a sub class namely “PhD Student” who has the extra field “Department”. The function to explain the information about PhD student also prints department in addition to showing information as shown by the student class.                             

(a) Overloaded Constructors

(b) Encapsulation

(c) Inheritance

(d) Polymorphism

Question3)    

Write down the advantages of using UML? Create class diagram for a University having classes – Student, Teacher, Subject and Programme. Make appropriate assumptions, if any.

Question4)

Describe the usage of the following C++ operators with the help of the example program.

(a) operator for type casting

(b) operator for bitwise OR

(c) operator for dereferencing an address

(d) comma operator

Question5)  

Differentiate between call by value and call by reference with the help of an example in content of function call. Describe the advantages of call by value. What does C++ uses?         

Question6)

Write down the template class “binaryTree” in C++. The class must have functions for search and insert and element into a binaryTree. Use this template to make a binary tree of integer keys. Make appropriate assumptions, if any.            

Question7)   

Create a class AlphaString which stores only alphabets in a string of arbitrary length. String has a constructor which ensures that String has only Alphabets. Class also has the copy constructor, and an overloaded + operator. The overloaded + operator must perform concatenation of two strings. Does the class need an explicit destructor? Justify your answer.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Writing template class binarytree to search-insert element
Reference No:- TGS02360

Expected delivery within 24 Hours