Java Programming Question Bank

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.

Java Programming Question Bank – 5 Units

  1. Introduction to Java Data Types, Operators, Statements
  2. Inheritance, Sub Classing, Package
  3. Exception, Collection Frameworks
  4. IO and Multi Threading
  5. GUI Programming and Applets

Expected Pattern of Question Paper

Question NoQuestion TypeNo. of questionsTotal Marks
11 Mark Questions55
23 Marks Questions515
35 Marks Questions420

Learning Objectives

LOLearning Outcome
LO1Explain Java fundamentals, programming paradigms, OO concepts, Java environment, data types, operators and control statements.
LO2Apply inheritance, subclassing, method overriding, packages, interfaces and access-control concepts in Java programs.
LO3Analyze and implement exception handling and Java Collection Framework concepts.
LO4Apply Java I/O streams, file handling and multithreading-related concepts to solve programming problems.

Suggested Bloom Distribution – Java Programming Question Bank

Bloom LevelDescriptionApprox. Weight
L1 – RememberRecall facts, concepts, definitions, and syntax15%
L2 – UnderstandExplain, describe, summarize, and interpret concepts20%
L3 – ApplyApply concepts to solve problems and write programs25%
L4 – AnalyzeAnalyze code, identify errors, compare approaches, and examine relationships20%
L5 – EvaluateEvaluate solutions, justify choices, and assess programming approaches10%
L6 – CreateDesign, develop, or construct programs and solutions10%
Total100%

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.QuestionLOBloom
1Define a programming paradigm.LO1L1
2Name two programming paradigms.LO1L1
3Identify the programming paradigm primarily based on procedures and functions.LO1L1
4State one limitation of procedure-oriented programming for large systems.LO1L1
5Name the language that introduced early object-oriented concepts such as classes and objects.LO1L1
6Identify the three major contributors associated with the development of unified OO methodologies.LO1L1
7Expand OMT.LO1L1
8Expand UML.LO1L1
9Define a class.LO1L1
10Define an object.LO1L1
11State the purpose of encapsulation.LO1L1
12What is abstraction?LO1L1
13Name the OOP feature that allows one class to acquire properties of another class.LO1L1
14Define polymorphism.LO1L1
15Identify the language feature that allows Java programs to run on different platforms through the JVM.LO1L1
16Name the Java component that executes bytecode.LO1L1
17What is Unicode?LO1L1
18List any two primitive data types in Java.LO1L1
19Identify the data type used to store a single character in Java.LO1L1
20What is a literal?LO1L1
21State the purpose of a symbolic constant.LO1L1
22Identify the operator used for the conditional/ternary operation.LO1L1
23Name the operator used for equality comparison.LO1L1
24Identify the logical AND operator in Java.LO1L1
25What is type casting?LO1L1
26Name Java’s selection statements.LO1L1
27What is the purpose of continue?LO1L1
28What is the purpose of return?LO1L1
29Define operator precedence.LO1L1
30Name the iteration constructs available in Java.LO1L1

3 Marks questions

No.QuestionLOBloom
1Compare procedure-oriented and object-oriented approaches with respect to data security, reusability and maintainability.LO1L4
2Explain the evolution of OO methodology from procedural programming to modern OO development.LO1L2
3Compare classes, objects and methods using a BankAccount example.LO1L4
4Demonstrate abstraction, encapsulation and inheritance using a suitable Vehicle example.LO1L3
5Analyze how polymorphism reduces the need for multiple independent implementations.LO1L4
6Explain the role of JVM, JRE and JDK in executing a Java program.LO1L2
7Trace the steps from writing a .java file to executing the corresponding bytecode.LO1L3
8Analyze the output of a program containing integer, floating-point, character and boolean variables.LO1L4
9Demonstrate implicit and explicit type conversion with suitable Java statements.LO1L3
10Evaluate the following expression using Java’s operator precedence: 10 + 5 * 2 > 15 && 8 != 3.LO1L4
11Analyze a situation in which integer division produces an unexpected result and suggest an appropriate type-casting solution.LO1L4
12Develop a Java expression using the ternary operator to determine the larger of two numbers.LO1L3
13Analyze a nested if structure and suggest an equivalent switch-based solution where appropriate.LO1L4
14Develop a Java program fragment that uses a for loop and continue to print only even numbers.LO1L3
15Analyze a loop containing return and explain why subsequent statements are not executed.LO1L4
16Construct a suitable array declaration and initialization for storing marks of 10 students.LO1L3
17Analyze the suitability of switch versus nested if-else for a menu-driven application.LO1L4
18Explain how symbolic constants improve readability and maintainability of a Java program.LO1L2
19Differentiate procedure-oriented and object-oriented programming based on data and functions.LO1L2
20Explain why object-oriented methodology became necessary for large software systems.LO1L2
21Differentiate a class and an object with a suitable example.LO1L2
22Explain encapsulation using a Student example.LO1L2
23Illustrate abstraction with a real-world example.LO1L2
24Explain how inheritance promotes code reuse.LO1L2
25Differentiate abstraction and encapsulation.LO1L2
26Explain polymorphism using a simple real-world example.LO1L2
27List the major components of the Java environment and state their purposes.LO1L2
28Explain the relationship among JDK, JRE and JVM.LO1L2
29Distinguish source code, bytecode and machine code.LO1L2
30Explain why Java is considered platform independent.LO1L2
31Differentiate primitive and reference data types.LO1L2
32Classify Java primitive data types into integral, floating-point, character and boolean categories.LO1L2
33Explain the difference between a variable and a literal.LO1L2
34Explain the need for Unicode support in Java.LO1L2
35Differentiate implicit and explicit type casting.LO1L2
36Explain the use of relational and logical operators with examples.LO1L2
37Explain the working of the ternary operator with an example.LO1L2
38Differentiate break and continue.LO1L2
39Explain the role of switch in Java.LO1L2
40Explain why operator precedence is important in Java expressions.LO1L2
41Describe the basic structure of a Java program.LO1L2
42Explain the purpose of arrays in Java.LO1L2

