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

Java Semester Final Exam Questions (3)

Uploaded by

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

Java Semester Final Exam Questions (3)

Uploaded by

vtu21739
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Java Semester Final Exam Questions

2-Mark Questions

Unit I: Object-Oriented Programming


1. Define Object-Oriented Programming (OOP).
2. What are tokens in Java? Give examples.
3. Explain the difference between literals and variables in Java.
4. What is type casting in Java?
5. What is the purpose of the ternary operator in Java? Provide an example.

Unit II: Classes and Objects


6. Define a class and an object in Java.
7. What is a constructor? Why is it used?
8. Differentiate between method overloading and method overriding.
9. What is the purpose of the "this" keyword in Java?
10. Explain the concept of encapsulation.

Unit III: Arrays and Inheritance


11. How is an array declared and initialized in Java?
12. Define inheritance and explain its advantages.
13. What is the "super" keyword in Java used for?
14. Differentiate between single inheritance and multilevel inheritance.
15. What is a polymorphic reference in Java?

Unit IV: Packages and Exception Handling


16. What is a package in Java, and why is it used?
17. Differentiate between checked and unchecked exceptions.
18. What is the purpose of the `finally` block in exception handling?
19. Explain auto-boxing and unboxing in Java.
20. What is the role of the "throw" and "throws" keywords?

Unit V: Advanced Topics


21. What is the purpose of the `StringBuilder` class in Java?
22. Differentiate between threads and processes.
23. How is a thread created using the `Thread` class?
24. What is the significance of the "synchronized" keyword in Java?
25. Define deadlock in multithreading.

General Programming
26. What is the difference between static and non-static methods in Java?
27. What is the output of `System.out.println(10 + "20");`?
28. How are mouse events handled in JavaFX?
29. Explain thread priority in Java.
30. What is the difference between String and StringBuffer classes?

10-Mark Questions

Unit I: Object-Oriented Programming


31. Explain the structure of a Java program with an example.
32. Discuss various data types in Java and their memory allocation.
33. Write a program to demonstrate the use of control statements like `if-else` and `switch`.

Unit II: Classes and Objects


34. Explain the concept of constructors and their types with examples.
35. Write a Java program to demonstrate method overloading and overriding.
36. Discuss access modifiers in Java with examples.

Unit III: Arrays and Inheritance


37. Write a program to sort elements of an array in ascending order.
38. Explain dynamic method dispatch with an example program.
39. Write a program to demonstrate the use of abstract classes and interfaces.

Unit IV: Packages and Exception Handling


40. Explain the process of creating and using packages in Java with examples.
41. Write a program to handle multiple exceptions using try-catch blocks.
42. Discuss the hierarchy of exception classes in Java.

Unit V: Advanced Topics


43. Write a program to demonstrate string handling methods in Java.
44. Explain the life cycle of a thread with an example.
45. Write a program to create multiple threads and synchronize them.

Miscellaneous
46. Write a Java program to calculate the factorial of a number using recursion.
47. Compare and contrast while, do-while, and for loops with examples.
48. Discuss the advantages and disadvantages of Object-Oriented Programming compared
to procedural programming.
49. Explain inter-thread communication in Java with an example program.
50. Write a program to demonstrate the event handling mechanism in JavaFX.

Combined Questions from All Units


2-Mark Questions:

1. Define Object-Oriented Programming (OOP) principles.


2. What are tokens in Java? Provide examples.
3. Differentiate between literals and variables in Java.
4. What is the ternary operator? Give an example.
5. Define inheritance and its advantages.
6. What is the role of escape sequences in Java? Provide examples.
7. Explain method overloading with an example.
8. What is a package in Java? Why is it used?
9. Differentiate between threads and processes.
10. What is the purpose of the "StringBuilder" class?
11. How is a class imported from a package?
12. Define encapsulation. Why is it important?
13. What is the difference between String and StringBuffer classes?
14. How is a two-dimensional array initialized in Java?
15. What is the role of the "finally" block in exception handling?

10-Mark Questions:

1. Explain the structure of a Java program with an example.


2. Discuss various data types in Java and their memory allocation.
3. Write a program to demonstrate the use of control statements (if-else, switch,
loops).
4. Explain the concept of constructors and their types with examples.
5. Write a program to demonstrate method overloading and method overriding.
6. Discuss method overriding with a program.
7. Write a program to sort elements of an array in ascending order.
8. Explain the process of creating and using packages in Java with examples.
9. Write a program to handle multiple exceptions using try-catch blocks.
10. Explain the life cycle of a thread with examples.
11. Write a program to create multiple threads and synchronize them.
12. Explain inter-thread communication in Java with a program.
13. Write a program to demonstrate reading and writing text files using
BufferedReader and BufferedWriter.
14. Discuss the main components of a JavaFX application.
15. Write a JavaFX program to create a simple graphical user interface (GUI).

You might also like