[Go to site: main page, start]

0% found this document useful (0 votes)
22 views10 pages

Java Project Interview Questions Guide

The document consists of a comprehensive list of interview questions covering various topics in Java, including project-related inquiries, Java concepts, OOP principles, multithreading, collections, Spring framework, microservices, and database operations. It also includes programming tasks and code snippets for candidates to analyze and explain. The questions are designed to assess the candidate's technical knowledge and practical skills in Java development.

Uploaded by

Vamsi Reddy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views10 pages

Java Project Interview Questions Guide

The document consists of a comprehensive list of interview questions covering various topics in Java, including project-related inquiries, Java concepts, OOP principles, multithreading, collections, Spring framework, microservices, and database operations. It also includes programming tasks and code snippets for candidates to analyze and explain. The questions are designed to assess the candidate's technical knowledge and practical skills in Java development.

Uploaded by

Vamsi Reddy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Interview Question

------about Project ------


1)Briefing your Project//tell me about ur project
2)which type of problem you faced?
// what are the difficulties u have faced in ur project ?(rep)
3)Is there any multithreding
you used in your project?
4)Java exception which major exception you faced?
5)which type of problem you faced?
6)have you used rest api ?
7)which authontications you used?
8)Which exception you handel in project?
9)Tell about critiacl business logic you devloped?
10)Have you used Microsevices ? how many microservices you created?
11)Who is your Client?
12)What is your roles in your Project?
13)Microservices uses?
14)are you working on Spring mvc or Boot ?(yes both)
15) tell me how to you use both?
16)Project architechure
17)If you are using spring then have you used a JSP in project?
18)what is you front end langauge
19)If you are usng JSp but Spring boot return APi
20)if you are using spring boot the how you can use
21)there is any Encapsution in Your Project tell me about this
22)which opration perform In Spring boot
23)OOPS concept with Example in Used in your Project?
24)where you used Overriding and overloading in project?
25)Is there any multithreding you used in your project?
26)what is recent work u have done in ur company?
//why this problems occur
27)what are the other concerns that u have?
28)how inheritance is applied in ur project .(rep)
29)what is flow of ur project ?
30)which security is use in your project
31)which technology is used in your project
32)which version of java you have work on
33)in your project which @annotation are used , write structure, flow of project
34)how to do u use JSON?
35)Why do you not use interface instead of abstract class?
36)what is the module of your project?
37)have you write repository in project?
38) Any proud moment you feel as a java devloper
39) How to user Collection in your project?
40) write a flow from DTO to controller
41) About Rest API
42) what is major issue faced during project?
43) basic information abouit system like (Ram, Core, procssor, thereads)
44) how to migarate data one DB to Another DB using Spring boot (how multithreading you used in this)
45) in banking domain trhere are 15 accoubnt so some of them are reapted and some are unique how we
find the unique ?
-------java------------
[Link] is static variable ? can we modify static variable .(rep)
[Link] is the diff between static and final variable.
[Link] we declare a constructor as a final.
[Link] is the difference between input and output
[Link] function in java?
[Link] is shift operator?
[Link] is pacakge?
[Link] Principle
[Link] balancing in java
[Link] is entry function in springboot and in java
[Link] is the difference between core java and advance java
[Link] loader in java?
14. how to comapre Object?
15. whay soime method provided in object class?

------OOPs (Core Java)----


1)Java inheritance?
2)OOps Concept?(Repetated)
3)Interface in java?
4)what is Interface and how to create a object of interface?
5)Difference between Abstract class and interface?
what is abstract classs
6)If you are saying you can achieve multiple inheritance then explain how ?
7)give me the realtime example of polymorphism?
8)how to access interface method in java
9)why we use interface over abstraction
10)how to use ooops conceopt in project?
11) interface is prefable in java?
12) what is default access modifer for method?
13) soppose we have a pricvate varibale ijn class how can we get that privatye vvariable in other class?

-----keyword----
1)synchronization with example
2)Volaile
3)transient
4)synchronouns
5)asynchronouns
6)this and super keyword
7)JVM and JRE and JDK(rep)

-------string-----------
1)how many ways create string.
2)String Immutability? string concat?(rep)
3)Stringbuffer and string builder?(rep) when you use?

------Exception--------
1)when we get indexoutofbounce and nullpointerexception
2)try catch and try with resource
3)What is Exception ?
4)How you handle the Exception?
5)hereirchy of eception?
6)Parent of exception?
7) iffrence between error and exception?
8)

