Nitin Agrawal
Contact -
  • Home
  • Interviews
    • Secret Receipe
    • InterviewFacts
    • Resume Thoughts
    • Daily Coding Problems
    • BigShyft
    • Companies
    • Interviews Theory
  • Programming Languages
    • Java Script >
      • Tutorials
      • Code Snippets
    • Reactive Programming >
      • Code Snippets
    • R
    • DataStructures >
      • LeetCode Problems >
        • Problem10
        • Problem300
      • AnagramsSet
    • Core Java >
      • Codility
      • Program Arguments OR VM arguments & Environment variables
      • Java Releases >
        • Java8 >
          • Performance
          • NasHorn
          • WordCount
          • Thoughts
        • Java9 >
          • ServiceLoaders
          • Lambdas
          • List Of Objects
          • Code Snippets
        • Java14 >
          • Teeing
          • Pattern
          • Semaphores
        • Java17 >
          • Switches
          • FunctionalStreams
          • Predicate
          • Consumer_Supplier
          • Collectors in Java
        • Java21 >
          • Un-named Class
          • Virtual Threads
          • Structured Concurrency
      • Threading >
        • ThreadsOrder
        • ProducerConsumer
        • Finalizer
        • RaceCondition
        • Executors
        • Future Or CompletableFuture
      • Important Points
      • Immutability
      • Dictionary
      • Sample Code Part 1 >
        • PatternLength
        • Serialization >
          • Kryo2
          • JAXB/XSD
          • XStream
        • MongoDB
        • Strings >
          • Reverse the String
          • Reverse the String in n/2 complexity
          • StringEditor
          • Reversing String
          • String Puzzle
          • Knuth Morris Pratt
          • Unique characters
          • Top N most occurring characters
          • Longest Common Subsequence
          • Longest Common Substring
        • New methods in Collections
        • MethodReferences
        • Complex Objects Comparator >
          • Performance
        • NIO >
          • NIO 2nd Sample
        • Date Converter
        • Minimum cost path
        • Find File
      • URL Validator
    • Julia
    • Python >
      • Decorators
      • String Formatting
      • Generators_Threads
      • JustLikeThat
    • Go >
      • Tutorial
      • CodeSnippet
      • Go Routine_Channel
      • Suggestions
    • Methodologies & Design Patterns >
      • Design Principles
      • Design Patterns >
        • TemplatePattern
        • Adapter Design Pattern
        • Proxy
        • Lazy Initialization
        • CombinatorPattern
        • Singleton >
          • Singletons
        • Strategy
  • Frameworks
    • Apache Velocity
    • React Library >
      • Tutorial
    • Spring >
      • Spring Boot >
        • CustomProperties
        • ExceptionHandling
        • Custom Beans
        • Issues
      • Quick View
    • Rest WebServices >
      • Interviews
      • Swagger
    • Cloudera BigData >
      • Ques_Ans
      • Hive
      • Apache Spark >
        • ApacheSpark Installation
        • SparkCode
        • Sample1
        • DataFrames
        • RDDs
        • SparkStreaming
        • SparkFiles
    • Integration >
      • Apache Camel
    • Testing Frameworks >
      • JUnit >
        • JUnit Runners
      • EasyMock
      • Mockito >
        • Page 2
      • TestNG
    • Blockchain >
      • Ethereum Smart Contract
      • Blockchain Java Example
    • Microservices >
      • Messaging Formats
      • Design Patterns
    • AWS >
      • Honeycode
    • Dockers >
      • GitBash
      • Issues
      • Kubernetes
  • Databases
    • MySql
    • Oracle >
      • Interview1
      • SQL Queries
    • Elastic Search
  • Random issues
    • TOAD issue
    • Architect's suggestions
  • Your Views
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 : 
Picture
Below is better version with less if-else statements -
Picture
 Enough show off for such simple problem, use below simple way -
Picture
Powered by Create your own unique website with customizable templates.