Multithreading ->
-which method releases the lock of the thread ?
Multithreading , asynchronous
Multithreading - 1000 requests comes in at the same time . How will you spawn the thread
and make it asynchronous? q ax
Lifecycle of thread.
Sleep() vs wait()
Serialization , at the the time of object serialization does deserializer calls the constructor of
the class
Collection ->
internal implementation os SET?
DoublyLinkedList
2 array's , print the pair of numbers .
Interface in collections framework
Difference between arrayList and arrays
Java 8 ->
Optional
Streams-> Parallel stream ,
Predicate , BiPredicate
FunctionalInterface
Sum of even numbers in list of integer array
5: Using java 8 : Given an array of integers , filter out ODD numbers and then find the sum of
square of those odd numbers
Given a list of Emplyoee object(Id,Salary,DepartmentId), find the average sum of salary
department wise
Junit ->
What happens when you make the test method as private ?
Desing pattern - >
factory design pattern ? Liskov Substitution Principle? Decorator Pattern ?
Data Structure & Algo
Data Structures (array, stack, queue, linked list, trees)
Algorithms on (String manipulation, data handlings in DS, sorting )
DoublyEndedQueue
Reverse singly linked list
can a key in hash map hold a object ? If yes , Integer object has hashCode method ?
-Given a Circular array list of strings, starting word , end word . What will be the minimum
no. of positions to travel ?
-Given an array of n continuous number in unordered manner.Any one number is missing
and other number is repeated . Find out the missing and the repeated number(Logic : using
sum of n numbers)
Rest API’s
What is the response entity ?
viii. GET, PUT, POST, DELETE
Difference between SOAP/REST
Scope of REST Api’s
Database
Query to select list of authors who has written more than 10 books.
JPA vs Hibernate ?
Types of joins
Views
Materialized views
JVM
basics of GC. threads, JVM memory model, Exception handlings
-JDK,JRE,JVM
Optimistic Lock Exceptionvs pessismistic lock exception
JVM ARCHITECTURE
Core Java :
StringBuilder/StringBuffer
-Advantage of immutable class
final keyword
How do you make the class as immutable ?
What happens to the mutable variable inside immutable class
1: String s1=new String("Himanshu");
String s2="Himanshu";
s1==s2 ====>>>>
s1.equals(s2);
2: Sysout(5+5+"Himanshu")
Sysout("Himanshu"+5+5
3: Comparable and comparator.
4: Parent p=new Child();
Difference between Future and Conpletable Future
Strictfp
SEMVER
Encapsulation and Abstraction
Docker
What inside docker container ?
Design pattern :
MICROSERVICES:
Microservice Design pattern, Event sourcing
What is distributed logging
Springboot:
What is Cyclic Padding
How do we instantiate transaction
Type of transaction
What is conditional bean?
v. @Component vs @Bean
How do you instantiate a bean in the application context
How do you route the context in the application
What is dependency injection
GIT :
Git rebase
Misc :
Output :
map.put("abc",1)
mapIfAbset("abc",k->k.)
Output
List value=Arrays.asList(1,2);
List xyz=value;
xyz.add(3.14);
-File with date and user who entered the mall on that date . Find the users who visited the
mall on 3 consecutive dates.
iv.
{
"type" : "Eval",
"operator" : "+",
"operands" : [
{
"type" : "Eval",
"operator" : "-",
"operands" : [
{
"type" : "Value",
"value" : 3
},
{
"type" : "Value"
"value" : 4
}
]
},
{
"type" : "Value",
"Value" : 2
}
]
}
i. Java Eq Pojo
class Type{
public String type;
public String operator;
getProperty(String type,String operator);
}
class Type implements Serializable{
private string type;
}
class Eval extends Type{
private String operator;
private List<Type> operands;
}
class Value extends Type{
private Integer value;
}
Programs :
1-convert java variable to c variable and vice versa.
2-Iterate over a string and give the number of occurance per character . Input-> phpqu
Output-> h1p2q1u1
3-Given an array , return the number whose frequency is more than array length/2. Eles
return -1
-Given a map of a,1 b,2 …z,26 . If input is 50 and using 2 numbers . Output should be 2
characters whose sums comes up as 50 .
DynaTrace
|- It's a monitoring tool. Where it gives us the distribution based on components/api
|- How does it work?
|- Collects the data / log (log4j also does this)
|- logger.log (“”)
|-
----------------------------------------------------------------------------------------------------------------------- -
-
RABBITMQ
|- Scalability
|- Message type
|- # of producer => 1 M producer => # of messages 10 per producer =>
10M messages [1KB avg] [ 1 day] [Load Profile in a day]
|- # of consumer
|- No. of messages 1 consumer can consume at any given time =>How
quickly can the consumer consume/process the message=>
|- Assuming 1000 messages are consumed by 1 consumer in
Peak hour .
|- Peak hour say suppose 20000 messages are coming => 20000/1000 = 20 consumers are
needed per hour + 2/3 consumers on the buffer side
|- What is missing ? Size of messages. Also the assumption that all the consumers will
consume the messages at the same speed.Per hour is the big data set that we are talking
about . We should think of the rate at any given instant(can be a second/minute/10
minute) . As granular as we can go.