JavaImpQuestions Set1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

UNIT-I

2 Marks Questions

1. What are the basic principles of Object-Oriented Programming (OOP)?

2. Define the concept of a class and an object in OOP.


3. What is the purpose of using comments in Java code?

4. Name the different data types available in Java.


5. Explain the difference between a variable and a constant.

6. Describe the structure of a simple Java program.

7. What is the significance of escape sequences in Java?

8. How does type casting work in Java?

9. Explain the concept of operator precedence and associativity.

10. What is the purpose of control statements in programming?

11. Write a Java program to calculate the area of a circle.

12. What is the ’static’ keyword in java?

13. Use a for loop to print the numbers from 1 to 10.

14. Implement a nested if-else statement to determine if a given number is positive, negative, or zero.

15. Write a Java program to find the factorial of a given number using recursion.

10 Marks Questions

16. Analyze the advantages and disadvantages of OOP compared to procedural programming.

17. Discuss the impact of different data types on memory usage and performance in Java.

18. Explain the role of control statements in algorithm development and problem-solving.

19. Compare and contrast the while, do-while, and for loops in terms of their usage and efficiency.

20. Evaluate the benefits and drawbacks of using the ternary operator in Java code.

21. Create a program that simulates a simple calculator using Java.

22. Evaluate the potential performance implications of using nested loops in Java programs.

UNIT-II

2-Mark Questions

1. What is the difference between a class and an object in OOP?

2. Define the concept of a constructor method.


3. What is the purpose of the ‘this‘ keyword in Java?

4. Explain the concept of method overloading.

5. What is the significance of the ‘final‘ keyword when applied to a class or method?

6. Describe the structure of a class declaration in Java.

7. How does access control work for class members?

8. What is the difference between passing arguments by value and by reference?

9. Explain the concept of method overriding.

10. What is the purpose of nested classes in Java?

11. Write a constructor method for a class that initializes its member variables.

12. Use the ‘this‘ keyword to refer to the current object within a method.

13. Overload a method to perform different actions based on the types or number of arguments.

14. Implement a recursive method to calculate the factorial of a given number.

10-Mark Questions

16. Analyze the advantages and disadvantages of using access control modifiers in Java.

17. Discuss the impact of passing arguments by value or by reference on function behavior.

18. Explain the role of constructors in object initialization and their relationship to other methods.

19. Compare and contrast method overloading and method overriding in terms of their usage and
implications.

20. Evaluate the benefits and drawbacks of using nested classes in Java code.

21. Analyze the trade-offs between using constructors and other methods for object initialization.

UNIT-III

2-Mark Questions

1. What is an array in Java?

2. How are arrays stored in computer memory?

3. Explain the concept of inheritance in OOP.

4. What is the purpose of an interface in Java?

5. Define the term "method overriding."


6. Describe the process of declaring and initializing an array in Java.

7. What are the different types of inheritance in Java?

8. How does access control affect inheritance?

9. Explain the concept of a default method in an interface.

10. What is the significance of annotations in Java?

11. How to define variable size array in java?

12. Implement a class hierarchy to represent different types of shapes (e.g., circle, rectangle, triangle).

13. Create an interface to define the behavior of a vehicle and implement it by different vehicle classes.

14. Use annotations to provide additional information about methods or classes.

10 Marks Questions

16. Explain different types of arrays in Java.

17. Write a java program to find minimum and maximum element in an array.

18. Write a java program to sort element in the given array.

19. Write a java program to search an element in a given array.

20. Java programs for matrix operations like addition, subtraction, multiplication, and transpose.

21. Explain different types of inheritances in java.

22. Explain object class in java? How it is used in inheritance?

23. How ’Final’ key is used with inheritance? Explain.

24. How to inherit public, private, protected members of a super class in to sub class? Explain.

25. What is super key word? How access based class members into sub class using super?

26. Explain the concept of "Overriding" in java.

27. Why Dynamic method dispatch? Write how to implement it in java.

28. What is abstract class? how to define it? how to use it in inheritance?

29. Write the differences between Abstract classes and Interfaces.

30. How to define interface? Explain how to access interface members in java?

31. How to implement multiple inheritance in java? Explain.

32. Evaluate the potential benefits and drawbacks of using annotations for code generation and analysis

UNIT-IV
2-Mark Questions

1. What is a package in Java?

2. How do you import a package into a Java program?

3. Name some commonly used packages in Java SE.

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

5. Explain the purpose of the ‘finally‘ block in exception handling.

6. Describe the concept of access control in packages.

7. What is the significance of the ‘java.lang‘ package?

8. How does autoboxing and auto-unboxing work in Java?

9. Explain the hierarchy of standard exception classes.

10. What is the difference between byte streams and character streams in Java I/O?

11. Create a Java package to encapsulate utility classes.

12. Write a Java program that uses the ‘Math‘ class to perform mathematical calculations.

13. Implement exception handling in a program to handle potential errors.

14. Use the ‘Scanner‘ class to read input from the user.

15. Write a Java program to read and write data to a file.

10 Marks Questions

16. How use predefined packages in java? Explain.

17. Explain different types of packages available in java.

18. How to create user define packages? How to use them in java program?

19. How to add class or interface to already existing package in java? Explain.

20. Explain different types of Errors and Exceptions available in java.

21. Draw and explain the hierarchy of standard exception class in java?

22. Explain the process of exception handling in java.

23. What is multi catch statement? How to use it to handle exceptions?

24. What is finally block? How to use it to handle exceptions?

25. Explain various types of streams available in java.


26. Enumerate character stream vs byte stream in java.

27. With an example, explain the work of scanner class.

You might also like