Question Paper
Unit-1
10 Marks
1. Explain the concept of Object-Oriented Programming in Java and discuss its main
principles.
2. Describe the role of constructors in Java. Provide examples of default and
parameterized constructors.
3. Compare primitive and non-primitive data types in Java with examples.
4. Explain the concept of variable scope in Java. Discuss the differences between local,
instance, and static variables.
5. What are access modifiers in Java? Explain with examples.
6. Discuss the different types of operators in Java (arithmetic, relational, logical,
bitwise). Provide code examples.
7. Explain the if-else and switch statements in Java. Compare their use cases.
8. Discuss iteration statements in Java with examples (for, while, do-while).
9. What are arrays in Java? Explain how arrays are declared, initialized, and used.
10. Compare Structural and Procedural programming paradigms with examples.
11. Write a detailed note on decision-making in Java with examples.
12. Explain the difference between method overloading and method overriding in Java.
13. Discuss the use of the 'this' and 'super' keywords in Java with examples.
14. What is inheritance in Java? Explain different types of inheritance.
15. Describe the concept of polymorphism in Java. Provide real-world examples.
16. Explain encapsulation and abstraction in Java. How do they differ?
17. Discuss exception handling in Java with examples (try, catch, throw, throws, and
finally).
18. What is multithreading in Java? Explain how threads are created and managed.
19. Describe the role of the Java Virtual Machine (JVM) and its importance.
20. What are interfaces in Java? How do they differ from abstract classes?
21. Explain file handling in Java. Provide examples for reading and writing files.
22. Discuss the garbage collection process in Java. How does it work?
23. What are generics in Java? Explain with examples.
24. Explain the concept of lambda expressions in Java and their use.
25. Compare Stack and Heap memory in Java.
26. Discuss the Collections framework in Java. Explain various types of collections.
27. Explain Java I/O Streams with examples of input and output operations.
28. What is serialization in Java? Explain how it works.
29. Discuss the concept of JDBC in Java and its role in database connectivity.
30. Explain the concept of event handling in Java. Provide examples of using listeners.
31. Write a Java program to demonstrate the concept of constructors. (Create a class
Student with fields like name, rollNo, and a constructor to initialize these values.
Demonstrate the use of both default and parameterized constructors in your code.)
32. Write a Java program to demonstrate method overloading. (Define a class Calculator
with overloaded methods add() that can accept two integers, three integers, and two
doubles. Write a program to test the overloaded methods.)
33. Write a Java program to demonstrate inheritance. (Create a base class Employee with
fields like name, salary. Then create a derived class Manager that extends Employee
and adds additional fields like department. Show how the derived class can access the
parent class’s members.)
34. Write a Java program to implement array operations. (Write a class ArrayOperations
with methods for finding the largest element, sorting an array, and searching for an
element using linear search. Write a program that tests these methods with user
inputs.)
35. Write a Java program to implement the concept of polymorphism using method
overriding. (Create a base class Animal with a method sound(). Then, create derived
classes Dog and Cat that override the sound() method. Write a program to
demonstrate runtime polymorphism using method overriding.)
36. Write a Java program to handle exceptions using try-catch blocks. (Create a program
that reads an array of integers from the user and divides a number by a user-input
value. Use exception handling to manage ArrayIndexOutOfBoundsException,
ArithmeticException, and other exceptions that might arise.)
37. Write a Java program to demonstrate file handling (reading and writing). (Write a
program to read content from a file, modify it, and then write the modified content to
another file. Implement exception handling for file operations.)
38. Write a Java program to demonstrate multithreading. (Create two threads: one that
prints even numbers and another that prints odd numbers between 1 and 50.
Implement the threads using the Thread class and the Runnable interface.
Demonstrate thread synchronization to avoid data inconsistency.)
39. Write a Java program to demonstrate the use of an interface. (Define an interface
Shape with methods area() and perimeter(). Create classes Circle and Rectangle that
implement the Shape interface. Write a program to test these classes with user inputs.)
40. Write a Java program to demonstrate the concept of collections (ArrayList). (Write a
program that reads a list of student names into an ArrayList, performs operations like
adding, removing, and displaying names, and sorts the list alphabetically. Also, use
the Iterator to traverse through the list.)
41. Write a Java program to implement a simple calculator using method overloading.
(Define a class calculator with overloaded methods: add(), subtract(), multiply(), and
divide(), which handle both integers and floats. Test each method.)
42. Write a Java program to create a class that demonstrates inheritance. (Create a base
class Animal with a method makeSound(). Then, create derived classes Dog and Cat
that override makeSound(). Write a program to test polymorphism.)
43. Write a Java program to demonstrate the use of arrays and loops. (Create a program
that takes an array of integers as input, sorts them in ascending order, and displays the
sorted array using a for loop.)
44. Write a Java program to handle exceptions using try-catch blocks. (Write a program
that takes an array of numbers from the user, prompts for an index to display, and
handles possible exceptions like ArrayIndexOutOfBoundsException and
InputMismatchException.)
5 Marks
1. Define a class and object in Java.
2. Explain the use of constructors in Java.
3. What are primitive data types in Java?
4. Describe the scope of local variables in Java.
5. What is the use of the 'private' access modifier in Java?
6. Write a short note on arithmetic operators in Java.
7. Explain the 'if' statement in Java with an example.
8. What is a 'for' loop in Java? Provide an example.
9. Define an array in Java and provide a simple example of array usage.
10. Compare procedural programming with object-oriented programming.
11. What is method overloading in Java?
12. Explain the use of the 'this' keyword in Java.
13. What is inheritance in Java?
14. Write a short note on encapsulation in Java.
15. What is a try-catch block in Java?
16. Define a thread in Java and explain its use.
17. What is an interface in Java?
18. Write a short note on garbage collection in Java.
19. What is the Java Collections framework?
20. Explain the concept of lambda expressions in Java.
21. Write a Java program to create a simple class with a method and display the output.
(Define a class Car with a method start(). Instantiate the class and call the method to
display "Car started.")
22. Write a Java program to calculate the sum of elements in an integer array. (Create an
array of integers and write a method that calculates the sum of its elements using a for
loop.)
23. Write a Java program to implement a simple if-else statement. (Create a program that
checks if a number is positive, negative, or zero using an if-else block.)
24. Write a Java program to demonstrate a while loop. (Implement a program that prints
the first 10 natural numbers using a while loop.)
25. Write a Java program to create a constructor and initialize an object. (Define a class
Book with a constructor to initialize the title and author. Create an object and display
its properties.)
Unit-2
10 Marks
1. Define and explain the concept of Object-Oriented Programming (OOP) in Java.
Discuss the four main principles of OOP with examples. (Answer Outline: Explain
encapsulation, inheritance, polymorphism, and abstraction. Provide code snippets illustrating
each principle.)
2. Describe the role and characteristics of constructors in Java. Differentiate between
default, parameterized, and copy constructors with examples. (Answer Outline: Define
each type of constructor and provide code examples demonstrating their usage and
differences.)
3. Explain the different data types available in Java. Discuss how type conversion is
handled in Java with examples. (Answer Outline: Describe primitive and reference data
types, and provide examples of implicit and explicit type conversions.)
4. Discuss the concept of variables in Java. Explain the difference between instance
variables, class variables, and local variables with code examples. (Answer Outline:
Define each type of variable and illustrate their scope and lifetime with examples.)
5. Illustrate the use of modifiers (access and non-access) in Java. Explain how they affect
class members and provide examples. (Answer Outline: Discuss public, private, protected,
and default access modifiers, as well as static, final, and abstract modifiers with examples.)
6. Explain branching statements in Java. Provide code examples for if, if-else, and switch
statements. (Answer Outline: Describe the syntax and usage of each branching statement
with appropriate code snippets.)
7. Discuss iteration statements in Java. Explain the use of for, while, and do-while loops
with examples. (Answer Outline: Provide syntax and examples for each loop type, including
common use cases and differences.)
8. Describe decision-making constructs in Java. Explain how the if, if-else, and switch
statements can be used to control program flow. (Answer Outline: Discuss the logic
behind each decision-making construct and provide example scenarios.)
9. Explain the use of arrays in Java. Discuss single-dimensional and multi-dimensional
arrays with code examples. (Answer Outline: Define arrays, provide syntax, and give
examples of both single-dimensional and multi-dimensional arrays.)
10. Describe the procedural programming paradigm. Discuss its characteristics and how it
is implemented in Java with examples. (Answer Outline: Explain the concept of
procedural programming, its characteristics, and provide examples of how it can be used in
Java.)
11. What is method overloading in Java? Explain with examples how method overloading
can be used to enhance code readability. (Answer Outline: Define method overloading and
provide examples illustrating how it can be applied.)
12. Discuss the use of this keyword in Java. Explain how it can be used to refer to the
current object and resolve ambiguity. (Answer Outline: Provide explanations and code
examples showing the use of this in constructors, methods, and field initialization.)
13. Explain the concept of encapsulation in Java. Discuss how getters and setters are used to
achieve encapsulation with examples. (Answer Outline: Define encapsulation, describe its
benefits, and provide code examples using getters and setters.)
14. Describe the different types of operators available in Java. Explain the use of arithmetic,
relational, logical, and bitwise operators with examples. (Answer Outline: Discuss each
operator type and provide code examples demonstrating their usage.)
15. Discuss the use of the super keyword in Java. Explain its role in inheritance and provide
examples. (Answer Outline: Define the super keyword, its uses in constructors and method
calls, and provide illustrative examples.)
16. Explain how Java handles exception handling. Describe the use of try, catch, finally, and
throw statements with examples. (Answer Outline: Define exception handling, describe the
syntax and role of each statement, and provide code examples.)
17. Describe the concept of polymorphism in Java. Explain the difference between compile-
time and runtime polymorphism with examples. (Answer Outline: Define polymorphism,
discuss method overloading (compile-time) and method overriding (runtime) with examples.)
18. Discuss the role of the static keyword in Java. Explain how it affects methods and
variables with code examples. (Answer Outline: Define the static keyword and provide
examples demonstrating its effect on class methods and variables.)
19. Explain the concept of method overriding in Java. Discuss how it is used to achieve
runtime polymorphism with examples. (Answer Outline: Define method overriding,
provide examples showing its use, and explain how it supports runtime polymorphism.)
20. Discuss the significance of the final keyword in Java. Explain its use in classes, methods,
and variables with examples. (Answer Outline: Define the final keyword and describe its
impact on class inheritance, method overriding, and variable values with examples.)
5 Marks
1. What are the different types of data types in Java? Provide a brief
overview of each type with examples.
2. Explain the difference between == and .equals() method in Java with
examples.
3. What is a class in Java? Describe how it is defined and instantiated with
examples.
4. Describe the purpose of access modifiers in Java. Explain the difference
between public, protected, and private with examples.
5. What are the benefits of using loops in programming? Provide examples
of for, while, and do-while loops in Java.
6. How does Java support method overloading? Provide an example
demonstrating how method overloading works.
7. Explain the difference between break and continue statements in Java
with examples.
8. Discuss the concept of inheritance in Java. Explain how it is implemented
with an example.
9. What is the role of the main method in Java? Describe its significance
and how it is used to run a Java application.
[Link] the use of public, private, and protected access modifiers in
Java classes with examples.