----- multithreading--------
1)suppose if u want to schedule any task what will u do. que regarding to multithreading .
2)Ways to create thread
3)What is multithreading?
4)projection
Deadlock in java?
5)sleep() and wait()?
6)what is thread?
7)What is synchronized?
8)what is multithreading
9) diffrence between throe and throws?
10) start and run method?
11) wait , notify and notifyAll?
12) what is deadlock?
13) which is types locks?
14)suppose if u want to schedule any task what will u do. que regarding to multithreading ?

-------Collection-------
1)how to iterate over the map?
2)What is Arraylist and its method?
3)What is Map?
4)What is entry and [Link] ?
5)comparable and comparator(rep)
6)hashmap vs treemap
7)map vs flatmap --> flatmap programe
8)how to resolve hash collision?
9)@springBoot Application - there annotation in that
10)What is spring boot
11)how to avoid hashCollision.
12)How u can remove duplicates from list?
13)hashmap vs concurrent hashmap
14)concurrent hashmap implementation.
15)what is synchronzied map.
16)arraylist vs linkedlist(rep)
17)queue blocking queue
18)treeset
19)inertnal working hashmap(rep)
20)design a tree like strcuture book , book ahe tya book madhih categories ahe tree like strcuture
21)Difference Collection and Collectios?
22)create HashMap and use size method?
23)default size of HashMap and its loading factor?
24)what is bucket and node?
25)advantage of map
26)GC in java?
26.1)27) equal and hashcode method in java?
27) equal and hashcode contract?
28) what is hash colosion?
29)How t0 prevent them?
30)use of object class & its methods?
31) internal working of concurent Hash map?

-----Java8--------
1)What are the features Included in java 8?(Rep)
2)Date and Time API
3)optional class(rep)
4)what is map in java 8.
5)Runnable vs callable interface
6)[Link]() method -->
7)What is stream API?
8)Difference .Java7 and Java8
9)can we use functional interface in lambda
10)what is the new feature implanted in collection in java8 expect stream API?
11)What is intermidate and terminal opretion? And what are they?
12)What is Lazy Loading
13)method refrence and use of it
14)marker interface ?what is use of it?which are they?
15)DateandTime ? in java7 there is already Date feature is present then why there in updation in java8?
16)What is the in feature added in collection?
17)what is [Link]?
18)what is collection and streamAPI?
19) Internal woking of stream API?
20)advancwe fetures in collection?
21) java 11 fetures?
22) optional class in java 8?

-----Design Patter----
1)singleton design pattern
2)what is singleton class.
3)Static and singleton
4)What are the design pattern
5)MVC Design pattern
-----Spring Framework------
1)Spring api Authentication and authorization?
2)Architechure of MVC?
3)Spring boot Architechure
4)actuator
5)new features in springboot 3.1.
6)@transactional?
7)what are the restservices.
8)what is the difference between restful web services and normal web services .
9)diff between restcontroller and controller.
10)why we use json in restapi as return the response.
11)what is bean? bean scopes?
12)Difference between Spring and Spring boot?(rep)
13)SpringBoot annotation(rep)
14)HQL in Hibernate?
15)@Data,@controller@Bean(rep)
16)what is IOC?
17)what are DI?
18)why we prefer spring boot?
19)Expalin @component and @service
20)Version of spring boot-2.3
21)what are the HTTP methods ellaborate?
22)@requestparam and @requestvalue
23)@requestparam and @ pathvariable
24)Comprehensive framework for building Java applications
26)what is @autowired,@bean,IOC Container.(rep)
27)How to send image through postman
28)how to do u use JSON?
29)@transinet? and @Qualifier?(rep)
30)What is pathparam and queryparam?
31)put and patch difference(rep)
32)status code 200,201,202?
33)Restful Principle
34)what is JPA ?
35) status code Series
36)What is idempotent in HTTP?
37)Rest API method
38) diffrence patch and put
39)what is springActutor?
40)Spring profile?
41)spring @Primary and @qulifire?
42)@component scan in spring boot?
43)@Autoconfiguration internal working?
44) how work httpMethod internally and its flow?
45) can we do crud opration without using a Server|
46) how many types of server present in spring?
47)
-------Microservices-----
1)how microsevices communicate with each other?
2)Architechure of Microservices?what is microservices?(rep)
3)api gateway ?
4)load balancer?
5)monolithic vs microservices.
6)microservices disadvantages.
7) What is Ci/cd
8)what is AOP?
9)microservices e commerce applications examples multiple servers 100 user is coming but instantly
20000 are using but avoid server crash how it handled using Load balancing auto scaling database
level?
10)Difference between Monolithic and Microservices
11) what do you know about microservices
12) how to test services by using post man

