Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
This round started with some basic questions from C and Java followed by some questions from Multithreading in Java and Java Design Patterns.
Difference between const char* p and char const* p?
const char* p is a pointer to a const char.
char const* p is a pointer to a char const.
Since const char and char const are the same, it's the same.
What are the advantages of Macro over function?
Macro on a high-level copy-paste, its definitions to places wherever it is called. Due to which it saves a lot of time, as no time is spent while passing the control to a new function and the control is always with the callee function. However, one downside is the size of the compiled binary is large but once compiled the program comparatively runs faster.
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
C is a language known for its low-level control over the memory allocation of variables in DMA there are two major standard library malloc() and free. The malloc() function takes a single input parameter which tells the size of the memory requested. It returns a pointer to the allocated memory. If the allocation fails, it returns NULL. The prototype for the standard library function is like this :
void *malloc(size_t size);
The free() function takes the pointer returned by malloc() and de-allocates the memory. No indication of success or failure is returned. The function prototype is like this:
void free(void *pointer);
There are 4 library functions provided by C defined under header file to facilitate dynamic memory allocation in C programming. They are :
malloc()
calloc()
free()
realloc()
What is the difference between #include "..." and #include <...>?
In practice, the difference is in the location where the preprocessor searches for the included file.
For #include the C preprocessor looks for the filename in the predefined list of system directories first and then to the directories told by the user(we can use -I option to add directories to the mentioned predefined list).
For #include "filename" the preprocessor searches first in the same directory as the file containing the directive, and then follows the search path used for the #include form. This method is normally used to include programmer-defined header files.
Differentiate Source Codes from Object Codes
The difference between the Source Code and Object Code is that Source Code is a collection of computer instructions written using a human-readable programming language while Object Code is a sequence of statements in machine language, and is the output after the compiler or an assembler converts the Source Code.
The last point about Object Code is the way the changes are reflected. When the Source Code is modified, each time the Source Code needs to be compiled to reflect the changes in the Object Code.
Why Java is platform independent and JVM platform dependent?
JVM is platform dependent because it takes java byte code and generates byte code for the current operating
system. So Java software is platform dependent but Java language is platform independent because different
operating system have different JVMs.
Explain the use of final keyword in variable, method and class.
In Java, the final keyword is used as defining something as constant /final and represents the non-access modifier.
1) final variable :
i) When a variable is declared as final in Java, the value can’t be modified once it has been assigned.
ii) If any value has not been assigned to that variable, then it can be assigned only by the constructor of the class.
2) final method :
i) A method declared as final cannot be overridden by its children's classes.
ii) A constructor cannot be marked as final because whenever a class is inherited, the constructors are not inherited.
Hence, marking it final doesn't make sense. Java throws compilation error saying - modifier final not allowed here
3) final class:
i) No classes can be inherited from the class declared as final. But that final class can extend other classes for its
usage.
Explain thread pool?
1) A Thread pool is simply a collection of pre-initialized or worker threads at the start-up that can be used to execute
tasks and put back in the pool when completed.
2) It is referred to as pool threads in which a group of fixed-size threads is created.
3) By reducing the number of application threads and managing their lifecycle, one can mitigate the issue of
performance using a thread pool.
4) Using threads, performance can be enhanced and better system stability can occur. To create the thread pools,
java.util.concurrent.Executors class usually provides factory methods.
What is race condition in Java? Given one example.
Race condition are cause of some subtle programming bugs when Java programs are exposed to concurrent
execution environment. As the name suggests, a race condition occurs due to race between multiple threads, if a
thread which is supposed to execute first lost the race and executed second, behaviour of code changes, which
surface as non-deterministic bugs. This is one of the hardest bugs to find and re-produce because of random nature
of racing between threads. One example of race condition is out-of-order processing.
Explain the Singleton pattern?
Singleton pattern in Java is a pattern which allows a single instance within an application. One good example of the
singleton pattern is java.lang.Runtime.
Singleton Pattern states that define a class that has only one instance and provides a global point of access to it.
In other words, it is the responsibility of the class that only a single instance should be created, and all other classes
can use a single object.
This round started with some questions from Spring Boot and Hibernate and then the interviewer moved on to some more questions from MVC and Microservices.
What Are the Basic Annotations that Spring Boot Offers?
The primary annotations that Spring Boot offers reside in its "org.springframework.boot.autoconfigure" and its sub-
packages. Here are a couple of basic ones :
@EnableAutoConfiguration – to make Spring Boot look for auto-configuration beans on its classpath and
automatically apply them.
@SpringBootApplication – used to denote the main class of a Boot Application. This annotation combines
@Configuration, @EnableAutoConfiguration, and @ComponentScan annotations with their default attributes.
Explain @RestController annotation in Sprint boot?
It is a combination of @Controller and @ResponseBody, used for creating a restful controller. It converts the
response to JSON or XML. It ensures that data returned by each method will be written straight into the response
body instead of returning a template.
What is dependency Injection?
The process of injecting dependent bean objects into target bean objects is called dependency injection.
1) Setter Injection : The IOC container will inject the dependent bean object into the target bean object by calling the
setter method.
2) Constructor Injection : The IOC container will inject the dependent bean object into the target bean object by calling
the target bean constructor.
3) Field Injection : The IOC container will inject the dependent bean object into the target bean object by Reflection
API.
What is hibernate caching?
Hibernate caching is the strategy for improving the application performance by pooling objects in the cache so that
the queries are executed faster. Hibernate caching is particularly useful when fetching the same data that is executed
multiple times. Rather than hitting the database, we can just access the data from the cache. This results in reduced
throughput time of the application.
Types of Hibernate Caching
First Level Cache :
1) This level is enabled by default.
2) The first level cache resides in the hibernate session object.
3) Since it belongs to the session object, the scope of the data stored here will not be available to the entire
application as an application can make use of multiple session objects.
Second Level Cache :
1) Second level cache resides in the SessionFactory object and due to this, the data is accessible by the entire
application.
2) This is not available by default. It has to be enabled explicitly.
3) EH (Easy Hibernate) Cache, Swarm Cache, OS Cache, JBoss Cache are some example cache providers.
Can you tell something about the N+1 SELECT problem in Hibernate?
N+1 SELECT problem is due to the result of using lazy loading and on-demand fetching strategy. Let's take an
example. If you have an N items list and each item from the list has a dependency on a collection of another object,
say bid. In order to find the highest bid for each item while using the lazy loading strategy, hibernate has to first fire 1
query to load all items and then subsequently fire N queries to load big of each item. Hence, hibernate actually ends
up executing N+1 queries.
What are the concurrency strategies available in hibernate?
Concurrency strategies are the mediators responsible for storing and retrieving items from the cache. While enabling
second-level cache, it is the responsibility of the developer to provide what strategy is to be implemented to decide for
each persistent class and collection.
Following are the concurrency strategies that are used:
1) Transactional: This is used in cases of updating data that most likely causes stale data and this prevention is most
critical to the application.
2) Read-Only: This is used when we don't want the data to be modified and can be used for reference data only.
3) Read-Write: Here, data is mostly read and is used when the prevention of stale data is of critical importance.
4) Non-strict-Read-Write: Using this strategy will ensure that there wouldn't be any consistency between the database
and cache. This strategy can be used when the data can be modified and stale data is not of critical concern.
Explain in brief the role of different MVC components?
The different MVC components have the following roles -
1) Presentation: This component takes care of the visual representation of a particular abstraction in the application.
2) Control: This component takes care of the consistency and uniformity between the abstraction within the system
along with their presentation to the user. It is also responsible for communicating with all other controls within the
MVC system.
3) Abstraction: This component deals with the functionality of the business domain within the application.
How is the routing carried out in MVC?
1) The RouteCollection contains a set of routes that are responsible for registering the routes in the application.
2) The RegisterRoutes method is used for recording the routes in the collection.
3) The URL patterns are defined by the routes and a handler is used which checks the request matching the pattern.
4) The MVC routing has 3 parameters.
4.1) The first parameter determines the name of the route.
4.2) The second parameter determines a specific pattern with which the URL matches.
4.3) The third parameter is responsible for providing default values for its placeholders.
Explain how independent microservices communicate with each other.
Communication between microservices can take place through :
1) HTTP/REST with JSON or binary protocol for request-response
2) Websockets for streaming.
3) A broker or server program that uses advanced routing algorithms.
RabbitMQ, Nats, Kafka, etc., can be used as message brokers; each is built to handle a particular message
semantic. You can also use Backend as a Service like Space Cloud to automate your entire backend.
Explain OAuth.
Generally speaking, OAuth (Open Authorization Protocol) enables users to authenticate themselves with third-party
service providers. With this protocol, you can access client applications on HTTP for third-party providers such as
GitHub, Facebook, etc. Using it, you can also share resources on one site with another site without requiring their
credentials.
This was a Technical Cum HR round where I was first asked some basic Java related concepts and then we discussed
about my expectations from the company , learnings and growth in the forthcomig years. I would suggest be honest and
try to communicate your thoughts properly in these type of rounds to maximise your chances of getting selected.
Why should we hire you ?
What are your expectations from the company?
How was your overall interview experience?
What are your strengths and weakness according to you?
Where do you see yourself in the next 5 years?
Why are you looking for a job change?
Tip 1 : The cross questioning can go intense some time, think before you speak.
Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.
Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round,
like what are the projects currently the company is investing, which team you are mentoring. How all is the work
environment etc.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?