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

Oopj Question Bank

Qp

Uploaded by

ushapetchi
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)
23 views

Oopj Question Bank

Qp

Uploaded by

ushapetchi
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/ 9

OBJECT ORIENTED PROGRAMMING

USING JAVA
QUESTION BANK
(Dr. Kalyan Kumar Jena)
1. Write a program to display “hello world”.
2. Write a program that shows the use of bit wise operators.
3. Write a program that shows the use of arithmetic operators.
4. Write a program that shows the use of increment and decrement operators.
5. Write a program to display the area of circle using (i)command line argument, (ii)Scanner class (iii)
BufferedReader class
6. Write a program to display the addition result of any two integers.
7. Write a program for the swapping of two numbers.
8. Write a program to print all the prime numbers between 1 to 100.
9. Write a program to print all the palindrome number between 100 to 500.
10. Write a program to display the student name, roll no and age of a student using class and object
concept.
11. Write separate programs that shows the implementation of
(i)static variable and static member function
(ii)static block concept
12. Write a program that shows the use of default, parameterized and copy constructor.
13. Write separate programs for method overloading and method overriding mechanism.
14. Write a program for single inheritance mechanism.
15. Write a program where abstract class concept is used.
16. Write a program to pass the arguments from child class constructor to parent class constructor using
super ( ).
17. Write a program to display name, department and age of employee using interface mechanism
18. Write a program for the implementation of user defined package.
19. Write a program for the manipulation of string using different functions of String class.
20. Write a program for the execution of multiple threads with their priority.
21. Write a program for the execution of multiple threads.
22. Write a complete program for the execution of applet mechanism.
23. Write a program for drawing several GUI components on applet.
24. Write a program for the implementation of several methods of Graphics class.
25. Write a program for handling multiple exceptions.
26. Write a complete program for Java Database Connectivity.
27. Write a program to enter two numbers(say a and b) and an option. If the option is:
1:display the result (a+b)
2: display the result (a-b)
3: display the result (a*b)
4: display the result (a/b)
5: display the result (a%b)

28. Write a program to display emp. no=101 and emp. name=”Martin” using class and object concept.
29. Write a program to display the area of triangle, rectangle and circle using constructors.
30. Write a program to print all the armstrong numbers between 200 to 400.
31. Write a program to check whether a number is prime or not.
32. Write a program to check whether a number is armstrong or not.
33. Write a program to check whether a number is pallindrome or not.
34. Develop a menu based program for the addition, subtraction, multiplication and division of two
complex numbers.
35. Write a program for the addition, subtraction, multiplication and division of two numbers using
constructor.
36. Write a program for addition of two 3x3 matrix.
37. Write a program for multiplication of two 3x3 matrix.
38. Write a program to display the transpose of a 3x3 matrix.
39. Write a program to display the sum of digits of a number.
40. Write a program to display the reverse of a number.
41. Write a program to enter n numbers to an array and display the greatest and smallest number.
42. Write a program that shows the use of multilevel inheritance mechanism.
43. Write a program that shows the use of multiple inheritance mechanism using interface.
44. Write a program to display car no., model, color and price of a car using class and object concept.(use
Scanner class)
45. Write a program to display the area of circle, triangle and rectangle using user defined package
46. Write a program to display the name, pages, price and author of a book using interface mechanism.
47. Write a program to display the average of five integers.
48. Write a program to display simple interest.
49. Write a program to display the factorial of a number.
50. Write a program to display the fibonacci series upto n terms.
51. Write a program to enter two numbers and display the GCD and LCM.
52. Write a program to convert decimal number to binary number.
53. Write separate programs for different pyramid structures.
54. Write a program for the implementation of swing components.
55. Write a java socket programming in which client sends a text and server receives it.
56. What are the OOP Principles?
57. What is Encapsulation?
58. What is Polymorphism?
59. What is Inheritance?
60. What are the features of Java Language?

61. What is the need for Java Language?


