Java Programming Question Bank covering Units 1 to 4 is provided in this post for students preparing for university examinations, internal examinations and practical-oriented assessments.
This Java Question Bank includes 1-mark, 2-mark, 3-mark and 5-mark questions, along with competency-based, application-oriented, code-based and scenario-based questions.
The questions are mapped with Learning Outcomes (LOs) and Bloom’s Taxonomy levels to support outcome-based education and higher-order thinking.
Topics Covered
Java Programming Question Bank – 5 Units
- Introduction to Java Data Types, Operators, Statements
- Inheritance, Sub Classing, Package
- Exception, Collection Frameworks
- IO and Multi Threading
- GUI Programming and Applets
Expected Pattern of Question Paper
| Question No | Question Type | No. of questions | Total Marks |
| 1 | 1 Mark Questions | 5 | 5 |
| 2 | 3 Marks Questions | 5 | 15 |
| 3 | 5 Marks Questions | 4 | 20 |
Learning Objectives
| LO | Learning Outcome |
| LO1 | Explain Java fundamentals, programming paradigms, OO concepts, Java environment, data types, operators and control statements. |
| LO2 | Apply inheritance, subclassing, method overriding, packages, interfaces and access-control concepts in Java programs. |
| LO3 | Analyze and implement exception handling and Java Collection Framework concepts. |
| LO4 | Apply Java I/O streams, file handling and multithreading-related concepts to solve programming problems. |
Suggested Bloom Distribution – Java Programming Question Bank
| Bloom Level | Description | Approx. Weight |
|---|---|---|
| L1 – Remember | Recall facts, concepts, definitions, and syntax | 15% |
| L2 – Understand | Explain, describe, summarize, and interpret concepts | 20% |
| L3 – Apply | Apply concepts to solve problems and write programs | 25% |
| L4 – Analyze | Analyze code, identify errors, compare approaches, and examine relationships | 20% |
| L5 – Evaluate | Evaluate solutions, justify choices, and assess programming approaches | 10% |
| L6 – Create | Design, develop, or construct programs and solutions | 10% |
| Total | 100% |
Recommended Competency Weightage – Java Programming Question Bank
For a modern Java examination, approximately 50–60% of the paper can be competency/application-oriented, especially through:
- Code output prediction
- Debugging
- Code completion
- Scenario-based questions
- Case studies
- Program design
- Choosing appropriate Java constructs
- Comparing alternative solutions
- Error/exception analysis
- Collection selection
- I/O design problems
- OO design problems
So let us begin with Unit 1 Introduction to Java Data Types, Operators, Statements. The Unit 1 covers these topics:
- Paradigms of programming languages
- Evolution of OO methodology
- Basic concepts of OO approach
- Comparison of object oriented and procedure oriented approaches
- Concepts of OOP – classes and objects, abstraction and encapsulation, inheritance, polymorphism
- Features of the Java language
- Java environment
- Object oriented programming in Java
- Java program structure
- Java and unicode
- Data types
- Variables and arrays – data types in Java, literals, characters, variable declaration, symbolic constants
- Type casting operations in Java, Arithmetic operators, Basic assignment operators, Relational operators, Boolean logical operators, Ternary operator, Operator precedence
- Control statements – Java’s selection statements, switch, nested switch, iteration constructs, continue, return.
1 Marks questions
| No. | Question | LO | Bloom |
| 1 | Define a programming paradigm. | LO1 | L1 |
| 2 | Name two programming paradigms. | LO1 | L1 |
| 3 | Identify the programming paradigm primarily based on procedures and functions. | LO1 | L1 |
| 4 | State one limitation of procedure-oriented programming for large systems. | LO1 | L1 |
| 5 | Name the language that introduced early object-oriented concepts such as classes and objects. | LO1 | L1 |
| 6 | Identify the three major contributors associated with the development of unified OO methodologies. | LO1 | L1 |
| 7 | Expand OMT. | LO1 | L1 |
| 8 | Expand UML. | LO1 | L1 |
| 9 | Define a class. | LO1 | L1 |
| 10 | Define an object. | LO1 | L1 |
| 11 | State the purpose of encapsulation. | LO1 | L1 |
| 12 | What is abstraction? | LO1 | L1 |
| 13 | Name the OOP feature that allows one class to acquire properties of another class. | LO1 | L1 |
| 14 | Define polymorphism. | LO1 | L1 |
| 15 | Identify the language feature that allows Java programs to run on different platforms through the JVM. | LO1 | L1 |
| 16 | Name the Java component that executes bytecode. | LO1 | L1 |
| 17 | What is Unicode? | LO1 | L1 |
| 18 | List any two primitive data types in Java. | LO1 | L1 |
| 19 | Identify the data type used to store a single character in Java. | LO1 | L1 |
| 20 | What is a literal? | LO1 | L1 |
| 21 | State the purpose of a symbolic constant. | LO1 | L1 |
| 22 | Identify the operator used for the conditional/ternary operation. | LO1 | L1 |
| 23 | Name the operator used for equality comparison. | LO1 | L1 |
| 24 | Identify the logical AND operator in Java. | LO1 | L1 |
| 25 | What is type casting? | LO1 | L1 |
| 26 | Name Java’s selection statements. | LO1 | L1 |
| 27 | What is the purpose of continue? | LO1 | L1 |
| 28 | What is the purpose of return? | LO1 | L1 |
| 29 | Define operator precedence. | LO1 | L1 |
| 30 | Name the iteration constructs available in Java. | LO1 | L1 |
3 Marks questions
| No. | Question | LO | Bloom |
| 1 | Compare procedure-oriented and object-oriented approaches with respect to data security, reusability and maintainability. | LO1 | L4 |
| 2 | Explain the evolution of OO methodology from procedural programming to modern OO development. | LO1 | L2 |
| 3 | Compare classes, objects and methods using a BankAccount example. | LO1 | L4 |
| 4 | Demonstrate abstraction, encapsulation and inheritance using a suitable Vehicle example. | LO1 | L3 |
| 5 | Analyze how polymorphism reduces the need for multiple independent implementations. | LO1 | L4 |
| 6 | Explain the role of JVM, JRE and JDK in executing a Java program. | LO1 | L2 |
| 7 | Trace the steps from writing a .java file to executing the corresponding bytecode. | LO1 | L3 |
| 8 | Analyze the output of a program containing integer, floating-point, character and boolean variables. | LO1 | L4 |
| 9 | Demonstrate implicit and explicit type conversion with suitable Java statements. | LO1 | L3 |
| 10 | Evaluate the following expression using Java’s operator precedence: 10 + 5 * 2 > 15 && 8 != 3. | LO1 | L4 |
| 11 | Analyze a situation in which integer division produces an unexpected result and suggest an appropriate type-casting solution. | LO1 | L4 |
| 12 | Develop a Java expression using the ternary operator to determine the larger of two numbers. | LO1 | L3 |
| 13 | Analyze a nested if structure and suggest an equivalent switch-based solution where appropriate. | LO1 | L4 |
| 14 | Develop a Java program fragment that uses a for loop and continue to print only even numbers. | LO1 | L3 |
| 15 | Analyze a loop containing return and explain why subsequent statements are not executed. | LO1 | L4 |
| 16 | Construct a suitable array declaration and initialization for storing marks of 10 students. | LO1 | L3 |
| 17 | Analyze the suitability of switch versus nested if-else for a menu-driven application. | LO1 | L4 |
| 18 | Explain how symbolic constants improve readability and maintainability of a Java program. | LO1 | L2 |
| 19 | Differentiate procedure-oriented and object-oriented programming based on data and functions. | LO1 | L2 |
| 20 | Explain why object-oriented methodology became necessary for large software systems. | LO1 | L2 |
| 21 | Differentiate a class and an object with a suitable example. | LO1 | L2 |
| 22 | Explain encapsulation using a Student example. | LO1 | L2 |
| 23 | Illustrate abstraction with a real-world example. | LO1 | L2 |
| 24 | Explain how inheritance promotes code reuse. | LO1 | L2 |
| 25 | Differentiate abstraction and encapsulation. | LO1 | L2 |
| 26 | Explain polymorphism using a simple real-world example. | LO1 | L2 |
| 27 | List the major components of the Java environment and state their purposes. | LO1 | L2 |
| 28 | Explain the relationship among JDK, JRE and JVM. | LO1 | L2 |
| 29 | Distinguish source code, bytecode and machine code. | LO1 | L2 |
| 30 | Explain why Java is considered platform independent. | LO1 | L2 |
| 31 | Differentiate primitive and reference data types. | LO1 | L2 |
| 32 | Classify Java primitive data types into integral, floating-point, character and boolean categories. | LO1 | L2 |
| 33 | Explain the difference between a variable and a literal. | LO1 | L2 |
| 34 | Explain the need for Unicode support in Java. | LO1 | L2 |
| 35 | Differentiate implicit and explicit type casting. | LO1 | L2 |
| 36 | Explain the use of relational and logical operators with examples. | LO1 | L2 |
| 37 | Explain the working of the ternary operator with an example. | LO1 | L2 |
| 38 | Differentiate break and continue. | LO1 | L2 |
| 39 | Explain the role of switch in Java. | LO1 | L2 |
| 40 | Explain why operator precedence is important in Java expressions. | LO1 | L2 |
| 41 | Describe the basic structure of a Java program. | LO1 | L2 |
| 42 | Explain the purpose of arrays in Java. | LO1 | L2 |
5 Marks Questions
| No. | Question | LO | Bloom |
| 1 | A college wants to develop a Student Management System containing student details, marks and operations. Analyze the limitations of a procedure-oriented approach and design an OO model using classes, objects, encapsulation and abstraction. | LO1 | L6 |
| 2 | A banking application has separate functions operating directly on customer data. Evaluate the problems with this design and propose an object-oriented alternative using encapsulation and classes. | LO1 | L5 |
| 3 | A program calculates average = total / count, where both variables are integers. The result is unexpectedly truncated. Analyze the problem and develop an appropriate type-casting solution. | LO1 | L4/L6 |
| 4 | Design a menu-driven Java program for a calculator using switch. Include suitable handling for addition, subtraction, multiplication and division. | LO1 | L6 |
| 5 | A school grading program uses deeply nested if-else statements. Analyze its limitations and redesign the logic using suitable selection constructs. | LO1 | L4/L6 |
| 6 | A shopping application needs to calculate discount based on purchase amount. Develop a Java solution using relational, logical and ternary operators. | LO1 | L6 |
| 7 | A Java program produces an incorrect result because several arithmetic and logical operators occur in one expression. Analyze the role of operator precedence and rewrite the expression using parentheses to make the intended evaluation explicit. | LO1 | L4/L6 |
| 8 | A university application needs to store marks of 50 students. Select and justify an appropriate array representation and develop the statements required to initialize and access the data. | LO1 | L5/L6 |
UNIT 2 – Inheritance, Subclassing and Packages
1 Mark questions
| No. | Question | LO | Bloom |
| 1 | Define inheritance. | LO2 | L1 |
| 2 | What is a subclass? | LO2 | L1 |
| 3 | What is a superclass? | LO2 | L1 |
| 4 | Name the keyword used to inherit a class. | LO2 | L1 |
| 5 | Identify the keyword used to access superclass members. | LO2 | L1 |
| 6 | Define method overriding. | LO2 | L1 |
| 7 | What is variable shadowing? | LO2 | L1 |
| 8 | Define method binding. | LO2 | L1 |
| 9 | What is variable binding? | LO2 | L1 |
| 10 | State the purpose of final when applied to a method. | LO2 | L1 |
| 11 | State the purpose of final when applied to a class. | LO2 | L1 |
| 12 | What is an abstract class? | LO2 | L1 |
| 13 | What is an interface? | LO2 | L1 |
| 14 | Name the root class of the Java class hierarchy. | LO2 | L1 |
| 15 | What is a package? | LO2 | L1 |
| 16 | Name the keyword used to create a package declaration. | LO2 | L1 |
| 17 | What is CLASSPATH? | LO2 | L1 |
| 18 | List the four major access levels in Java. | LO2 | L1 |
| 19 | Identify the access specifier with the widest accessibility. | LO2 | L1 |
| 20 | Identify the access level that restricts a member to its declaring class. | LO2 | L1 |
3 Marks questions
| No. | Question | LO | Bloom |
| 1 | Explain the purpose of inheritance with an example. | LO2 | L2 |
| 2 | Differentiate superclass and subclass. | LO2 | L2 |
| 3 | Explain method overriding using Animal and Dog. | LO2 | L2 |
| 4 | Explain the use of super in Java. | LO2 | L2 |
| 5 | Differentiate method overriding and method overloading. | LO2 | L4 |
| 6 | Explain variable shadowing with a suitable example. | LO2 | L2 |
| 7 | Explain early and late method binding. | LO2 | L2 |
| 8 | Explain the purpose of the final keyword in Java. | LO2 | L2 |
| 9 | Differentiate an abstract class and an interface. | LO2 | L4 |
| 10 | Explain why Object is considered the root class in Java. | LO2 | L2 |
| 11 | Explain two advantages of packages. | LO2 | L2 |
| 12 | Describe the steps for creating and using a user-defined package. | LO2 | L2 |
| 13 | Explain the role of the CLASSPATH environment variable. | LO2 | L2 |
| 14 | Compare public, private, protected and default access. | LO2 | L4 |
| 15 | Explain how packages help prevent naming conflicts. | LO2 | L2 |
| 16 | Demonstrate inheritance using a Person superclass and Student subclass. | LO2 | L3 |
| 17 | Develop a Java example that overrides a method of a superclass. | LO2 | L3 |
| 18 | Analyze a program containing superclass and subclass variables with the same name and explain variable shadowing. | LO2 | L4 |
| 18 | Trace which version of an overridden method is executed when a superclass reference refers to a subclass object. | LO2 | L4 |
| 19 | Explain the effect of final on classes, methods and variables with examples. | LO2 | L2 |
| 20 | Construct an abstract class containing at least one abstract method and show how a subclass implements it. | LO2 | L3 |
| 21 | Develop a simple interface and demonstrate its implementation by a class. | LO2 | L3 |
| 22 | Analyze a situation where an interface is more appropriate than an abstract class. | LO2 | L4 |
| 23 | Demonstrate how super can be used to access superclass variables and methods. | LO2 | L3 |
| 24 | Analyze a Java program and determine the accessibility of members declared with different access specifiers. | LO2 | L4 |
| 25 | Construct a package named college.student containing a Student class and show how it can be imported. | LO2 | L3 |
| 26 | Analyze why a class in one package cannot directly access a private member of a class in another package. | LO2 | L4 |
5 Marks Questions
| No. | Question | LO | Bloom |
| 1 | A university system contains Person, Student and Faculty. Design an inheritance hierarchy and implement suitable overridden methods. | LO2 | L6 |
| 2 | A company has different types of employees whose salary calculation differs. Design an inheritance-based solution using method overriding and explain the role of dynamic method binding. | LO2 | L6 |
| 3 | A payment system supports Credit Card, UPI and Net Banking. Evaluate whether an abstract class or interface is more appropriate and justify your design. | LO2 | L5 |
| 4 | A developer wants to prevent a class from being inherited and a method from being overridden. Design an appropriate solution using final and explain its effects. | LO2 | L5 |
| 5 | A college application is divided into student, faculty and admin packages. Design the package structure and demonstrate appropriate access control among the packages. | LO2 | L6 |
| 6 | Given a program with superclass and subclass variables and overridden methods, analyze the output and explain variable shadowing versus method overriding. | LO2 | L4 |
| 7 | A developer creates a class hierarchy but directly exposes all data members. Evaluate the design and redesign it using appropriate access control and encapsulation. | LO2 | L5/L6 |
Unit 3 Exception Handling and Collection Framework
1 Mark Questions
| No. | Question | LO | Bloom |
| 1 | Define an exception. | LO3 | L1 |
| 2 | Name the root class for exceptions and errors in Java. | LO3 | L1 |
| 3 | What is Throwable? | LO3 | L1 |
| 4 | Name the keyword used to handle an exception. | LO3 | L1 |
| 5 | Name the block used to contain code that may generate an exception. | LO3 | L1 |
| 6 | What is the purpose of finally? | LO3 | L1 |
| 7 | Name the keyword used to explicitly generate an exception. | LO3 | L1 |
| 8 | Name the keyword used to declare exceptions that a method may propagate. | LO3 | L1 |
| 9 | Define a user-defined exception. | LO3 | L1 |
| 10 | Name one built-in Java exception. | LO3 | L1 |
| 11 | What is a nested try block? | LO3 | L1 |
| 12 | Define Collection Framework. | LO3 | L1 |
| 13 | Name the interface used for an ordered collection that may contain duplicates. | LO3 | L1 |
| 14 | Name the interface used for a collection that does not normally allow duplicate elements. | LO3 | L1 |
| 15 | Name a commonly used resizable-array implementation. | LO3 | L1 |
| 16 | What is an iterator? | LO3 | L1 |
| 17 | Name an older interface used to enumerate elements. | LO3 | L1 |
| 18 | Identify the method used by an iterator to check whether another element exists. | LO3 | L1 |
| 19 | Identify the method used by an iterator to retrieve the next element. | LO3 | L1 |
| 20 | State one advantage of ArrayList over a fixed-size array. | LO3 | L1 |
3 Marks questions
| No. | Question | LO | Bloom |
| 1 | Differentiate checked and unchecked exceptions. | LO3 | L4 |
| 2 | Explain the hierarchy involving Throwable, Exception and Error. | LO3 | L2 |
| 3 | Explain the purpose of try and catch. | LO3 | L2 |
| 4 | Differentiate throw and throws. | LO3 | L4 |
| 5 | Explain why finally is useful in exception handling. | LO3 | L2 |
| 6 | Explain nested try statements with a suitable situation. | LO3 | L2 |
| 7 | List any four common built-in Java exceptions and their causes. | LO3 | L1/L2 |
| 8 | Explain how a user-defined exception is created. | LO3 | L2 |
| 9 | Differentiate List and Set. | LO3 | L4 |
| 10 | Differentiate ArrayList and an ordinary array. | LO3 | L4 |
| 11 | Explain the purpose of an Iterator. | LO3 | L2 |
| 12 | Compare Enumeration and Iterator. | LO3 | L4 |
| 13 | Explain why collections are preferred when the number of elements changes dynamically. | LO3 | L2 |
| 14 | Explain how duplicate elements are treated differently by List and Set. | LO3 | L2 |
| 15 | Analyze a program that may generate ArithmeticException and suggest an appropriate handling mechanism. | LO3 | L4 |
| 16 | Develop a Java code fragment using multiple catch blocks for different exception types. | LO3 | L3 |
| 17 | Trace the execution of nested try-catch blocks when an inner block generates an exception. | LO3 | L4 |
| 18 | Demonstrate the use of throw and throws in a method that validates age. | LO3 | L3 |
| 19 | Develop a user-defined InvalidAgeException and show how it can be used. | LO3 | L6 |
| 20 | Analyze a program containing try, catch and finally and determine which blocks execute under different conditions. | LO3 | L4 |
| 21 | Select a suitable collection for storing student names where duplicate names are allowed and justify your choice. | LO3 | L5 |
| 22 | Select a suitable collection for storing unique course codes and justify your choice. | LO3 | L5 |
| 23 | Develop an ArrayList program to add, access, modify and remove student names. | LO3 | L3 |
| 24 | Demonstrate traversal of an ArrayList using an Iterator. | LO3 | L3 |
| 25 | Analyze why removing elements directly during collection traversal can cause problems and suggest an appropriate approach. | LO3 | L4 |
| 26 | Compare ArrayList, List and Set for a student-record application based on ordering, duplicates and flexibility. | LO3 | L4 |
5 Marks questions
| No. | Question | LO | Bloom |
| 1 | A banking application accepts withdrawal amounts. It must handle insufficient balance, invalid amount and invalid account conditions. Design an exception-handling solution using suitable built-in and user-defined exceptions. | LO3 | L6 |
| 2 | A student registration system should reject students below a specified age. Create a user-defined exception and develop the required validation logic using throw, throws, try and catch. | LO3 | L6 |
| 3 | An online examination program may encounter invalid array access, invalid input and arithmetic errors. Analyze the possible failures and design an exception-handling strategy. | LO3 | L6 |
| 4 | A college needs to maintain a dynamically changing list of student names. Develop an ArrayList-based solution supporting insertion, deletion, searching and traversal. | LO3 | L6 |
| 5 | A course registration system must store course codes without duplicates, while another component must preserve duplicate student entries. Evaluate List and Set and select suitable collections for both requirements. | LO3 | L5 |
| 6 | Given a collection-processing program containing multiple exceptions and nested try blocks, analyze the execution flow and predict which exception handler will execute. | LO3 | L4 |
| 7 | A developer uses an array for a dataset whose size changes continuously. Evaluate this design and redesign the solution using the Collection Framework. | LO3 | L5/L6 |