Monday, February 17, 2020

1. How hashset works internally
2. Scenario where you can use hashcode and equals override.
3. which datastructure hashmap/set uses.
4. what all the new features were added in java 1.7
5. what all the scopes are there for bean in sprigboot
6. if singleton has a object of prototype then how will you overcome of this situation.
7. difference between @qualifier and @resources.
8. how will you implement logging framework in microservices.
9. if you get nullpointer exception in microservices how will you know from which service it is coming.
10. How will you initialize a mockito.(syntax)
11. what is the use of any in mockito.
12. SQL syntax to get Manager of an employee.
13. how do you get the duplicate records(syntax).
14. What is on demand injection, what is annotation for this.
15. What is chained constructor.
16. How to validate requestObject, and what if any request is null.

Tuesday, February 11, 2020

Questions by Mishraji

anant mishra

Sat, Jan 25, 11:06 AM

GE questions:
to me
Core Java
=======
1. Strings, StringBuilder, StringBuffer.. Definitions, Uses, Diff, etc.
2. Collections
-ArrayList vs LinkList.
-HashMap vs CHM.
-Iterator implementation does not have to add() method?
- Fail fast vs fail Safe Itratior implementation
-How we can create unmodifiable Collections like Map, List, Set
- How does serialisation work? Write a simple program to serialize a serialized the emp object.
-Depp cloning vs Shallow? Example and participants classes.

3. Multithreading
-Why thread?
-How many ways we can create threads?
-Where to use Runnable and extends Thread?
-Can be change Thread priority after t.start()?
-How Synchronisation works?
-Inter thread communication? use of wati(), notify() and notifyAll(). Why these methods are part of Object class.
-Sleep() vs wait()?
- join() vs yield()?
- Producer consumer program like Ping pong example?

4. Design questions
-Vending machine implementation. Just identify classes, interface and methods to expose to the user as Rest Endpoints
-Bookmyshow like implementation.
-There is a train with a bogi and in this bogi 9 compartment and each compartment has 8 seats. For given seat number tell use whether it is LOWER birth, UPPER ...

5. Coding Skills
-String reverse except for spacial letters.
Example
Input= V*s$ A AJ======>Output is ===>J*A$SAV
-Separate 0 and 1.
-Separate -ve and +ve numbers.
6. Spring and Springboot questions
-Spring bean scope? default bean scope. When to use what scope.
-How Autowring works?
-How Springboot application starts? Execution flow.
-ApplicationContext vs BenaFActory?
-Dependency injection?
- How to develop RESTFUL services using Springboot?
-GET vs POST, and UPDATE, DELETE, PUT

7. Architecture level interview with Ashish Sharma.
-32 bit vs 64 bit OS(platform)
- 32 bit vs 64 bit JAVA
- Diff b/w Array, Arraylist and LinkedList.
-How to do estimation of a given task?
- What are the complex task you handled so far(Prepare 1-2 stories).

8. HR/Manager discussion
-As usual happens. No technical question. Be honest anwser. Prepare few basic questions 
like project work, Arhitecture etc. You should be able to speek at least 15 mins about your past experience.




Telphonic 1:
Questions from
-Collections
-Exceptions(Exceptions rule in inheritence)
-Strings(SCP and intern() method use)
-REST based questions


F2F 1:
1. Why Static and uses of it.
class Test{
int a = 10;
p s v m(){
sop(a);
}

Whats the output for above code if compiler error then what kind error message.. Right answer is C.E
Then followup question : how we can initialise instance variable as they created?Ans: Using constructor.

2. Method hiding in parent chiled relationship.
3. Explain output and flow of below code
public class ClazzA {
    static {
        System.out.println("Static from A");
    }
   
    public ClazzA() {
        System.out.println("Constructor from A");
    }

    public void m1() {
        System.out.println("m1() from A");
       
    }

}

public class ClazzB extends ClazzA {
    static {
        System.out.println("Static from B");
    }
   
    public ClazzB() {
        System.out.println("Constructor from B");
    }

    @Override
    public void m1() {
        System.out.println("m1() from B");
       
    }
}

public class InheritanceFlowDemo {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        ClazzA a = new ClazzA();       
        ClazzA b = new ClazzB();
        a.m1();
        b.m1();
       

    }

}


4. Design Coffiee Vendor Machine. Rest API and resources etc.
How to handle exceptions.


====================
F2F 2.
1. How good you are in multithreading. Explain and write code to demonstrate the the use of join().
2. If a class implements an interface( has methods a,b) then can we write like

Interface i = new Clazz().
i.c();//c is not present in the interface what added in the class Clazz.
Full code for above question:
interface InterfaceA {
foo();
}
public class ClassA implements InterfaceA {

    @Override
    public void foo() {
        // TODO Auto-generated method stub
    }
    //Below is not present in the interface
    public void bar() {
        System.out.println("bar");
    }

    public static void main(String[]args) {
        InterfaceA ia = new ClassA();
        ia.bar();//Right Answer is C.E i.e code will not compile
    }
   

}

3. Why we should create Referece of Interface at the left hand side.
4. Spring Bean life cycle.

