UKG
10+ Sun Pharmaceutical Industries Interview Questions and Answers
Q1. What Is Java. Who developed Java.
Java is a high-level programming language developed by Sun Microsystems (now owned by Oracle) in 1995.
Java is platform-independent, meaning it can run on any device with a Java Virtual Machine (JVM).
It is object-oriented and designed to have as few implementation dependencies as possible.
Java is widely used for building web applications, mobile apps, and enterprise software.
James Gosling, Mike Sheridan, and Patrick Naughton are credited with the development of Java.
Q2. What is ApplicationContext in Spring
ApplicationContext is an interface for providing configuration information to an application.
ApplicationContext is the central interface in a Spring application for providing configuration information to the application.
It is responsible for instantiating, configuring, and assembling beans.
ApplicationContext can load bean definitions, wire beans together, and dispense beans upon request.
It provides a means for resolving text messages, accessing resources, and loading file res...read more
Q3. find 2nd largest number in an array
Iterate through array to find 2nd largest number
Iterate through array and keep track of largest and second largest numbers
Handle edge cases like duplicates and empty array
Example: ['3', '5', '2', '7', '5'] should return 5 as the 2nd largest number
Q4. write a prograame to find duplicate
Program to find duplicate strings in an array
Iterate through the array and store each string in a HashSet
If a string is already in the HashSet, it is a duplicate
Return a list of all duplicate strings found
Q5. tell me java8 features
Java 8 introduced several new features including lambda expressions, functional interfaces, streams, and default methods.
Lambda expressions allow you to write code in a more concise way by replacing anonymous classes.
Functional interfaces are interfaces with a single abstract method, which can be implemented using lambda expressions.
Streams provide a way to work with sequences of elements and perform operations like filter, map, reduce, etc.
Default methods allow interfaces to...read more
Q6. Is JAVA platform independent
Yes, Java is platform independent due to its ability to compile code into bytecode that can run on any platform with a Java Virtual Machine (JVM).
Java code is compiled into bytecode which can run on any platform with a JVM
JVM acts as an abstraction layer between the Java code and the underlying platform
Java's 'write once, run anywhere' principle allows for platform independence
Q7. Reverse the linked list.
Reverse a linked list by changing the direction of pointers.
Start with three pointers: current, previous, and next.
Iterate through the linked list, updating pointers to reverse the direction.
Return the new head of the reversed linked list.
Q8. Internel working of Hashmap
HashMap is a data structure that stores key-value pairs and uses hashing to quickly retrieve values based on keys.
HashMap internally uses an array of linked lists to store key-value pairs.
When a key-value pair is added, the key is hashed to determine the index in the array where it will be stored.
If multiple keys hash to the same index, a linked list is used to handle collisions.
Retrieving a value involves hashing the key to find the index and then traversing the linked list ...read more
Q9. Difference between AOT and JIT
AOT compiles code before runtime, JIT compiles code during runtime.
AOT stands for Ahead Of Time compilation, compiles code before execution
JIT stands for Just In Time compilation, compiles code during execution
AOT produces machine code that can be executed directly
JIT converts code into machine code as needed, optimizing performance
Examples: AOT - Angular, JIT - Java Virtual Machine
Q10. Swap of numbers
Swapping two numbers without using a temporary variable.
Use XOR operation to swap two numbers without using a temporary variable.
Example: a = 5, b = 10. After swapping, a = 10, b = 5.
Q11. explain psvm in java
psvm in Java stands for public static void main, which is the entry point for a Java program.
psvm is the method signature for the main method in Java programs.
It is used to start the execution of a Java program.
It must be declared as public, static, and void.
It takes an array of strings as an argument, which can be used to pass command line arguments.
Q12. explain collection
A collection is a group of related objects or data items that are stored together.
Collections can be implemented using data structures like arrays, lists, sets, maps, etc.
Collections allow for easy manipulation and organization of data.
Examples of collections include arrays of integers, lists of strings, sets of unique values, and maps of key-value pairs.
Interview Process at Sun Pharmaceutical Industries
Top Senior Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month