1. What is a class?
Ans: The objects with the same data structure (attributes) and behavior (operations) are called class.
Ans: The objects with the same data structure (attributes) and behavior (operations) are called class.
2. What is an object?
Ans: It is an entity which may correspond to real-world entities such as students, employees, bank account. It may be concrete such as file system or conceptual such as scheduling policies in multiprocessor operating system.
Every object will have data structures called attributes and behavior called operations.
Ans: It is an entity which may correspond to real-world entities such as students, employees, bank account. It may be concrete such as file system or conceptual such as scheduling policies in multiprocessor operating system.
Every object will have data structures called attributes and behavior called operations.
3. What is the difference between an
object and a class?
Ans: All objects possessing similar properties are grouped into class.
Example :–person is a class, ram, hari are objects of person class. All have similar attributes like name, age, sex and similar operations like speak, walk.
Ans: All objects possessing similar properties are grouped into class.
Example :–person is a class, ram, hari are objects of person class. All have similar attributes like name, age, sex and similar operations like speak, walk.
Class person
{
private:
char name[20];
int age;
char sex;
public: speak();
walk();
};
{
private:
char name[20];
int age;
char sex;
public: speak();
walk();
};
4. What is the difference between
class and structure?
Ans: In class the data members by default are private but in structure they are by default public
Ans: In class the data members by default are private but in structure they are by default public
5. Define object based programming
language?
Ans: Object based programming language support encapsulation and object identity without supporting some important features of OOPs language.
Object based language=Encapsulation + object Identity
Ans: Object based programming language support encapsulation and object identity without supporting some important features of OOPs language.
Object based language=Encapsulation + object Identity
6. Define object oriented language?
Ans: Object-oriented language incorporates all the features of object based programming languages along with inheritance and polymorphism.
Example: – c++, java.
Ans: Object-oriented language incorporates all the features of object based programming languages along with inheritance and polymorphism.
Example: – c++, java.
7. Define OOPs?
Ans: OOP is a method of implementation in which programs are organized as co-operative collection of objects, each of which represents an instance of some class and whose classes are all member of a hierarchy of classes united through the property of inheritance.
Ans: OOP is a method of implementation in which programs are organized as co-operative collection of objects, each of which represents an instance of some class and whose classes are all member of a hierarchy of classes united through the property of inheritance.
8. What is public, protected, and
private?
Ans: These are access specifier or a visibility lebels .The class member that has been declared as private can be accessed only from within the class. Public members can be accessed from outside the class also. Within the class or from the object of a class protected access limit is same as that of private but it plays a prominent role in case of inheritance
Ans: These are access specifier or a visibility lebels .The class member that has been declared as private can be accessed only from within the class. Public members can be accessed from outside the class also. Within the class or from the object of a class protected access limit is same as that of private but it plays a prominent role in case of inheritance
9. What is a scope resolution
operator?
Ans: The scope resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.
Ans: The scope resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.
10. What do you mean by inheritance?
Ans: The mechanism of deriving a new class (derived) from an old class (base class) is called inheritance. It allows the extension and reuse of existing code without having to rewrite the code from scratch.
Ans: The mechanism of deriving a new class (derived) from an old class (base class) is called inheritance. It allows the extension and reuse of existing code without having to rewrite the code from scratch.
No comments:
Post a Comment