5 Marks Questions

No.QuestionLOBloom
1A 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.LO1L6
2A 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.LO1L5
3A 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.LO1L4/L6
4Design a menu-driven Java program for a calculator using switch. Include suitable handling for addition, subtraction, multiplication and division.LO1L6
5A school grading program uses deeply nested if-else statements. Analyze its limitations and redesign the logic using suitable selection constructs.LO1L4/L6
6A shopping application needs to calculate discount based on purchase amount. Develop a Java solution using relational, logical and ternary operators.LO1L6
7A 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.LO1L4/L6
8A 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.LO1L5/L6

UNIT 2 – Inheritance, Subclassing and Packages

1 Mark questions

No.QuestionLOBloom
1Define inheritance.LO2L1
2What is a subclass?LO2L1
3What is a superclass?LO2L1
4Name the keyword used to inherit a class.LO2L1
5Identify the keyword used to access superclass members.LO2L1
6Define method overriding.LO2L1
7What is variable shadowing?LO2L1
8Define method binding.LO2L1
9What is variable binding?LO2L1
10State the purpose of final when applied to a method.LO2L1
11State the purpose of final when applied to a class.LO2L1
12What is an abstract class?LO2L1
13What is an interface?LO2L1
14Name the root class of the Java class hierarchy.LO2L1
15What is a package?LO2L1
16Name the keyword used to create a package declaration.LO2L1
17What is CLASSPATH?LO2L1
18List the four major access levels in Java.LO2L1
19Identify the access specifier with the widest accessibility.LO2L1
20Identify the access level that restricts a member to its declaring class.LO2L1

3 Marks questions

No.QuestionLOBloom
1Explain the purpose of inheritance with an example.LO2L2
2Differentiate superclass and subclass.LO2L2
3Explain method overriding using Animal and Dog.LO2L2
4Explain the use of super in Java.LO2L2
5Differentiate method overriding and method overloading.LO2L4
6Explain variable shadowing with a suitable example.LO2L2
7Explain early and late method binding.LO2L2
8Explain the purpose of the final keyword in Java.LO2L2
9Differentiate an abstract class and an interface.LO2L4
10Explain why Object is considered the root class in Java.LO2L2
11Explain two advantages of packages.LO2L2
12Describe the steps for creating and using a user-defined package.LO2L2
13Explain the role of the CLASSPATH environment variable.LO2L2
14Compare public, private, protected and default access.LO2L4
15Explain how packages help prevent naming conflicts.LO2L2
16Demonstrate inheritance using a Person superclass and Student subclass.LO2L3
17Develop a Java example that overrides a method of a superclass.LO2L3
18Analyze a program containing superclass and subclass variables with the same name and explain variable shadowing.LO2L4
18Trace which version of an overridden method is executed when a superclass reference refers to a subclass object.LO2L4
19Explain the effect of final on classes, methods and variables with examples.LO2L2
20Construct an abstract class containing at least one abstract method and show how a subclass implements it.LO2L3
21Develop a simple interface and demonstrate its implementation by a class.LO2L3
22Analyze a situation where an interface is more appropriate than an abstract class.LO2L4
23Demonstrate how super can be used to access superclass variables and methods.LO2L3
24Analyze a Java program and determine the accessibility of members declared with different access specifiers.LO2L4
25Construct a package named college.student containing a Student class and show how it can be imported.LO2L3
26Analyze why a class in one package cannot directly access a private member of a class in another package.LO2L4

