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

Question Bank

The document contains questions from 13 units covering Java programming concepts. The questions cover topics such as Java history and applications, data types, operators, control flow, OOP concepts, exceptions, strings, threads, I/O, collections, AWT/Swing, Applets, and JDBC.

Uploaded by

Aakash Shrestha
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)
132 views5 pages

Question Bank

The document contains questions from 13 units covering Java programming concepts. The questions cover topics such as Java history and applications, data types, operators, control flow, OOP concepts, exceptions, strings, threads, I/O, collections, AWT/Swing, Applets, and JDBC.

Uploaded by

Aakash Shrestha
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

Questions of all Chapters:

Unit 1:

1. Describe the history of Java in brief. Also write their applications.


2. What are the features in Java?
3. How does Java enables high performances?
4. What are the Java IDE‟s?
5. What are the oops concept?
6. What do you mean by JVM? Explain their working mechanism.
7. What is bytecode? Explain its importance?
8. .class file is called machine independent code why?
9. What do you mean by java applets? How it is differ from java program? Explain.
10. Describe the basic structure of a java program. And explain each of the parts.
11. What is the use of public in java code? Explain.
12. How to set pat in java?
13. How to compile and run java source code from console? Explain.
14. What do you mean by Object oriented programming? Explain their features.
15. Differentiate between object oriented and procedure oriented programming.

Unit 2:

1. What is data type?


2. Write a program to get a number from the user and print whether it is positive or negative.
3. Write a java program to solve quadratic equations(use if, else if and else).
4. Write a java program that keeps a number from the user and generates an integer between 1 and 7
and displays the name of weekday.
5. Differentiate between while and do-while loop with suitable example.
6. Define for loop. Differentiate it with enhanced for loop, while loop and do-while loop.
7. Differentiating between break and continue statement.
8. Define switch statement by entering user input characters of first letter of Weekdays and display the
weekday.
9. Define operator. List out the possible operators in java and also describe bitwise operator with
suitable example.
10. Write a java program that takes user input to provide a single character from the alphabet. Print
vowel or consonant, depending on the user input. If the user input is not a letter print an error
message.
11. Write a program to display the multiplication table of a given integer.
12. A school has the following rules for grading system;
a. Below 25 – F
b. 25 to 45 –E
c. 45 to 50 – D
d. 50 to 60 – C
e. 60 to 80 – B
f. Above 80 – A

Ask user to enter marks and print the corresponding grade.


13. Compute the product from 1 to 11, 1 to 12, 1 to 13 and 1 to 14. Write down the product obtained and
decide if the results are correct. Check the results with factorial 11, factorial 12, factorial 13 and
factorial 14.
14. Write a program to find the Fibonacci series of first 20 numbers. F(n)=F(n-1)+F(n-2) and F(1) =0
and F(2)=1.
15. Write a program called Swap2Integers that prompts user for two integers. The program shall read the
inputs as int and save in two variables called number 1 and number 2; swap the contents of the two
variables and print the results.
16. Write a program that prompts positive integer. The program shall read the input as int and print the
“reverse” of the input integer.
17. Write a program to check whether the positive integer is palindrome or not.

Unit 3:

1. What are class and an object? How it is created in java? Explain the difference between reference
and object.
2. What is constructor? Describe their types.
3. What is constructor overloading? How it is different from method overloading?
4. What is the use of “this” keyword in java? Show the different areas where we can use “this” keyword
with examples.
5. What is nested method? Explain with suitable example.
6. What is the use of static keyword? Explain static data, static method and static block with suitable
example.
7. Write a program to find the perimeter and area of a triangle having sides of 3, 4 and 5 units by
creating a class named “Triangle” without any parameter in its constructor.
8. Write a program to find the area of rectangle and square using constructor overloading. (hint: use
parameterized constructors to initialize the length and breadth of the shapes).
9. What is access control in java? Explain their types with examples.
10. What is recursion? Write a program to find the factorial of given number by using recursion.
11. How to pass value to methods in java. Differentiate between pass by value and pass by reference
method with suitable examples.
12. What do you mean by Anonymous inner class in java? Explain.

Unit 4:

