Capita pvt ltd interview experience Real time questions & tips from candidates to crack your interview

Senior Consultant

Capita pvt ltd
upvote
share-icon
3 rounds | 16 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 Months
Topics: Java, Spring Boot, Jenkins, Java Collections, OOPS, Multithreading, MVC
Tip
Tip

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.

Application process
Where: Referral
Eligibility: Above 2 years of experience
Resume Tip
Resume tip

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.

Interview rounds

01
Round
Medium
Video Call
Duration60 Minutes
Interview date8 Jun 2021
Coding problem8

This round had questions from Java, OOPS and MVC. More emphasis was given on the fundamentals of the subject rather than the advanced topics.

1. Java Question

How ConcurrentHashMap works in Java

Problem approach

According to ConcurrentHashMap Oracle docs,

The constructor of ConcurrentHashMap looks like this :

public ConcurrentHashMap (int initialCapacity, float loadFactor, int concurrencyLevel)

So the above line creates a new, empty map with the specified initial capacity, load factor and concurrency level.
where,
Important Parameters to consider from ConcurrentHashMap Constructor :

initialCapacity - the initial capacity. The implementation performs internal sizing to accommodate this many elements.

concurrencyLevel - the estimated number of concurrently updating threads. The implementation performs internal
sizing to try to accommodate this many threads.


In the ConcurrentHashMap Api , you will find the following constants.

static final int DEFAULT_INITIAL_CAPACITY = 16;
static final int DEFAULT_CONCURRENCY_LEVEL = 16;

initial capacity parameter and concurrency level parameters of ConcurrentHashMap constructor (or Object) are set to
16 by default.


1) Thus, instead of a map wide lock, ConcurrentHashMap maintains a list of 16 locks by default ( number of locks
equal to the initial capacity , which is by default 16) each of which is used to lock on a single bucket of the Map.

2) This indicates that 16 threads (number of threads equal to the concurrency level , which is by default 16) can
modify the collection at the same time , given ,each thread works on different bucket.

3) So unlike hashtable, we perform any sort of operation ( update ,delete ,read ,create) without locking on entire map
in ConcurrentHashMap.


Retrieval operations (including get) generally do not block, so may overlap with update operations (including put and
remove). Retrievals reflect the results of the most recently completed update operations holding upon their onset.

1) The allowed concurrency among update operations is guided by the optional concurrencyLevel constructor
argument (default 16), which is used as a hint for internal sizing.

2) The table is internally partitioned to try to permit the indicated number of concurrent updates without contention.

3) Because placement in hash tables is essentially random, the actual concurrency will vary. Ideally, you should
choose a value to accommodate as many threads as will ever concurrently modify the table.

4) Using a significantly higher value than you need can waste space and time, and a significantly lower
value can lead to thread contention

2. Java Question

Explain the use of final keyword in variable, method and class.

Problem approach

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 :
No classes can be inherited from the class declared as final. But that final class can extend other classes for its
usage.

3. Java Question

Differentiate between HashSet and HashMap.

Problem approach

Hash Set :
1) It implements the Set Interface.
2) It does not allow duplicate values.
3) While adding an element it requires only one object as a parameter.
4) Internally, HashSet uses HashMap to add entries. The key K in a HashSet is the argument supplied in the
add(Object) method. For each value supplied in the add(Object) method, Java assigns a dummy value.
5) It is slower than HashMap.



Hash Map :
1) It implements the Map Interface.
2) The key needs to be unique while two different keys can have the same value.
3) While adding an entry, it requires two object values, the Key and the Value as the parameter.
4) There is no concept of duplicate values.
5) It is faster than HashSet.

4. Java Question

Differentiate between ArrayList and Vector in java.

Problem approach

Following are the differences between ArrayList and Vector in java :

1) Synchronization : Vector is synchronized, which means that only one thread can access the code at a time,
however, ArrayList is not synchronized, which means that multiple threads can operate on ArrayList at the same time.

2)Data Growth : Both ArrayList and Vector dynamically expand and shrink to make the most use of storage space,
but the manner they do it is different. If the number of elements in an array exceeds its limit, ArrayList increments
50% of the current array size, while vector increments 100%, thereby doubling the current array size.

3) Performance : ArrayList is faster than vector operations because it is non-synchronized, but vector operations are
slower since they are synchronized (thread-safe). When one thread works on a vector, it acquires a lock on it,
requiring any other threads working on it to wait until the lock is released.

4) Ease of Iteration : Vector can traverse over its elements using both Enumeration and Iterator, whereas ArrayList
can only traverse using Iterator.

