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.
| 101. |
In RMI program the following example shows the,import java.rmi.*; public interface Adder extends Remote{ public int add(int x,int y)throws RemoteException; } |
| A. | Create and start the remote application |
| B. | Create and start the client application |
| C. | Create the remote interface |
| D. | Provide the implementation of the remote interface |
| Answer» D. Provide the implementation of the remote interface | |
| 102. |
State true or false (i) public can only be assigned to class (ii) protected protects a statement (iii) protected method is never accessible outside the package (iv) friendly variable may be accessible outside class |
| A. | True, True, False, True |
| B. | False, False, False, True |
| C. | False, True, False, False |
| D. | True, False, False, False |
| Answer» B. False, False, False, True | |
| 103. |
The method to set the text of Textfield. |
| A. | setLabel() |
| B. | setString() |
| C. | setText() |
| D. | setData() |
| Answer» D. setData() | |
| 104. |
Which package provides many event classes and Listener interfaces for event handling? |
| A. | java.awt |
| B. | java.awt.Graphics |
| C. | java.awt.event |
| D. | None of the above |
| Answer» D. None of the above | |
| 105. |
The modifier which specifies that the member can only be accessed in its own class is |
| A. | public |
| B. | private |
| C. | protected |
| D. | none |
| Answer» C. protected | |
| 106. |
Which of the following is an exception thrown by the methods of the class String? |
| A. | NullPointerException |
| B. | FileNotFoundException |
| C. | NoSuchElementsException |
| D. | NumberFormatException |
| Answer» B. FileNotFoundException | |
| 107. |
Which class is the super class of all classes of the java.lang package? |
| A. | Object |
| B. | System |
| C. | Super |
| D. | Class |
| Answer» B. System | |
| 108. |
A class that cannot be a subclass is called as______ class. |
| A. | abstract |
| B. | parent class |
| C. | Final |
| D. | none of these |
| Answer» D. none of these | |
| 109. |
Which of the following statements is legal in Java?(i) mysRef = (Mystery) mySecret; (ii) mysRef = (Mystery) secRef; |
| A. | Only (i) |
| B. | Only (ii) |
| C. | Both (i) and (ii) |
| D. | None of these |
| Answer» C. Both (i) and (ii) | |
| 110. |
Which method would you most likely use to add an element to an end of a vector? |
| A. | insertElementAt |
| B. | addElement |
| C. | copyInto |
| D. | lastElement |
| Answer» C. copyInto | |
| 111. |
What is the string contained in s after following lines of code?StringBuffer s new StringBuffer("Hello"); s.deleteCharAt(0); |
| A. | Hell |
| B. | ello |
| C. | Hel |
| D. | llo |
| Answer» C. Hel | |
| 112. |
------------------- is an example of container class |
| A. | Label |
| B. | Panel |
| C. | TextField |
| D. | Button |
| Answer» C. TextField | |
| 113. |
Which of these interface is implemented to create a Thread? |
| A. | Runnable |
| B. | Connections |
| C. | Set |
| D. | MapConnections |
| Answer» B. Connections | |
| 114. |
The method in Graphics class to draw a circle/oval with specified width and height. |
| A. | drawCircle() |
| B. | drawShape() |
| C. | drawOval() |
| D. | none of these |
| Answer» D. none of these | |
| 115. |
The AWT component used for taking input from user. |
| A. | A TextBox |
| B. | A Label |
| C. | A button |
| D. | A TextField |
| Answer» E. | |
| 116. |
Which of these classes are used by Byte streams for input operation? |
| A. | InputStream |
| B. | InputOutputStream |
| C. | Reader |
| D. | All of the mentioned |
| Answer» B. InputOutputStream | |
| 117. |
Which command disassembles a class file |
| A. | javaamd |
| B. | javacmd |
| C. | java |
| D. | javap |
| Answer» E. | |
| 118. |
The keyword used to create a package is |
| A. | import |
| B. | package |
| C. | classpath |
| D. | public |
| Answer» C. classpath | |
| 119. |
Which Swing methods are thread-safe? |
| A. | repaint() |
| B. | revalidate() |
| C. | invalidate() |
| D. | all of the above |
| Answer» E. | |
| 120. |
_________ is used to initialize objects. |
| A. | Methods |
| B. | arguments |
| C. | constructors |
| D. | new keyword |
| Answer» D. new keyword | |
| 121. |
Which of these jump statements can skip processing the remainder of the code in its body fora particular iteration? |
| A. | break |
| B. | return |
| C. | exit |
| D. | continue |
| Answer» E. | |
| 122. |
JVM is ___________for bytecode. |
| A. | a compiler |
| B. | an interpreter |
| C. | assembler |
| D. | none of the above |
| Answer» C. assembler | |
| 123. |
Which refers to a channel through which data flow from the source to the destination: |
| A. | String |
| B. | Character |
| C. | Stream |
| D. | Buffer |
| Answer» D. Buffer | |
| 124. |
What is byte code in the context of Java? |
| A. | The type of code generated by a Java compiler |
| B. | The type of code generated by a Java Virtual Machine |
| C. | It is another name for a Java source file |
| D. | It is the code written within the instance methods of a class. |
| Answer» B. The type of code generated by a Java Virtual Machine | |
| 125. |
Which of the following methods finds the maximum number of connections that a specific driver can obtain? |
| A. | Database.getMaxConnections |
| B. | Connection.getMaxConnection |
| C. | DatabaseMetaData.getMaxConnections |
| D. | ResultSetMetaData.getMaxConnections |
| Answer» D. ResultSetMetaData.getMaxConnections | |
| 126. |
The class used to encapsulate fonts is |
| A. | Graphics |
| B. | Font |
| C. | Applet |
| D. | Component |
| Answer» C. Applet | |
| 127. |
What is the correct way to write a JavaScript array? |
| A. | var txt = new Array:1=("tim")2=("kim")3=("jim") |
| B. | var txt = new Array(1:"tim",2:"kim",3:"jim") |
| C. | var txt = new Array="tim","kim","jim") |
| D. | var txt = new Array("tim","kim","jim") |
| Answer» E. | |
| 128. |
How do you change the current layout manager for a container? |
| A. | Use the setLayout method. |
| B. | Once created you cannot change the current layout manager of a component |
| C. | Use the setLayoutManager meth |
| Answer» B. Once created you cannot change the current layout manager of a component | |
| 129. |
Suppose that you want to have an object eh handle the TextEvent of TextArea object t. How should you add eh as the event handler for? |
| A. | t.addTextListener(eh); |
| B. | eh.addTextListner(t); |
| C. | addTextListner(eh.t); |
| D. | addTextListner(t,eh); |
| Answer» E. | |
| 130. |
Byte Stream Classes support input/output operations on _____ |
| A. | 8 bit |
| B. | 16 bit |
| C. | 32 bit |
| D. | 64 bit |
| Answer» B. 16 bit | |
| 131. |
DataInputStream class contains methods to read________ |
| A. | Non primitive data type |
| B. | Primitive data type |
| C. | Formatted data |
| D. | all of the above |
| Answer» C. Formatted data | |
| 132. |
Which method is used to enable an event for a particular object? |
| A. | enableEvent() |
| B. | enable() |
| C. | enableObject() |
| D. | enableEvents() |
| Answer» E. | |
| 133. |
What is the value of the expression 8 |
| A. | 2 |
| B. | 32 |
| C. | 1 6 |
| D. | 5 |
| Answer» C. 1 6 | |
| 134. |
RMI has which of these protocols implementations? |
| A. | Java Remote Method Protocol (JRMP) |
| B. | Internet Inter-ORB Protocol (IIOP) |
| C. | Jinni Extensible Remote Invocation (JERI) |
| D. | All mentioned above |
| Answer» E. | |
| 135. |
Which of these packages contains all the classes and methods required for even handlingin Java? |
| A. | java.applet |
| B. | java.awt |
| C. | java.event |
| D. | java.awt.event |
| Answer» E. | |
| 136. |
Which one of the following is a valid identifier in java? |
| A. | x1 |
| B. | 1x |
| C. | $x |
| D. | x 1 |
| Answer» B. 1x | |
| 137. |
Which method defined in Integer class can be used to convert a whole number in string type to primitive int type. |
| A. | valueOf() |
| B. | intValue() |
| C. | parseInt() |
| D. | getInteger() |
| Answer» D. getInteger() | |
| 138. |
Java language has support for which of the following types of comment ? |
| A. | block, line and javadoc |
| B. | javadoc, literal and string |
| C. | javadoc, char and string |
| D. | single, multiple and quote |
| Answer» B. javadoc, literal and string | |
| 139. |
Which of the following creates a List with 5 visible items and multiple selections enabled? |
| A. | new List(5, true) |
| B. | new List(true, 5) |
| C. | new List(5, false) |
| D. | new List(false, 5) |
| Answer» B. new List(true, 5) | |
| 140. |
Which of these exceptions will be thrown if we use null reference for an arithmeticoperation? |
| A. | ArithmeticException |
| B. | NullPointerException |
| C. | IllegalAccessException |
| D. | IllegalOperationException |
| Answer» C. IllegalAccessException | |
| 141. |
Which of the interface contains all the methods used for handling thread related operationsin Java? |
| A. | Runnable interface |
| B. | Math interface |
| C. | System interface |
| D. | ThreadHandling interface |
| Answer» B. Math interface | |
| 142. |
State true or false(i) JPanel is a class included in awt package (ii) Anonymous classes are mostly used for event handling (iii) Names of anonymous classes must be unique (iv) JOptionPane is an inner class |
| A. | i-false, ii-false, iii-true, iv-true |
| B. | i-true, ii-false, iii-true, iv-false |
| C. | i-false, ii-true, iii-false, iv-false |
| D. | i-true, ii-true, iii-false, iv-true |
| Answer» D. i-true, ii-true, iii-false, iv-true | |
| 143. |
Swing is not a part of JFC (Java Foundation Classes) that is used to create GUIapplication? |
| A. | True |
| B. | False |
| C. | none |
| D. | all |
| Answer» C. none | |
| 144. |
The ________ method help in clearing the contents of the buffer: |
| A. | flush() |
| B. | clear() |
| C. | rub() |
| D. | vanish() |
| Answer» D. vanish() | |
| 145. |
These two ways are used to create a Frame By creating the object of Frame class (association) By extending Frame class (inheritance) |
| A. | True |
| B. | False |
| C. | none |
| D. | all |
| Answer» C. none | |
| 146. |
Who is considered as the creator of JAVA ? |
| A. | Dennis Richie |
| B. | Ken Thompson |
| C. | James Gosling |
| D. | Bjarne Stroupstrup |
| Answer» D. Bjarne Stroupstrup | |
| 147. |
What is the numerical range of a char in Java? |
| A. | -128 to 127 |
| B. | 0 to 256 |
| C. | 0 to 32767 |
| D. | 0 to 65535 |
| Answer» E. | |
| 148. |
Which of the following statements is NOT true about creating your own exceptions? |
| A. | Typically, constructors are the only methods that you include when you define your own exception class. |
| B. | The exception class that you define extends either the class Throwable or one of its subclasses. |
| C. | If you have created an exception class, you can define other exception classes extending the definition of the exception class you creat |
| Answer» C. If you have created an exception class, you can define other exception classes extending the definition of the exception class you creat | |
| 149. |
Thread priority in Java is represented as? |
| A. | int |
| B. | Float |
| C. | double |
| D. | long |
| Answer» B. Float | |
| 150. |
Which of this package is used for remote method invocation? |
| A. | java.applet |
| B. | java.rmi |
| C. | java.lang.rmi |
| D. | java.lang.reflect |
| Answer» C. java.lang.rmi | |