1. Define inheritance. Discuss the benefits of using inheritance and discuss how can multiple
inheritance can be achieved in java?
2. What are different types of inheritance supported by java? Explain all with suitable diagrams and
examples.
3. What is the difference between inheritance and aggregation? Explain with suitable examples.
4. Explain the difference between abstraction and encapsulation with suitable examples.
5. Create a class named “Rectangle” with two data members „length‟ and „breadth‟ and two methods to
print the area and perimeter of the rectangle respectively. Its constructor must initialize these two
data members. Again create a new class “Square” inherits the class “Rectangle” class with its
constructor having a parameter for its side (suppose s) calling constructor of its parent class as
„super(s,s). Print he area and perimeter of a Rectangle and a Square.
6. What is method overriding? How it is differ from method overloading, explain with examples.
7. What is an interface? How it is different from class?
8. What is dynamic method dispatch and up-casting in inheritance? Explain with suitable examples.
9. What is package in java? Describe its types with suitable example.
10. Differentiate between this() and super() method in re-using constructors.

Unit 5:

1. What is an exception in java?


2. What are the different types of exceptions in java?
3. How exceptions can be handled? Explain different blocks with suitable examples.
4. What is the purpose of throw and throws keyword? Explain with suitable example.
5. What is the difference between error and exception?
6. What are chained exceptions in java? Explain with examples. [hint: throwing exceptions from
different catch blocks]
7. Write a program for user defined exceptions with suitable example.

Unit 6:

1. How can we make any string lower case and upper case using String methods?
2. How to compare two strings in java? Explain with example.
3. How to split string in java?
4. How to check whether two strings are equal or not?
5. How to count a number of vowels and consonants in a string?
6. Write a java program to compare a given string to the specified string buffer.

Unit 7:

1. What is a thread?
2. Describe the complete life cycle of a thread.
3. What is synchronization? When do we use it? Explain with example.
4. Write a program illustrating the thread priority.
5. How inter thread communication is possible between multiple threads. Explain with suitable
example. [hint: use wait and notify methods]
6. What is deadlock? Justify it with suitable example.
7. Differentiate between synchronized method and synchronized block with suitable example.

Unit 8:

1. What is IO stream?
2. What are FileInputStream and FileOutputStream classes?
3. What is serialization and deserialization? Explain with suitable example.
4. What is the difference between byte streams and character streams?

Unit 9:

1. What is a wrapper class? Explain each classes in detail.


2. Write a program to illustrate Integer class as a wrapper class of int.
3. Differentiate between autoboxing and unboxing with appropriate examples.
4. Write a program that demonstrates the java.lang.Number class, which includes Byte, Integer,
Double, Short, Float, Long and its corresponding methods.
5. Write a program to implement all the methods used in Stack class.
6. Write a program implementing the Random class and its associated methods.
7. Write a program that demonstrated the use of HashTable, Dictionary and Enumeration using next()
and hasNext() methods.

Unit 10:

8. What is difference between HashMap and HashTable?


9. What is the difference between Array and ArrayList?
10. What is a vector, elaborate with an appropriate example?
11. What is the difference between HashSet and TreeSet? Differentiate with appropriate example.
12. What are the similarities and differences between Vector and ArrayList?
13. Write a program that demonstrates List and ArrayList, Map and HashMap.

Unit 11:

1. What is the difference between AWT and Swing?


2. Draw the hierarchy for both AWT and Swing.
3. What is the difference between JFrame and JPanel?
4. What is the difference between components and container? Illustrate with example.
5. Write a program input the values from two different JTextField and concatenate these two strings
and display it to a JLabel.
6. Write a program for JCheckBox and JRadioButton.
7. Write a program for JList with event handlers.
8. Write a program to add JMenuBar, JMenu and JMenuItem in a JFrame. Write a complete program.
9. What is the default layout for JFrame and JPanel? Write a program for FlowLayout, BorderLayout
and GridLayout?
10. What is an event? What are the different ways of using event handling?
11. Write a program for action event, key event, mouse event.
12. What are adapter classes? What are the advantages of using adapter classes over listener interface in
event handling?

Unit 12:

1. What is an Applet?
2. Explain the Lifecycle of an Applet.
3. Can we perform the programming in Applet in present? If not, why?

Unit 13:

1. What is JDBC?
2. What are Connection and Statement classes of java.sql package? Why are they used in database
connectivity in Java?
3. Write a complete procedure to connect the java application to mssql server with proper code.
4. Write a complete program;
a. To create a table
b. To insert data
c. To update data
d. To select data
e. To delete row data
5. What is ResultSet? What is ResultSet concurrency?
6. Why are absolute(), relative(), first(), last() methods used in ResultSet Concurrency?

You might also like