Object Oriented Programming Using C++ Assignment
Q1) What are class templates? Create a template for array class.
Q2) When and how does the C++ compiler generate an actual function definition from its
Q3) Answer the following
a. Illustrate 2 ways to open a file.
b. Describe the various file modes available.
c. What are the various components of standard template library?
d. Distinguish between the vectors and lists in standard template library.
Q4) Write a code that define a vector of size five and initialize its elements as 10, 20, 30, 49, 12.
It should then display these elements.
Q5) A file contains a list of student name and corresponding telephone numbers. The name is a
single word and name, telephone numbers are separated by a white space. Write a code that
finds the telephone number of a specified student from this file.
Q6) What is Function Template? Write a function Template for finding the largest in a given
array. The array parameter must be of generic data type.
Q7) What is generic programming? What are its advantages and state some of its application?
Q8) Explain how the compiler processes calls to a function template.
Q9) Explain the syntax for inheriting template – based super class. Note that the derived class
can again be template – based or non – template –based. Give an example.
Q10) Write a template based program for adding objects of the Vector class. Use dynamic data
members instead of arrays for storing vector elements.