You are on page 1of 11

ExecutorService Exp –

1. Reader/Writer problem where u can either read from multiple sources and write to single or vice
versa.

2. notification system: in an organization need to drop mail to employees whoever did not
complete some sort of trainings. Here reading the huge data from db filtering the data and
notifying the respective ppl

3.Please try like take the csv file with 10000 rows and read all rows and write to database
with 10 threads and each thread has to carry 1000 rows like (1-1000, 1001 - 1002) but you
need total count to split and assign rows to thread. I can demo multi thread any one day.
(prefer spring batch if you know)

4. registration system. As part of registration we need to provide different files for


identification like Aaadhar , PAN & passport...
here each file can process by different threads. Eventhough API is only one and it accepts all
files MultiPart file array as input

how @Transactional keyword works internally, and you may relate it to as a proxy pattern design
pattern. Any idea on this??

1. Different scenarios to work with collection framework


2. In how many ways we can read data from the file. Can we read the data line by line
3. What are the primary factors to consider while building an API and while gathering
requirements
4. Different types of design patterns with examples.
5. API's to built CRUD opertaions with example
6. Transaction Mechanism Scenario based
7. How can we do pagination
8. Spring JPA Implementation end to end
9. Different types of propagation and isolation level with examples
10. Logging and Load Balancing, Time Factors
11. How can we measure the performance of our APIs
12. How to Secure your API OR How to Authenticate your API using Spring boot?
13. How to authenticate any URL that comes to your Application without hitting the DB first?
( As I answered I will use the credential from DB to validate the user who is sending the URL)
14. Say you have 100 xml which you need to read and process it. how to do it using multi
threading so that the performance gets improved?
15. How the deployment happens in my project and do I have any experience in deployment of
my application on Server?
16. Do I have experience on Cloud and AWS?
17. Java 8 features and stream API functional if , default and static methods
18. SOLID principles
19. Exception Hierarchy
20. monolith and microservice
21. how applications communicate with each other and resttemplate
22. what is rest in detail.
23. Transactions in hibernate, propagation and isolation
24. why only json in rest
25. write one API by following REST guidelines, @PathParam, @RequestParam, @component,
@service, @repository
26. what is spring framework, Spring context, spring bean, bean scopes, Dependency Injections
27. Proxy in spring
28. Marker interfaces

1) How to track the slowness of a REST API?

2) In E-commerce app on UI identified potential slowness due to ratings while getting the
product information(sync services) what are steps to mitigate the problem.

3) Strategies to maintain the REST APi version.

4) Spring dependency and code problem related to it.

5) Design pattern and code problem related to it.

6) How to auto scale the pods in kubernetes and which parameters to consider for the scaling.

7) Scenario on saga pattern, option for saga in sync api calls(discussion).

8) what are different authentication/authorization mechanisms used in your previous


application.

9) Hibernate n+1 problem

10) what are few hiccups faced on JPA

11) How to investigate/mitigate DB performance.

12) Which git branching strategy has been adopted and scenarios in case of failure ow to
revert merge vs rebase.

13) Counting character in string and print character which repeat more than 2 times.

14) Questions on team management and project management.

15) How to handle the situation if your team blocked by other team deliverables.

16) How do you do code reviews and what you look for in code reviews?

17) Feature of java 8 and how to avoid null pointer.

18) Scenario is to deliver the code but testing not happened, How to approach this?
public int getMaximumLenghArithmaticSequence(int ar[]) {

int n = ar.length;

Arrays.sort(ar);

if (n <= 2)
return n;

Map<String, Integer> dp = new HashMap<>();


int ans = Integer.MIN_VALUE;

for (int i = 1; i < n; i++) {

for (int j = 0; j < i; j++) {

int diff = ar[i] - ar[j];

int val = (dp.get(j + " " + diff) != null) ? (dp.get(j + " "
+ diff) + 1) : 2;
dp.put(i + " " + diff, val);

ans = Math.max(ans, dp.get(i + " " + diff));


}
}

return ans;

int[] array1 = {4, 7, 1, 5, 3};


System.out.println(solution.getMaximumLenghArithmaticSequence(array1)); //
Output: 4

// Example 2
int[] array2 = {12, 12, 12, 15, 10};
System.out.println(solution.getMaximumLenghArithmaticSequence(array2)); //
Output: 3

// Example 3
int[] array3 = {18, 26, 18, 24, 24, 20, 22};

Please find the interview experience of DBS-VRTB

1. Different scenarios to work with collection framework


2. In how many ways we can read data from the file. Can we read the data line by line
3. What are the primary factors to consider while building an API and while gathering
requirements
4. Different types of design patterns with examples.
5. API's to built CRUD opertaions with example
6. Transaction Mechanism Scenario based
7. How can we do pagination
8. Spring JPA Implementation end to end
9. Different types of propagation and isolation level with examples
10. Logging and Load Balancing, Time Factors
11. How can we measure the performance of our APIs

@GetMapping(value="/all")

public ResponseEntity<List<Customer>> getCustomers(@RequestBody Customer


customer)
Only thing is it violates REST API design principles

GET

The GET method is used ONLY to retrieve the resource and NOT to modify it or create it.
GET endpoints are said to be safe endpoints as they do not change the state of the resource.
Furthermore GET endpoints have to be idempotent. This means that making multiple
identical requests must produce the same result each and every time until a change to the
resource is carried out on the server.

GET requests should not contain a body, but should send any parameters needed for the
request in a query string. An example of this could be filter or paging parameters.

If the resource is found in the API then the endpoint must return an HTTP response code 200
(OK) together with the body containing the resource in the format the client asked for.

If the resource is not found in the API then the endpoint must return an HTTP response code
404 (NOT FOUND).

If API determines that the GET request is not properly formed then it must return an HTTP
response code of 400 (BAD REQUEST).

@Transactional(isolation = Isolation.SERIALIZABLE) supports for multiple threads. It handles row or


table level locking as per configuration. we don't need any code to maintain the lock even it one
request from browser and other from mobile or atm)

