0% found this document useful (0 votes)
3 views

Trainee developer

This document contains a comprehensive list of interview questions for a Trainee Developer role, covering topics in Core Java, Advanced Java, SQL, and data structures. It includes questions on Java fundamentals, object-oriented programming, exception handling, collections, multithreading, servlets, JDBC, Java 8 features, and SQL commands. Additionally, it features behavioral questions and practical coding tasks to evaluate candidates' theoretical knowledge and problem-solving skills.

Uploaded by

Sapna Madhavai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Trainee developer

This document contains a comprehensive list of interview questions for a Trainee Developer role, covering topics in Core Java, Advanced Java, SQL, and data structures. It includes questions on Java fundamentals, object-oriented programming, exception handling, collections, multithreading, servlets, JDBC, Java 8 features, and SQL commands. Additionally, it features behavioral questions and practical coding tasks to evaluate candidates' theoretical knowledge and problem-solving skills.

Uploaded by

Sapna Madhavai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Here’s a curated list of interview questions for a Trainee Developer role based on Core Java,

Advanced Java, and SQL:

Core Java Questions

Basics of Java

1. What are the key features of Java?

2. Explain the difference between JDK, JRE, and JVM.

3. What is the difference between == and equals() in Java?

4. What are access modifiers in Java?

5. What is the use of the final keyword in Java?

6. Explain the concept of constructors in Java.

7. What is the difference between method overloading and method overriding?

8. What are static variables and methods? When should you use them?

9. What is the difference between an abstract class and an interface?

10. What is the purpose of the this and super keywords?

11. How does Java achieve platform independence?

12. What is a constructor? Can it be overridden?

• What is the difference between Stack and Heap memory?


• Explain garbage collection in Java and the role of the finalize() method.
1. • What are strong, weak, soft, and phantom references?

Object-Oriented Programming (OOP)

11. Explain the four pillars of OOP: encapsulation, inheritance, polymorphism, and abstraction.

12. What is a class and an object? How are they related?

13. What is the difference between aggregation, composition, and inheritance?

14. How does Java implement polymorphism?

15. What is the significance of the toString() method in Java?

Exception Handling

16. What is exception handling, and why is it important?

17. What is the difference between checked and unchecked exceptions?

18. Explain the try-catch-finally block with an example.

19. What is the purpose of the throw and throws keywords?

20. Can we have multiple catch blocks for a single try block? Explain.
Collections Framework

21. What are the main interfaces in the Java Collections Framework?

22. What is the difference between a List, Set, and Map?

23. Explain the difference between ArrayList and LinkedList.

24. What is the difference between HashMap and Hashtable?

25. What is the significance of Iterator and ListIterator?

26. What is the purpose of the StringBuilder and StringBuffer classes?

Multithreading and Concurrency

26. What is multithreading in Java?

27. How does the synchronized keyword work?

28. What is the difference between Thread class and Runnable interface?

29. What is the difference between synchronized and volatile keywords?

30. What is a deadlock, and how can it be avoided?

31. How do you create a thread in Java? Which is better, Runnable or extending Thread?

32. What is a thread? How is it different from a process?

33. What is the purpose of the volatile keyword?

Advanced Java Questions

Servlets

1. What are servlets in Java?

2. Explain the lifecycle of a servlet.

3. What is the difference between GET and POST methods in HTTP?

4. What is the use of the doGet() and doPost() methods in servlets?

5. How is session tracking achieved in servlets?

6. How do you handle sessions in servlets?

JSP (Java Server Pages)

6. What is JSP, and how is it different from servlets?

7. What are JSP directives? How is data shared between JSP pages?
8. What are JSP directives? Explain include and page.

9. Explain the difference between include directive and include action in JSP.

10. What is the purpose of JSP implicit objects?

11. What are custom tags in JSP?

JDBC (Java Database Connectivity)

11. What is JDBC, and why is it used?

12. Explain the steps to connect to a database using JDBC.

13. What is the difference between Statement and PreparedStatement?

14. How does batch processing work in JDBC?

15. What is the role of the ResultSet interface in JDBC?

16. What is the role of a web server and an application server in Java EE?

Java 8 Features

1. Functional Programming:

o What are functional interfaces? Name some examples.

o Explain the concept of lambda expressions. Provide a basic example.

o What is a default method in interfaces? Why was it introduced?

2. Streams API:

o What are streams in Java 8? How are they different from collections?

o Explain the difference between map() and flatMap().

o What are terminal and intermediate operations in streams?

3. Optional Class:

o What is the purpose of the Optional class in Java 8?

o How can you avoid NullPointerException using Optional?

4. Date and Time API:

o What are the advantages of the new java.time package over java.util.Date?

o How do you parse and format dates in Java 8?

1. Data Structures

1. Array:

▪ How is an array stored in memory? How do you access its elements?


▪ Write a program to find the second-largest element in an array.

2. Linked List:

