Interview Questions
Interview Questions
com/share/66f5ae2a-b4d4-8001-8072-e7e408bd8c3f
A class gives the object's outline and has a fixed data type defined by the user. Member
functions, variables, constants and other functionality are designated within a class. It does not
use any memory during run time. A class can exist without an object, but an object cannot exist
outside the class.
Abstraction: Abstraction refers to the representation of essential properties without revealing the
entire framework. Problems are solved at the 'abstract' or interface level.
Encapsulation: Data and the corresponding code are 'encapsulated', that is, combined in a
single unit called a class.
Inheritance: The existing class properties are 'inherited' by the new child class. For example, if
there are two separate child classes such as 'Dog' and 'Cat', they can inherit properties such as
'mammals' and 'pets' from the parent 'Animal' class.
Constructors are used to initialize the data members of a new object. It prepares the object for
run-time operation using keywords and member variables.
By packaging together data states and code to modify those data states in OOP coding, you
can keep the intricacies private (Considering an analogy of a car, you can only see the steering
of the vehicle while driving, the circuitry behind it is hidden from you). OOP architecture
consequently results in code that is adaptable, versatile, and expressive. As a result, it is
particularly beneficial for creating more extensive programmes. You can use classes and
objects to implement OOP in your programming. All states and capacities of the category to
which they pertain will be present in the things you generate.
● OOPS allows you to specify the variables of each data item by combining the code into a
single unit. Encapsulation is the process of grouping information into a single unit.
● One can standardize your objects and make your programme easier to use by utilizing
classes. We refer to this as an abstraction.
● More code can be reused when a class can inherit traits and behaviors from other
courses.
● With the aid of polymorphism, numerous objects can be produced from a single, flexible
class of code.
A clustered index is used to define the order in which the data will be tangibly stored in the
table. If you add a primary key to a table, it automatically becomes a clustered index,
An SQL trigger is an object that raises an alarm when something happens in a database. For
example, a trigger can be set to record the deletion of an entry from the database.
● Java Heap Space is leveraged throughout the application, while Stack space is used for
the method/methods running currently.
● Heap Space uses dynamic memory allocation, while Stack is used for storing local
variables during run-time.
A session is a logical connection established between the source and the destination. A socket
is the physical apparatus (an IP address and Port Number) used to implement a session.
UDP is a protocol without connection. TCP is connection-oriented. UDP is much simpler, faster
and more efficient than TCP.
An SDLC presents the life cycle of software in the diagrammatic form. It displays the software's
methods for its complete development, maintenance, requirement analysis, etc.
● The waterfall model is not user-friendly as it does not consider the end-product from the
user-end.
● It is not flexible in terms of accommodating changes.
● It disallows testing until after the finishing of the project.
Node is another word for a device that is connected to a network. If two PCs, two machines, and
a web server are all linked to a network, we may say there are five nodes within the network.
Black-box Testing is a testing approach that only relies on specifications and requirements. This
approach does not call for any understanding of the internal structures, routes, or
implementations of the software being examined.
White box testing is a testing method that examines the internal code, execution, and integration
routes of the software under test. White box testing typically calls for in-depth programming
abilities.
When using the gray box testing technique to debug software, the tester has little access to the
program's internal workings.
Confirmation: It is a statically analytical method. Without running the code, Testing is done in
this case. Reviews, inspections, and walkthroughs are a few examples.
Testing is performed by running the code in a dynamic analysis process called validation.
Techniques used in Testing that are functional and non-functional are examples.
The developmental and QA processes are carried out simultaneously under the V model.
Testing does not have a separate phase of its own; instead, it begins with the requirement
phase. The actions of validation and verification are complementary.
PAN- The smallest and most basic network form, a personal area network, is frequently used at
home. It is a link between a computer and a different gadget, such as a telephone, printer,
broadband, iPad, etc.
LAN- Local Area Network links a few computers together in office spaces and Coffee shops.
They are typically used to play games or transfer files via a network.
MAN- A more robust network type than LAN is the metropolitan area network (MAN). The MAN
service area includes a small city, town, etc. A massive server is utilized to cover such a vast
area for connection.
WAN- Wide Area Network is more intricate than LAN(Local Area Network) and generally spans
a considerable physical distance. The largest WAN that is globally distributed is the Internet. It
has a distributed ownership rather than single ownership by an organization.
1. Data encapsulation: It refers to combining both data and methods into a single unit
called a class. Data encapsulation helps in hiding the data from an external world.
2. Data abstraction: Representation of essential features excluding their background
details is known as data abstraction.
3. Inheritance: Deriving existing class properties into a new class is called inheritance. A
newly derived class is called the subclass(child class) and the existing class(parent
class) is called the base class. It is helpful for the re-usability of code.
4. Polymorphism: Polymorphism means the ability of an object to take multiple forms. In
java, compile-time polymorphism is achieved with the help of method overloading, and
run-time polymorphism is achieved with the help of method overriding.
Method overriding means the ability to define subclass and super-class methods with the
same name as well as the same method signatures, here the subclass method will override the
super-class method. It is performed during run time, so it is known as run-time polymorphism.
● DDL refers to Data Definition Language. DDL commands are used to define database
schema i.e., to create and modify the database object structure in the database.
Examples are CREATE, ALTER, DROP, TRUNCATE, etc.
● DML refers to Data Manipulation Language. DML commands are used to manipulate
the data within the database. Examples are: INSERT, UPDATE, DELETE.
Uses of pointers:
1) What is polymorphism?
Polymorphism is a concept by which we can perform a single action in different ways.
Polymorphism is derived from two Greek words: poly and morphs. The word "poly" means many
and "morphs" means forms. So polymorphism means many forms.
First is eliminating redundant data and ensuring data dependencies make sense. It reduces the
amount of space that the database consumes and ensure that data is logically stored.
Join:
This clause is used in DBMS to combine rows from two or more tables, based on a related
column between them.
Keys:
Keys are a crucial part of the relational database model. They are used to identify and establish
relationships between tables. They are also used to uniquely determine each record or row of
data in a table.
Key:
4) What is inheritance?
In, object-oriented programming, inheritance is a mechanism based on classes.
Inheritance refers to inheriting the data members and properties of a parent class to a child
class. A class which is derived from another class is often called as a sub-class, and the class
from which the child class is derived is known as super-class or parent class.
● Single inheritance
● Multiple Inheritance
A class inherits from more than one parent class.
Not allowed with classes in java but can be handled with interfaces.
● Multi-level Inheritance
A class is derived from another derived class, creating a chain.
● Hierarchical Inheritance
Multiple classes inherit from the same parent class.
● The instance of the class can be created by creating its object, whereas interfaces
cannot be instantiated as all the methods in the interface are abstract and do not
perform any action, There is no need for instantiating an interface.
● A class is declared using class keyword whereas an interface is declared using interface
keyword.
● The members of the class can have access specifier such as public, protected, and
private but members of the interface cannot have the access specifier, all the members
of the interface is declared as public because the interface is used to derive another
class. There will be no use of access specifies inside the members of an interface.
● The methods inside the class are defined to perform some actions on the fields declared
in the class whereas interface lacks in declaring in fields, the methods in an interface are
purely abstract.
● A class can implement any number of the interface but can only extend one superclass,
whereas interface can extend any number of interfaces but cannot implement any
interface.
● A class can have a constructor defined inside the class to declare the fields inside the
class, whereas interface doesn't have any constructor defined because there are no
fields to be initialized.
9) What is software development life-cycle? Also, explain the waterfall
model.
SDLC is a process followed for developing and enhancing software project. It consists of a
detailed plan for developing, maintaining a specific software. The life cycle defines a
methodology process for improving the quality of software and the overall development process.
In "The Waterfall" model, the whole process of software development is divided into separate
phases. In this Waterfall model, typically, the outcome of one phase acts as the input for the
next phase sequentially.
1. Abstraction
2. Inheritance
3. Encapsulation
4. Polymorphism.
17) Write a program to check whether the input number is a perfect number
or not.
1. #include <stdio.h>
2.
3. int main()Improved data sharing.
4. {
5. int number, remainder, sum = 0, i;
6.
7. printf("Enter a Number\n");
8. scanf("%d", &number);
9. for (i = 1; i < number ; i=i+1)
10. {
11. remainder = number % i;
12. if (remainder == 0)
13. {
14. sum += i;
15.
16. }
17. }
18. if (sum == number)
19. {
20. printf("Number is perfect number");
21. }
22. else
23. {
24. printf("Number is not a perfect number");
25. }
26. return 0;
27. }
Faster to read than non clustered because the data is physically stored in index order
Embedded C
1. Embedded C is the set of language extensions for the C Programming language. It was
released by the C Standards committee. Through the Embedded C extensions, the C
Standards committee hoped to address the commonality issues that exist between C
extensions for different embedded systems.
2. Embedded C is for micro-controller based applications.
3. Embedded C is used with the limited resources, such as RAM, ROM, I/Os on an
embedded processor.
4. Embedded C requires compilers to create files to be downloaded to the micro-
controllers/microprocessors where it needs to run.
A null pointer contains zero as its value which means pointer is empty and not pointing to
anywhere in the memory. Null pointers can be used further in the program to initialize the
address of the memory location with the same data type of the pointer.
Note: Pointers can only point to the variable having the same datatype. If the data type of
pointer and datatype of pointing variable is different, then the pointer will not work.
The function malloc() allocates a memory area, and length will be the value entered as a
parameter. (it has one parameter). It does not initialize memory area free() used to free the
allocated memory(allocated through calloc and malloc), in other words, this used release the
allocated memory new also used to allocate memory on the heap and initialize the memory
using the constructor delete also used release memory allocated by new operator
28) Write output of the program?
1. int i=10;
2. printf("%d%d%d",i,++i,i++);
3. Answer = 10 12 12
29) What is a virtual function and what is the pure virtual function?
Virtual function:- In order to achieve polymorphism, function in base class is declared as
virtual, By declare virtual we make the base class pointer to execute the function of any derived
class depends on the content of pointer (any derived class address).
Pure Virtual Function:- This is a function used in base class, and its definition has to be
provided in a derived class, In other pure virtual function has no definition in the base is defined
as:
That means this function not going to do anything, In case of the pure virtual function derived
function has to implement the pure virtual function or redeclare it as the pure virtual function
32) Scenarios in which the web application should be used and scenarios
in which desktop application should be used?
Scenarios in which web application used are listed below:
Safe for computationally expensive software that needs to communicate directly with the OS.
The desktop application is often offline and does not need an Internet connection to function
compared to a web application.
39) Define the structural difference between the b-tree index and bitmap?
Btree
This tree structure is a height-balanced m-way search tree. A B-tree of the order m can be
defined as an m-way search tree.
Bitmap
It consists merely of bits for every single distinct value. It uses a string of bits to locate rows in a
table quickly. Used to index low cardinality columns.
For example, char(7) will take 7 bytes of memory to store the string, and it also includes space.
Whereas varchar will take variable space, which means that it will only take that much of space
as the actual data entered as the data of varchar data type.
43) What is the word used for the virtual machine in JAVA? How is it
implemented?
The word "Java Virtual Machine known as JVM in short" is used for the virtual machine in Java.
This word is implemented from the java runtime environment (JRE).
44) List the areas in which data structures are applied extensively?
The list of areas where data structures are applied extensively are listed below:
● Compiler Design
● Operating System
● Database management System
● Numerical analysis
● Artificial Intelligence
● Simulation
● Statistical analysis package
46) What is the difference between a white box, black box, and gray box
testing?
47) Describe three levels of data abstraction? Which layer is at the user
end?
The three levels of data abstraction are listed below:
1. Physical level: This is the lowest level of database abstraction describes how the data
are stored.
2. Logical level: This level is the next higher level than the physical level of database
abstraction, which represents the data stored in the database and what relationship
among those data.
3. View level: This is the highest level of database abstraction describes only part of the
entire database.
49) Write the program in C language to swap two numbers without using a
third variable.
1. #include<Stdio.h>
2. #include<conio.h>
3. void main()
4. {
5. int i,j;
6. printf("Enter the value of i: \n");
7. scanf("%d",&i);
8. printf("Enter the value of j: \n");
9. scanf("%d",&j);
10. printf("Value of i before swap:%d \n",i);
11. printf("Value of j before swap:%d \n",j);
12. i=i+j;
13. j=i-j;
14. i=i-j;
15. printf("Value of i after swap:%d \n",i);
16. printf("Value of j after swap:%d \n",j);
17.
18. }
IPv4 IPv6
56) Tell about normalization and its types and difference between each
using example.
Example: I get to know about your company from several online websites.
Infosys has many competitors, providing the software facilities worldwide. HCL, Wipro, IBM, and
Microsoft were some software companies in competition with Infosys.