480 Core Java Interview Questions (Part 4)

This guide having 480 Core Java interview questions will help you in revising most asked core java interview questions for both junior and senior developers.

480 Core Java Interview Questions (Part 3)

301.Which intrinsic lock is acquired by a synchronized method in Java?
302.Can we mark a constructor as synchronized in Java?
303.Can we use primitive values for intrinsic locks?
304.Do we have re-entrant property in intrinsic locks?
305.What is an atomic operation?
306.Can we consider the statement i++ as an atomic operation in Java?
307.What are the Atomic operations in Java?
308.Can you check if following code is thread-safe?
309.What are the minimum requirements for a Deadlock situation in a
program?
310.How can we prevent a Deadlock?
311. How can we detect a Deadlock situation?312.What is a Livelock?
313.What is Thread starvation?
314.How can a synchronized block cause Thread starvation in Java?
315.What is a Race condition?
316.What is a Fair lock in multi-threading?
317.Which two methods of Object class can be used to implement a
Producer Consumer scenario?
318.How JVM determines which thread should wake up on notify()?
319.Check if following code is thread-safe for retrieving an integer value
from a Queue?
320.How can we check if a thread has a monitor lock on a given object?
321.What is the use of yield() method in Thread class?
322.What is an important point to consider while passing an object from
one thread to another thread?
323.What are the rules for creating Immutable Objects?
324.What is the use of ThreadLocal class?
325.What are the scenarios suitable for using ThreadLocal class?
326.How will you improve the performance of an application by multithreading?
327.What is scalability in a Software program?
328.How will you calculate the maximum speed up of an application by
using multiple processors?
329.What is Lock contention in multi-threading?
330.What are the techniques to reduce Lock contention?331.What technique can be used in following code to reduce Lock
contention?
332.What is Lock splitting technique?
333.Which technique is used in ReadWriteLock class for reducing Lock
contention?
334.What is Lock striping?
335.What is a CAS operation?
336.Which Java classes use CAS operation?
337.Is it always possible to improve performance by object pooling in a
multi-threading application?
338.How can techniques used for performance improvement in a single
thread application may degrade the performance in a multi-threading
application?
339.What is the relation between Executor and ExecutorService
interface?
340.What will happen on calling submit() method of an ExecutorService
instance whose queue is already full?
341.What is a ScheduledExecutorService?
342.How will you create a Thread pool in Java?
343.What is the main difference between Runnable and Callable
interface?
344.What are the uses of Future interface in Java?
345.What is the difference in concurrency in HashMap and in Hashtable?
346.How will you create synchronized instance of List or Map Collection?
347.What is a Semaphore in Java?348.What is a CountDownLatch in Java?
349.What is the difference between CountDownLatch and CyclicBarrier?
350.What are the scenarios suitable for using Fork/Join framework?
351.What is the difference between RecursiveTask and RecursiveAction
class?
352.In Java 8, can we process stream operations with a Thread pool?
353.What are the scenarios to use parallel stream in Java 8?
354.How Stack and Heap work in Java multi-threading environment?
355.How can we take Thread dump in Java?
356.Which parameter can be used to control stack size of a thread in
Java?
357.There are two threads T1 and T2? How will you ensure that these
threads run in sequence T1, T2 in Java?
Java 8
358.What are the new features released in Java 8?
359.What are the main benefits of new features introduced in Java 8?
360.What is a Lambda expression in Java 8?
361.What are the three main parts of a Lambda expression in Java?
362.What is the data type of a Lambda expression?
363.What is the meaning of following lambda expression?
364.Why did Oracle release a new version of Java like Java 8?
365.What are the advantages of a lambda expression?
366.What is a Functional interface in Java 8?367.What is a Single Abstract Method (SAM) interface in Java 8?
368.How can we define a Functional interface in Java 8?
369.Why do we need Functional interface in Java?
370.Is it mandatory to use @FunctionalInterface annotation to define a
Functional interface in Java 8?
371.What are the differences between Collection and Stream API in Java
8?
372.What are the main uses of Stream API in Java 8?
373.What are the differences between Intermediate and Terminal
Operations in Java 8 Streams?
374.What is a Spliterator in Java 8?
375.What are the differences between Iterator and Spliterator in Java 8?
376.What is Type Inference in Java 8?
377.Does Java 7 support Type Inference?
378.How does Internal Iteration work in Java 8?
379.What are the main differences between Internal and External
Iterator?
380.What are the main advantages of Internal Iterator over External
Iterator in Java 8?
381.What are the applications in which we should use Internal Iteration?
382.What is the main disadvantage of Internal Iteration over External
Iteration?
383.Can we provide implementation of a method in a Java Interface?
384.What is a Default Method in an Interface?385.Why do we need Default method in a Java 8 Interface?
386.What is the purpose of a Static method in an Interface in Java 8?
387.What are the core ideas behind the Date/Time API of Java 8?
388.What are the advantages of new Date and Time API in Java 8 over
old Date API?
389.What are the main differences between legacy Date/Time API in Java
and Date/Time API of Java 8?
390.How can we get duration between two dates or time in Java 8?
391.What is the new method family introduced in Java 8 for processing of
Arrays on multi core machines?
392.How does Java 8 solve Diamond problem of Multiple Inheritance?
393.What are the differences between Predicate, Supplier and Consumer
in Java 8?
394.Is it possible to have default method definition in an interface without
marking it with default keyword?
395.Can we create a class that implements two Interfaces with default
methods of same name and signature?
396.How Java 8 supports Multiple Inheritance?
397.In case we create a class that extends a base class and implements an
interface. If both base class and interface have a default method with
same name and arguments, then which definition will be picked by JVM?
398.If we create same method and define it in a class , in its parent class
and in an interface implemented by the class, then definition will be
invoked if we access it using the reference of Interface and the object of
class?
399.Can we access a static method of an interface by using reference ofthe interface?
400.How can you get the name of Parameter in Java by using reflection?

Continue with 480 Core Java Interview Questions (Part 5)

Leave a Comment

*

Please share it if you found this useful
Hide Buttons