HSBC Interview Question on OOPS

Object-oriented programming – As the name suggests uses objects in programming. Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism, etc. in programming. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.

Q1. What are the 4 pillars of OOPS?
The four pillars of OOPS are:

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

Abstraction: is a process of hiding implementation details and exposing only the functionality to the user.
Encapsulation: is the process of wrapping code and data together into a single unit.
Inheritance: is the process of one class inheriting properties and methods from another class in Java.
Polymorphism: is the ability to perform many things in many ways.

Q2. Define virtual functions.
A virtual function (also known as virtual methods) is a member function that is declared within a base class and is re-defined (overridden) by a derived class. When you refer to a derived class object using a pointer or a reference to the base class, you can call a virtual function for that object and execute the derived class’s version of the method.

Abstraction

Encapsulation

Abstraction is the process or method of gaining the information. While encapsulation is the process or method to contain the information.
In abstraction, problems are solved at the design or interface level. While in encapsulation, problems are solved at the implementation level.
Abstraction is the method of hiding the unwanted information. Whereas encapsulation is a method to hide the data in a single entity or unit along with a method to protect information from outside.
We can implement abstraction using abstract classes and interfaces. Whereas encapsulation can be implemented using by access modifier i.e. private, protected and public.

Q4. What is Polymorphism?
Polymorphism is considered one of the important features of Object-Oriented Programming. Polymorphism allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations.

Q5. What are Manipulators?
Manipulators are helping functions that can modify the input/output stream. It does not mean that we change the value of a variable, it only modifies the I/O stream using insertion (<<) and extraction (>>) operators. 

Method Overloading

Method Overriding

Method overloading is a compile-time polymorphism. Method overriding is a run-time polymorphism.
Method overloading helps to increase the readability of the program. Method overriding is used to grant the specific implementation of the method which is already provided by its parent class or superclass.
It occurs within the class. It is performed in two classes with inheritance relationships.
Method overloading may or may not require inheritance. Method overriding always needs inheritance.

Q7. What is Inheritance?
Inheritance is an important pillar of OOP(Object-Oriented Programming). It is the mechanism in Java by which one class is allowed to inherit the features(fields and methods) of another class. In Java, Inheritance means creating new classes based on existing ones. A class that inherits from another class can reuse the methods and fields of that class. In addition, you can add new fields and methods to your current class as well.

Compile Time Polymorphism Run time Polymorphism
In compile-time Polymorphism, the call is resolved by the compiler. In run-time Polymorphism, the call is not resolved by the compiler.
It is also known as Static binding, Early binding and overloading as well. It is also known as Dynamic binding, Late binding and overriding as well.
Method overloading is the compile-time polymorphism where more than one methods share the same name with different parameters or signatures and different return types with compared. Method overriding is the runtime polymorphism having the same method with the same parameters or signature but associated with compared, different classes.
It is achieved by function overloading and operator overloading. It is achieved by virtual functions and pointers.

Q9. What is encapsulation?
Encapsulation in Java is a fundamental concept in object-oriented programming (OOP) that refers to the bundling of data and methods that operate on that data within a single unit, which is called a class in Java. Java Encapsulation is a way of hiding the implementation details of a class from outside access and only exposing a public interface that can be used to interact with the class.

Q10. What are Constructors in Java?
Constructor is a block of codes similar to the method. It is called when an instance of the class is created. At the time of calling the constructor, memory for the object is allocated in the memory. It is a special type of method that is used to initialize the object. Every time an object is created using the new() keyword, at least one constructor is called.

HSBC Interview Question

Explore these carefully selected HSBC interview questions to prepare for a successful career move with this renowned global bank. Understand the kinds of questions they might ask in technical assessments and when solving problems. Elevate your readiness for interviews by delving into these questions. HSBC, which stands for the Hong Kong and Shanghai Banking Corporation, is a major global bank with a rich history dating back to 1865. Renowned for its international presence, HSBC provides a wide range of financial services, serving millions of customers worldwide. The bank is recognized for its commitment to innovation, diversity, and fostering a dynamic work culture. Discover the exciting career prospects and fantastic work culture at HSBC, and gear up for a fulfilling journey with this leading international financial institution.

Landing your desired position at HSBC isn’t just about technical skills – it also involves understanding how they conduct interviews. This article takes a close look at what to expect in HSBC’s interviews, providing insights into the types of questions you might come across.

Table of Content

  • HSBC Interview Question DSA
  • HSBC Interview Question on OOPS
  • HSBC Interview Question on OS
  • HSBC Interview Question Computer Networks

Similar Reads

HSBC Interview Question DSA

Q1. Longest Palindromic Substring...

HSBC Interview Question on OOPS

...

HSBC Interview Question on OS

...

HSBC Interview Question Computer Networks

...