0% found this document useful (1 vote)
146 views3 pages

Assignment 1 Object Oriented Programming

The document discusses various concepts in object-oriented programming using C++ such as call by value vs call by address vs call by reference, differences between structures and classes, use of this pointer, constructors and destructors, inheritance, polymorphism, and provides programming assignments involving classes. It asks questions about features like function overloading, default arguments, copy constructors, static members, access specifiers, and memory management in OOP using C++.

Uploaded by

d.alhalabi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (1 vote)
146 views3 pages

Assignment 1 Object Oriented Programming

The document discusses various concepts in object-oriented programming using C++ such as call by value vs call by address vs call by reference, differences between structures and classes, use of this pointer, constructors and destructors, inheritance, polymorphism, and provides programming assignments involving classes. It asks questions about features like function overloading, default arguments, copy constructors, static members, access specifiers, and memory management in OOP using C++.

Uploaded by

d.alhalabi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 3

Assignment-1

Object Oriented Programming Using C++

Explain all the features of object oriented programming which you will be using in C++.

2. Differentiate call by value, call by address, and call by reference with example.

3. Differentiate C++ structure from a C++ class.

4. Can we use the same function name for a member function of a class and an outsidefunction in
the same program file? If yes, how are they distinguished? If no, give reasons.

5. What is inline function? Discuss the pros and cons of using inline function with example.

6. Discuss the advantages of using function with default arguments as compared to function
overloading with example. Also discuss the possible conflict which may arise when both the features
are combined.

7. Differentiate function overloading and function overriding with example.

8. Illustrate the need of friend function with example.

9. Discuss the various access methods used in c++ with respect to their scope and life time.

10. Explain the need of static data members in a class through an example. Why this pointer can not
be used with the static members of the class?

11. What does this pointer point to? Mention the applications of this pointer through examples?

12. What is a constructor? Discuss the different types of constructors and mention when it is
mandatory to define a constructor of a class.

13. Can we have a constructor with default arguments? Justify your answer.

14. Mention all the scenarios when the copy constructor is going to be invoked and replicate those
scenarios through examples. Why does copy constructor accept the objects by reference and not by
value.

15. Can we have more than one constructors in a class? If yes, explain the need for such a situation.

16. Describe the need of defining a explicit copy constructor in a program through examples.

17. Differentiate between shallow copy and deep copy while copying an existing object to a new
object.

18. Differentiate between a constructor and destructor.

19. Why call by address and call by reference is preferred over call by value while passing an object
as an argument to a function.

20. Is there any way to access class private members without its object? Justify your answer.

21. When do we use the protected visibility specifier to a class member?

22. In what order are the class constructors called when a derived class object is created?
23. Differentiate between compile and run-time polymorphism. Explain how run-time polymorphism
is achieved in c++ using an example.

25. Explain, why a constructor can not be made virtual.

26. Write a c++ program using class to represent a bank account. Include the following members:

Data members:

1. Name of the depositor.

2. Account number.

3. Type of account.

4. Balance amount in the account.

Member functions:

1. To assign initial values.

2. To deposit an amount.

3. To withdraw an amount after checking the balance.

4. To display the name and balance.

27. Write a c++ program using class to take the input of a fraction in terms of numerator and
denominator, then simplify and display the same.

28. Write a c++ program using class to add two numbers using this pointer.

29. Write a c++ program using class to display the name of the topper in the class.

30. Write a c++ program using class that has array of integers as data members and input(),display(),
find_largest(), find_smallest(), and sum() as its member function to carry out the desired task.

31. Write a c++ program using class to exchange two inter members of a class. Use friend function,
pointer to data member, and pointer to member function.

32. Write a c++ program using class to dynamically allocate two integer arrays and add them in a
third array.

33. Write a c++ program using class that concatenate two strings defined as private members in a
class using friend function. The strings to be concatenated must belong to object S1 and S2 of class
string.

34. Write a c++ program using class that uses dynamic constructor to allocate memory to an array.
Count the number of even and odd elements. Finally free the dynamically allocated memory.

Write a c++ program using class to dynamically allocate memory to string objects. Use copy
constructor to copy one string to another.

36.How are data and functions organized in an object oriented system?

useful in OOP?

-oriented program.
-oriented programming? How it is different from the procedure-oriented
programming?

40.What are the merits and demerits of OOP?

concept of OOP.

-oriented programming? What are its main characteristics?

You might also like