You can Download Chapter 6 Object-Oriented Concepts Questions and Answers, Notes, 1st PUC Computer Science Question Bank with Answers Karnataka State Board Solutions help you to revise complete Syllabus and score more marks in your examinations.
Karnataka 1st PUC Computer Science Question Bank Chapter 6 Object-Oriented Concepts
1st PUC Computer Science Object-Oriented Concepts One Mark Questions and Answers
What does OOP mean?
OOP means Object-Oriented Programming.
What is object oriented programming?
Object-oriented programming (OOP) is a programming language model, organized around objects” rather than “actions” and data rather than a logic of the program.
- An object is a combination of code and data that can be treated as a unit.
- An object can be considered as any real-time entity, (existing thing) that can perform a set of related activities.
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describes the details of an object.
Which programming approach does the OOP follow?
OOP follows the Bottom-up approach of programming.
What is the meaning of abstraction in OOP?
Abstraction in OOP is “A model of a complex system that includes only the details essential to the perspective of the viewer of the system.”
The method of combining data, attributes, and methods in the same entity is called encapsulation.
What is polymorphism?
Polymorphism is a Greek word that means Many Shapes. In OOP Polymorphism means the ability to take on many forms. The term is applied both to objects and to operations.
What is dynamic binding?
Dynamic binding means a link exists between procedure call and code to be executed at run time when that procedure is called for. At run time when a procedure is called for, calls the link between procedure call and code is dynamically chosen and executed.
What is message passing?
Message passing is a method by which an object sends data to another object or requests other objects to invoke a method. This is also known as interfacing.
What do you mean by inheritance in OOP?
Inheritance is the process by which objects can acquire the properties of objects of some other class.
Write one advantage of OOP.
The object-oriented programming provides improved software development productivity over traditional procedure based programming techniques, because of the factors like modularity, extensibility, and reusability.
Write one disadvantage of OOP.
Larger program size:
Object-oriented programs typically involve more lines of code than procedural programs.
Mention one application of OOP.
Main application areas of OOP are
- User interface design such as windows, menu
- Object-oriented databases
1st PUC Computer Science Object-Oriented Concepts Two/Three Marks Questions and Answers
Explain object-oriented programming briefly.
Object-oriented programming is the method of programming, where a system is considered as a collection of objects that interact together to accomplish certain tasks. Objects are entities that encapsulate data and procedures that operate on the data.
Compare Structured Programming and Object-Oriented Programming languages.
Malar difference between Structured Programming Language and Object-Oriented
Programming Language are:
Structured Programming Language
Object-Oriented Programming Language
|(1) Follows a top-down approach in program design.||(1) Follows a bottom-up approach in program design.|
|(2) Data and Functions are not coupled with each other.||(2) Functions and data are coupled together.|
Write any two important characteristics of OOP.
Data encapsulation and inheritance are two important characteristics of OOP.
What is the purpose of object-oriented programming?
The main purpose of object-oriented programming is to simplify the design, programming and most importantly debugging of a program. So to modify a particular data, it is easy to identify which function to use.
Briefly explain the class.
A class may be defined as a collection of similar objects. In other words, it is a general name for all similar objects. In the OOPs concept the variables declared inside a class are known as “Data Members” and the functions are known as “Member Functions”.
Compare objects and classes.
A class is a definition of an object. It is a data type like int. A class is a type, and an object of this class is just like a variable. In other words, the class is a blueprint and an object can be considered as any real-time entity (existing thing) that can perform a set of related activities.
Explain about message passing in object-oriented programming?
Message passing is a method by which an object sends data to another object or requests another object to invoke a method. It acts like a messenger from one object to another object to convey specific instructions.
State the advantages of object-oriented programming.
Some of the advantages of object-oriented programming are as follows:
- A clear modular structure can be obtained which can be used as a prototype and it will not reveal the details of the design.
- Easy maintenance and modifications to the existing objects can be done with ease.
- A good framework is provided which facilitates creating rich GUI applications.
Explain about inheritance in OOPS?
Inheritance is the process of creating a new class, called derived class from an existing or base class. The derived class inherits all the capabilities of the base class. Using inheritance some qualities of the base class are added to the newly derived class, apart from its own features. Inheritance permits code reusability.
Briefly explain about polymorphism.
Polymorphism is the ability of an object to take more than one form in different instances. For example, one function name can be used for different purposes. Similarly, the same operator can be used for different operations. There are two types of polymorphism namely “compile-time polymorphism” and “run-time polymorphism”.
Briefly explain about dynamic binding.
In OOPs dynamic binding refers to linking a procedure call to the code that will be executed only at run time. The code associated with the procedure in not known until the program is executed, which is also known as late binding.
Explain the usage of encapsulation?
Encapsulation is the method of combining the data and functions inside a class. This hides the data from being accessed from outside a class directly, and only through the functions inside the class, it is able to access the information. This is also known as “Data Abstraction”, as it gives a clear separation between properties of data type and the associated implementation details.
How is message passing done in OOP? Explain briefly.
Message passing is nothing but sending and receiving of information by the objects, similar to people exchanging information. In OOPs, message passing involves specifying the name of objects, the name of the function, and the information to be sent.
The following are the basic steps in message passing.
- Creating classes that define objects and their behaviour.
- Creating objects from class definitions.
- Establishing communication among objects.
1st PUC Computer Science Object-Oriented Concepts Five Marks Questions and Answers
Write a short note on the techniques of programming.
1. Procedural programming technique:
It is a list of instructions telling a computer, step-by-step, what to do, usually having a linear order of execution from the first statement to the second and so forth with occasional loops and branches. Procedural programming languages include c, C++, etc.,
Some of the benefits of the procedural programming methodology are:
- Easy to read program code.
- Easily maintainable program code, as various procedures can be debugged in isolation.
- The code is more flexible as one can change a specific procedure that gets implemented across the program.
2. Structured programming technique:
Structured programming deals only with logic and code, and suggests making use of programming structures such as sequence, selection, iteration and modularity in programs.
- It focuses on techniques for developing good computer programs and problem solution.
- It is most important to consider single-entry and single-exit control in a program and structures.
- Structured code is like a page, which can be read from the top to bottom without any backward references.
- Read from top to bottom makes the code easy to read, test, debug, and maintain.
3. Object-oriented technique:
Object-oriented programming is a method of programming where a system is considered as a collection of objects that interact together to accomplish certain tasks. Objects are entities that encapsulate data and procedures that operate on the data. The main purpose of object-oriented programming is to simplify the design, programming and most importantly debugging a program.
So to modify a particular data, it is easy to identify which function to use. The important elements of OOP are objects, classes, abstraction, encapsulation, polymorphism, and inheritance.
What are the features of object-oriented programming languages?
Programs are divided into objects
- Data structures are designed such that, they characterize the objects.
- Functions that operate on the data of an object are tied together in the data structure.
- Data is hidden and cannot be accessed by external functions.
- Objects may communicate with each other through functions.
- New data and functions can be easily added whenever necessary.
- It follows a bottom-up approach in program design.
- Concentration is on data rather than on procedures.
What are the benefits of OOP?
Through inheritance, we can eliminate redundant code and extend the use of existing classes.
- It saves the program development time and higher productivity.
- The use of data hiding helps the programmer to build secure programs that cannot be invaded by code, in other parts of the program.
- It is possible to have multiple instances of an object to co-exist without any interference.
- It is possible to map objects in the program domain to those objects in the program.
- It is easy to partition the work in a project based on objects.
- It can be upgraded from small to large systems.
- It makes the interface descriptions with external systems much simpler by using message passing techniques.
- Software complexity can be easily managed.
Write a short note on the characteristics of OOP.
Basic Characteristics of Object-Oriented Programming:
- An object represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the problem domain/An object may be tangible things like a car, printer, is the sentence incomplete.
- In object-oriented programming, a problem is analyzed in terms of objects. Each object contains data and code to manipulate the data. It can be defined as Object = Data + Methods or functions
A class may be defined as a collection of similar objects. In other words, it is a general name for all similar objects. For example, mango, apple, banana all may be described under the common name fruits. A class serves as a blueprint or a plan or a template.
Inheritance is the process by which objects of one class acquire the properties of objects of another class. Inheritance allows to create classes which are derived from other classes so that they automatically include their “parent’s” properties, plus their own. The concept of inheritance provides the idea of reusability, which means additional features can be added to an existing class without modifying it.
The reusability implies the reuse of existing code in another program without modification to it. The concept of inheritance provides the basis for reusability in OOP.
5. Creating new data types:
Creating a class in object-oriented programming can be considered as creating new data types.
6. Polymorphism and overloading:
The property of object-oriented programming polymorphism is the ability to take more than one form in different instances. For example, the same function name can be used for different purposes. Similarly, the same operator can be used for different operations.
Explain the advantages and disadvantages of OOP.
The main advantages of OOP are:
- It is easy to model a real system as real objects are represented by programming objects in OOP.
- With the help of inheritance, we can reuse the existing class to derive a new class such that the repetition of code is eliminated and the use of the existing class is extended. This saves time and the cost of a program.
- In OOP, data can be made private to a class such that only member functions of the class can access the data. This principle of data hiding helps the programmer to build a secure program.
- With the help of polymorphism, the same function or same operator can be used for different purposes. This helps to manage software complexity easily.
- Large problems can be reduced to smaller and more manageable problems. It is easy to partition the work in a project based on objects.
- It is possible to have multiple instances of an object to co-exist without any interference i.e. each object has its own separate member data and function.
The few disadvantages of OOP are:
Object-Oriented programs are much larger than other programs. In the early days of computing, space on hard drives, floppy drives and in memory was at a premium. Today we do not have these restrictions.
Object-Oriented programs require a lot of work to create. Specifically, a great deal of planning goes into an object-oriented program well before a single piece of code is ever written. Initially, this early effort was felt by many to be a waste of time. In addition, because the programs were larger (see above) coders had to spend more time while writing the program.
Object-Oriented programs are slower than other programs, partially because of their size. Other aspects of Object-Oriented programs also demand more system resources, thus further slowing down the program.
Bring out the differences between structured programming and object-oriented programming languages
The differences between Structured Programming language and Object-Oriented Programming language are:
1. Structured Programming Language:
- It follows a top-down approach in program design.
- Data and Functions are not coupled with each other.
- Large programs are divided into smaller self-contained program segments known as functions.
- Data moves openly around the system from function to function.
- Functions are dependent so reusability is not possible.
2. Object-Oriented Programming Language:
- It follows a bottom-up approach in program design.
- Functions and data are coupled together.
- Programs are divided into entities called Objects.
- Data is hidden and cannot be accessed from outside that class.
- Functions are not dependent so reusability is possible.
Explain in detail about data encapsulation and inheritance.
It is the method of combining the data and functions within a class. This hides the data from being accessed from outside a class directly and only through the functions inside the class one is able to access the information.
This is also known as “Data Abstraction”, as it gives a clear separation between properties of data type and the associated implementation details. There are two types, known as “function abstraction” and “data abstraction”. A Function when used without knowing how implemented function abstraction. Data abstraction is using data without knowing how the data is stored.
Inheritance is the process of creating a new class, called derived class, from an existing or base classes. The derived class inherits all the capabilities of the base class but in addition, can have its own capability. Inheritance permits code reusability. Once a base class is written and debugged, it need not be touched. Reusing existing code saves time and money and increases a program’s reliability.
Inheritance can also help in the original conceptualization of a programming problem, and in the overall design of the program. A programmer can use a class created by another person or company, and without modifying it, derive at other classes which are suited to particular situations.
Write a note on polymorphism and dynamic binding.
In object-oriented programming, polymorphism is a generic term that means ‘many shapes’, (from the Greek meaning “having multiple forms”). Polymorphism is briefly described as “one interface, many implementations.” There are two types of polymorphism one is compile-time polymorphism and the other is run time polymorphism.
For example, consider the operation of addition.
- If the operands are strings, then the operation would produce a third-string by concatenation.
- If the operands are numbers, it will generate a sum by dynamic binding.
- It refers to the linking of a procedure call to the code to be executed in response to the call.
- Dynamic binding means, that the code associated with a given procedure call is not known until the time of the call at run time.
- It is associated with polymorphism and inheritance.
Explain briefly dynamic binding and message passing.
Binding refers to the linking of a procedure call to the code to be executed in response to the call.
1. Dynamic binding:
Dynamic binding (also known as late binding) means the code associated with a given procedure is not known until the time of the call at runtime.
2. Message passing:
An object-oriented program consists of a set of objects that communicate with each other the process of programming in an object-oriented language, and so it involves the following Basic steps
- Creating classes that objects and their behaviour.
- Creating objects from class definitions, and
- Establishing communication among objects.