Code Pumpkin

Wissen Infotech Interview Questions – Set 2

July 19, 2018
Posted by Rahul Chudasama

I have appeared for Senior Java Developer Position at Wissen Infotech and It was my 3rd round. Interviewer mainly focused on Multithreading. He started with basic multithreading questions and moved to internals of Concurrent Utils. Here I am listing down some of the interesting questions he asked.

  1. What is the difference between notify() and notifyAll()? (Answer)
  2. How can we stop a thread in Java? (Answer)
  3. What do you know about InterruptedException? Name some of the java methods which throws it?
  4. What is CountDownLatch and when to use it? What happens if count will never become zero?
  5. Implement custom CountDownLatch  using wait(), notify() or join() method.
  6. Write a program to print 1 to 12 numbers in sequence using four threads T1, T2, T3, T4
        i.e. T1 will print -> 1, 5 and 9
               T2 will print -> 2, 6 and 10
               T3 will print -> 3, 7 and 11
               T4 will print -> 4, 8 and 12
    Final Output should be :

    
    T1 : 1
    T2 : 2
    T3 : 3
    T4 : 4
    T1 : 5
    T2 : 6
    T3 : 7 
    T4 : 8
    T1 : 9
    T2 : 10
    T3 : 11
    T4 : 12
    
  7. What is the difference between synchronized keyword and ReentrantLock?
  8. Implement Custom ReentrantLock.
  9. Write a code for below mention scenario
        – We have a list of threads.
        – Each thread returns a integer number before completing execution or throws an exception.
        – Our requirement is to get sum of all these integer numbers.
        – Also store the details of thread which had thrown exception.

 
 

That's all for this topic. If you guys have any suggestions or queries, feel free to drop a comment. We would be happy to add that in our post. You can also contribute your articles by creating contributor account here.

Happy Learning 🙂



About the Author





Tags: , , , ,


Comments and Queries

If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code class="java"> 
String foo = "bar";
</code></pre>
For more information on supported HTML tags in disqus comment, click here.
Total Posts : 112
follow us in feedly
Contribute Your Articles

Subscribe Us

Like Us On Facebook