5 Marks Questions

No.QuestionLOBloom
1A university system contains Person, Student and Faculty. Design an inheritance hierarchy and implement suitable overridden methods.LO2L6
2A 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.LO2L6
3A payment system supports Credit Card, UPI and Net Banking. Evaluate whether an abstract class or interface is more appropriate and justify your design.LO2L5
4A 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.LO2L5
5A college application is divided into student, faculty and admin packages. Design the package structure and demonstrate appropriate access control among the packages.LO2L6
6Given a program with superclass and subclass variables and overridden methods, analyze the output and explain variable shadowing versus method overriding.LO2L4
7A developer creates a class hierarchy but directly exposes all data members. Evaluate the design and redesign it using appropriate access control and encapsulation.LO2L5/L6

Unit 3 Exception Handling and Collection Framework

1 Mark Questions

No.QuestionLOBloom
1Define an exception.LO3L1
2Name the root class for exceptions and errors in Java.LO3L1
3What is Throwable?LO3L1
4Name the keyword used to handle an exception.LO3L1
5Name the block used to contain code that may generate an exception.LO3L1
6What is the purpose of finally?LO3L1
7Name the keyword used to explicitly generate an exception.LO3L1
8Name the keyword used to declare exceptions that a method may propagate.LO3L1
9Define a user-defined exception.LO3L1
10Name one built-in Java exception.LO3L1
11What is a nested try block?LO3L1
12Define Collection Framework.LO3L1
13Name the interface used for an ordered collection that may contain duplicates.LO3L1
14Name the interface used for a collection that does not normally allow duplicate elements.LO3L1
15Name a commonly used resizable-array implementation.LO3L1
16What is an iterator?LO3L1
17Name an older interface used to enumerate elements.LO3L1
18Identify the method used by an iterator to check whether another element exists.LO3L1
19Identify the method used by an iterator to retrieve the next element.LO3L1
20State one advantage of ArrayList over a fixed-size array.LO3L1

3 Marks questions

No.QuestionLOBloom
1Differentiate checked and unchecked exceptions.LO3L4
2Explain the hierarchy involving Throwable, Exception and Error.LO3L2
3Explain the purpose of try and catch.LO3L2
4Differentiate throw and throws.LO3L4
5Explain why finally is useful in exception handling.LO3L2
6Explain nested try statements with a suitable situation.LO3L2
7List any four common built-in Java exceptions and their causes.LO3L1/L2
8Explain how a user-defined exception is created.LO3L2
9Differentiate List and Set.LO3L4
10Differentiate ArrayList and an ordinary array.LO3L4
11Explain the purpose of an Iterator.LO3L2
12Compare Enumeration and Iterator.LO3L4
13Explain why collections are preferred when the number of elements changes dynamically.LO3L2
14Explain how duplicate elements are treated differently by List and Set.LO3L2
15Analyze a program that may generate ArithmeticException and suggest an appropriate handling mechanism.LO3L4
16Develop a Java code fragment using multiple catch blocks for different exception types.LO3L3
17Trace the execution of nested try-catch blocks when an inner block generates an exception.LO3L4
18Demonstrate the use of throw and throws in a method that validates age.LO3L3
19Develop a user-defined InvalidAgeException and show how it can be used.LO3L6
20Analyze a program containing try, catch and finally and determine which blocks execute under different conditions.LO3L4
21Select a suitable collection for storing student names where duplicate names are allowed and justify your choice.LO3L5
22Select a suitable collection for storing unique course codes and justify your choice.LO3L5
23Develop an ArrayList program to add, access, modify and remove student names.LO3L3
24Demonstrate traversal of an ArrayList using an Iterator.LO3L3
25Analyze why removing elements directly during collection traversal can cause problems and suggest an appropriate approach.LO3L4
26Compare ArrayList, List and Set for a student-record application based on ordering, duplicates and flexibility.LO3L4

5 Marks questions

No.QuestionLOBloom
1A 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.LO3L6
2A 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.LO3L6
3An online examination program may encounter invalid array access, invalid input and arithmetic errors. Analyze the possible failures and design an exception-handling strategy.LO3L6
4A college needs to maintain a dynamically changing list of student names. Develop an ArrayList-based solution supporting insertion, deletion, searching and traversal.LO3L6
5A 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.LO3L5
6Given a collection-processing program containing multiple exceptions and nested try blocks, analyze the execution flow and predict which exception handler will execute.LO3L4
7A developer uses an array for a dataset whose size changes continuously. Evaluate this design and redesign the solution using the Collection Framework.LO3L5/L6

Leave a Comment