62. What is platform independency?
63. What is Architecture Neutral?
64. How Java supports platform independency?
65. Why Java is important to Internet?
66. What are the types of programs Java can handle?
67. What is an applet program?
68. Compare Application and Applet.
69. What are the advantages of Java Language?
70. Give the contents of Java Environment (JDK).
71. Give any 4 differences between C and Java.
72. Give any 4 differences between C++ and Java.
73. What are the different types of comment symbols in Java?
74. What are the data types supported in Java?
75. What is the difference between a char in C/C++ and char in Java?
76. How is a constant defined in Java?
77. What is the use of final keyword?
78. What are the different types of operators used in Java?
79. What is short-Circuit operator?
80. What is labeled break?
81. What is the use of for each control structure?
82. What is the need for static variables?
83. What is the need for static methods?
84. Compare static constants and final constants.
85. Why is main method assigned as public?
86. Why is main method assigned as static?
87. What are the types of variables Java handles?
88. What are the relationships between classes?
89. What is the general form of a class?
90. What is the use of new keyword?
91. If ObjA1 is an object of class A created using new keyword, What does the statement A
ObjA2=ObjA1; mean?
92. What is a constructor?
93. What is the difference between a constructor and a method?
94. What is the use of this keyword?
95. What are destructors?
96. How is object destruction done in Java?
97. What is Garbage collection?
98. What is the use of finalize method?
99. Compare Garbage collection and finalize method?
100. How is it guaranteed that finalize methods are called?
101. What is method overloading?
102. What is a String in Java?
103. What is the difference between a String in Java and String in C/C++?
104. Name a few String methods.
105. What is the difference between Concat method and + operator to join strings?
106. What is String Buffer?
107. How does String class differ from the String Buffer class?
108. Name some methods available under String Buffer class.
109. Output of some expressions using String methods.
110. How will you initialize arrays?
111. What is arraycopy method? Explain with syntax.
112. What are the methods under Util.Arrays?
113. Use the array sort method to sort the given array.
114. Give the syntax for array fill operation.
115. What is vector? How is it different from an array?
116. What is the constraint for using vectors?
117. What is wrapper class?
118. What are the different access specifiers available in Java?
119. What is the default access specifier in Java?
120. What is a package in Java?
121. Name some Java API Packages.
122. Name some JavaDoc Comments.
123. What is CommandLine Arguments.
124. Explain OOP Principles.
125. Explain the features of Java Language.
126. Compare and Contrast Java with C.
127. Compare and Contrast Java with C++.
128. Explain Constructors with examples.
129. Explain the methods available under String and String Buffer Class.
130. Explain the Date Class methods with examples.
131. Discuss in detail the access specifiers available in Java.
132. Explain the different visibility controls and also compare with each of them.
133. Explain the different methods in java.Util.Arrays class with example.
134. Explain Packages in detail.
135. Discuss the methods under Array Class.
136. Discuss some of the classes available under Lang package.
137. Illustrate with examples: static and final.
138. Explain method overriding with example program.
139. What is javaDoc? Explain the comments for classes, methods, fields and link.
140. Application Programs in Java.
141. Define Inheritance
142. What are the types of inheritance?
143. How is multiple inheritance achieved in java?
144. What is the use of super keyword?
145. What are object wrappers? Give example.
146. What is Inheritance Hierarchy?
147. Differentiate overloading and overriding.
148. Define polymorphism.
149. Differentiate static binding and dynamic binding.
150. When will a class be declared as final?
151. When will a method be declared final?
152. What is an abstract class?
153. What is the need for abstract classes?
154. Explain about protected visibility control.
155. What are the methods under "object" class / java.lang.Object.
156. Explain toString method of object class.
157. What is reflection?
158. What are the uses of reflection in Java.
159. How will you create an instance of Class.
160. What are the methods under reflection used to analyze the capabilities of classes?
161. How to create arrays dynamically using reflection package.
162. Define an interface.
163. What is the need for an interface?
164. What are the properties of an interface?
165. Differentiate Abstract classes and interface.
166. What is object cloning?
167. Differentiate cloning and copying.
168. Differentiate shallow copy and deep copy in cloning.
169. Does Inheritance removes any fields/or methods of super class?
170. Mention the use of final keyword.
171. What is nested class? Mention its types.
172. What is inner class?
173. What is the need for inner classes?
174. What are the rules for inner class?
175. What is local inner class and anonymous inner class? Give their advantages.
176. Write the advantages and disadvantages of static nested class.
177. Define proxies.
178. Write the application of proxies.
179. What are the properties of proxy classes?
180. Explain the concept of inheritance and its types.
181. Explain the concept of overriding with examples.
182. What is dynamic binding? Explain with example.
183. Explain the uses of reflection with examples.
184. Define an interface. Explain with example.
185. Explain the methods under “object” class and “class” class.
186. What is object cloning? Explain deep copy and shallow copy with examples.
187. Explain static nested class and inner class with examples.
188. With an example explain proxies.
189. Develop a message abstract class which contains playMessage abstract method. Write a different
sub-classes like TextMessage, VoiceMessage and FaxMessage classes for to implementing the
playMessage method.
190. Develop a abstract Reservation class which has Reserve abstract method. Implement the sub-
classes like ReserveTrain and ReserveBus classes and implement the same.
191. Develop an Interest interface which contains simpleInterest and compInterest methods and static
final field of Rate 25%. Write a class to implement those methods.
192. Develop a Library interface which has drawbook(), returnbook() (with fine), checkstatus() and
reservebook() methods. All the methods tagged with public.
193. Develop an Employee class which implements the Comparable and Cloneable interfaces.
Implement the sorting of persons (based on name in alphabetical). Also implement the shallow copy
(for name and age) and deep copy (for DateOfJoining).
194. Explain the different methods supported in Object class with example.
195. Explain the methods supported in Class class.
196. Explain the Methods supported in reflect package. Also write a program to implement the
reflection of a particular class details like constructors, methods and fields with its modifiers.
197. Develop a static Inner class called Pair which has MinMax method for finding min and max
values from the array.
198. What is proxy class? Develop a code for constructing a proxy objects to trace a binary search
method with explanations.
199. Draw the inheritance hierarchy for the frame and component classes in AWT and Swing.
200. What are the advantages of using swing over awt?
201. How do achieve special fonts for your text? Give example.
202. Give the syntax of drawImage() and copyArea() methods.
203. What is Adapter class?
204. Draw the AWT event Hierarchy.
205. What are the swing components?
206. What are the methods under Action Interface.
207. What are the methods under WindowListener Interface.
208. What is the difference between Swing and AWT?
209. Explain the classes under 2D shapes.
210. Explain event handling with examples.
211. Explain action event with an example.
212. What are the swing components. Explain.
213. Describe the AWT event hierarchy.
214. What is generic programming?
215. What are Checked and UnChecked Exception?
216. What are checked exceptions?
217. What are runtime exceptions?
218. What is the difference between error and an exception?
219. What classes of exceptions may be caught by a catch clause?.
220. If I want an object of my class to be thrown as an exception object, what should I do?
221. How to create custom exceptions?
222. What are the different ways to handle exceptions?
223. What is the purpose of the finally clause of a try-catch-finally statement?
224. What is the basic difference between the 2 approaches to exception handling.
225. Is it necessary that each try block must be followed by a catch block?
226. How does Java handle integer overflows and underflows?
227. Explain generic classes and methods.
228. Explain exception hierarchy.
229. What are the advantages of Generic Programming?
230. Explain the different ways to handle exceptions.
231. How Java handle overflows and underflows?
232. Describe synchronization in respect to multithreading.
233. Explain different way of using thread?
234. What is synchronization and why is it important?
235. When a thread is created and started, what is its initial state?
236. What are synchronized methods and synchronized statements?
237. What is daemon thread and which method is used to create the daemon thread?
238. What method must be implemented by all threads?
239. What kind of thread is the Garbage collector thread?
240. What is a daemon thread?
241. What is a thread?
242. What is the algorithm used in Thread scheduling?
243. What are the different level lockings using the synchronization keyword?
244. What are the ways in which you can instantiate a thread?
245. What are the states of a thread?
246. What are the threads will start, when you start the java program?
247. What are the different identifier states of a Thread?
248. Why do threads block on I/O?
249. What is synchronization and why is it important?
250. Explain the different states of a thread.
251. Explain thread synchronization with examples.
252. Explain the algorithm used for thread scheduling.
253. Describe multi threading.
254. Explain Deadlocks.
255. Explain JVM.
256. Explain Bytecode.
257. Explain the three principles of Java.
258. What is class and instance of a class?
259. What are objects? How to create objects?
260. Explain the features of OOP.
261. Explain how the concept of polymorphism is implemented in Java?
262. Explain encapsulation in the object oriented programming.
263. What is encapsulation? How does Java achieve encapsulation?
264. How does Java incorporates the concept of polymorphism? Give one example.
265. What do you understand by encapsulation in Java?
266. Explain the steps involved in implementation of a Java program.
267. Explain the use of JVM.
268. What is Java Development Kit (JDK)?
269. Explain the term polymorphism with an example.
270. Explain the features of Java.
271. Is the following statement true or false? If it is false then supply suitable example:
272. “The data is lost when converted from higher data type to lower data type.”
273. Can you make the keyword public to private in main() method? If yes, what will happen?
274. Explain with an example data types boolean and byte in Java.
275. Explain with an example data type byte in Java.
276. What is type conversion in Java? Explain with an example.
277. Write the difference between the operators = and = = in Java.
278. What is type casting? Give an example to explain it.
279. What are literals? State the boolean literals.
280. List the different operators in Java.
281. What are literals in Java? Mention their different types.
282. What are different integer data types in Java?
283. Explain any two logical operators in Java with example.
284. What is meant by an assignment statement? For what purpose it is used?
285. State the bitwise operators in Java. Explain any one.
286. Write the difference between break and continue statements in Java.
287. Explain switch statement in Java.
288. Explain switch statement with example in Java.
289. Explain the goto statement in Java.
290. Explain while loop in Java.
291. Explain any one loop statement in Java with an example.
292. Explain how arrays are created in Java? How array elements are accessed?
293. How do you declare an array in Java? Give an example.
294. How do you declare a two dimensional array in Java? Give an example.
295. Define an array. How do you declare and create array objects?
296. Can you have two return statements in a method? Can you write any statement after return?
Explain.
297. Write difference between constructor and method.
298. Can you have a method without return statement? Explain.
299. Explain the use of the keyword static in Java.
300. Explain overloading in Java.
301. Explain the return statement in Java.
302. State whether the following statement is true/false with justification “when a reference
variable is assigned to another reference variable, another copy of object is created.”
303. Explain the keyword new in Java.
304. Explain the meaning of the keywords used in the declaration of main() method.
305. What is an instance variable? How does one access an instance variable of a class?
306. Explain different types of constructors in Java.
307. What are constructors? How are they different from methods?
308. Explain overloading methods with an example.
309. Write a short note on this keyword.
310. Explain the finalize method.
311. What do you understand by an abstract class?
312. What is method overriding and how does it differ from methos overloading in Java?
313. When can a method in super class be prevented from being overridden by a method in
subclass?
314. Explain by an example.
315. Explain in brief the overriding methods in Java.
316. Explain the use of the keyword final in Java programming.
317. Explain the use of finalize method.
318. State the different access specifiers available in Java.
319. What is method overriding and how does one prevent a method from being overridden?
320. State any two differences between method overloading and method overriding.
321. What do you understand by inheritance in Java?
322. How does a subclass constructor call a super class constructor?
323. Write a note on finalizer method.
324. Explain the keyword super in Java.
325. What is a class and a subclass? Give examples.
326. What is inheritance? Is multiple inheritance supported by Java?
327. What is data abstraction?
328. Explain the terms subclass and super class.
329. What are different access specifiers in Java?
330. What do you mean by final variable and final method?
331. Explain an abstract class.
332. Explain the term package.
333. What is the major difference between an interface and a class?
334. Explain how to use a particular package in a Java program. Give example.
335. What is an interface? How is it implemented?
336. What do you mean by a package in Java?
337. Write a method to fill a rectangle with red color.
338. What is an applet? How do applets differ from an application programs?
339. Explain life cycle of an applet.
340. Write a method in Java applet to display a circle.
341. How do we pass parameters to an applet? Give one example.
342. What does your method do when start() (life cycle of an applet) is called?
343. Explain destroy() method, a stage in the life cycle of an applet.
344. Write a method to display a message “Computer Programming” at position (50, 20)
inside a square.
345. Explain drawRect () method in Graphics class with suitable example.
346. How getParameter () method is used in applet?
347. Explain Font class and Color class.
348. Explain the steps involved to execute and run an applet.
349. What is AWT? What are the various components in AWT?

You might also like