

MCQOPTIONS
Saved Bookmarks
This section includes 215 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
151. |
Which of the following package stores all the standard java classes?a) jav |
A. | lang |
B. | java |
C. | java.util |
D. | java.packages |
Answer» B. java | |
152. |
What is the preferred way to handle an object's events in Java 2? |
A. | Override the object's handleEvent( ) method. |
B. | Add one or more event listeners to handle the events |
C. | Have the object override its process Event ( ) methods. |
D. | Have the object override its dispatch Event ( ) methods. |
Answer» C. Have the object override its process Event ( ) methods. | |
153. |
In order for a source code file, containing the public class test, to successfully compile,which of the following must be true? |
A. | It must have a package statement |
B. | It must be named test.java |
C. | It must import java.lang |
D. | It must declare a public class named test. |
Answer» C. It must import java.lang | |
154. |
java.awt.Component class method getLocation() returns Point (containg x and y cordinate).What does this x and y specify |
A. | Specify the postion of components lower-left component in the coordinate space of the component's parent. |
B. | Specify the postion of components upper-left component in the coordinate space of the component's parent. |
C. | Specify the postion of components upper-left component in the coordinate space of the screen. |
D. | none |
Answer» C. Specify the postion of components upper-left component in the coordinate space of the screen. | |
155. |
What are the sequences of method executed when an Applet starts execution? |
A. | init(),start(),stop(),destroy() |
B. | load(),start(),stop(),unload() |
C. | init(),activate(),deactivate(),destroy() |
D. | start(),init(),destroy(),stop() |
Answer» B. load(),start(),stop(),unload() | |
156. |
Which of these events will be generated if scroll bar is manipulated? |
A. | ActionEvent |
B. | ComponentEvent |
C. | AdjustmentEvent |
D. | WindowEvent |
Answer» E. | |
157. |
To design a general-purpose search method, searchList, to search a list, which of thefollowing must be parameters of the method searchList? (i) The array containing the list. (ii) The length of the list. (iii) The search item. (iv) A boolean variable indicating whether the search is successful. |
A. | (i) and (ii) |
B. | (i), (ii), and (iii) |
C. | (ii), (iii), and (iv) |
D. | (i), (ii), (iii), and (iv) |
Answer» C. (ii), (iii), and (iv) | |
158. |
The method that returns the selected item from a List component is |
A. | getSelected() |
B. | getSelectedString() |
C. | getSelectedItem() |
D. | getSelectedData() |
Answer» D. getSelectedData() | |
159. |
What is the process of defining a method in terms of itself that is a method that calls itself? |
A. | Polymorphism |
B. | Abstraction |
C. | Encapsulation |
D. | Recursion |
Answer» E. | |
160. |
When method defined in subclass which has same signature as a method in a super class,it is known as method |
A. | Overloading |
B. | Overriding |
C. | Packing |
D. | None of these |
Answer» C. Packing | |
161. |
Minimum threads in a program are |
A. | 1 |
B. | 2 |
C. | 5 |
D. | Many |
Answer» B. 2 | |
162. |
Through the design mode of a builder tool, we use ___ or ____ to customize the bean. |
A. | Property sheet |
B. | Bean customizer |
C. | Either (a) or (c) |
D. | None of the above |
Answer» D. None of the above | |
163. |
Which of these methods can be used to write console output? |
A. | printout() |
B. | println() |
C. | write() |
D. | All of the mentioned |
Answer» C. write() | |
164. |
Which of these methods are used to register a MouseMotionListener? |
A. | addMouse() |
B. | addMouseListener() |
C. | addMouseMotionListner() |
D. | eventMouseMotionListener() |
Answer» D. eventMouseMotionListener() | |
165. |
Java supports input/output of data through the classes included in the _______ package:a)jav |
A. | oi |
B. | java.out |
C. | java.in |
D. | java.io |
Answer» E. | |
166. |
Which of this package contains classes and interfaces for networking? |
A. | java.io |
B. | java.util |
C. | java.net |
D. | java.network |
Answer» D. java.network | |
167. |
What happens in a method if there is an exception thrown in a try block but there is no catch block following the try block? |
A. | The program ignores the exception. |
B. | The program will not compile without a complete try/catch structure. |
C. | The program terminates immediately. |
D. | The program throws an exception and proceeds to execute the finally block. |
Answer» E. | |
168. |
The method setFont() is defined in---------- class |
A. | Applet |
B. | Font |
C. | Container |
D. | Component |
Answer» E. | |
169. |
Which of these classes is used to read characters and strings in Java from console? |
A. | BufferedReader |
B. | StringReader |
C. | BufferedStreamReader |
D. | InputStreamReader |
Answer» E. | |
170. |
Which of these method waits for the thread to treminate? |
A. | sleep() |
B. | isAlive() |
C. | join() |
D. | stop() |
Answer» D. stop() | |
171. |
JRE stands for |
A. | Java Realtime Environment |
B. | Java Rapid Enterprise |
C. | Java Runtime Environment |
D. | None of the above |
Answer» D. None of the above | |
172. |
How many finally blocks can there be in a try/catch structure? |
A. | There must be 1. |
B. | There can be 1 following each catch block. |
C. | There can be 0 or 1 following the last catch block. |
D. | There is no limit to the number of finally blocks following the last catch block. |
Answer» D. There is no limit to the number of finally blocks following the last catch block. | |
173. |
The class used to create a Radio button in awt is |
A. | Checkbox |
B. | RadioButton |
C. | OptionButton |
D. | CheckboxGroup |
Answer» E. | |
174. |
The following specifies the advantages of It is lightweight. It supports pluggable look and feel. It follows MVC (Model View Controller) architecture. |
A. | Swing |
B. | AWT |
C. | Both A & B |
D. | None of the above |
Answer» B. AWT | |
175. |
Which of these events will be generated if we close a Frame window? |
A. | ActionEvent |
B. | ComponentEvent |
C. | AdjustmentEvent |
D. | WindowEvent |
Answer» E. | |
176. |
Which of the following will cause a semantic error, if you are trying to compare x to 5? |
A. | if (x == 5) |
B. | if (x = 5) |
C. | if (x <= 5) |
D. | if (x >= 5) |
Answer» C. if (x <= 5) | |
177. |
What is stored in the object obj in following lines of code? box obj; |
A. | Memory address of allocated memory of object. |
Answer» C. | |
178. |
What is the error in this code? byte b = 50; b = b * 50; |
A. | b can not store the result 2500, limited by its range. |
B. | * operator has converted b * 50 into int, which can not be converted to byte without casting. |
C. | b can not contain value 50. |
D. | No error in this code |
Answer» C. b can not contain value 50. | |
179. |
Under what circumstances might you use the yield method of the Thread class |
A. | To call from the currently running thread to allow another thread of the same or higher priority to run |
B. | To call on a waiting thread to allow it to run |
C. | To allow a thread of higher priority to run |
D. | To call from the currently running thread with a parameter designating which thread should be allowed to run |
Answer» B. To call on a waiting thread to allow it to run | |
180. |
Which class cannot be a subclass in java |
A. | Abstract class |
B. | Parent class |
C. | Final class |
D. | None of above |
Answer» D. None of above | |
181. |
How do you position a component using FlowLayout? |
A. | North, South, East, West |
B. | Assign a row/column grid reference |
C. | Pass a X/Y percentage parameter to the add method |
D. | Do nothing, the FlowLayout will position the component |
Answer» E. | |
182. |
Which of these packages contains all the classes and methods required for event handling in Java?a) jav |
A. | applet |
B. | java.awt |
C. | java.event |
D. | java.awt.event |
Answer» E. | |
183. |
Which of the following methods can be used to draw the outline of a square within a JAVA.awt.Component object? |
A. | drawLine() |
B. | fillRect() |
C. | drawPolygon() |
D. | drawPolygon() |
Answer» B. fillRect() | |
184. |
The layout manager that lets you align components at north, south, east, west directions is |
A. | BorderLayout |
B. | GridLayout |
C. | FlowLayout |
D. | GridBagLayout |
Answer» B. GridLayout | |
185. |
Thread class is available in |
A. | java.io package |
B. | java.lang package |
C. | java.awt package |
D. | java.util package |
Answer» C. java.awt package | |
186. |
Which class cannot have a subclass in java |
A. | abstract class |
B. | parent class |
C. | final class |
D. | None of above |
Answer» D. None of above | |
187. |
Which of these exceptions will occur if we try to access the index of an array beyond itslength? |
A. | ArithmeticException |
B. | ArrayException |
C. | ArrayIndexException |
D. | ArrayIndexOutOfBoundsException |
Answer» E. | |
188. |
The default layout manager of an Applet is |
A. | Flowlayout |
B. | Gridlayout |
C. | BorderLayout |
D. | BoxLayout |
Answer» B. Gridlayout | |
189. |
Which of this method of Thread class is used to change the state of a thread to blocked state? |
A. | sleep() |
B. | terminate() |
C. | stop() |
D. | block() |
Answer» B. terminate() | |
190. |
An abstract method ____. |
A. | is any method in the abstract class |
B. | cannot be inherited |
C. | has no body |
D. | is found in a subclass and overrides methods in a super-class using the reserved word abstract |
Answer» D. is found in a subclass and overrides methods in a super-class using the reserved word abstract | |
191. |
In RMI program the following two steps are used to, Either extend the UnicastRemoteObject class, the exportObject() method of the UnicastRemoteObject class, |
A. | Provide the Implementation of the remote interface |
B. | Create the remote interface |
C. | Create and start the remote application |
D. | Compile the implementation class and create the stub and skeleton objects using the rmic tool |
Answer» B. Create the remote interface | |
192. |
A primitive data type can be passed as an argument into a method |
A. | By value |
B. | by reference |
C. | both a & b |
D. | none of these |
Answer» B. by reference | |
193. |
A ------------- is a component that can hold other components. |
A. | A window |
B. | a container |
C. | A control |
D. | a form |
Answer» C. A control | |
194. |
Which component method is used to access a component's immediate container? |
A. | getVisible() |
B. | getImmediate() |
C. | getParent() |
D. | getContainer() |
Answer» D. getContainer() | |
195. |
The AWT component used to display a single line of read-only text |
A. | A checkbox |
B. | A Label |
C. | A button |
D. | A TextField |
Answer» C. A button | |
196. |
Each remote object has a unique name identified by an URL with the protocol rmi as follows: |
A. | http://host:port/name |
B. | //host:port/name |
C. | http://host/name |
D. | rmi://host:port/name |
Answer» C. http://host/name | |
197. |
Which of the following statements is false as far as different type of statements is concern in JDBC? |
A. | Regular Statement |
B. | Prepared Statement |
C. | Callable Statement |
D. | Interim Statement |
Answer» E. | |
198. |
Swing is a ___________ framework |
A. | connection-based |
B. | component-based |
C. | platform-based |
D. | None of the above |
Answer» C. platform-based | |
199. |
Variables declared with in a class are called |
A. | Identifier |
B. | local variable |
C. | instance variable |
D. | global variable |
Answer» D. global variable | |
200. |
Which package consist an applet class?a) jav |
A. | applet |
B. | java.awt |
C. | java.awt.applet |
D. | java.event |
Answer» B. java.awt | |