Software Engineer Interview Questions
Software Engineer Interview Questions
Object-Oriented Programming(OOPs) is a type of programming that is based on objects rather than just
functions and procedures. Individual objects are grouped into classes. OOPs implement real-world entities
like inheritance, polymorphism, hiding, etc into programming. It also allows binding data and code together.
• Inheritance
• Encapsulation
• Polymorphism
• Data Abstraction
5. What is a class?
A class is a prototype that consists of objects in different states and with different behaviors. It has a number
of methods that are common to the objects present within that class.
6. What is an object?
An object is a real-world entity which is the basic unit of OOPs for example chair, cat, dog, etc.
Note: Class is a concept and to map this concept in real life is an object.
Structure: A structure is basically a user-defined collection of variables which are of different data types.
8. Can you call the base class method without creating an instance?
Yes, you can call the base class without instantiating it if:
• It is a static method.
• The base class is inherited by some other subclass.
Object Class
A class is basically a template or a blueprint
A real-world entity which is an instance of a
within which objects can be created
class.
Binds methods and data together into a single
An object acts like a variable of the class
unit
An object is a physical entity A class is a logical entity
Objects take memory space when they are A class does not take memory space when
created created
Objects can be declared as and when required Classes are declared just once
• Single inheritance
• Multiple inheritance
• Multilevel inheritance
• Hierarchical inheritance
• Hybrid inheritance
• Increases the time and effort required to execute a program as it requires jumping back and forth
between different classes
• The parent class and the child class get tightly coupled
• Any modifications to the program would require changes both in the parent as well as the child
class
• Needs careful implementation else would lead to incorrect results.
Method overloading is a feature of OOPs which makes it possible to give the same name to more than one
method within a class if the arguments passed differ.
Overloading Overriding
Two or more methods having the same name but Child class regarding methods present in the base
different parameters or signature. class with the same parameters or signature.
Encapsulation refers to binding the data and the code that works on that together in a single unit. For
example, a class. Encapsulation also allows data-hiding as the data specified in one class is hidden from
other classes.
Data abstraction is a very important feature of OOPs that allows displaying only the important information
and hiding the implementation details. For example, while riding a bike, you know that if you raise the
accelerator, the speed will increase, but you don't know how it actually happens. This is data abstraction as
the implementation details are hidden from the rider.
• Abstract class
• Abstract method
An abstract class is a class that consists of abstract methods. These methods are basically declared but not
defined. If these methods are to be used in some subclass, they need to be exclusively defined in the
subclass.
No. Instances of an abstract class cannot be created because it does not have a complete implementation.
However, instances of subclass inheriting the abstract class can be created.
Solves the problem at the design level Solves the problem at the implementation
level
Allows showing important aspects while hiding Binds code and data together into a single
implementation details unit and hides it from the world
• Default constructor
• Parameterized constructor
• Copy constructor
• Static constructor
• Private constructor
Error Exception
Errors are problems that should not be Conditions that an application might try
encountered by applications to catch
Term Traversal is used to refer to the operation of processing each element in the list.
4. Describe what is Node in the link list? and name the types of Linked Lists.
Together (data + link) is referred to as the Node.
Types of Linked Lists are,
For insertion and deletion, it needs or insertion and deletion, it does not require
movements movement of nodes
To avail each element the same amount of To avail each element a different amount of
time is required. time is required.
We can reach there directly if we have to go To reach a particular node, you need to go
to a particular element through all those nodes that come before
that node.
8. Mention what is the difference between singly and doubly linked lists?
A doubly linked list nodes contain three fields:
Chapter 3. Database
1. What do you understand about “Database”?
Database is an organized collection of related data where the data is stored and organized to serve some
specific purpose.
2. Define DBMS.
DBMS stands for Database Management System. It is a collection of application programs which allow the
user to organize, restore and retrieve information about data efficiently and as effectively as possible.
• First Normal Form (INF): A relation is said to be in INF only when all the entities of the table contain
unique or atomic values.
• Second Normal Form (2NF): A relation is said to be in 2NF only if it is in INF and all the non-key
attributes of the table are fully dependent on the primary key.
• Third Normal Form (3NF): A relation is said to be in 3NF only if it is in 2NF and every non-key attribute
of the table is not transitively dependent on the primary key.
• Data Definition Language (DDL) commands are used to define the structure that holds the data.
These commands are auto-committed i.e. changes done by the DDL commands on the database
are saved permanently.
• Data Manipulation Language (DML) commands are used to manipulate the data of the database.
These commands are not auto-committed and can be rolled back.
• Data Control Language (DCL) commands are used to control the visibility of the data in the
database like revoke access permission for using data in the database.
• Simple SQL queries can be used to retrieve a large amount of data from the database very quickly
and efficiently.
• SQL is easy to leam and almost every DBMS supports SQL.
• It is easier to manage the database using SQL as no large amount of coding is required.
Field: A field refers to an area within a record that is reserved for specific data. For Example, Employee ID.
Table: Table is the collection of records of specific types. For Example, the Employee table is a collection of
records related to all the employees.
13. What are the advantages and disadvantages of views in the database?
View is a virtual table that does not have its data on its own rather the data is defined from one or more
underlying base tables.
Advantages of Views:
• As there is no physical location where the data in the view is stored, it generates output without
wasting resources.
• Data access is restricted as it does not allow commands like insertion, updation, and deletion.
Disadvantages of Views:
• The view becomes irrelevant if we drop a table related to that view.
• Much memory space is occupied when the view is created for large tables.
For Example, R is a Relation, X and Y are two attributes. Tl and T2 are two tuples. Then,
T1[X]=T2[X] and T1[Y]=[T2[Y]
To fulfill the criteria of fully functional dependency, the relation must meet the requirement of functional
dependency.
A functional dependency 'A' and 'B' are said to be fully functional dependent when removal of any attribute
say 'X' from 'A' means the dependency does not hold anymore.
Entity can be anything, be it a place, class or object which has an independent existence in the real world
Relation is a two-dimensional table containing a number of rows and columns where every row represents
a record of the relation. Here, rows are also known as 'Tuples' and columns are known as 'Attributes'.
EmplD EmpName
1000 Rohan
1001 Shruti
1002 Nikhil
1003 Naveen
employee_info table:
EmplD Address
1000 Delhi
1001 Mumbai
1002 Delhi
1003 Kolkata
a) Inner JOIN: Inner JOIN is also known as a simple JOIN. This SQL query returns results from both the tables
having a common value in rows.
SQL Query:
SELECT * from employee, employee_info WHERE employee.EmplD = employee_info .EmplD
Result:
b) Natural JOIN: This is a type of Inner JOIN that returns results from both the tables having the same data
values in the columns of both the tables to be joined.
SQL Query:
SELECT * from employee NATURAL JOIN employee_info;
Result:
c) Cross JOIN: Cross JOIN returns the result as all the records where each row from the first table is
combined with each row of the second table.
SQL Query:
SELECT * from employee CROSS JOIN employee_info;
Result:
Let us do some modification in the above tables to understand Right JOIN, Left JOIN, and Full JOIN,
employee table:
EmplD EmpName
1000 Rohan
1001 Shruti
1002 Nikhil
1003 Naveen
1004 Shikha
1005 Shalu
employee_info table:
EmplD Address
1000 Delhi
1001 Mumbai
1002 Gurgaon
1003 Kolkata
1006 Noida
1007 Kerala
SQL Query:
SELECT * from employee RIGHT OUTER JOIN employee_info on (employee.EmplD = employee_info.EmplD);
Result:
e) Left JOIN: Left JOIN is also known as Left Outer JOIN. This returns all the rows as a result of the left table
even if the JOIN condition does not match any records in the right table. This is exactly the opposite of
Right JOIN.
SQL Query:
SELECT * from employee LEFT OUTER JOIN employee_info on (employee.EmplD = employee_info.EmplD);
Result:
SQL Query:
SELECT from employee FULL OUTER JOIN employee_info on (employee.EmplD = employee_info.EmplD);
Result:
Composite Key is a form of the candidate key where a set of columns will uniquely identify every row in the
table.
• Relational model
• Network model
• Hierarchical model
After the execution of 'TRUNCATE' operation, COMMIT, and ROLLBACK statements cannot be performed to
retrieve the lost data.
'DROP' command is used to drop the table or key like the primary key/foreign key.
2. Try to get to know about the company for which you are applying and before appearing in the
interview. Get to know about them by visiting their website or Linkedin Profiles. This will help you to
answer the question “What do you know about us”?
5. Stick to the point. Try to avoid narrating stories rather than actual answers.
6. Don't hesitate to tell interviews you don't know the answer. Just be formal saying "l am not sure
about the answer for this question but I'll go through it later".
7. Interviewers Usually end the interview by asking you "Do you have any questions?". Try to show them
your interest. Come up with the questions and feel free to ask them.