Programming with C++ previous year question paper 2017 | HNBGU Second semester

Programming with C++

HNBGU BCA Previous Question Paper 2017-18

  1. Write application of OOPs

  2. Define pointer

  3. What is polymorphism?

  4. What are binary operators?

  5. Explain base class and derives class.

  6. What are reference parameters?

  7. Discuss very briefly friend function.

    1. How does a class accomplish encapsulation and data hiding? Illustrate with an example.

    2. What are constructors? Explain constructors with arguments and how are arguments passed to the constructor?

    1. Write a program to overload operator’<=’ to compare the length of two strings.

    2. What is virtual base class? When do we make class virtual?

    1. What is function overriding? Explain with suitable example

    2. Give the hierarchy of I/O stream classes in C++

    1. What does polymorphism mean in C++? How is polymorphism achieved at (i) runtime and (ii) compile time? Explain with the help of example

    2. differentiate between private, public and protected access modifiers. Also explain their meaning.

    1. Write a class COMPLES in C++. It has two members of type integer. One for real part and another for imaginary part. Also write functions that can overload assignment and increment operator both prefix and suffix.

    2. Why are virtual constructors not supported in C++?justify.

  1. Write a C++ program that creates a class time with two integers and in one float as hour, minutem and seconds respectively. There should be two constructors one for initializing these values to zero and another for initializing Them to fized values. In case seconds are not given, it should be automatically initialized to zero. A member function should display time in 02: 45 : 67.05 format. There should also be member function that adds two time objects.

  2. Write short notes on the following.

    1. Dynamic memory allocation
    2. Dynamic binding