Teamware Solutions (QUANTUM LEAP CONSULTING PVT LTD) ( CAlLL BASED 2018 BATCH ONLY )

Teamware Solutions (QUANTUM LEAP CONSULTING PVT LTD) ( CAlLL BASED 2018 BATCH ONLY )

HIREING FOR THIRD PARTY PAY ROLE

ONLY 2018 BATCH

Job Location: Bangalore or Mumbai
Rounds of Interviews: Aptitude & Assessment, Technical Round & Face to Face
Year of Passing: 2018
Education criteria: B.E/ B.Tech (IT) (ECE) or Computer Science with minimum 70% of marks.
Freshers with Java trained / Certified candidates.

Good communication skills

Time and Distance
Time and Work
Compound Interest
Partnership
Problems on Ages
Clock
Area
Permutation and Combination
Problems on Numbers
Decimal Fraction
Square Root and Cube Root
***********************************************************
The ratio between the length and the breadth of a rectangular park is 3 : 2. If a man cycling along the boundary of the park at the speed of 12 km/hr completes one round in 8 minutes, then the area of the park (in sq. m) is:

A. 15360
B. 153600
C. 30720
D. 307200
2.
An error 2% in excess is made while measuring the side of a square. The percentage of error in the calculated area of the square is:

A. 2%
B. 2.02%
C. 4%
D. 4.04%
3.
The ratio between the perimeter and the breadth of a rectangle is 5 : 1. If the area of the rectangle is 216 sq. cm, what is the length of the rectangle?

A. 16 cm
B. 18 cm
C. 24 cm
D. Data inadequate
E. None of these
4.
The percentage increase in the area of a rectangle, if each of its sides is increased by 20% is:

A. 40%
B. 42%
C. 44%
D. 46%
5.
A rectangular park 60 m long and 40 m wide has two concrete crossroads running in the middle of the park and rest of the park has been used as a lawn. If the area of the lawn is 2109 sq. m, then what is the width of the road?

A. 2.91 m
B. 3 m
C. 5.82 m
D. None of these
****************************************************************************

Look at this series: 2, 1, (1/2), (1/4), … What number should come next?

A. (1/3)
B. (1/8)
C. (2/8)
D. (1/16)
2.
Look at this series: 7, 10, 8, 11, 9, 12, … What number should come next?

A. 7
B. 10
C. 12
D. 13
3.
Look at this series: 36, 34, 30, 28, 24, … What number should come next?

A. 20
B. 22
C. 23
D. 26
4.
Look at this series: 22, 21, 23, 22, 24, 23, … What number should come next?

A. 22
B. 24
C. 25
D. 26
5.
Look at this series: 53, 53, 40, 40, 27, 27, … What number should come next?

A. 12
B. 14
C. 27
D. 53

Look at this series: 21, 9, 21, 11, 21, 13, 21, … What number should come next?

A. 14
B. 15
C. 21
D. 23
View Answer Discuss in Forum Workspace Report
7.
Look at this series: 58, 52, 46, 40, 34, … What number should come next?

A. 26
B. 28
C. 30
D. 32
View Answer Discuss in Forum Workspace Report
8.
Look at this series: 3, 4, 7, 8, 11, 12, … What number should come next?

A. 7
B. 10
C. 14
D. 15
View Answer Discuss in Forum Workspace Report
9.
Look at this series: 8, 22, 8, 28, 8, … What number should come next?

A. 9
B. 29
C. 32
D. 34
View Answer Discuss in Forum Workspace Report
10.
Look at this series: 31, 29, 24, 22, 17, … What number should come next?

A. 15
B. 14
C. 13
D. 12

The ratio between the length and the breadth of a rectangular park is 3 : 2. If a man cycling along the boundary of the park at the speed of 12 km/hr completes one round in 8 minutes, then the area of the park (in sq. m) is:

A. 15360
B. 153600
C. 30720
D. 307200
View Answer Discuss in Forum Workspace Report
2.
An error 2% in excess is made while measuring the side of a square. The percentage of error in the calculated area of the square is:

A. 2%
B. 2.02%
C. 4%
D. 4.04%
View Answer Discuss in Forum Workspace Report
3.
The ratio between the perimeter and the breadth of a rectangle is 5 : 1. If the area of the rectangle is 216 sq. cm, what is the length of the rectangle?

