Anna University - Java Programming - Question Bank (All Units)

Department of IT
IT2301-JAVA PROGRAMMING
Question Bank

UNIT I
PART A
  1. What are the OOP Principles?
  2. What is Encapsulation?
  3. What is Polymorphism?
  4. What is Inheritance?
  5. What are the features of Java Language?
  6. What is the need for Java Language?
  7. What is platform independency?
  8. What is Architecture Neutral?
  9. How Java supports platform independency?
  10. Why Java is important to Internet?
  11. What are the types of programs Java can handle?
  12. What is an applet program?
  13. Compare Application and Applet.
  14. What are the advantages of Java Language?
  15. Give the contents of Java Environment (JDK).
  16. Give any 4 differences between C and Java.
  17. Give any 4 differences between C++ and Java.
  18. What are the different types of comment symbols in Java?
  19. What are the data types supported in Java?
  20.  What is the difference between a char in C/C++ and char in Java?
  21.  How is a constant defined in Java?
  22.  What is the use of final keyword?
  23.  What are the different types of operators used in Java?
  24.  What is short-Circuit operator?
  25. What is labeled break?
  26. What is the use of for each control structure?
  27. What is the need for static variables?
  28. What is the need for static methods?
  29. Compare static constants and final constants.
  30. Why is main method assigned as public?
  31. Why is main method assigned as static?
  32. What are the types of variables Java handles?
  33. What are the relationships between classes?
  34. What is the general form of a class?
  35. What is the use of new keyword?
  36. If ObjA1 is an object of class A created using new keyword, What does the statement A ObjA2=ObjA1;    mean?
  37. What is a constructor?
  38. What is the difference between a constructor and a method?
  39. What is the use of this keyword?
  40. What are destructors?
  41. How is object destruction done in Java?
  42. What is Garbage collection?
  43. What is the use of finalize method?
  44. Compare Garbage collection and finalize method?
  45. How is it guaranteed that finalize methods are called?
  46. What is method overloading?
  47. What is a String in Java?
  48. What is the difference between a String in Java and String in C/C++?
  49. Name a few String methods.
  50. What is the difference between Concat method and + operator to join strings?
  51. What is String Buffer?
  52. How does String class differ from the String Buffer class?
  53. Name some methods available under String Buffer class.
  54. Output of some expressions using String methods.
  55. How will you initialize arrays?
  56. What is arraycopy method? Explain with syntax.
  57. What are the methods under Util.Arrays?
  58. Use the array sort method to sort the given array.
  59. Give the syntax for array fill operation.
  60. What is vector? How is it different from an array?
  61. What is the constraint for using vectors?
  62. What is wrapper class?
  63. What are the different access specifiers available in Java?
  64. What is the default access specifier in Java?
  65. What is a package in Java?
  66. Name some Java API Packages.
  67. Name some JavaDoc Comments.
  68. What is CommandLine Arguments.


Part B
  1. Explain OOP Principles.
  2. Explain the features of Java Language.
  3. Compare and Contrast Java with C.
  4. Compare and Contrast Java with C++.
  5. Explain Constructors with examples.
  6. Explain the methods available under String and String Buffer Class.
  7. Explain the Date Class methods with examples.
  8. Discuss in detail the access specifiers available in Java.
  9. Explain the different visibility controls and also compare with each of them.
  10. Explain the different methods in java.Util.Arrays class with example.
  11. Explain Packages in detail.
  12. Discuss the methods under Array Class.
  13. Discuss some of the classes available under Lang package.
  14. Illustrate with examples: static and final.
  15. Explain method overriding with example program.
  16. What is javaDoc? Explain the comments for classes, methods, fields and link.
  17. Application Programs in Java.

UNIT II
PART A
  1. Define Inheritance
  2. What are the types of inheritance?
  3. How is multiple inheritance achieved in java?
  4. What is the use of super keyword?
  5. What are object wrappers? Give example.
  6. What is Inheritance Hierarchy?
  7. Differentiate overloading and overriding.
  8. Define polymorphism.
  9. Differentiate static binding and dynamic binding.
  10. When will a class be declared as final?
  11. When will a method be declared final?
  12. What is an abstract class?
  13. What is the need for abstract classes?
  14. Explain about protected visibility control.
  15. What are the methods under "object" class / java.lang.Object.
  16. Explain toString method of object class.
  17. What is reflection?
  18. What are the uses of reflection in Java.
  19. How will you create an instance of Class.
  20. What are the methods under reflection used to analyze the capabilities of classes?
  21. How to create arrays dynamically using reflection package.
  22. Define an interface.
  23. What is the need for an interface?
  24. What are the properties of an interface?
  25. Differentiate Abstract classes and interface.
  26. What is object cloning?
  27. Differentiate cloning and copying.
  28. Differentiate shallow copy and deep copy in cloning.
  29. Does Inheritance removes any fields/or methods of super class?
  30. Mention the use of final keyword.
  31. What is nested class? Mention its types.
  32. What is inner class?
  33. What is the need for inner classes?
  34. What are the rules for inner class?
  35. What is local inner class and anonymous inner class? Give their advantages.
  36. Write the advantages and disadvantages of static nested class.
  37. Define proxies.
  38. Write the application of proxies.
  39. What are the properties of proxy classes?


PART B
  1. Explain the concept of inheritance and its types.
  2. Explain the concept of overriding with examples.
  3. What is dynamic binding? Explain with example.
  4. Explain the uses of reflection with examples.
  5. Define an interface. Explain with example.
  6. Explain the methods under “object” class and “class” class.
  7. What is object cloning? Explain deep copy and shallow copy with examples.
  8. Explain static nested class and inner class with examples.
  9. With an example explain proxies.
  10. Develop a message abstract class which contains playMessage abstract method. Write a different sub-classes like TextMessage, VoiceMessage and FaxMessage classes for to implementing the playMessage method.
  11. Develop a abstract Reservation class which has Reserve abstract method. Implement the sub-classes like ReserveTrain and ReserveBus classes and implement the same.
  12. Develop an Interest interface which contains simpleInterest and compInterest methods and static final field of Rate 25%. Write a class to implement those methods.
  13. Develop a Library interface which has drawbook(), returnbook() (with fine), checkstatus() and reservebook() methods. All the methods tagged with public.
  14. Develop an Employee class which implements the Comparable and Cloneable interfaces. Implement the sorting of persons (based on name in alphabetical). Also implement the shallow copy (for name and age) and deep copy (for DateOfJoining). 
  15. Explain the different methods supported in Object class with example.
  16. Explain the methods supported in Class class.
  17. Explain the Methods supported in reflect package. Also write a program to implement the reflection of a particular class details like constructors, methods and fields with its modifiers.
  18. Develop a static Inner class called Pair which has MinMax method for finding min and max values from the array.
  19. What is proxy class? Develop a code for constructing a proxy objects to trace a binary search method with explanations.           

UNIT III
PART A

  1. Draw the inheritance hierarchy for the frame and component classes in AWT and Swing.
  2. What are the advantages of using swing over awt?
  3. How do achieve special fonts for your text? Give example.
  4. Give the syntax of drawImage() and copyArea() methods.
  5. What is Adapter class?
  6. Draw the AWT event Hierarchy.
  7. What are the swing components?
  8. What are the methods under Action Interface.
  9. What are the methods under WindowListener Interface.
  10. What is the difference between Swing and AWT?


PART B

  1. Explain the classes under 2D shapes.
  2. Explain event handling with examples.
  3. Explain action event with an example.
  4. What are the swing components. Explain.
  5. Describe the AWT event hierarchy.



UNIT IV
PART A
  1. What is generic programming?
  2. What are Checked and UnChecked Exception?
  3. What are checked exceptions?
  4. What are runtime exceptions?
  5. What is the difference between error and an exception?
  6. What classes of exceptions may be caught by a catch clause?.
  7. If I want an object of my class to be thrown as an exception object, what should I do?
  8. How to create custom exceptions?
  9. What are the different ways to handle exceptions?
  10. What is the purpose of the finally clause of a try-catch-finally statement?
  11. What is the basic difference between the 2 approaches to exception handling.
  12. Is it necessary that each try block must be followed by a catch block?
  13. How does Java handle integer overflows and underflows?

PART B

  1. Explain generic classes and methods.
  2. Explain exception hierarchy.
  3. What are the advantages of Generic Programming?
  4. Explain the different ways to handle exceptions.
  5. How Java handle overflows and underflows?



UNIT V
PART A

  1. Describe synchronization in respect to multithreading.
  2. Explain different way of using thread?
  3. What is synchronization and why is it important?
  4. When a thread is created and started, what is its initial state?
  5. What are synchronized methods and synchronized statements?
  6. What is daemon thread and which method is used to create the daemon thread?
  7. What method must be implemented by all threads?
  8. What kind of thread is the Garbage collector thread?
  9. What is a daemon thread?
  10. What is a thread?
  11. What is the algorithm used in Thread scheduling?
  12. What are the different level lockings using the synchronization keyword? 
  13. What are the ways in which you can instantiate a thread?
  14. What are the states of a thread?
  15. What are the threads will start, when you start the java program?
  16. What are the different identifier states of a Thread?
  17. Why do threads block on I/O?
  18. What is synchronization and why is it important?


PART B

  1. Explain the different states of a thread.
  2. Explain thread synchronization with examples.
  3. Explain the algorithm used for thread scheduling.
  4. Describe multi threading.
  5. Explain Deadlocks.