0% found this document useful (0 votes)
11 views5 pages

Question Bank

The document is a comprehensive Java programming question bank, containing a variety of questions categorized into 2 marks and 5 marks sections, covering topics such as Java basics, data types, operators, control structures, object-oriented concepts, arrays, and collections. It also includes programming exercises that require writing Java code for various algorithms and tasks. This resource serves as a study guide for individuals preparing for Java programming assessments or interviews.

Uploaded by

avanijagtap2
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)
11 views5 pages

Question Bank

The document is a comprehensive Java programming question bank, containing a variety of questions categorized into 2 marks and 5 marks sections, covering topics such as Java basics, data types, operators, control structures, object-oriented concepts, arrays, and collections. It also includes programming exercises that require writing Java code for various algorithms and tasks. This resource serves as a study guide for individuals preparing for Java programming assessments or interviews.

Uploaded by

avanijagtap2
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
You are on page 1/ 5

Java Programming Question Bank

✅ 2 Marks Questions (20 Questions)


1.​ What is the purpose of JDK and JRE?

2.​ why java is platform independent.

3.​ Mention any two key features of Java.

4.​ What is the purpose of JVM?

5.​ State the syntax of declaring a variable in Java.

6.​ What is the difference between int and float data types?

7.​ What is a constant in Java? Give an example.

8.​ Define implicit and explicit type casting.

9.​ What is the output of: System.out.println(10 % 3);?

10.​Differentiate between = and == operators.

11.​Write syntax for an if statement in Java.

12.​State the difference between while and do-while loop.

13.​What is the use of break statement?

14.​Write any two string methods in Java.

15.​What is a method signature?

16.​Define method overloading.

17.​What is an abstract method?

18.​What is static method?

19.​Define instance method?

20.​Give the syntax to declare a one-dimensional array.

21.​Write one difference between ArrayList and HashSet.

22.​What is the use of Collections.enumeration()?

✅ 5 Marks Questions (30 Questions)


Java Basics

1.​ What is Java? Explain its key features.

2.​ Describe the Java Virtual Machine (JVM) and its role.

3.​ Explain the difference between JDK, JRE, and JVM.

4.​ What is the significance of the main() method in Java?

5.​ Explain the concept of platform independence in Java.

6.​ What is bytecode in Java?

7.​ Explain the concept of class and object with examples.

8.​ What are access modifiers? Describe each with examples.

9.​ Explain the concept of encapsulation in Java.

10.​What is the difference between compile-time and run-time errors?

✅ Data Types and Variables


11.​Explain the primitive data types in Java with a table.

12.​What are the different types of variables in Java? Give examples.

13.​Differentiate between static and instance variables.

14.​What is type casting? Differentiate between widening and narrowing.

15.​Explain constants and final keyword in Java.

✅ Operators and Expressions


16.​Describe arithmetic, relational, and logical operators with examples.

17.​What is operator precedence? Explain with an example.

18.​What is the difference between expressions and statements?

19.​Explain the use of increment and decrement operators in Java.

20.​What is the difference between == and .equals() in Java?

✅ Control Structures
21.​Describe different types of conditional statements in Java.

22.​Differentiate between if, if-else, and if-else-if statements.

23.​What is a switch statement? When is it preferred over if-else?

24.​Compare for, while, and do-while loops.

25.​Explain the use of break and continue in loops with examples.

✅ Object-Oriented Concepts
21.​What is inheritance? Explain its types in Java.

22.​Explain method overloading and method overriding with examples.

23.​What is a constructor? Differentiate between default and parameterized constructors.

24.​What is abstraction? How is it implemented in Java?

25.​Explain polymorphism with suitable examples.

✅ Arrays – Theory Questions


26.​What is an array in Java? Why is it used?

27.​How do you declare, create, and initialize an array in Java?

28.​What are the advantages and limitations of arrays?

29.​Explain the difference between one-dimensional and two-dimensional arrays with examples.

30.​What happens if you access an array index out of bounds?

31.​How can arrays be passed to methods in Java?

32.​Write the syntax for initializing a 2D array using nested loops.

33.​How do you find the length of an array in Java?

34.​Differentiate between arrays and ArrayList.

✅ Collections – Theory Questions


35.​What is the Java Collection Framework? Why is it used?

36.​List and explain the core interfaces of the Java Collection Framework.

37.​Differentiate between List, Set, and Map in Java.


38.​What is the difference between ArrayList and LinkedList?

39.​What is the purpose of the Iterator interface?

40.​What are the key methods provided by the Collections class?

Programs:

1.​ Write a Java program to find the sum of digits of a number.

2.​ Write a Java program to reverse a number.

3.​ Write a Java program to check whether a number is a palindrome or not.

4.​ Write a Java program to check whether a number is prime or not.

5.​ Write a Java program to find the factorial of a number.

6.​ Write a Java program to check whether a number is even or odd.

7.​ Write a Java program to find the greatest of three numbers.

8.​ Write a Java program to check whether a number is an Armstrong number or not.

9.​ Write a Java program to check whether a number is a perfect number or not.

10.​Write a Java program to count the digits in a number.

11.​Write a Java program to reverse an array.

12.​Write a Java program to find the sum of all elements in an array.

13.​Write a Java program to count even and odd numbers in an array.

14.​Write a Java program to copy all elements of one array into another.

15.​Write a Java program to reverse a string.

16.​Write a Java program to check whether a string is a palindrome.

17.​Write a Java program to count the number of vowels and consonants in a string.

18.​Write a Java program to convert a string to uppercase and lowercase.

19.​Write a Java program to remove all spaces from a string.

20.​Write a Java program to replace a character in a string.

21.​Write a Java program to swap two numbers without using a third variable.

22.​Write a Java program to check whether a year is a leap year or not.


23.​Write a Java program to generate Fibonacci series up to n terms.

24.​Write a Java program to calculate the power of a number using a loop.

25.​Write a Java program to generate the multiplication table of a given number.

You might also like