Skip to main content

Posts

Top 20 Java Collections Framework Interview Questions (With Detailed Answers)

  Top 20 Java Collections Framework Interview Questions (With Detailed Answers) Q1. What is the Java Collections Framework? Answer : It’s a unified architecture to manage and manipulate groups of data. It includes interfaces (like List , Set ), classes ( ArrayList , HashMap ) and utility classes ( Collections , Arrays ). It simplifies development and promotes reusability. Q2. Difference between List, Set, and Map? Answer : List : Ordered, allows duplicates Set : No duplicates Map : Key-value pairs Used based on the need for ordering, uniqueness, or key-based access. Q3. Difference between ArrayList and LinkedList? Answer : ArrayList is backed by array, fast read, slow insert/delete. LinkedList is backed by doubly linked nodes, slow read, fast insert/delete. Q4. Difference between HashSet and TreeSet? Answer : HashSet : Unordered, fast operations using hash table TreeSet : Sorted, slower operations using Red-Black Tree Q5. How does HashMap work interna...

Top 20 Java Pattern Programs Asked in Interviews Questions (With Code using for loop & Output)

Top 20 Java Pattern Questions Asked in Interviews Top 20 Java Pattern Questions Asked in Interviews Here are 20 frequently asked Java pattern program questions with their code and expected output. Use them for coding rounds or practice. 1. Right-Angled Triangle * * * * * * * * * * * * * * * for(int i = 1; i <= 5; i++) { for(int j = 1; j <= i; j++) { System.out.print("* "); } System.out.println(); } 2. Inverted Right-Angled Triangle * * * * * * * * * * * * * * * for(int i = 5; i >= 1; i--) { for(int j = 1; j <= i; j++) { System.out.print("* "); } System.out.println(); } 3. Pyramid Pattern * *** ***** ******* ********* for(int i = 1; i <= 5; i++) { for(int j = i; j < 5; j++) System.out.print(" "); for(int k = 1; k <= (2 * i - 1); k++) System.out.print("*"); System.out.println(); } 4. Diamond P...

Wipro Java Developer Interview Questions with Answers (Mid-Level Role)

  Wipro Java Developer Interview Questions with Answers (Mid-Level Role) (Glassdoor Based – May 2024) Interview Location: Bengaluru Interview Mode: Online Candidate Role: Mid-Level Java Developer Source: Based on real experience shared on Glassdoor Review Summary: Easy and conversational. Interviewer was friendly. Focus was mainly on Java basics, internals, and real-world understanding. Q1: What is static in public static void main(String[] args) ? A: The static keyword lets the JVM call the method without creating an object. It indicates that the method belongs to the class, not instances. Q2: Why does a Java program start from the main method? A: main() is the predefined entry point of a Java application. The JVM starts execution from there. Q3: What are Checked and Unchecked Exceptions? With examples. A: Checked Exceptions : Detected at compile time. E.g., IOException , SQLException . Unchecked Exceptions : Detected at runtime. E.g., NullPointerExce...