0% found this document useful (0 votes)
3 views

JAVA Reference Questions

The document outlines a comprehensive curriculum for Object Oriented Programming using Java, covering topics such as Collections, MultiThreading, Database Programming, and Servlets and JSP. It includes definitions, explanations, comparisons, and programming exercises related to various Java concepts and frameworks. Each chapter contains numerous questions and programming tasks aimed at reinforcing understanding of the material.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

JAVA Reference Questions

The document outlines a comprehensive curriculum for Object Oriented Programming using Java, covering topics such as Collections, MultiThreading, Database Programming, and Servlets and JSP. It includes definitions, explanations, comparisons, and programming exercises related to various Java concepts and frameworks. Each chapter contains numerous questions and programming tasks aimed at reinforcing understanding of the material.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Indira College of Commerce and Science, Pune.

Object Oriented Programming using Java–II


T. Y. B. Sc. (CS)
CH1:Collections
1. Define Collection.
2. What is a Collection Framework?
3. Define List.
4. Define Set.
5. What is the use of Map interface?
6. List components for the Collection framework.
7. Give the purpose of ArrayList.
8. Defne Iterator.
9. What is the Enumeration interface?
10. Define comparator.
11. What is the use of the LinkedList class?
12. Compare the Map and Set interface with any two points.
13. What TreeSet?
14. List any methods for the Collection interface.
15. What is the Collections Framework? Explain with a diagram. Also, state its
advantages.
16. What are the core collection interfaces? Explain any two of them in detail.
17. What is the use of the LinkedList class? Explain with an example.
18. What is HashMap? Describe with an example.
19. Write a Java program to read n strings and store them into linkedList, also
displaycontents of the same LinkedList.
20. Write a java program that reads in a series of first names and stores them in a
LinkedList. The program should not allow to storageof duplicate names and it
should allow the user to search for a first name.
21. Explain TreeSet in detail.
22. What is the Iterator interface? Describe with an example.
23. What is Comparator Interface? Explain in detail the example.
24. With the help of the Enumeration interface.
25. Differentiate between Comparator Interface and the Enumeration interface.
26. "ArrayList is a list implemented using a resizable array". Comment.
27. Write a program to accept employee information as (id, name). Store it into
Hashtable. Display only names of all employees.
28. Write a java program to read n strings into ArrayList collection. Display the
elements of collection in reverse order.
29. Write a Java program to read n strings into Arraylist collection and sort the
elements of collection in descending order (use comparator).
30. Create the Hashtable that will maintain the mobile number and student name.
Display the contact list.
31. Write a program that uses the Hashtable class for storing and retrieving employee
records.
32. Write a program to read 10 strings from console and add them in a collection. The
strings should be stored in the collection in the descending order. Display the
elements of the collection using iterator.
1. What is the difference between an Iterator and List Iterator?
2. Write a Java program to accept 'n' employee information (id, name) and store into
Hashtable. Display all employee details.
3. State four constructors of HashSet class.
4. What is collection?
5. Which interfaces are implemented by TreeSet class?
6. Explain map interface. Give its implementation.
7. State the use of Iterator and List Iterator.
8. State constructors of TreeSet class.
9. Write a program that uses Hashtable for storing and retrieving students record
(containing Name and Percentage) Display the details of students having higher
percentage.
10. List any four collection interfaces.
11. State the use of iterator with its syntax.
12. Write a program to create a linklist of four integer objects and do the following
operations.
a. Add element at first position
b. Delete last element.
13. Write any two differences between ArrayList and LinkedList.
14. What is collection framework?
15. Write a note on TreeMap class.
16. Write a code using Hashtable, that will maintain the names and phone nos of
twostudents.
17. Which method of Hashtable returns a duplicate of the invoking object?
18. Explain the use of collection Interface?
19. Write a Java program to accept names of n cities, insert the same into array list
collection and display the content of the same array list, also remove all
theseelements.
CH2:MultiThreading
20. Define thread.
21. What is multithreaded program
22. Which states occurs in life cycle of multithreading. 4. Define thread priority.
23. Explain the purpose of join() method in the threads.
24. Define inter-thread communication.
25. Java's multithreading built upon the Thread class. State true or false.
26. Compare thread and process. Any two points.
27. What is the use of notifyAll () method?
28. Which are the two ways that are used to create a new thread in Java?
29. Name the methods used for inter-thread communication.
30. Give the purpose of synchronization.
31. "A thread is a lightweight process". Comment.
32. What is the purpose of multithreading.
33. What is multithreading? Explain with diagram.
34. What is synchronization? Why it is needed? Describe in detail.
35. What is thread? Define multithreaded program. What is its purpose in Java? 4. What
is inter-thread communication? Describe with a program.
36. Describe life cycle of thread with diagram.
37. What is thread priority? How they can be used in program? Explain in detail. 7. How
to create a thread? Explain with suitable example.
38. What is synchronization? How can thread synchronization be achieved in Explain
with example.
39. What is main thread? Describe with example.
40. Write a short note on: Running multiple threads.
41. What will be the output of the program?
class Test extends Thread
{
public
void run()
{
System.out.println("Run");
}
} class Myclass {
public
static void main(String[] args)
{
Test t = new Test();
t.start();
}
}
42. State two-way in creating thread.
43. What is the purpose of join method in the context of thread?
44. Write a note on thread priorities.
45. What is the use of notify() and notifyAll() methods? .
46. State any two methods of inner-thread communication.
47. How do we set priority to thread?
48. Explain thread life cycle with its methods.
49. Explain the purpose of join method in the context of threads.
50. Give two differences between Multithreading and Multitasking.
51. Write a program to display "examination" 50 times using multithreading.
52. What is Multithreading?
53. "Java can control different types of multitasking" True/False - Justify.
54. What are two different ways used to implement threading in Java? Explain with
example.
55. Explain the purpose of yield() method in the context of thread.
56. "Multithreading is better than multiprocessing". Comment.
57. State any two methods for inter-thread communication.
58. Explain life cycle of thread.
59. Why synchronization is used to implement threading in Java?
60. How do we set priority to threads?
61. Explain thread synchronization with an example.
62. State two ways in creating a Thread.
CH3: Database Programming
63. Define database and DBMS.
64. What is JDBC?
65. Define JDBC driver.
66. What is the advantage of using PreparedStatement over Statement?
67. Which class manages list of database drivers.
68. What is the role of Connection interface.
69. What is ResultSet?
70. Define transaction in database.
71. What is the use of callable statement?
72. When to use executeUpdate()?
73. Name the class responsible for selecting database drivers and creating a new database
connection.
74. Define metadata.
75. What is the use of SetAutoCommit()?
76. List any two methods for creating transaction.
77. What is the purpose of PreparedStatement?
78. List the types of JDBC drivers.
79. With the help of diagram describe working of JDBC. Also explain JDBC
80. What are the components of JDBC? Explain with them with their role.
81. Write a short note on: Design of JDBC.
82. What is JDBC driver? List its types. Explain with diagram.
83. With the help of example describe how to connect database in Java using De
84. How to executing SQL statements? Describe in detail.
85. What is ResultSet? How it can be used in JDBC? Explain with example.
86. What is metadata? Explain in detail.
87. What is savepoint? What is its use? How to create it? Explain with example.
88. Write a short note on: Scrollable and Updatable ResultSet.
89. What is batch updates? How it works? Explain with example.
90. State the difference between statement, callable statement and pre
91. Write a JDBC program to display all details of the student table (roll, name,
maks).Also perform insertion and updation operation on student database.
92. Write the Java method that creates scrollable and Updatable ResultSet.
93. What is use of SetAutoCommit()?
94. What is metadata? How do you create database and ResultSet metadata? Expla in
detail.
95. Write a JDBC program to insert student details in student table (roll, name, mark and
display all details.
96. What are four types of JDBC drives?
97. When to use PreparedStatement?
98. Write a JDBC program to insert following 'n' records to employee table have structure
emp_no, emp_name and salary and display it.
99. What is ResultSet? Explain scrollable and updatable resultsets.
100. Which packages are required of Java database connectivity?
101. What is purpose of rollback() in transactions in Java database connectivity?
102. What is use of the following in JDBC?
a. execute()
b. executeUpdate()
c. executeQuery()
d. statement()
e. preparedStatement().
103. Write a JDBC program to read, update any record from database. Database about
element Oxygen and Hydrogen has the following fields: (Atomic weight, name,
chemical symbol). The input should provided through command line. For example,
Java pgm_name R will Read and show the contents of the table Java pgm_name U 10
'oxygen' 137 will update the record according to the name specified.
104. When to use execute update (string sql) method?
105. Name the statement types used for executing SQL queries.
106. Write a JDBC program to display information about table such as column labels,
number of columns and column type (Table name is stud and Database name is
Exam).
107. Explain JDBC architecture in detail.
108. State the advantage of using type 3 JDBC driver.
109. Explain JDBC architecture with types of JDBC drivers.
110. The project in a database has the following fields: Title (text), StudentName
(text), duration (Number), Class (text), and submission date (date).
111. Write a Java program to read the project details from the user and add it in the
table. Continue the process until the user presses 'Y' to the prompt. Add more
(Yes/No)?
112. What is the use of commit() in Transactions in Java?
113. Write the Advantages of using a Type 4 driver in Database connectivity.
114. Write a JDBC program that acceptsthe department from the user and displays the
emp information, who hasa maximum salary from that department.
CH4:Servlets and JSP
115. What is Servlet?
116. Define cookie.
117. What is JSP?
118. Which method is used to send a cookie to the client from Servlet?
119. State the difference between doGet and doPost methods.
120. Which methods are used to obtain and store information from HttpSessionobject?
121. Which method is used to send the cookie from server to the client? Give itssyntax.
122. What is session?
123. What is purpose of JSP directives?
124. Name the methods in the lifecycle of a Servlet.
125. What is scriplet?
126. How to send cookie from server to client?
127. Name the method to get all values of a parameter passed from html to Servlet.
128. List the different ways by which session tracking can be done.
129. What are the parameters of the doGet method in Servlet?
130. State any two predefined variables provided by JSP.
131. What is JSP action?
132. Define session tracking.
133. What is Servlet technology? Explain with example. What are its advantages and
disadvantages?
134. With the help of diagram describe Servlet hierarchy.
135. Explain the life cycle of Servlet diagrammatically.
136. How many types are there in Servlet? Explain.
137. What is a cookie? How to create and access it? Explain with example.
138. What is session? How to track it? Explain with example.
139. Write a program for making a registration form which collects name and email address
send this data to a Servlet that displays it.
140. Describe the relationship between Servlet and JSP. Also compare them.
141. Write a Servlet program which display the current date and time.
142. Write a Servlet which accepts a font name and name of background color from user and
use this information to display text in the specified font and change the background color of
the HTML page to the specified color.
143. Write a Servlet code to get information about the server such as name of server, server port
number and server version.
144. Explain architecture of JSP with the help of diagram.
145. Write a short note on: JSP directives.
146. What are the components of JSP? Describe two of them in detail
147. Explain the following terms in context of JSP:
148. scriptlets
149. expression.
150. What is purpose of JSP directives? Explain with syntax and example.
151. What are JSP scripting elements? Describe them in brief.
152. What is the purpose of implicit objects? Explain any two implicit objects in JSP.
153. Differentiate between Servlet and JSP.
154. State the difference between doGet() and doPost() methods.
155. How do you create a session using HttpSessionobject.
156. List any two difference between JSP and Servlet.
157. What is scriptlet? Write syntax of scriptlet.
158. What is cookies? Explain how cookies are created and accessed in Servlet.
159. Explain JSP life cycle.
160. Write a note on JSP Expressions with example.
161. What is Servlet?
162. Write syntax of comments in JSP.
163. What is purpose of JSP directives?
164. Explain the purpose of GET and POST method is Servlet request. Differentiate between
doGet() and doPost() methods.
165. Write a Servlet program to count the number of times a Servlet has been invoked.
166. What is JSP? Explain JSP life-cycle.
167. What is cookie? Explain how cookie can be created and accessed in servlet.
168. What are advantages of JSP?
169. What is the use of page directives in JSP?
170. List the parameters of the doPost method is Servlet.
171. Write a Servlet program that accept teacher id, name and subject and also print the same.
172. Explain Servlet lifecycle with the help of a diagram.
173. Write a JSP program which takes Multiplicant and Multiplier from user as input and after
clicking on "Multiply" button it will display Multiplicant, *, Multiplier and Product.
174. Differentiate between doGet() and doPost() methods.
175. Explain scripting elements in JSP.
176. What is cookie? How to set cookies explain with example.
177. Which JSP tag is used to give declaration?
178. Write a Servlet program which display the current data and time.
179. Explain scripting elements in JSP.
180. What is Servlet? State its advantages.
181. List implicit objects in JSP and explain any two implicit objects in JSP.
182. Write any two methods of HTTP session.
183. Explain the session tracking.
184. What is scriplet?
185. Write a Servlet program to get information about the server such as name, server port
number and server version.
186. Write JSP program to demonstrate all three scripting tags used in JSP. Ans. Refer to
Additional Program.
187. Write JSP program to accept student name, address and class from HTML and display it on
another page.
188. What is a Servlet? Differentiate doGet() and doPost() methods.
189. Write a Servlet program to count number of times a Servlet has been invoked.
190. What is JSP? Explain JSP life cycle.
191. Explain and write the syntax of getcookies() method in Servlet? Refer to Section 4.7.2.4.
192. State three methods which are used for session tracking?
193. Write a general syntax of include directive in JSP?
194. Write a Servlet to get information about the server such as name of server, port number of
server.
195. Explain the Servlet Life Cycle.
196. Explain scripting elements in JSP?
197. Explain life cycle of JSP.
CH5:Spring Framework
198. What is Spring?
199. "Spring is lightweight, loosely coupled and open source". Comment this statement.
200. List modules in Spring.
201. What is Inversion of Control and dependency Injection?
202. What is Spring MVC?
203. List any two applications of Spring.
204. Spring has MVC architecture. State true or false.
205. List modules for Spring.
206. What is Spring Framework? Explain in detail.
207. With the help of diagram describe MVC Spring architecture.
208. What are the applications of Spring?
209. With the help of diagram describe module architecture of Spring.
---------xxxxxxxxxxx-----------

You might also like