Wissen Infotech Interview Questions – Set 2
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.
-
What is the difference between
notify()
andnotifyAll()
? (Answer) - How can we stop a thread in Java? (Answer)
- What do you know about InterruptedException? Name some of the java methods which throws it?
- What is CountDownLatch and when to use it? What happens if count will never become zero?
-
Implement custom
CountDownLatch
usingwait()
,notify()
orjoin()
method. -
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
-
What is the difference between
synchronized
keyword andReentrantLock
? -
Implement Custom
ReentrantLock
. -
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 🙂
If you like the content on CodePumpkin and if you wish to do something for the community and the planet Earth, you can donate to our campaign for planting more trees at CodePumpkin Cauvery Calling Campaign.
We may not get time to plant a tree, but we can definitely donate ₹42 per Tree.
About the Author
Tags: Core Java, Java, Multithreading, Synchronization, Thread
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.