---------------------------------------

[Link] u worked on messaging queue like rabbitmq , apache kafka .


[Link] why we use?
[Link] is authentication?
[Link] is authorization?
[Link] and mockito?
[Link] is compatible?
[Link] is time complexity?
[Link] is Api gateway
[Link] is load balancing?& it is relatable to database t spring?
[Link] and sns?

-------program----
1)Duplicate array Question? (Using HashMap)
2)Encapsulation write a program
3)Singletone write a program
4) Dynamic Polymarohism and Static write in code
5)Reverse the words of String
6)Create list .add method()
7)do you have idea about sorting ? the....write a Bubble sorting Program
8)write a program to find second largest no. without using build in method and explain i
9)array program to add an element in an exixting array using java
10)third highest using stream api in java
11)Cube of int
12)int a[]={1,2,3,5,9,10,7,6} find the messing number in array by using java 8
13) find Thrid highet number form array
14) find The word in in round parathysys and reverse it xyz(cba)yesd
15)find the occurance in string?
16) there is text file which have multiple sentances and multiple words so we have to find occureanc eof
this word?

-------MySql-----
1)Joins
2)Difference between delete, drop , truncate
3)grouby and having clause
4)join vs union
3)procedure In database
4)InnerJoin Join Employee ON Order.(EmployeeID=EmployeeID)
5)sql query to find the sum of max score of student
6)what schema have you work
7)what is [procedure and Fucntion
8) DML opration
9) DDL opartion
10) why we use database?
11) what is primary key and unique and forign key
12)Rigt join and left joins and union join and unioun all
13) all types of join
14)write delete command
15)what is generate d primary key
16)which one you prefer in join
17) do you know about clauses?
18)what is grant?
19) write outter join?
20) grouping by calsue?
21|) what is indexes ? based on column?
22) what if forign key is allowed a null value?
23)

-------Git------
1)what if you want to get the updated code in your system?- git Pull
2)git conflict
3)how to creat git branch ?
4)when you have two interface having same default method what will happen? - conflit

---------------------------------------------------

cube of array

public class Test{

public static main (String[] args){

int [] i={4,5,6,7,1,2,3};

int [] cubeArry = [Link](i).map(n->n*n*n).toArray();


[Link]([Link](cubeArry));
}
}

------------------------------- Find the output of this code -----------------------------------------

What is the output of the following code snippet?


Integer int_data = new Integer(10);
[Link](int_data.byteValue());
[Link]("-");
int int_data_2 = new Integer(10);
[Link](int_data_2.byteValue());

10-10
1010-1010
Does not compile
Run-time error

_______________________________________________________________________________-

What is the output of the following code snippet?

class Parent {
public void Print()
{
[Link]("Parent");
}
}

class Child extends Parent {


public void Print()
{
[Link]("Child");
}
}

class Main {
public static void PrintMain(Parent o)
{
[Link]();
}
public static void main(String[] args)
{
Parent x = new Parent();
Parent y = new Child();
Child z = new Child();
PrintMain(x);
PrintMain(y);
PrintMain(z);
}
}

Child, Child, Child


Parent, Child, Child
Parent, Child, Parent
Parent, Parent, Child

__________________________________________________________

What is the output of the following code snippet?


public class Code
{
public static void main(String args[])
{
StringBuffer str1 = new StringBuffer("open");
StringBuffer str2 = str1;
[Link]("genus");
[Link](str1 + " " + str2 + " " + (str1 == str2));
}
}

opengenus open false


opengenus opengenus false
opengenus open true
opengenus opengenus true

____________________________________________________________________________________
____

What is the output of the following code snippet?

class Code extends Thread


{
public void run()
{
[Link]("thread 1");
}
public static void main(String args[])
{
Code thread1 = new Code();
[Link]();
[Link]();
[Link]();
}
}

8
9
Compilation error
Runtime error

____________________________________________________________________________________
__________

What is the output of the following code snippet?

class CodeA
{
public String type = "A ";
public CodeA() {
[Link]("CodeA ");
}
}
public class CodeB extends CodeA
{
public CodeB() {
[Link]("CodeB ");
}

void go()
{
type = "B ";
[Link]([Link] + [Link]);
}

public static void main(String[] args)


{
new CodeB().go();
}
}

CodeA CodeB A B
CodeA CodeA B B
CodeA CodeB B B
CodeB CodeB B B

