BCA2030 - OBJECT ORIENTED PROGRAMMING – C++

Dear students get fully solved assignments
Send your semester & Specialization name to our mail id
“ help.mbaassignments@gmail.com ”
or
Call us at : 08263069601

ASSIGNMENT

PROGRAM
BCA(REVISED FALL 2012)
SEMESTER
2
SUBJECT CODE & NAME
BCA2030 - OBJECT ORIENTED PROGRAMMING – C++
CREDIT
4
BK ID
B1641
MAX.MARKS
60

Note: Answer all questions. Kindly note that answers for 10 marks questions should be approximately of 400 words. Each question is followed by evaluation scheme.


1 Differentiate between Classes and Objects. Write an example program to represent a class and its object.

Answer: OOP (Object Oriented Programming) is a programming concept (or technique), which treats data and functions as objects.
Important to this concept is to understand the difference between a Class and an Object.
·         A class is a "blueprint" for an object, is a code template used to generate objects. It contins the instructions that define the properties and methods that an object can use.
·         Objects are elements from the script that are defined to perform the instructions written in a class, and can use the properties and methods defined in the class.
·         For example, to understand, you can


2 Differentiate between while and do-While loop.

Answer: while is an ENTRY CONTROLLED LOOP while do while is an EXIT CONTROLLED LOOP. The main feature of the do while loops is it is an exit controlled loopThis means that the statements enclosed inside the do {} will execute irrespective of the condition.
·         In while loop the condition is tested first and then statements are executed if the condition turns out to be true. In do while loop the statements are executed for the first time and then the conditions are tested, if the condition turns out to be true then the statements are executed again.
·         A do while is used for a block of code that



3 Differentiate between Constructors and Destructors.

Answer: The main difference is that constructor constructs the values of an object and a destructor destructs the values created by the constructor for the object. A constructor is called when you want to create a new instance of a class. A destructor is called when you want to free up the memory of an object (when you delete it).  A constructor constructs the value of an object. A destructor destructs the value created by the constructor for the object. Constructor is called in the beginning of the program and **destructor is called at the ending of the program.
·         constructer can be overloaded
·         destructors cannot be overloaded



4 What are the advantages of Polymorphism? How can it be implemented?

Answer: Polymorphism means the ability to take more than one form. An operation may exhibit different behaviors in different instances. The behavior depends on the data types used in the operation

Advantages of polymorphism:
- Same interface could be used for creating methods with different implementations
- Reduces the volume of work in terms of distinguishing and handling various objects
- Supports building extensible systems
- Complete implementation can be replaced by using same method signatures


}






5 Write a program in C++ to calculate the area of the circle when radius is given from the keyboard.

Answer:





6 Write a program in C++ to demonstrate the use of constructors.

Answer: In class-based object-oriented programming, a constructor (abbreviation: ctor) in a class is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.

Algorithm:
STEP 1:  Start the program.
STEP 2:  Declare the class as Prime with data members,
                  Member functions.
STEP 3:  Consider the argument constructor Prime() with integer
                  Argument.
Dear students get fully solved assignments
Send your semester & Specialization name to our mail id :

“ help.mbaassignments@gmail.com ”
or
Call us at : 08263069601


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.