A. 16 cm
B. 18 cm
C. 24 cm
D. Data inadequate
E. None of these
View Answer Discuss in Forum Workspace Report
4.
The percentage increase in the area of a rectangle, if each of its sides is increased by 20% is:

A. 40%
B. 42%
C. 44%
D. 46%
View Answer Discuss in Forum Workspace Report
5.
A rectangular park 60 m long and 40 m wide has two concrete crossroads running in the middle of the park and rest of the park has been used as a lawn. If the area of the lawn is 2109 sq. m, then what is the width of the road?

A. 2.91 m
B. 3 m
C. 5.82 m
D. None of these
************************************************************************************************************************
English Assessment Test.
******************************************************************************************
Prepare a multiple-paragraph writing sample of about 300–600 words on the topic
below. You will have 50 minutes to complete this sample. You should use the time
available to plan, write, review, and edit what you have written. Read the assignment
carefully before you begin to write.
Some schools require each student to participate in an organized school sport chosen
by the student. People at these schools argue that athletics is an important part of the
educational experience and that there should be a rule requiring participation. Others
argue that students should be free to decide whether or not they wish to participate in
organized school sports. Write an essay for a classroom instructor in which you take a
position on whether participation in organized school athletics should be required. Be
sure to defend your position with logical arguments and appropriate examples.
Please refer to the ‘WritePlacer Guide’ for more information on Writeplacer and its
scoring (i.e., click the online link – here).
© 2007 The College Board. All rights reserved. College Board, ACCUPLACER,
WritePlacer, and the acorn logo are registered trademarks of the College Board.
connect to college success is a trademark owned by the College Board. All other
products and services may be trademarks of their respective owners. Visit the College
Board on the Web: www.collegeboard.com.
Test 2 – ACCUPLACER READING COMPREHENSION TEST
The 20 questions in this test are of two main types:
1. Read a Passage: The first type of question consists of a reading passage followed
by a question based on the text. Both short and long passages are provided. The
reading passages can also be classified according to the kind of information processing
required, including explicit statements related to the main idea, explicit statements
related to a secondary idea, application, and inference.
2. Sentence relationships: The second type of question, sentence relationships,
presents two sentences followed by a question about the relationship between these
two sentences. The question may ask, for example, if the statement in the second
sentence supports that in the first, if it contradicts it, or if it repeats the same information.
READING COMPREHENSION SAMPLE QUESTIONS
Directions for Questions 1 to 6:
Read the statement or passage and then choose the best answer to the question. Answer the question
based on what is stated or implied in the statement or passage.
1. In the words of Thomas DeQuincey, “It is notorious that the memory strengthens as
you lay burdens upon it.” If, like most people, you have trouble recalling the names
of those you have just met, try this: The next time you are introduced, plan to
remember the names. Say to yourself, “I’ll listen carefully; I’ll repeat each person’s
name to be sure I’ve got it, and I will remember.” You’ll discover how effective this
technique is and probably recall those names for the rest of your life.
The main idea of the paragraph maintains that the memory
A. always operates at peak efficiency.
B. breaks down under great strain.
C. improves if it is used often.
D. becomes unreliable if it tires.
2. Unemployment was the overridi
This passage is primarily about
A. unemployment in the 1930s.
B. the effect of unemployment on United States families.
C. President Franklin D. Roosevelt’s presidency.
D. President Roosevelt’s FERA program.
3. It is said that a smile is universally understood. And nothing triggers a smile more
universally than a taste of sugar. Nearly everyone loves sugar. Infant studies
indicate that humans are born with an innate love of sweets. Based on statistics, a
lot of people in Great Britain must be smiling because on average, every man,
woman, and child in that country consumes 95 pounds of sugar each year.
From this passage it seems safe to conclude that the English
A. do not know that too much sugar is unhealthy.
B. eat desserts at every meal.
C. are fonder of sweets than most people.
D. have more cavities than any other people.
4. With varying success, many women around the world today struggle for equal rights.
Historically, women have achieved greater equality with men during periods of social
adversity. The following factors initiated the greatest number of improvements for
women: violent revolution, world war, and the rigors of pioneering in an undeveloped
land. In all three cases, the essential element that improved the status of women was a
shortage of men, which required women to perform many of society’s vital tasks.
We can conclude from the information in this passage that
A. women today are highly successful in winning equal rights.
B. only pioneer women have been considered equal to men.
C. historically, women have only achieved equality through force.
D. historically, the principle of equality alone has not been enough to secure
women equal rights.
5. In 1848, Charles Burton of New York City made the first baby carriage, but people
strongly objected to the vehicles because they said the carriage operators hit too many
pedestrians. Still convinced that he had a good idea, Burton opened a factory in
England. He obtained orders for the baby carriages from Queen Isabella II of Spain,
Queen Victoria of England, and the Pasha of Egypt. The United States had to wait
another 10 years before it got a carriage factory, and only 75 carriages were sold in the
first year.
Even after the success of baby carriages in England,
A. Charles Burton was a poor man.
B. Americans were still reluctant to buy baby carriages.
C. Americans purchased thousands of baby carriages.
D. the United States bought more carriages than any other country.
6. All water molecules form six-sided structures as they freeze and become snow
crystals. The shape of the crystal is determined by temperature, vapor, and wind
conditions in the upper atmosphere. Snow crystals are always symmetrical because
these conditions affect all six sides simultaneously.
The purpose of the passage is to present
A. a personal observation.
B. a solution to a problem.
C. actual information.
D. opposing scientific theories.
7. In the words of Thomas DeQuincey, “It is notorious that the memory strengthens as
you lay burdens upon it.” If, like most people, you have trouble recalling the names of
those you have just met, try this: The next time you are introduced, plan to remember
the names. Say to yourself, “I’ll listen carefully; I’ll repeat each person’s name to be sure
I have it, and I will remember.” You’ll discover how effective this technique is and
probably recall those names for the rest of your life.
The writer believes people remember names best when they
a. meet new people
b. are intelligent
c. decide to do so
d. are interested in people
8. Many people have owned, or have heard of, traditional “piggy banks,” coin banks
shaped like pigs. A logical theory about how this tradition started might be that because
pigs often symbolize greed, the object is to “fatten” one’s piggy bank with as much
money as possible. However, while this idea makes sense, it is not the correct
origin of the term. The genesis of the piggy bank is the old English word “pygg”, which
was a common kind of clay hundreds of years ago in England. People used pots and
jars made out of this red “pygg” clay for many different purposes in their homes.
Sometimes they kept their money in one of the pots, and this was known as a pygg
bank. Over the years, because “pygg” and “pig” sounded the same, glaziers began
making novelty banks out of pottery in the shape of a pig as a kind of joke. These banks
were given as gifts and exported to countries where people spoke other languages and
where no one had ever heard of pygg clay. The tradition caught on all over the world,
and today piggy banks come in all colors and are made of all kinds of materials,
including plastic.
This passage is mainly about
A. how people in different countries save their money
B. how people in England made pottery centuries ago
C. how a common expression began in a surprising way
D. how an unusual custom got started
9. It is said that a smile is universally understood. And nothing triggers a smile more
universally that the taste of sugar. Nearly everyone loves sugar. Infant studies indicate
that humans are born with an innate love of sweets. Based on statistics, a lot of people
in Great Britain must be smiling because on average, every man, woman and child in
that country consumes 95 pounds of sugar each year.
This passage implies that the writer thinks that 95 pounds of sugar per person per year
is
A. a surprisingly large amount
B. a surprisingly small amount
C. about what one would expect
D. an unhealthy amount
10. The wheel has been used by humans since nearly the beginning of civilization and
is considered one of the most important mechanical inventions of all time. Most primitive
technologies since the invention of the wheel have been based on its principles, and
since the industrial revolution, the wheel has been a basic element of nearly every
machine constructed by humankind. No one knows the exact time and place of the
invention of the wheel, but its beginnings can be seen across many ancient civilizations.
According to this passage, the wheel is an important invention because
a. it is one of the world’s oldest inventions
b. it forms the basis of so many later inventions
c. it is an invention that can be traced to many cultures
d. it is one the world’s most famous inventions
11. Samuel Morse, best known today as the inventor of Morse Code and one of the
inventors of the telegraph, was originally a prominent painter. While he was always
interested in technology and studied electrical engineering in college, Morse went to
Paris to learn from famous artists of his day and later painted many pictures that now
hang in museums, including a portrait of former President John Adams. In 1825, Morse
was in Washington, D.C., painting a portrait of the Marquis de Lafayette when a
messenger arrived on horseback to tell him that his wife was gravely ill back at his
home in Connecticut. The message had taken several days to reach him because of the
distance. Morse rushed to his home as fast as he could, but his wife had already
passed away by the time he arrived. Grief-stricken, he gave up painting and devoted the
rest of his life to finding ways to transmit messages over long distances faster.
Morse left the art world and helped to invent the telegraph
A. because he was tired of painting
B. because he wanted to communicate with people far away
C. because of a personal tragedy in his life
D. because he was fascinated by science
12. Leonardo DaVinci is not only one of the most famous artists in history, he was also
a botanist, a writer and an inventor. Even though most of his inventions were not
actually built in his lifetime, many of today’s modern machines can be traced back to
some of his original designs. The parachute, the military tank, the bicycle and even the
airplane were foretold in the imaginative drawings that can still be seen in the fragments
of Leonardo’s notebooks. Over 500 years ago, this man conceived ideas that were far
ahead of his time.
The author of this passage is praising Leonardo DaVinci for his:
A. artistic talent
B. intelligence
C. vision
D. fame
Directions for questions 13–22
For the questions that follow, two underlined sentences are followed by a question or
statement. Read the sentences, then choose the best answer to the question or the
best completion of the statement.
13. The Midwest is experiencing its worst drought in 15 years.
Corn and soybean prices are expected to be very high this year.
What does the second sentence do?
A. It restates the idea found in the first.
B. It states an effect.
C. It gives an example.
D. It analyzes the statement made in the first.
14. Social studies classes focus on the complexity of our social environment.
The subject combines the study of history and the social sciences and promotes
skills in citizenship.
What does the second sentence do?
A. It expands on the first sentence.
B. It makes a contrast.
C. It proposes a solution.
D. It states an effect.
15. Knowledge of another language fosters greater awareness of cultural diversity
among the peoples of the world.
Individuals who have foreign language skills can appreciate more readily other
peoples’ values and ways of life.
How are the two sentences related?
A. They contradict each other.
B. They present problems and solutions.
C. They establish a contrast.
D. They repeat the same idea.
16. Serving on a jury is an important obligation of citizenship.
Many companies allow their employees paid leaves of absence to serve on
juries.
What does the second sentence do?
A. It reinforces what is stated in the first.
B. It explains what is stated in the first.
C. It expands on the first.
D. It draws a conclusion about what is stated in the first.
17. While most people think of dogs as pets, some dogs are bred and trained
specifically for certain types of work.
The bloodhound’s acute sense of smell and willing personality make it ideal for
tracking people missing in the woods.
What does the second sentence do?
A. It makes a contrast.
B. It restates an idea found in the first.
C. It states an effect.
D. It gives an example.
18. Paris, France, is a city that has always been known as a center of artistic and
cultural expression.
In the 1920s, Paris was home to many artists and writers from around the world
who became famous, such as Picasso and Hemingway.
What does the second sentence do?
A. It reinforces the first.
B. It states an effect.
C. It draws a conclusion.
D. It provides a contrast.
19. Studies show that the prevalence of fast-food restaurants corresponds with the
rates of obesity in both children and adults.
Obesity is now on the rise in countries outside the U.S., where fast food
restaurants are becoming more common.
How do the two sentences relate?
A. They express roughly the same idea.
B. They contradict each other.
C. They present problems and solutions.
D. They establish a contrast.
20. Compared with the rest of the country, North Dakota has a thriving economy,
making it a place where more people want to live.
Winters in North Dakota are inhospitable, with average temperatures in January
ranging from 2 degrees Fahrenheit to 17 degrees.
What does the second sentence do?
A. It reinforces the first.
B. It explains what is stated in the first.
C. It contradicts the first.
D. It analyzes a statement made in the first.
21. Some stores are testing a new checkout system that allows shoppers to use their
mobile phones to scan items as they walk through stores and pay at self-service
kiosks, skipping the cashiers’ lines.
The new mobile checkout system is intended to reduce long lines and customer
wait times in stores.
What does the second sentence do?
A. It expands on the first.
B. It states an effect.
C. It contrasts with the first.
D. It gives an example.
22. According to the American Sleep Disorders Association, the average teenager
needs around 9.5 hours of sleep per night, possibly because critical growth
hormones are released during sleep.
The average adult requires between six and eight hours of sleep per night for
optimal health and productivity.
How do the two sentences relate?
A. They establish a contrast.
B. They contradict each other.
C. They reinforce each other.
D. They provide a problem and solution.
**********************************************************************************************

