SAG Interview Questions:

1. How to sort the file with comma separated integers of file say 1 GB in system with memory limit of 100MB

2. Design a stack which returns minimum number with O(1)

3. Write a method to replace the elements of array with next max number (If no max number, then put -1). Example 4,5,2,25 -> 5,25,25,-1

4. Write a logic to print the combinations on Mobile KeyPad press. 1-> ABC, 2 -> DEF, Example: if user presses 12, then AD,AE,AF, BD,BE,BF,CD,CE,CF, if user presses 1, then A,B,C


OpenText Questions:

1. Sorting a array of numbers. Which sort would you use?

2. When will Error occur and can we handle Error conditions.

3. StackOverflow Exception. Explain about Heap and Stack Memory.

4. ThreadPoolExecutor: Is there a way to identify a thread failure and manage transactions (rolling back on any sublet/tasklet/thread failure) inside multi threaded job.

5. PostgreSQL: Why did you choose PostgreSQL among other DBs.

6. For Asynchronous Tasks, how does server send the response back to client and explain the mechanism.

7. In REST API, How would you send the large sized data from Server to Client.

8. What type of Authentication used in your application (Basic auth?)

ALTRA#SAMSUNG:

1. Write a logic to perform line wrapping of the log files by line character limit of 80. If the last word is truncated with 80 characters, then move that word to next line.

2.  Write a logic to add and delete integers up to max of 100 sequentially with 2 threads.

3.  Use Operator overloading in Java. Customize the "-" overload function with your own method to achieve below result.

     Ex: "Samsung" - "s" = amung

4. System.exit() and return code execution.

5. Design Pattern - Double lockedSingleton 

Morga -Stanly:

1. SQL City, Effective_date, Temperature, is_valid
Bang, 2011-01-09, 33, true
Ed, 2012-02-11,40 , true
Bang, 2013-02-07, 31, true
Banga, 2014-05-08, 27, false
coim, 2015-04-09, 44, true
Banga, 2015-05-08, 26, true

Find all cities whose temperature falls with the date of 2012-05-23 and with temp > 33

2. Given Input.txt , write java code to find all the words with 3rd highest occurrences.

3. Input.stream().parallel().forEach() will result in the random output or sequence.

4. default method implementation in interface in java8

5. Spring configuration to inject the java collection

6. afterAdvice and afterReturningAdvice in spring aspect jointpoint

NET #### APP:

1. What is Actuator in Spring boot

2. Profiling in spring boot and how does it work in Springboot and in Maven

3. How to make an application two way secure (what need to be done in the SpringBoot application to make it two way secure)

4. REST API how to secure the access? What authentication to be done.

5. Oauth authorization? how does it work in your application for secure?

6. What are the basic minimum dependencies to run a spring boot application

    spring-boot-starter-parent, spring-boot-starter-web, spring-boot-starter-security, 

   spring-boot-starter-jpa, spring-boot-starter-tomcat, spring-boot-starter-thymeleaf

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

    

7. Write a code to covert the number to words in Java. (For example: 20 -> Twenty, 135 -> One hundred and thirty five)

8. How do you add your own dependencies in local environment. (.m2 folder)

9. What is the disadvantage of using static variable in Java? when would it be disadvantage to use?

10. How do we configure container (dockerizing) of the spring boot application

11. HashMap and how internally it works when adding put?

12. What are the things to migrate from Spring to Spring-Boot Application?


Gold # Sachs:

1. How do you make your controller thread to wait if it spans multiple threads and waiting for all of them to complete. (Using executor service and Future#get of each thread will wait for each of the spanned threads to complete)

2. Class level synchronization and how does it work (static methods are synchronized and they are part of class level locks)

3. How switches are authenticated when you application tries to make a connection to device? (aaa authentication) can be used to set user name and password authentication. These has to be provisioned in the application to access those devices.

4. Is your application works with in the LAN. No it can work beyond LAN. Neighbor info of those devices are available with in the Routers/Switches but  Application can access those devices/endpoints only when it has proper access credentials.

#S@P:

1. Write the logic to print the following in recursive manner:

*

**

**...n

2. Write the logic to find the pairs returning the given sum N from the list of integers

  •     Solution: N-each integer and find the number from hash set to form a pair

3. singleton and is there a way to avoid checking synchronized code every time. 

4. What is multi-ton and how can we achieve that. Do we need to concurrent hashmap and/or synchronize it inside multi-ton?

5. SQL query to find the employee count and department id from given table of emp and department with given date falling between start date and end date.

6. R,B,RB: how can we correctly label the jars which are labelled incorrectly with only one pick from only one jar.

   Solution: pick from RB first and eliminate the possibilities.

7. When do we need to use the setter based dependency injection instead of constructed based based injection?

8. HashMap: Are the objects stored sequentially inside the HashMap under each bucket. Would the search be sequential with in each bucket?

9. How do we sum the 2 linked lists with integer representation? and make a listed for output

  • Solution: Use the stack to pop from 2 list and add it until both stacks are not empty. Carry forward the extra digit and pop from stack which is not empty.

10. How do we analyse the performance of a system in production? How do we analyze?

  • Java dump and thread lock analysis

11. Processes and Threads inside the application?

  • Is hardware factor(cores/RAM) matters while setting thread limits of an application? 

12. Could you design a bitly system? what would be internal logic for storing a shorturl and fullurl?

SCharted:

1. Generics and when method with argument <E> type is overloaded with method with Object type..... compile error or allowed

2. Future type and when is it exactly useful?

3. What is REST and how exactly is it different from struts and other xml oriented ones?

4. Which List implementation you select in your application?

5. Which Map implementation you prefer in multi threaded application? why concurrent hashmap over hashtable?

6. Any JMS and how queue works inside Integration messaging for publish subscribe model?