@Configurationpublic class YourConfiguration {

@Bean @Qualifier("first") public Model firstInstance() {


return new Model();
}
@Bean @Qualifier("second") public Model secondInstance(){
return new Model();
}
}

...@Autowired@Qualifier("first")private Model first;

@Autowired
@Qualifier("second")
private Model second;

This create multiple bean even thogh single bean defined:


ApplicationContext parentContext = new
AnnotationConfigApplicationContext(ParentConfig.class);
childContext = new AnnotationConfigApplicationContext();
((AnnotationConfigApplicationContext) childContext).setParent(parentContext);
((AnnotationConfigApplicationContext)
childContext).register(ChildConfig.class);
((AnnotationConfigApplicationContext) childContext).refresh();

public class RetrofitClient {


private static final String BASE_URL = "http://your-api-url.com";
private static final Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();

private RetrofitClient() {}

public static Retrofit getInstance() {


return retrofit;
}
}
@Configuration

public class Configuration {

@Bean

public RetrofitClient getRetrofitClient() {

new RetrofitClient.getInstance();
}

https://projecteuler.net/

public String transformRec(String source) {


StringBuilder res = new StringBuilder();
t(source, res);

return String.valueOf(res);
}

// tc: O(N^3)
private void t(String source, StringBuilder res) {
if(source.isEmpty()) return;

for(int i=(source.length()-1)/2;i>=0;i--) {
String sub = source.substring(0, i+1);

int matchCount = 0;
int subLength = sub.length();
int j = i+1;
while(j < source.length() && j + subLength <= source.length() &&
sub.equals(source.substring(j, j + subLength))) {
j += subLength;
matchCount++;
}

if(i == 0 || matchCount != 0) {
res.append("[" + sub + "]" + (matchCount + 1));
t(source.substring(j), res);
break;
}
}
}

https://dba-presents.com/jvm/java/278-large-files-in-rest-api

"aaabbbccccd" -> a3b3c4d1 (single char repeat), "aaaaababcacadddd" -> aa2ab2ca2dd2(two


char repeat)
String decodeString = "[ab]10[cd]5";
Stack<Character> characters = new Stack<>();
char[] chars = decodeString.toCharArray();
StringBuilder decodedString = new StringBuilder();

for (int i = 0 ; i < chars.length ; i++) {


StringBuilder stringBuilder = new StringBuilder();
if(!Character.isDigit(chars[i])) {
if(!(chars[i] == '[' || chars[i] == ']'))
characters.push(chars[i]);
} else if(Character.isDigit(chars[i])) {
int sum = Character.getNumericValue(chars[i]);
for(int k = i+1 ; k < chars.length ; k ++) {
if(Character.isDigit(chars[k])) {
sum = sum * 10;
sum = sum + Character.getNumericValue(chars[k]);
} else {
break;
}
}
while (characters.isEmpty() == false) {
stringBuilder.append(characters.pop());
}
stringBuilder.reverse();
int j = 0;
while( j < sum) {
decodedString.append(stringBuilder.toString());
j++;
}
}
}
System.out.println(decodedString);

OR
https://www.oracle.com/java/technologies/javase/vmoptions-
jsp.html#PerformanceTuning

prometheus + graffana + Dynatrace for monitoring microservices


Partitioned tolerance:
Sometimes, we need to partitioned the data (regionwise, customerwise or other factor can be
possible) to support application. this process is know as sharding.

Even after sharding(partitioned ) the data, application works robustly, without any
performance issue, we can call that application partitioned tolerant
1. How to decide which database we will choose
2. How to trouble shoot memory leaks in springboot
3. After a recent release application crashes how to troubleshoot?
4. How to perform heap dump and get the heap dump
5. You have few microservices which is running on multiple instances and certain point of
time one microservice instance is down how can we check which microsevrice is down? And
there is fault tolerance is implemented here…

1. Given an integer array, move all elements that are 0 to the left while maintaining the
order of other elements in the array. The array has to be modified in-place.

 Original Array
 1, 10, 20, 0, 59, 63, 0, 88, 0,
 After Moving Zeroes to Left
 0, 0, 0, 1, 10, 20, 59, 63, 88,

1. Challenges face while migration monolith to microservices


2. what are http methods available for rest.
3. what is idempotent method in rest and why.
4. Diff b/w put and patch.
5. How to manage if spring boot startup time is taking too much time
6. How to manage transaction if one rest endpoint calling two Database call using the
service class
7. If one microservice is down, then what is way to identify.
8. How add log4j in spring boot.
9. What is use of pom.xml and how we can add 3rd party library.
10. Design Pattern, where you have used singleton design pattern.
11. How call API from Angular
12. https://www.lucidchart.com/blog/cloud-migration-strategies-the-6-rs-of-cloud-
migration#:~:text=The%206%20Rs%20of%20cloud%20migration%E2%80%94re-
host%2C%20re,as%20a%20separate%20migration%20strategy.

You might also like