Dear students get fully solved assignments
Send your semester & Specialization name to our mail id :
“ help.mbaassignments@gmail.com ”
or
Call us at : 08263069601
1. 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 questionis followedbyevaluationscheme.
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 functionsasobjects.
Importantto thisconceptisto understandthe difference betweenaClassandan Object.
A class is a "blueprint" for an object, is a code template used to generate objects. It contins the
instructionsthatdefine the propertiesandmethodsthatanobjectcan use.
Objects are elements from the script that are defined to perform the instructions written in a
class,and can use the propertiesandmethodsdefinedinthe class.
For example,tounderstand,youcan
2 Differentiate betweenwhileanddo-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 executeirrespective of the condition.
2. 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 isusedforablockof code that
3 Differentiate betweenConstructorsandDestructors.
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 **destructoris calledatthe endingof the program.
constructercan be overloaded
destructorscannotbe 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
differentbehaviorsindifferentinstances.The behaviordependsonthe datatypesusedinthe operation
Advantages of polymorphism:
- Same interface couldbe usedforcreatingmethodswithdifferentimplementations
- Reducesthe volume of workintermsof distinguishingandhandlingvariousobjects
- Supportsbuildingextensible systems
- Complete implementationcanbe replacedbyusingsame methodsignatures
}
5 Write a program in C++ to calculate the area of the circle when radius isgiven from the keyboard.
3. 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
argumentsthatthe constructorusesto setrequiredmembervariables.
Algorithm:
STEP 1: Start the program.
STEP 2: Declare the classas Prime withdata members,
Memberfunctions.
STEP 3: Considerthe argumentconstructorPrime()withinteger
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