▪ Explain the differences between a singly and a doubly linked list.

▪ How would you reverse a linked list?

3. Stack and Queue:

▪ What is the difference between a stack and a queue? Explain their


applications.

▪ Write a program to implement a stack using arrays.

4. Trees and Graphs:

▪ What is a binary tree? How is it different from a binary search tree?

▪ Explain depth-first search (DFS) and breadth-first search (BFS).

5. Sorting and Searching:

▪ What is the difference between linear search and binary search?

▪ Explain the time complexity of bubble sort, selection sort, and quicksort.

Frameworks and APIs

16. What is the purpose of Hibernate, and how does it simplify database interaction?

17. What is the Spring Framework, and why is it popular?

18. What is dependency injection in Spring?

19. How does the MVC (Model-View-Controller) architecture work in Spring?

20. What is RESTful web services?

SQL Questions

Basics of SQL

1. What is SQL, and why is it used?

2. What are the different types of SQL commands (DDL, DML, DCL, TCL)?

3. What is the difference between DELETE, TRUNCATE, and DROP?

4. What are primary key and foreign key?

5. Write a query to find the highest salary in a table.

6. What is the difference between WHERE and HAVING clauses?


Queries and Joins

6. Write a query to fetch the second-highest salary from an employee table.

7. Explain the different types of SQL joins (INNER, LEFT, RIGHT, FULL).

8. What is a self-join? Provide an example.

9. What is the difference between UNION and UNION ALL?

10. Write a query to find duplicate records in a table.

Functions and Operators

11. What are aggregate functions in SQL? Provide examples.

12. What is the difference between COUNT(*) and COUNT(column_name)?

13. What is a subquery, and how is it different from a join?

14. What are window functions in SQL?

15. What is the purpose of the LIKE operator?

• What is an index? How does it improve query performance?


11. • What are the differences between clustered and non-clustered indexes?

12.
1. Write a query to find duplicate records in a table.
2. Explain the difference between DELETE and TRUNCATE.
3. How do you write a subquery in SQL?
13.

Database Design

16. What is normalization, and why is it important?

17. Explain the different normal forms (1NF, 2NF, 3NF).

18. What is denormalization? When should it be used?

19. What are indexes in SQL? What is the difference between clustered and non-clustered
indexes?

20. What are views in SQL? How are they different from tables?

Behavioral/Scenario-Based Questions

1. How would you debug a NullPointerException in a Java program?

2. Explain a time when you optimized an SQL query for better performance.

3. How would you handle a situation where your code is failing in production?

4. What steps would you take to troubleshoot a database connectivity issue in Java?

5. How would you approach designing a database schema for a library management system?
Sample Practical Questions

1. Java Coding:

o Write a program to check if a string is a palindrome.

o Implement a program to sort an array using quicksort.

2. SQL Query:

o Write a query to fetch the top 3 highest salaries from a table.

o Write a query to calculate the total sales by each salesperson.

3. Data Structures:

o Write a program to implement a queue using two stacks.

o Create a program to detect a cycle in a linked list.

Here’s an additional section focusing on Strings in Java for your interview questions:

Core Java: Strings

1. Basics:

o What is the difference between String, StringBuilder, and StringBuffer?

o Why are strings immutable in Java?

o How is the String pool managed in Java?

2. Common Operations:

o How can you concatenate two strings in Java? Which is more efficient: +, concat(), or
StringBuilder?

o Write a program to count the number of occurrences of a character in a string.

o How do you check if two strings are anagrams of each other?

3. String Methods:

o What is the purpose of the substring() method? How does it work?

o How does the split() method work? Provide an example.

o What is the difference between toUpperCase() and toLowerCase()?

4. String Comparisons:

o What is the difference between equals(), equalsIgnoreCase(), and compareTo()?

o Why is it not recommended to use == for string comparison?


5. Pattern Matching:

o How do you find whether a string contains a specific substring?

o Explain the use of the matches() method with a regular expression.

6. Advanced Concepts:

o Explain the difference between mutable and immutable objects with reference to
strings.

o How does the intern() method work in strings?

7. Practical Coding Questions:

o Write a program to reverse a string without using any built-in methods.

o Write a program to find all duplicate characters in a string.

o Implement a program to check if a string is a palindrome.

o Write a program to count the number of vowels and consonants in a string.

o Write a program to remove all occurrences of a given character from a string.

Java 8: Strings and Functional Programming

1. Streams and Strings:

o How can you use Java 8 Streams to count the frequency of characters in a string?

o Write a Java 8 program to reverse a string using Streams.

2. Lambdas and Strings:

o Write a program to filter and print strings with more than five characters from a list
using lambdas.

o Use a lambda function to convert a list of strings to uppercase.

3. Optional:

o How can you use Optional to handle null strings safely?

These questions provide a mix of theory and hands-on tasks to assess a candidate’s understanding of
string operations and practical problem-solving skills.

You might also like