I got this opportunity with CDK Global, Pune & below process details from CerTro Technologies Pvt. Ltd.
As this interview happened in month of May 2020, so interview happened over Zoom. And I will suggest not to use the online IDE being offered by CDK interviewers, as this IDE just s*cks to give the reason that you can't code. So try to use your own desktop IDE & share that screen rather. And if you get call with this Snehasish from CerTro, don't expect proper feedback from him, he is also like any other recruiter only & never get proper feedback, only can tell Yes or No.
Selection Process:
1. Coding challenge (Programming Test for 60 – 90 minutes)
2. 2 Technical Face to Face interview.
3. 1 interview with Hiring Manager Face to Face
4. 1 HR Interview.
Anyone looking for the answer of the coding, please let me know I will provide the perfectly working & innovative solution, which no one at CDK also would have ever thought of.
Coding problem was on Shopping Cart.
Then I had only one interview discussion once & interviewer was looking more about logics & approach but due to some miscommunication that interview was interrupted & rescheduled.
Next week I had the interview discussion with some other interviewer where I am pretty much sure, interviewer himself was not interested. So he just spent time in asking about the project in previous company. Then in last 30 mins he asked below 3 questions only -
Question 1 : Write a code to show the deadlock.
Solution :
public class CDKDeadlock {
public static void main(String[] args) throws InterruptedException {
Resource1 resource1 = new Resource1();
Resource2 resource2 = new Resource2();
Thread t1 = new Thread(new Deadlock(resource1, resource2, 1));
Thread t2 = new Thread(new Deadlock(resource1, resource2, 2));
t1.start();
t2.start();
t1.join();
t2.join();
System.out.println("No Deadlock detected....");
}
static class Deadlock implements Runnable {
int order;
Resource1 resource1;
Resource2 resource2;
public Deadlock(Resource1 resource1, Resource2 resource2, int order) {
this.order = order;
this.resource1 = resource1;
this.resource2 = resource2;
resource1.setResource2(resource2);
resource2.setResource1(resource1);
}
@Override
public void run() {
if(order == 1) {
resource1.getResource();
} else if(order == 2) {
resource2.getResource();
}
}
}
static class Resource1 {
Resource2 resource2 = null;
public Resource1() {
}
public void setResource2(Resource2 resource2) {
this.resource2 = resource2;
}
public synchronized void getResource() {
System.out.println("Resource1");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
resource2.getResource();
}
}
static class Resource2 {
Resource1 resource1 = null;
public Resource2() {
}
public void setResource1(Resource1 resource1) {
this.resource1 = resource1;
}
public synchronized void getResource() {
System.out.println("Resource2");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
resource1.getResource();
}
}
}
Question 2 : Why Map is not part of Collection interface in Java?
Solution : I gave him the reasons as per my understanding with reasons but I think he was not interested in what I am
explaining & he had already made his mind about my profile. But anyhow this question is straight & simple one if
one understands a bit about Java APIs.
Question 3 : You are given array of positive integers,which are in sorted order
int [] intArray = new int[] { 1,2,3,5,6,8,9,10,12 } ;
Print the output in below format -
//1,2,3
//5,6
//8,9,10
Solution :
As this interview happened in month of May 2020, so interview happened over Zoom. And I will suggest not to use the online IDE being offered by CDK interviewers, as this IDE just s*cks to give the reason that you can't code. So try to use your own desktop IDE & share that screen rather. And if you get call with this Snehasish from CerTro, don't expect proper feedback from him, he is also like any other recruiter only & never get proper feedback, only can tell Yes or No.
Selection Process:
1. Coding challenge (Programming Test for 60 – 90 minutes)
2. 2 Technical Face to Face interview.
3. 1 interview with Hiring Manager Face to Face
4. 1 HR Interview.
Anyone looking for the answer of the coding, please let me know I will provide the perfectly working & innovative solution, which no one at CDK also would have ever thought of.
Coding problem was on Shopping Cart.
Then I had only one interview discussion once & interviewer was looking more about logics & approach but due to some miscommunication that interview was interrupted & rescheduled.
Next week I had the interview discussion with some other interviewer where I am pretty much sure, interviewer himself was not interested. So he just spent time in asking about the project in previous company. Then in last 30 mins he asked below 3 questions only -
Question 1 : Write a code to show the deadlock.
Solution :
public class CDKDeadlock {
public static void main(String[] args) throws InterruptedException {
Resource1 resource1 = new Resource1();
Resource2 resource2 = new Resource2();
Thread t1 = new Thread(new Deadlock(resource1, resource2, 1));
Thread t2 = new Thread(new Deadlock(resource1, resource2, 2));
t1.start();
t2.start();
t1.join();
t2.join();
System.out.println("No Deadlock detected....");
}
static class Deadlock implements Runnable {
int order;
Resource1 resource1;
Resource2 resource2;
public Deadlock(Resource1 resource1, Resource2 resource2, int order) {
this.order = order;
this.resource1 = resource1;
this.resource2 = resource2;
resource1.setResource2(resource2);
resource2.setResource1(resource1);
}
@Override
public void run() {
if(order == 1) {
resource1.getResource();
} else if(order == 2) {
resource2.getResource();
}
}
}
static class Resource1 {
Resource2 resource2 = null;
public Resource1() {
}
public void setResource2(Resource2 resource2) {
this.resource2 = resource2;
}
public synchronized void getResource() {
System.out.println("Resource1");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
resource2.getResource();
}
}
static class Resource2 {
Resource1 resource1 = null;
public Resource2() {
}
public void setResource1(Resource1 resource1) {
this.resource1 = resource1;
}
public synchronized void getResource() {
System.out.println("Resource2");
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
resource1.getResource();
}
}
}
Question 2 : Why Map is not part of Collection interface in Java?
Solution : I gave him the reasons as per my understanding with reasons but I think he was not interested in what I am
explaining & he had already made his mind about my profile. But anyhow this question is straight & simple one if
one understands a bit about Java APIs.
Question 3 : You are given array of positive integers,which are in sorted order
int [] intArray = new int[] { 1,2,3,5,6,8,9,10,12 } ;
Print the output in below format -
//1,2,3
//5,6
//8,9,10
Solution :
Below is better version with less if-else statements -
Enough show off for such simple problem, use below simple way -