5. OOPS Question

What is meant by Interface?

Problem approach

Multiple inheritances cannot be achieved in java. To overcome this problem the Interface concept is
introduced. An interface is a template which has only method declarations and not the method implementation.

Some imp. points about Interface :

1) All the methods in the interface are internally public abstract void.
2) All the variables in the interface are internally public static final that is constants.
3) Classes can implement the interface and not extends.
4) The class which implements the interface should provide an implementation for all the methods declared in the
interface.

6. OOPS Question

Difference between Abstract class and Interface.

Problem approach

The differences between Abstract Class and Interface are as follows : 

Abstract Class:
1) Abstract classes have a default constructor and it is called whenever the concrete subclass is instantiated.
2) It contains Abstract methods as well as Non-Abstract methods.
3) The class which extends the Abstract class shouldn’t require the implementation of all the methods, only Abstract
methods need to be implemented in the concrete sub-class.
4) Abstract class contains instance variables.


Interface:
1 )It doesn’t have any constructor and couldn’t be instantiated.
2) The abstract method alone should be declared.
3) Classes that implement the interface should provide the implementation for all the methods.
4) The interface contains only constants.

7. MVC Question

Explain in brief the role of different MVC components?

Problem approach

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.

8. MVC Question

How is the routing carried out in MVC?

Problem approach

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.

02
Round
Medium
Video Call
Duration50 Minutes
Interview date8 Jun 2021
Coding problem7

In this round, I was asked questions mainly from Jenkins, CI/CD and some more questions revolving around common HTTP methods and Microservices.

1. Jenkins Question

What is Jenkins?

Problem approach

Jenkins is a self-contained, open-source automation server that can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software. Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.

2. Jenkins Question

What are the types of Jenkins pipelines?

Problem approach

1) Jenkins Pipelines can be either - a Declarative pipeline or a Scripted Pipeline. 

2) Declarative pipeline makes use of numerous, generic, predefined build steps/stages (i.e. code snippets) to build our job according to our build/automation needs. 

3) Whereas, with Scripted pipelines, the steps/stages can be custom-defined & used using a groovy syntax which provides better control & fine-tuned execution levels.

3. Jenkins Question

Explain Jenkins Multibranch Pipeline?

Problem approach

It is a pipeline job that can be configured to Create a set of Pipeline projects according to the detected branches in one SCM repository. This can be used to configure pipelines for all branches of a single repository e.g. if we maintain different branches (i.e. production code branches) for different configurations like locales, currencies, countries, etc.

4. Jenkins Question

What are the credential types supported by Jenkins?

Problem approach

In Jenkins, credentials are a set of information used for authentication with internal/external services to accomplish an action. Jenkins credentials are provisioned & managed by a built-in plugin called - Credentials Binding - plugin. Jenkins can handle different credentials as follows -

1) Secret text - A token such as an API token, JSON token, etc.
2) Username and password - Basic Authentication can be stored as a credential as well.
3) Secret file - A secret file used to authenticate some secure data services & security handshakes.
4) SSH Username with a private key - An SSH public/private key pair for Machine to Machine authentication.
5) Certificate - a PKCS#12 certificate file and an optional password.
6) Docker Host Certificate Authentication credentials.


And as we can guess, this can be extended to several other extensible credential types like - AWS credential, Azure secrets, etc. using commonly available plugins.

5. API Question

Difference between PUT and POST methods?

Problem approach

1) PUT method is called when you have to modify a single resource while POST method is called when you have to
add a child resource.

2) PUT method response can be cached but you cannot cache POST method responses.

3) You can use UPDATE query in PUT whereas you can use create query in POST.

4) In PUT method, the client decides which URI resource should have, and in POST method, the server decides
which URI resource should have.

5) PUT works as specific while POST work as abstract.

6) If you send the same PUT request multiple times, the result will remain the same but if you send the same POST
request multiple times, you will receive different results.

7) PUT method is idempotent whereas POST method is not idempotent.

6. Microservices Question

Explain how independent microservices communicate with each other.

Problem approach

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.

7. Microservices Question

Explain OAuth.

Problem approach

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.

03
Round
Easy
HR Round
Duration30 Minutes
Interview date8 Jun 2021
Coding problem1

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.

1. Basic HR Question

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?

Problem approach

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

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
8518 views
0 comments
0 upvotes
Analytics Consultant
3 rounds | 10 problems
Interviewed by ZS
907 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
3320 views
0 comments
0 upvotes
company logo
SDE - 2
4 rounds | 6 problems
Interviewed by Expedia Group
2581 views
0 comments
0 upvotes