5. Design Restaurent application. Identify Rest APIs, Resources and questions based on the implementations.
6. What you will use between ArrayList and LinkedList with respect to q5.

======
F2F 3: Manager Round
1. Project description and general discussion.No technical.




F2F 4:
Javascript Promises- example on race, all etc,, ES6 arrow function.
Some problem on callback array loop

F2F 5:
HTTPClient, gave a code snippet on callback and told me to solve using promise.
some basic css questions

Round 6: With architect, telephonic interview.
Binary tree algorithm problem on hackerrank platform
Gave a binary tree and told me to convert it to string without using JSON.stringify and convert it back to binary tree.
I tried to do using traverse method but couldn’t complete in 45 min.

https://www.geeksforgeeks.org/vmware-interview-experience-set-13-staff-engineer-ui/


=============DS Questions===========
1. Delet/Print nth node from the last in sigly liniked list . 

---------------------------------

VM Ware

DS: Tech1
1. separate 0 and 1 in O(n).
2. Check whether given string  is rotated of another given string in O(n)
INDIAN,
ANINDI ==> something like that.
 
Java Questions: Tech 3
1. How to write immutable class.
2. Use of synchronised keyword.
3. Shuffle a deck of cards in List without using  Collections.shuffle().

4. How to design A System to generate tiny url.

Manage Round; Round 4
1. Project description.
2. Question related to current project.
3. How to do Performance testing(Memory) in the Browser(client side)
4. What are engines used in Chrome and Safari.
5. What is the current release of JDK.
6. Current release of Angularjs 2.==> 6 is the stable release.
7. What is the Swapping and Threshold in linux. Its related to Memory management in OS.
8. Why you are looking for change?


 
Round-1 Telephonic- Pair coding
Need to write working code on a shared document so that the interviewer can see if you can put your ideas into code
1) Given BST, find the pairs whose sum is equal to given number
2) Binary search.
Other basic algo questions i forgot.

Round-2 F2F Interview
I was interviewed for vcloud team so they asked me below questions
1) What is cloud ? Why cloud ? Advantages of cloud ? Challenges in cloud ?
2) My project
Then started on algos
3) Reverse every k nodes in linked list
Write working code
4) Reverse the elements in stack-inplace. No extra memory should be used.
I wrote iterative solution code but interviewer asked me to write recursive solution
 
 
 
1st Round:
1) Write a program to Reverse a number in Java without using builtin methods.
2) Write a program to Reverse a String in Java without using builtin methods.
3) He combined the above questions such that, no matter what we provide string or an integer or a double, the program should reverse it. Basically He was expecting method overloading concept.
4) A puzzle. You will be given with a 3 Litre container & a 7 Litre Container. Measure exactly 5 Litres of water.
5) Reverse a linked list.
6) Asked about one of my projects I mentioned in my resume.

2nd Round:
1) Detailed discussion about all my projects that I mentioned in my resume.
2) Find the common elements from 3 Lists.
3) Some questions on Object Oriented Programming Concepts.
4) Some Questions on Multi-Threading.
5) Asked in detail about ‘volatile’ variables.

3rd Round:
1) Which protocol is used by telnet?
2) Difference between telnet and ssh
3) What happens when we open a file using one tab and delete it from the other tab of the terminal
4) Some questions from Software development life cylce.
5) Basics about Virtualization & Hyperwisers.
6) Explain Cloud computing in layman’s language. (Thanks to Balaji Vishwanthan for an amazing answer for a similar question Quora) 😛 😛
 
 
 1. Search a element in a cyclic sorted array .
2.The first HackerRank challenge I had was an abstract design problem where I was told, within 90 minutes,
to write a function that detects whether a robot loops within a trajectory passed as an arbitrary commands string that controls the movement of the robot.
(e.g. GRGRGL where L stands for turn left, R for turn right and G for go one step)

-============================

Philips

Phillipse heackerearth:
1. Given a string (1-9) size N split it into groups such that each group has index started ...

Now find all possble number using all groups..
Sort the valid numbers and then find the Kth number.

2. Reduce the array size to last element such that
a[i] = [i] + [i+1]//transform until 1 element

example
1,2,3

O/p
8

Solution
1,2,3
3,5
8


=====================================

SAP -Ariba

First two rounds were completely Algorithm .

Below were te questions asked :
1st panel [ this guy had a big attitude to show to candidates]:
When i told him i am working on webservices , he asked me what do i know about Mtom .
How will you send a big binary file as a webservice call .
what is the maximum possible size of a file on a system .
Later when i told him we used ssl , following were the questions asked:
Explain the process of signing a certificate by any CA .


Later he started with algorithm :

What is arraylist . write a program simulating arraylist . I wrote the program what i have seen in jdk  library .
Later he wanted me not to use any temporary array while add operation .
What is a circular linked list .
How do find the circular link in the list [where tail points to head] .
What is the complexity of algorithm .