list Of All Interview Programs:
**************************************************************************
How to reverse Singly Linked List?
Find out duplicate number between 1 to N numbers.
Find out middle index where sum of both ends are equal.
Write a singleton class.
Write a program to create deadlock between two threads.
Write a program to reverse a string using recursive algorithm.
Write a program to reverse a number.
Write a program to convert decimal number to binary format.
Write a program to find perfect number or not.
Write a program to implement ArrayList.
Write a program to find maximum repeated words from a file.
Wrie a program to find out duplicate characters in a string.
Write a program to find top two maximum numbers in a array.
Write a program to sort a map by value.
Write a program to find common elements between two arrays.
How to swap two numbers without using temporary variable?
Write a program to print fibonacci series.
Write a program to find sum of each digit in the given number using recursion.
Write a program to check the given number is a prime number or not?
Write a program to find the given number is Armstrong number or not?
Write a program to convert binary to decimal number.
Write a program to check the given number is binary number or not?
Write a program for Bubble Sort in java.
Write a program for Insertion Sort in java.
Write a program to implement hashcode and equals.
*****************************************************************************

Q1. Explain JVM, JRE and JDK?
JVM (Java Virtual Machine): It is an abstract machine. It is a specification that provides run-time environment in which java bytecode can be executed. It follows three notations:

Specification: It is a document that describes the implementation of the Java virtual machine. It is provided by Sun and other companies.
Implementation: It is a program that meets the requirements of JVM specification.
Runtime Instance: An instance of JVM is created whenever you write a java command on the command prompt and run the class.
JRE (Java Runtime Environment) : JRE refers to a runtime environment in which java bytecode can be executed. It implements the JVM (Java Virtual Machine) and provides all the class libraries and other support files that JVM uses at runtime. So JRE is a software package that contains what is required to run a Java program. Basically, it’s an implementation of the JVM which physically exists.

JDK(Java Development Kit) : It is the tool necessary to compile, document and package Java programs. The JDK completely includes JRE which contains tools for Java programmers. The Java Development Kit is provided free of charge. Along with JRE, it includes an interpreter/loader, a compiler (javac), an archiver (jar), a documentation generator (javadoc) and other tools needed in Java development. In short, it contains JRE + development tools.

Refer to this below image and understand how exactly these components reside:

Components – Java Interview Questions – Edureka

Q2. Explain public static void main(String args[]).
public : Public is an access modifier, which is used to specify who can access this method. Public means that this Method will be accessible by any Class.
static : It is a keyword in java which identifies it is class based i.e it can be accessed without creating the instance of a Class.

void : It is the return type of the method. Void defines the method which will not return any value.

main: It is the name of the method which is searched by JVM as a starting point for an application with a particular signature only. It is the method where the main execution occurs.

String args[] : It is the parameter passed to the main method.

Q3. Why Java is platform independent?
Platform independent practically means “write once run anywhere”. Java is called so because of its byte codes which can run on any system irrespective of its underlying operating system.

Q4. Why java is not 100% Object-oriented?
Java is not 100% Object-oriented because it makes use of eight primitive datatypes such as boolean, byte, char, int, float, double, long, short which are not objects.

Q5. What are wrapper classes?
Wrapper classes converts the java primitives into the reference types (objects). Every primitive data type has a class dedicated to it. These are known as wrapper classes because they “wrap” the primitive data type into an object of that class. Refer to the below image which displays different primitive type, wrapper class and constructor argument.

WrapperClass – Java Interview Questions – Edureka

Q6. What are constructors in Java?
In Java, constructor refers to a block of code which is used to initialize an object. It must have the same name as that of the class. Also, it has no return type and it is automatically called when an object is created.

There are two types of constructors:

Default constructor
Parameterized constructor
Q7. What is singleton class and how can we make a class singleton?
Singleton class is a class whose only one instance can be created at any given time, in one JVM. A class can be made singleton by making its constructor private.

Q8. What is the difference between Array list and vector?
Array List Vector
Array List is not synchronized. Vector is synchronized.
Array List is fast as it’s non-synchronized. Vector is slow as it is thread safe.
If an element is inserted into the Array List, it increases its Array size by 50%. Vector defaults to doubling size of its array.
Array List does not define the increment size. Vector defines the increment size.
Array List can only use Iterator for traversing an Array List. Except Hashtable, Vector is the only other class which uses both Enumeration and Iterator.
Q9. What is the difference between equals() and == ?
Equals() method is defined in Object class in Java and used for checking equality of two objects defined by business logic.
“==” or equality operator in Java is a binary operator provided by Java programming language and used to compare primitives and objects. public boolean equals(Object o) is the method provided by the Object class. The default implementation uses == operator to compare two objects. For example: method can be overridden like String class. equals() method is used to compare the values of two objects.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class Equaltest {
public static void main(String[] args) {
String str1= new String(“ABCD”);
String str2= new String(“ABCD”);
if(Str1 == str2)
{
System.out.println(“String 1 == String 2 is true”);
}
else
{
System.out.println(“String 1 == String 2 is false”);
String Str3 = Str2;
if( Str2 == Str3)
{
System.out.println(“String 2 == String 3 is true”);
}
else
{
System.out.println(“String 2 == String 3 is false”);
}
if(Str1.equals(str2))
{
System.out.println(“String 1 equals string 2 is true”);
}
else
{
System.out.prinltn(“String 1 equals string 2 is false”);
}
}}
Q10. What are the differences between Heap and Stack Memory?
The major difference between Heap and Stack memory are:

Features Stack Heap
Memory Stack memory is used only by one thread of execution. Heap memory is used by all the parts of the application.
Access Stack memory can’t be accessed by other threads. Objects stored in the heap are globally accessible.
Memory Management Follows LIFO manner to free memory. Memory management is based on generation associated to each object.
Lifetime Exists until the end of execution of the thread. Heap memory lives from the start till the end of application execution.
Usage Stack memory only contains local primitive and reference variables to objects in heap space. Whenever an object is created, it’s always stored in the Heap space.

In case you are facing any challenges with these java interview questions, please comment your problems in the section below. Apart from this Java Interview Questions Blog, if you want to get trained from professionals on this technology, you can opt for a structured training from edureka! Click below to know more.

Get Started with Java

OOPS Java Interview Questions:
Q1. What is Polymorphism?

Polymorphism is briefly described as “one interface, many implementations”. Polymorphism is a characteristic of being able to assign a different meaning or usage to something in different contexts – specifically, to allow an entity such as a variable, a function, or an object to have more than one form. There are two types of polymorphism:

Compile time polymorphism
Run time polymorphism

Compile time polymorphism is method overloading whereas Runtime time polymorphism is done using inheritance and interface.

Q2. What is runtime polymorphism or dynamic method dispatch?
In Java, runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time. In this process, an overridden method is called through the reference variable of a superclass. Let’s take a look at the example below to understand it better.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class Car {
void run()
{
System.out.println(“car is running”);
}
}
class Audi extends Car {
void run()
{
System.out.prinltn(“Audi is running safely with 100km”);
}
public static void main(String args[])
{
Car b= new Audi(); //upcasting
b.run();
}
}
Q3. What is the difference between abstract classes and interfaces?
Abstract Class Interfaces
An abstract class can provide complete, default code and/or just the details that have to be overridden. An interface cannot provide any code at all,just the signature.
In case of abstract class, a class may extend only one abstract class. A Class may implement several interfaces.
An abstract class can have non-abstract methods. All methods of an Interface are abstract.
An abstract class can have instance variables. An Interface cannot have instance variables
An abstract class can have any visibility: public, private, protected. An Interface visibility must be public (or) none.
If we add a new method to an abstract class then we have the option of providing default implementation and therefore all the existing code might work properly If we add a new method to an Interface then we have to track down all the implementations of the interface and define implementation for the new method
An abstract class can contain constructors An Interface cannot contain constructors
Abstract classes are fast Interfaces are slow as it requires extra indirection to find corresponding method in the actual class
Q4. What is method overloading and method overriding?
Method Overloading :
In Method Overloading, Methods of the same class shares the same name but each method must have different number of parameters or parameters having different types and order.
Method Overloading is to “add” or “extend” more to method’s behavior.
It is a compile time polymorphism.
The methods must have different signature.
It may or may not need inheritance in Method Overloading.
Let’s take a look at the example below to understand it better.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Adder {
Static int add(int a, int b)
{
return a+b;
}
Static double add( double a, double b)
{
return a+b;
}
public static void main(String args[])
{
System.out.println(Adder.add(11,11));
System.out.println(Adder.add(12.3,12.6));
}}
Method Overriding:
In Method Overriding, sub class have the same method with same name and exactly the same number and type of parameters and same return type as a super class.
Method Overriding is to “Change” existing behavior of method.
It is a run time polymorphism.
The methods must have same signature.
It always requires inheritance in Method Overriding.
Let’s take a look at the example below to understand it better.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Car {
void run(){
System.out.println(“car is running”);
}
Class Audi extends Car{
void run()
{
System.out.prinltn(“Audi is running safely with 100km”);
}
public static void main( String args[])
{
Car b=new Audi();
b.run();
}
}
Q5. Can you override a private or static method in Java?
You cannot override a private or static method in Java. If you create a similar method with same return type and same method arguments in child class then it will hide the super class method; this is known as method hiding. Similarly, you cannot override a private method in sub class because it’s not accessible there. What you can do is create another private method with the same name in the child class. Let’s take a look at the example below to understand it better.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Base {
private static void display() {
System.out.println(“Static or class method from Base”);
}
public void print() {
System.out.println(“Non-static or instance method from Base”);
}
class Derived extends Base {
private static void display() {
System.out.println(“Static or class method from Derived”);
}
public void print() {
System.out.println(“Non-static or instance method from Derived”);
}
public class test {
public static void main(String args[])
{
Base obj= new Derived();
obj1.display();
obj1.print();
}
}
Q6. What is multiple inheritance? Is it supported by Java?
MultipleInheritance – Java Interview Questions – EdurekaIf a child class inherits the property from multiple classes is known as multiple inheritance. Java does not allow to extend multiple classes.

The problem with multiple inheritance is that if multiple parent classes have a same method name, then at runtime it becomes difficult for the compiler to decide which method to execute from the child class.

Therefore, Java doesn’t support multiple inheritance. The problem is commonly referred as Diamond Problem.

Q7. What is association?
Association is a relationship where all object have their own lifecycle and there is no owner. Let’s take an example of Teacher and Student. Multiple students can associate with a single teacher and a single student can associate with multiple teachers but there is no ownership between the objects and both have their own lifecycle. These relationship can be one to one, One to many, many to one and many to many.

Q8. What do you mean by aggregation?
Aggregation is a specialized form of Association where all object have their own lifecycle but there is ownership and child object can not belongs to another parent object. Let’s take an example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy.

Q9. What is composition in Java?
Composition is again specialized form of Aggregation and we can call this as a “death” relationship. It is a strong type of Aggregation. Child object dose not have their lifecycle and if parent object deletes all child object will also be deleted. Let’s take again an example of relationship between House and rooms. House can contain multiple rooms there is no independent life of room and any room can not belongs to two different house if we delete the house room will automatically delete.

In case you are facing any challenges with these java interview questions, please comment your problems in the section below. Apart from this Java Interview Questions Blog, if you want to get trained from professionals on this technology, you can opt for a structured training from edureka! Click below to know more.

Learn Java From Experts

Servlets Interview Questions
Q1. What is a servlet?
Java Servlet is server side technologies to extend the capability of web servers by providing support for dynamic response and data persistence.
The javax.servlet and javax.servlet.http packages provide interfaces and classes for writing our own servlets.
All servlets must implement the javax.servlet.Servlet interface, which defines servlet lifecycle methods. When implementing a generic service, we can extend the GenericServlet class provided with the Java Servlet API. The HttpServlet class provides methods, such as doGet() and doPost(), for handling HTTP-specific services.
Most of the times, web applications are accessed using HTTP protocol and thats why we mostly extend HttpServlet class. Servlet API hierarchy is shown in below image.
Servlet – Java Interview Questions – Edureka

Q2. What are the differences between Get and Post methods?
Get Post
Limited amount of data can be sent because data is sent in header. Large amount of data can be sent because data is sent in body.
Not Secured because data is exposed in URL bar. Secured because data is not exposed in URL bar.
Can be bookmarked Cannot be bookmarked
Idempotent Non-Idempotent
It is more efficient and used than Post It is less efficient and used
Q3. What is Request Dispatcher?
RequestDispatcher interface is used to forward the request to another resource that can be HTML, JSP or another servlet in same application. We can also use this to include the content of another resource to the response.

There are two methods defined in this interface:

1.void forward()

2.void include()

ForwardMethod – Java Interview Questions – Edureka
IncludeMethod – Java Interview Questions – Edureka

Q4. What are the differences between forward() method and sendRedirect() methods?
Forward() method SendRedirect() method
forward() sends the same request to another resource. sendRedirect() method sends new request always because it uses the URL bar of the browser.
forward() method works at server side. sendRedirect() method works at client side.
forward() method works within the server only. sendRedirect() method works within and outside the server.
Q5. What is the life-cycle of a servlet?
There are 5 stages in the lifecycle of a servlet:LifeCycleServlet – Java Interview Questions – Edureka

Servlet is loaded
Servlet is instantiated
Servlet is initialized
Service the request
Servlet is destroyed
Q6. How does cookies work in Servlets?
Cookies are text data sent by server to the client and it gets saved at the client local machine.
Servlet API provides cookies support through javax.servlet.http.Cookie class that implements Serializable and Cloneable interfaces.
HttpServletRequest getCookies() method is provided to get the array of Cookies from request, since there is no point of adding Cookie to request, there are no methods to set or add cookie to request.
Similarly HttpServletResponse addCookie(Cookie c) method is provided to attach cookie in response header, there are no getter methods for cookie.
Q7. What are the differences between ServletContext vs ServletConfig?
The difference between ServletContext and ServletConfig in Servlets JSP is in below tabular format.

ServletConfig ServletContext
Servlet config object represent single servlet It represent whole web application running on particular JVM and common for all the servlet
Its like local parameter associated with particular servlet Its like global parameter associated with whole application
It’s a name value pair defined inside the servlet section of web.xml file so it has servlet wide scope ServletContext has application wide scope so define outside of servlet tag in web.xml file.
getServletConfig() method is used to get the config object getServletContext() method is used to get the context object.
for example shopping cart of a user is a specific to particular user so here we can use servlet config To get the MIME type of a file or application session related information is stored using servlet context object.
Q8. What are the different methods of session management in servlets?
Session is a conversational state between client and server and it can consists of multiple request and response between client and server. Since HTTP and Web Server both are stateless, the only way to maintain a session is when some unique information about the session (session id) is passed between server and client in every request and response.

Some of the common ways of session management in servlets are:

User Authentication
HTML Hidden Field
Cookies
URL Rewriting
Session Management API

SessionManagement – Java Interview Questions – Edureka
In case you are facing any challenges with these java interview questions, please comment your problems in the section below. Apart from this Java Interview Questions Blog, if you want to get trained from professionals on this technology, you can opt for a structured training from edureka! Click below to know more.

Get Java Certified

JDBC Interview Questions
Q1. What is JDBC Driver?
JDBC Driver is a software component that enables java application to interact with the database. There are 4 types of JDBC drivers:

JDBC-ODBC bridge driver
Native-API driver (partially java driver)
Network Protocol driver (fully java driver)
Thin driver (fully java driver)
Q2. What are the steps to connect to a database in java?
Registering the driver class
Creating connection
Creating statement
Executing queries
Closing connection
Q3. What are the JDBC API components?
The java.sql package contains interfaces and classes for JDBC API.

Interfaces:
Connection
Statement
PreparedStatement
ResultSet
ResultSetMetaData
DatabaseMetaData
CallableStatement etc.
Classes:
DriverManager
Blob
Clob
Types
SQLException etc.
Q4. What is the role of JDBC DriverManager class?
The DriverManager class manages the registered drivers. It can be used to register and unregister drivers. It provides factory method that returns the instance of Connection.

Q5. What is JDBC Connection interface?
The Connection interface maintains a session with the database. It can be used for transaction management. It provides factory methods that returns the instance of Statement, PreparedStatement, CallableStatement and DatabaseMetaData.

ConnectionInterface – Java Interview Questions – Edureka
Q6. What is the purpose of JDBC ResultSet interface?
The ResultSet object represents a row of a table. It can be used to change the cursor pointer and get the information from the database.

Q7. What is JDBC ResultSetMetaData interface?
The ResultSetMetaData interface returns the information of table such as total number of columns, column name, column type etc.
*****************************************************************************************************