Intellect Design Arena
10+ Dr. Reddy's Interview Questions and Answers
Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.
Abstract class can have constructors, member variables, and methods with implementation.
Interface can only have abstract methods and constants.
A class can implement multiple interfaces but can only extend one abstract class.
Example: abstract class Animal { abstract void sound(); void eat() { // implementation } }
Example: interface Shape { void draw(); }
Yes, static methods can be used in interfaces in Java.
Static methods in interfaces were introduced in Java 8.
Static methods can be called using the interface name.
Static methods in interfaces are used for providing utility methods.
Example: interface MyInterface { static void myMethod() { System.out.println("Static method in interface"); }}
Polymorphism in Java can be achieved through method overloading and method overriding.
Method overloading: Having multiple methods in the same class with the same name but different parameters.
Method overriding: Subclass provides a specific implementation of a method that is already provided by its superclass.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
Example: Animal class with a method 'makeSound', and subclasses Dog and C...read more
Q4. 1. Exception handling in java 2. What is method overriding
Exception handling in Java is a mechanism to handle runtime errors and prevent program termination.
Java provides try, catch, and finally blocks to handle exceptions.
Checked exceptions must be caught or declared in the method signature.
Unchecked exceptions do not need to be caught or declared.
Example: try { // code that may throw exception } catch (Exception e) { // handle exception }
Example: try { // code that may throw exception } finally { // cleanup code }
Q5. Reverse string using any popular language
Reverse a string using popular programming languages
Use built-in functions like reverse() in Python
Iterate through the string in reverse order in C++
Use StringBuilder.reverse() in Java
Q6. Find length of string they give string
Use the length() function to find the length of the given string.
Use the length() function in programming languages like Java, Python, C++, etc.
For example, in Java: String str = 'hello'; int length = str.length();
Make sure to handle edge cases like empty strings or null values.
Q7. Prime number using any popular language
A prime number is a number greater than 1 that can only be divided by 1 and itself.
Use a loop to check if the number is divisible by any number other than 1 and itself
Start checking from 2 up to the square root of the number for efficiency
If the number is only divisible by 1 and itself, it is a prime number
Q8. Remove duplicatefrom string
Use a set to remove duplicates from a string
Create a set to store unique characters
Iterate through the string and add each character to the set
Convert the set back to a string to get the result
Q9. Replace characters from string
Replace characters from string with another character
Use a loop to iterate through each character in the string
Check if the character needs to be replaced and replace it with the desired character
Return the modified string
Q10. Write star pattern
Print a star pattern using loops
Use nested loops to print the desired pattern
Start with a small pattern and then increase complexity
Use '*' character to represent the stars
Example: For a simple pattern, you can use a loop to print '*' in a single line
Interview Process at Dr. Reddy's
Top System Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month