__________________________________________________________________________________

Common questions

Powered by AI

Encapsulation in Java enhances data security and integrity by restricting direct access to an object's state and allowing it to be modified only through well-defined interfaces. This is achieved by declaring class variables as private and providing public getter and setter methods to update and access them. It prevents unauthorized access and modification by external classes, thus maintaining control over how data is accessed or modified, reducing the likelihood of introducing bugs or inconsistent states due to improper usage .

Microservices architecture breaks down applications into small, independent services, each focused on a specific task or business feature, which can be deployed and scaled independently. This addresses the limitations of monolithic architecture by enhancing flexibility, as changes to a single service do not require redeploying the entire application. It also improves scalability, as each service can handle its own load and can be scaled independently. Furthermore, it encourages the choice of technology best suited for each service, rather than a one-size-fits-all technology stack, allowing for better optimization and innovation .

The SOLID principles are a set of design rules that promote the creation of more understandable, flexible, and maintainable software. For instance, the Single Responsibility Principle ensures each class only changes due to one reason, promoting cohesion. The Open/Closed Principle allows systems to be extended without changing existing code, preventing regression. The Liskov Substitution Principle ensures objects can be replaced with instances of their subtypes without affecting correctness. Interface Segregation promotes granular, client-specific interfaces rather than large, monolithic ones, while Dependency Inversion facilitates decoupling mechanisms .

In microservices architecture, integrating load balancing and auto-scaling ensures system robustness against sudden user demand spikes. Load balancers distribute incoming traffic among various service instances effectively, optimizing resource use and minimizing response time. Auto-scaling adjusts the number of service instances based on traffic load, ensuring sufficient capacity to handle user demand while keeping costs in check by provisioning additional resources only when needed. Together, they ensure seamless scaling and high availability, maintaining performance under varying user loads .

Annotations in Spring Boot act as metadata that provide configuration information, replacing verbose and error-prone XML configurations with concise and readable code. Annotating classes and methods with @Component, @Autowired, and other specific Spring annotations integrates them seamlessly into the Spring framework, automating the setup of application contexts. This significantly reduces boilerplate code and configuration overhead, speeding up development while maintaining flexibility and control over the components' behavior and lifecycle .

The Stream API introduced in Java 8 allows for a functional approach to processing sequences of elements, supporting operations like filter, map, reduce which improve code efficiency by enabling parallel execution and laziness in processing. The use of Streams leads to concise, expressive, and readable code compared to traditional loops for data manipulation. The Optional class helps in managing null references, thereby preventing run-time errors like NullPointerExceptions by encouraging better safety checks and making the absence or presence of a value explicit in the API design .

Developers face difficulties with synchronization and deadlocks when implementing multithreading in Java. Synchronization challenges arise from the need to manage shared resources without causing inconsistent data states. Deadlocks can occur when multiple threads hold locks and wait indefinitely for each other's resources. These can be mitigated by avoiding nested locks, utilizing timeout locks, and implementing thread-safe data structures. Understanding thread lifecycle and proper lock hierarchy while employing high-level concurrency tools offered by Java such as java.util.concurrent package also help manage and resolve these issues effectively .

Core Java primarily covers the fundamental aspects of the Java programming language foundational for all Java applications, including basic concepts like inheritance, polymorphism, encapsulation, and the standard libraries. Advanced Java, on the other hand, focuses on specialized fields in Java programming, typically involving enterprise-scale applications and web-based functionalities, covering topics such as database connectivity, servlets, JSP, EJB, etc. Core Java is significant for basic programming and understanding OOPs principles, while Advanced Java is essential for building enterprise-level applications .

An interface in Java defines a contract that implementing classes must adhere to, but does not provide any implementation, allowing multiple inheritance and promoting a form of loose coupling. Conversely, an abstract class allows partial implementation with defined methods and instance variables, providing a mechanism for sharing common code among subclasses. Interfaces are preferred in scenarios where a class needs to adhere to multiple traits or behaviors, while abstract classes are suitable when there's a hierarchal relationship or when shared base functionality is required among a group of subclasses .

Lazy loading improves performance by delaying the loading of resources until they are actually needed, which reduces unnecessary memory usage and initial load time. This is particularly beneficial in enterprise applications with complex object graphs, as it avoids loading the entire object structure if only part of it is required, thus lowering memory footprint and processing overhead. For instance, using Hibernate, lazy fetching allows associated entities to be loaded only when accessed, promoting efficiency in access and manipulation of large datasets .

You might also like