• +91 9723535972
  • info@interviewmaterial.com

OOP Interview Questions and Answers

OOP Interview Questions and Answers

Question - 61 : - What is method overloading?

Answer - 61 : -

Method overloading is a feature of OOPs which makes it possible to give the same name to more than one methods within a class if the arguments passed differ.

Question - 62 : - What is Garbage Collection(GC)?

Answer - 62 : -

GC is an implementation of automatic memory management. The Garbage collector frees up space occupied by objects that are no longer in existence.

Question - 63 : - What is a final variable?

Answer - 63 : -

A variable whose value does not change. It always refers to the same object by the property of non-transversity.

Question - 64 : - What is an exception?

Answer - 64 : -

An exception is a kind of notification that interrupts the normal execution of a program. Exceptions provide a pattern to the error and transfer the error to the exception handler to resolve it. The state of the program is saved as soon as an exception is raised.

Question - 65 : - What is exception handling?

Answer - 65 : -

Exception handling in Object-Oriented Programming is a very important concept that is used to manage errors. An exception handler allows errors to be thrown and caught and implements a centralized mechanism to resolve them.

Question - 66 : - What is a try/ catch block?

Answer - 66 : -

A try/ catch block is used to handle exceptions. The try block defines a set of statements that may lead to an error. The catch block basically catches the exception.

Question - 67 : - What is a finally block?

Answer - 67 : -

A finally block consists of code that is used to execute important code such as closing a connection, etc. This block executes when the try block exits. It also makes sure that finally block executes even in case some unexpected exception is encountered.

Question - 68 : - What are the limitations of OOPs?

Answer - 68 : -

  • Usually not suitable for small problems
  • Requires intensive testing
  • Takes more time to solve the problem
  • Requires proper planning
  • The programmer should think of solving a problem in terms of objects

Question - 69 : - What is the need for OOPs?

Answer - 69 : -

There are many reasons why OOPs is mostly preferred, but the most important among them are: 

  • OOPs helps users to understand the software easily, although they don’t know the actual implementation.
  • With OOPs, the readability, understandability, and maintainability of the code increase multifold.
  • Even very big software can be easily written and managed easily using OOPs.

Question - 70 : - What are some other programming paradigms other than OOPs?

Answer - 70 : -

Programming paradigms refers to the method of classification of programming languages based on their features. There are mainly two types of Programming Paradigms:

  • Imperative Programming Paradigm
  • Declarative Programming Paradigm
  • Now, these paradigms can be further classified based:

1. Imperative Programming Paradigm: Imperative programming focuses on HOW to execute program logic and defines control flow as statements that change a program state. This can be further classified as:
a) Procedural Programming Paradigm: Procedural programming specifies the steps a program must take to reach the desired state, usually read in order from top to bottom.
b) Object-Oriented Programming or OOP: Object-oriented programming (OOP) organizes programs as objects, that contain some data and have some behavior.
c) Parallel Programming: Parallel programming paradigm breaks a task into subtasks and focuses on executing them simultaneously at the same time.

2. Declarative Programming Paradigm: Declarative programming focuses on WHAT to execute and defines program logic, but not a detailed control flow. Declarative paradigm can be further classified into:
a) Logical Programming Paradigm: Logical programming paradigm is based on formal logic, which refers to a set of sentences expressing facts and rules about how to solve a problem
b) Functional Programming Paradigm: Functional programming is a programming paradigm where programs are constructed by applying and composing functions.
c) Database Programming Paradigm: Database programming model is used to manage data and information structured as fields, records, and files.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners