0% found this document useful (0 votes)
2 views6 pages

Java Questions 1

The document outlines a comprehensive curriculum on Java programming, covering key concepts such as Java's features, platform independence, object-oriented programming principles, inheritance, exception handling, and file I/O operations. It includes detailed explanations of Java's syntax, data types, and various programming constructs, along with practical examples and comparisons. The content is organized into six units, each addressing fundamental and advanced topics essential for mastering Java.

Uploaded by

babulapubun1356
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Java Questions 1

The document outlines a comprehensive curriculum on Java programming, covering key concepts such as Java's features, platform independence, object-oriented programming principles, inheritance, exception handling, and file I/O operations. It includes detailed explanations of Java's syntax, data types, and various programming constructs, along with practical examples and comparisons. The content is organized into six units, each addressing fundamental and advanced topics essential for mastering Java.

Uploaded by

babulapubun1356
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIT - 1

1. What is Java? Explain its key features.


2. Why is Java called a platform-independent language?
3. What are the advantages of Java compared to other programming languages?
4. What is the difference between Java SE, Java EE, and Java ME?
5. Why is Java known as a portable language?
6. What is Java Virtual Machine (JVM)? Explain its role.
7. What is bytecode in Java? How is it different from machine code?
8. Explain the working of JVM with a diagram.
9. What is the difference between JDK, JRE, and JVM?
10. Explain Java’s naming conventions for classes, variables, and methods.
11. What is the meaning of public, static, void main in main method?
12. What will happen if we remove static from main method? Explain why?
13. What is Procedure-Oriented Programming (POP)?
14. What is Object-Oriented Programming (OOP)? How is it different from POP?
15. What are the key principles of OOP?
16. Advantages of OOP.
17. What is Encapsulation? How it works?
18. Explain Abstraction with an example.
19. What is Inheritance? How does Java implement it?
20. What are subclasses and superclasses? Explain with an example.
21. What is Polymorphism? Differentiate between compile-time and runtime polymorphism.
22. Explain method overloading and method overriding. What are the differences?
23. What is message communication in OOP?
24. What is javac and java command? Explain their usage.
25. Difference between Abstraction and polymorphism.
26. Difference between Encapsulation and data hiding.
27. Difference between Abstraction and Encapsulation.
28. Difference between encapsulation and Polymorphism.
UNIT – 2

1. What are user-defined data types in Java?


2. What is the difference between primitive data types and user-defined data types?
3. What are identifiers in Java? List the rules for naming identifiers.
4. What are literals in Java? Explain different types of literals.
5. How are character literals represented in Java?
6. What is the difference between local, instance, and class variables?
7. What is the final keyword? How does it help in defining constants?
8. Use of this, static and final keyword.
9. What is type conversion in Java? Explain implicit and explicit type conversion.
10. How does automatic (widening) type conversion work? Give an example.
11. What is type casting?
12. What is the difference between implicit conversion and explicit casting?
13. What is variable scope in Java? Explain different scopes with examples.
14. What are wrapper classes in Java? List different wrapper classes.
15. What is autoboxing and unboxing? Explain with examples.
16. What are the advantages of using wrapper classes?
17. Explain different types of comments in Java with examples.
18. What is garbage collection in Java? Why is it important?
19. What are the different types of garbage collectors in Java?
20. How can we request garbage collection in Java?
21. How does Java handle memory allocation for arrays?
22. How do you create and initialize a String in Java?
23. What are the different ways to concatenate strings in Java?
24. How do you convert other data types to strings and vice versa?
25. What is a StringBuffer? How is it different from String?
26. What are bitwise operators? Provide an example.
27. What are relational (comparison) operators? Explain their usage.
28. How do logical operators work in Java?
29. What is the difference between = and == in Java?
30. What is the ternary operator? How is it used in decision-making?
UNIT – 3

1. What is a class in Java? How do you define a class?


2. What are fields (instance variables) and methods in Java?
3. How do you create an object in Java? Explain with an example.
4. What are the different ways to create objects in Java?
5. Explain the rules for accessing class members.
6. What is this, final, static keyword?
7. How does this help in constructor chaining?
8. Can a static method access non-static members? Justify the answer.
9. What is method overloading? Advantages of method overloading.
10. What is the difference between final variables, final methods, and final classes?
11. Can a final method be overridden? Justify the answer.
12. What happens if we declare a final static variable?
13. How does Java ensure compile-time polymorphism using method overloading?
14. What is a constructor in Java? How is it different from a method?
15. What are the different types of constructor? Give example of every types of constructor.
16. Explain the role of the default constructor in object initialization.
17. What is Copy constructor? How it works?
18. What is constructor overloading?
19. Can a constructor be private? If yes, when would we use it?
20. Can we call a constructor inside another constructor? If yes, how?
UNIT – 4

1. What is inheritance in Java? What is the importance?


2. What is the syntax for creating a subclass in Java?
3. What is the extends keyword used for?
4. What are the advantages and limitations of inheritance?
5. How does inheritance support polymorphism?
6. What is single inheritance? Give an example.
7. What is multiple inheritance? Why is it not supported directly in Java?
8. How can multiple inheritance be achieved in Java?
9. What is multilevel inheritance? Provide an example.
10. Explain hierarchical inheritance with a code snippet.
11. What is hybrid inheritance? Can Java support hybrid inheritance?
12. Differentiate between multilevel and multiple inheritance.
13. How does interface-based multiple inheritance work?
14. What issues can arise with multiple inheritance?
15. What is the "Diamond Problem" in inheritance?
16. What is method overriding? What are the rules for method overriding in Java?
17. What is the use of the @Override annotation? What happens if we remove the override annotation?
18. How does the JVM resolve overridden methods?
19. Can a static method be overridden? Why or why not?
20. How do access modifiers affect method overriding?
21. Why is method overriding important in runtime polymorphism?
22. What is a superclass and subclass?
23. What are the advantages of using subclassing?
24. Can a subclass access private members of the superclass?
25. Explain the super() keyword and its uses.
26. How does constructor chaining work in inheritance?
27. What is the use of [Link]?
28. What is dynamic method dispatch? Why it is important?
29. How is dynamic method dispatch different from static binding?
30. What happens if both superclass and subclass have the same method?
31. What are virtual methods in Java?
32. What is the Object class in Java?
33. How is Object class a superclass of all classes?
34. What is the difference between == and equals()?
35. What is clone(), toString(), hashCode() method?
36. What is a package in Java? Syntax of creating a package.
37. What is the default package in Java? What are Java’s built-in packages?
38. What are the access specifiers in Java?
39. What access modifier allows access from any package?
40. How do you restrict class access in packages?
41. What is an interface?
42. How do you define an interface in Java?
43. What is the syntax for creating an interface?
44. Can interfaces have method implementations?
45. What are default and static methods in interfaces?
46. What are marker interfaces?
47. What are functional interfaces?
48. How is an interface different from an abstract class?
49. Can an interface extend a class?
50. Can an interface contain constructors or instance variables?

UNIT – 5

1. What are the different types of errors in Java?


2. What is the difference between a syntax error and a runtime error?
3. What is an exception in Java?
4. What is the difference between an error and an exception?
5. What is the base class for all exceptions?
6. What are checked and unchecked exceptions?
7. What is the use of try block in Java?
8. How does the catch block work?
9. Can a try block exist without a catch block?
10. What happens if no exception occurs in the try block?
11. Can we catch multiple exceptions using a single catch?
12. What happens when an exception is not caught?
13. What is the purpose of multiple catch blocks?
14. Can we have a single catch block to catch multiple exceptions?
15. Can a catch block catch more than one exception type?
16. What is the throw keyword in Java?
17. How is throw different from throws?
18. Can we throw an exception manually?
19. What is the use of throw?
20. What is the advantage of declaring exceptions using throws?
21. What is finally keyword? What is the use of it?
22. What happens if an exception occurs in the finally block?
23. How does finally work in nested try-catch?
24. What is exception? How can we handle it?
25. Why do we need exception handling?
26. Advantages of exception handling.
27. What is exception chaining?
28. How do you create a custom exception?
29. What is a thread? How it is different from a process?
30. How many ways can you create a thread in Java?
31. What is the difference between Thread class and Runnable interface?
32. What is run() and start() method? What are the differences?
33. What happens if we call run() directly instead of start()?
34. Draw the life cycle of a thread. Explain every state of this cycle.
35. What causes a thread to enter the Blocked or Waiting state?
36. What is thread scheduler?
37. What is the difference between sleep and wait?
38. What is thread termination?
39. What is the use of join() method?
40. How do you check if a thread is alive?
41. What happens when a thread completes execution?
42. What is thread priority?
43. What is synchronization in Java? Why we need it?
44. What is the range of thread priority values?
45. How do you use the synchronized keyword?
46. What are deadlocks? How can we prevent them?

UNIT – 6

1. What are streams in Java?


2. What is the difference between byte streams and character streams?
3. What are the main classes used for byte streams and character streams?
4. What is the parent class of all input stream classes and output stream classes?
5. What is the difference between InputStream and Reader classes?
6. What is the difference between OutputStream and Writer classes?
7. What is serialization?
8. What is deserialization?
9. What is the use of the File class in Java?
10. What is the difference between BufferedReader and FileReader?
11. How do FileReader and FileWriter work?
12. What is the purpose of BufferedReader?
13. What is the purpose of PrintWriter?
14. What is the use of FileInputStream and FileOutputStream?
15. How are ObjectInputStream and ObjectOutputStream used?
1. How do you create a new file in Java? What happens if the file already exists?
2. How do you check if a file exists before creating it?
3. What are the common methods of the File class?
4. How do you create a file using FileWriter?
5. What is the difference between [Link]() and using a stream constructor?
6. How do you create a file with a specific path or extension?
7. How do you check if a file is writable or readable?
8. How do you handle file creation exceptions?
9. How do you append to an existing file instead of overwriting?
10. How do you read a text file line by line in Java?
11. How do you read a file using Scanner?
12. How do you read a character at a time?
13. How do you write multiple lines to a file?
14. What is the use of flush() in writers?
15. What is the difference between writing a string and writing a character array?
16. How do you close file writers properly?
17. How do you detect the end of a file while reading?

You might also like