Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 5 subjective questions I/O Fundamentals, Generics, and Multithreading

CSE310 — Programming In Java 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    Differentiate between Byte Streams and Character Streams in Java I/O.

  2. Question 2 of 20

    Explain the hierarchy of Java I/O Streams.

  3. Question 3 of 20

    What is Object Serialization and Deserialization? Write a code snippet to demonstrate writing an object to a file.

  4. Question 4 of 20

    Explain the significance of the transient keyword in Java Serialization.

  5. Question 5 of 20

    Discuss the Try-with-resources statement. How does it improve I/O exception handling?

  6. Question 6 of 20

    Define Generics in Java. What are the main advantages of using Generics?

  7. Question 7 of 20

    Create a custom Generic class named Box that can store an object of any type T. Include methods to set and get the object.

  8. Question 8 of 20

    Explain Bounded Types in Generics. How do you restrict a Generic type to accept only numbers?

  9. Question 9 of 20

    What are Wildcards in Java Generics? Explain the difference between Upper Bounded, Lower Bounded, and Unbounded wildcards.

  10. Question 10 of 20

    Describe the Lifecycle of a Thread in Java. What are the various states a thread can be in?

  11. Question 11 of 20

    Compare implementing the Runnable interface versus extending the Thread class for creating threads.

  12. Question 12 of 20

    Explain the concept of Thread Synchronization. Why is it necessary?

  13. Question 13 of 20

    How is Inter-thread Communication achieved in Java? Explain wait(), notify(), and notifyAll().

  14. Question 14 of 20

    What are Thread Priorities? How can we set and get the priority of a thread in Java?

  15. Question 15 of 20

    Write a Java program to create two threads: one printing even numbers and the other printing odd numbers up to 10.

  16. Question 16 of 20

    What is the Type Inference Diamond <> operator introduced in Java 7? Give an example.

  17. Question 17 of 20

    Explain the difference between join() and yield() methods in the Thread class.

  18. Question 18 of 20

    What is a Deadlock? Describe a scenario where a deadlock might occur in Java.

  19. Question 19 of 20

    Explain the purpose of the File class in java.io. It is a stream?

  20. Question 20 of 20

    What is Type Erasure? How does it affect Generic code at runtime?

That's unit 5

Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.