Samin Tekmindz India
10+ DTCC Interview Questions and Answers
Q1. What is the difference between overloading and overriding in java?
Overloading is when multiple methods have the same name but different parameters, while overriding is when a subclass provides a specific implementation for a method in its superclass.
Overloading involves multiple methods with the same name but different parameters.
Overriding involves a subclass providing a specific implementation for a method in its superclass.
Overloading is determined at compile time based on the method signature, while overriding is determined at runtime b...read more
Q2. What is the difference between sleep and join methods?
Sleep method pauses the current thread for a specified amount of time, while join method waits for a thread to finish execution.
Sleep method is a static method of Thread class, while join method is an instance method.
Sleep method does not release the lock on the object, while join method does.
Sleep method takes a specified time in milliseconds as an argument, while join method waits until the thread it is called on finishes execution.
Example: Thread.sleep(1000) will pause the...read more
Q3. What is the difference between ArrayList and Vector?
ArrayList is not synchronized while Vector is synchronized.
ArrayList is not thread-safe, while Vector is thread-safe.
Vector is slower than ArrayList because of synchronization.
ArrayList is a part of the Java Collection Framework, while Vector is a legacy class.
Example: ArrayList
list = new ArrayList<>(); Vector vector = new Vector<>();
Q4. What is the @Restcontroller and @Controller annotations.
Annotations used in Spring framework for defining RESTful web services (@RestController) and MVC controllers (@Controller).
Annotations in Spring framework for defining RESTful web services (@RestController) and MVC controllers (@Controller)
@RestController is used for RESTful web services, @Controller is used for MVC controllers
@RestController combines @Controller and @ResponseBody annotations
Example: @RestController public class MyRestController {}
Example: @Controller public ...read more
Q5. How would you compare two strings in java?
Use the equals() method or compareTo() method to compare two strings in Java.
Use the equals() method to compare two strings for content equality.
Use the compareTo() method to compare two strings lexicographically.
Consider using the equalsIgnoreCase() method for case-insensitive comparison.
Q6. What docker commands do you know?
I know various docker commands for managing containers and images.
docker run - to create and start a new container
docker ps - to list all running containers
docker stop - to stop a running container
docker images - to list all available images
docker pull - to download an image from a registry
docker build - to build an image from a Dockerfile
Q7. How do you write a docker file?
A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image.
Start with a base image using the FROM keyword
Use the RUN keyword to execute commands in the image
Use the COPY keyword to add files from your Docker client's current directory
Use the CMD keyword to specify the command to run when the container starts
Q8. Can you tell me about some git commands?
Git commands are used to interact with the version control system Git.
git clone: Used to clone a repository from a remote server to your local machine.
git add: Adds changes in the working directory to the staging area.
git commit: Records changes to the repository.
git push: Pushes changes to a remote repository.
git pull: Fetches changes from a remote repository and merges them into the local branch.
Q9. What is the Composition in java?
Composition in Java is a design technique where a class contains an object of another class to reuse its functionality.
Composition is a 'has-a' relationship, where one class contains an instance of another class.
It allows for code reuse and flexibility in design.
Example: A Car class may contain an Engine object, utilizing its functionality without inheriting from it.
Q10. Can you override static method in java?
No, static methods cannot be overridden in Java.
Static methods belong to the class itself, not to any specific instance of the class.
Subclasses can have static methods with the same signature as the parent class, but it is not considered overriding.
Example: Parent class has a static method 'display()', and subclass also has a static method 'display()', this is not overriding.
Q11. What is actuator in springboot?
Actuator in Spring Boot is a set of tools and features that help monitor and manage your application.
Actuator provides endpoints to monitor application health, metrics, info, etc.
It allows you to interact with your application through HTTP endpoints.
Examples of endpoints include /actuator/health, /actuator/metrics, /actuator/info.
Actuator can be customized and secured based on your requirements.
Q12. What is the data encapsulation?
Data encapsulation is the concept of bundling data with the methods that operate on that data, restricting access to the data.
Data encapsulation is a fundamental principle of object-oriented programming.
It allows for the data to be hidden and only accessible through the defined methods.
Encapsulation helps in achieving data abstraction and information hiding.
Example: In a class representing a car, the variables like speed and fuel level can be encapsulated with methods like ac...read more
Q13. What is the Spring MVC flow?
Spring MVC flow is the sequence of steps followed in processing a web request in a Spring MVC application.
Client sends a request to the DispatcherServlet.
DispatcherServlet sends the request to the appropriate Controller.
Controller processes the request, interacts with the Model and returns a ModelAndView object.
DispatcherServlet selects the appropriate ViewResolver to render the view.
ViewResolver resolves the view and sends the response back to the client.
Q14. What is the thread life cycle?
Thread life cycle refers to the various stages a thread goes through from creation to termination.
Thread creation
Thread start
Thread running
Thread waiting or blocked
Thread termination
Q15. How do you handle exceptions?
I handle exceptions by using try-catch blocks to catch and handle errors gracefully.
Use try-catch blocks to catch exceptions and handle them gracefully
Log the exception details for debugging purposes
Throw custom exceptions when necessary
Use finally block to clean up resources
Q16. Why Strings immutable in java?
Strings are immutable in Java to ensure thread safety, security, and optimization.
Immutable strings are thread-safe as they cannot be modified concurrently by multiple threads.
Immutable strings prevent security vulnerabilities like injection attacks.
Immutable strings allow for optimization by caching and reusing string literals.
Q17. What is point cut?
Point cut is a term used in Aspect-Oriented Programming (AOP) to define where certain aspects should be applied in the code.
Point cut specifies the join points in the code where advice should be applied.
It helps in separating the cross-cutting concerns from the main business logic.
Examples of point cuts include method executions, field accesses, and exception handling.
Q18. What is joint point?
Joint point is a point in the execution of a program where an aspect can be applied.
Joint point is a specific point in the execution of a program where additional behavior can be introduced.
It is a point in the code where the aspect code can be weaved in.
Examples include method calls, exception handling, variable assignments, etc.
Interview Process at DTCC
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month