Panel 2 [ cool guy ]:
Write a program which returns first non repeating char from a string"google" . Very easy . Later he aske me to optimize the algo to search first non repeating char .
Write the code so that you can find find the first non repeating char in single traversal and without storing the counter in temp variable . What  is the complexity of the algoritm.
Consider array [-1,-2,-1,0,4,6,2,1,3] . Now write an algo to find the pair of all possible values which on adding returns the number  2 and later try to optimize the search algo .

Later HR told me that there panel found some area where i have to improve .
I asked HR about the process of interview as job description asked for strong OOPS and Java knowledge .
This is waht he told me:

Ariba has three kind of interview rounds .
1. Algorithm and data structure [can be any number of rounds ].
2. Database , performance tuning.
3. Design and architecture
4. java language coding skills .
5. Hiring manager round .
6. One more management round .



Three years before when i went for interview in Ariba , below is what happened .
Panel 1.
Diffrence between overriding and overloading . He was trying to change the code many times to confuse .

What is your understanding about entity beans and CMT .[ that time my resume was not having EJB in it , which i have to tell him explicitely.]
Ultimate question : what is the defference between jre running on windows and one running on unix.
What tweek can be done to make the win jre to run on unix .[ :( ]

Later i was asked to wait for a long time , and when i did nt got any response i walked away .
============================Interview @SAP===========
1. Finding connected cells in a 2d array.
https://stackoverflow.com/questions/11253027/algorithm-to-find-the-total-number-of-connected-sets-in-a-matrix
2. Desgin a data structure for below operations which works on o(1)  i.e constants time complexity.
-add(E)
-delete(E)
-getRandom()==> This is what we need to think more. For this operation we need to return element based on random number but time complexity should be constants.


3rd round java
1. Write a java program in which two threads print even odd numbers.
2. Design patters==> How to implement Adaptor pattern.
=======================================

======================================================

Sapience

First two rounds were completely Algorithm .

Below were te questions asked :
1st panel [ this guy had a big attitude to show to candidates]:
When i told him i am working on webservices , he asked me what do i know about Mtom .
How will you send a big binary file as a webservice call .
what is the maximum possible size of a file on a system .
Later when i told him we used ssl , following were the questions asked:
Explain the process of signing a certificate by any CA .


Later he started with algorithm :

What is arraylist . write a program simulating arraylist . I wrote the program what i have seen in jdk  library .
Later he wanted me not to use any temporary array while add operation .
What is a circular linked list .
How do find the circular link in the list [where tail points to head] .
What is the complexity of algorithm .

Panel 2 [ cool guy ]:
Write a program which returns first non repeating char from a string"google" . Very easy . Later he aske me to optimize the algo to search first non repeating char .
Write the code so that you can find find the first non repeating char in single traversal and without storing the counter in temp variable . What  is the complexity of the algoritm.
Consider array [-1,-2,-1,0,4,6,2,1,3] . Now write an algo to find the pair of all possible values which on adding returns the number  2 and later try to optimize the search algo .

Later HR told me that there panel found some area where i have to improve .
I asked HR about the process of interview as job description asked for strong OOPS and Java knowledge .
This is waht he told me:

Ariba has three kind of interview rounds .
1. Algorithm and data structure [can be any number of rounds ].
2. Database , performance tuning.
3. Design and architecture
4. java language coding skills .
5. Hiring manager round .
6. One more management round .



Three years before when i went for interview in Ariba , below is what happened .
Panel 1.
Diffrence between overriding and overloading . He was trying to change the code many times to confuse .

What is your understanding about entity beans and CMT .[ that time my resume was not having EJB in it , which i have to tell him explicitely.]
Ultimate question : what is the defference between jre running on windows and one running on unix.
What tweek can be done to make the win jre to run on unix .[ :( ]

Later i was asked to wait for a long time , and when i did nt got any response i walked away .
============================Interview @SAP===========
1. Finding connected cells in a 2d array.
https://stackoverflow.com/questions/11253027/algorithm-to-find-the-total-number-of-connected-sets-in-a-matrix
2. Desgin a data structure for below operations which works on o(1)  i.e constants time complexity.
-add(E)
-delete(E)
-getRandom()==> This is what we need to think more. For this operation we need to return element based on random number but time complexity should be constants.


3rd round java
1. Write a java program in which two threads print even odd numbers.
2. Design patters==> How to implement Adaptor pattern.
=======================================

=========================================================


=============DS Questions Vmware===========
1. Search a element in a cyclic sorted array . 
2.The first HackerRank challenge I had was an abstract design problem where I was told, within 90 minutes,
to write a function that detects whether a robot loops within a trajectory passed as an arbitrary commands string that controls the movement of the robot.
(e.g. GRGRGL where L stands for turn left, R for turn right and G for go one step)


Rewards360==Satessh
1. First occurence of non repeating character in Strings.
2. String with 01 and replce 0-->01 and 1--->11 or compbination of 10 to n times and then find char at kth index.

Sapeinse
1. Remove duplicate and sort in desc

MoveinSync
1.Arrays question : rain water (available on gfg), merge sort,
2. Tree questions : dfs, bfs , other traversal , zigzag traversal 
3. Coin exchange problem
4. Inorder successor in a binary tree.