

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.
1. |
Which of these events is generated when the size os an event is changed? |
A. | ComponentEvent |
B. | ContainerEvent |
C. | FocusEvent |
D. | InputEvent |
Answer» B. ContainerEvent | |
2. |
Which of the following is true in the case of abstract class |
A. | Abstract constructors cannot be created. |
B. | Abstract classes can not be inherited. |
C. | An abstract class contains only abstract methods. |
D. | All of the above. |
Answer» B. Abstract classes can not be inherited. | |
3. |
Which of the following is the correct syntax for suggesting that the JVM performsgarbage collection? |
A. | System.free(); |
B. | System.setGarbageCollection(); |
C. | System.out.gc(); |
D. | System.gc(); |
Answer» E. | |
4. |
In RMI which layer defines and supports the invocation semantics of the RMIconnection, this layer maintains the session during the method call? |
A. | The Stub & Skeleton Layer |
B. | The Application Layer |
C. | The Remote Reference Layer |
D. | The Transport Layer |
Answer» D. The Transport Layer | |
5. |
When is a finally {} block executed? |
A. | Only when an exception is thrown by a try block |
B. | Only when there are no exceptions thrown |
C. | At the end of a program |
D. | Always after the execution of a try block, regardless of whether or not an exception is thrown |
Answer» E. | |
6. |
Character Stream Classes support input/output operations on _______ characters: |
A. | 8 bit Unicode |
B. | 16 bit Unicode |
C. | 32 bit Unicode |
D. | 64 bit Unicode |
Answer» C. 32 bit Unicode | |
7. |
When two or more objects are added as listeners for the same event, which listener is firstinvoked to handle the event? |
A. | The first object that was added as listner. |
B. | The last object that was added as listner |
C. | There is no way to determine which listener will be invoked first. |
D. | It is impossible to have more than one listener for a given event. |
Answer» D. It is impossible to have more than one listener for a given event. | |
8. |
The keyword used inside a class to refer to its immediate super class is |
A. | super |
B. | parent |
C. | base |
D. | none of these |
Answer» B. parent | |
9. |
The _______ class is used to read characters from the file: |
A. | StreamReader |
B. | CharacterReader |
C. | InputReader |
D. | FileReader |
Answer» E. | |
10. |
Which of the following statements about the Java language is true? |
A. | Java supports only Procedural Oriented Programming approach |
B. | Both Procedural and Object Oriented Programming are supported in Java |
C. | Java supports only Object Oriented Programming approach |
D. | None of the Above |
Answer» D. None of the Above | |
11. |
Why we use array as a parameter of main method |
A. | It is syntax |
B. | Can store multiple values |
C. | Both of above |
D. | None of above |
Answer» C. Both of above | |
12. |
Which one of the following is a jump statement in java? |
A. | goto |
B. | jump |
C. | break |
D. | if |
Answer» D. if | |
13. |
Which of these method of class StringBuffer is used to find the length of current charactersequence? |
A. | length() |
B. | Length() |
C. | capacity() |
D. | Capacity() |
Answer» B. Length() | |
14. |
State true or false(i) Java RMI supports distributed objects written entirely in java (ii) Java RMI makes use of stubs and skeleton (iii) In Java RMI an object registers itself with a media server (iv) IDL is interface declaration language |
A. | True, True, False, False |
B. | False, True, True, True |
C. | True, False, True, False |
D. | True, True, True, True |
Answer» B. False, True, True, True | |
15. |
If a negative value is used for an array index, ____. |
A. | a NumberFormatException is thrown |
B. | the program terminates immediately |
C. | the last index of the array is automatically accessed instead |
D. | an IndexOutOfBoundsException is thrown |
Answer» E. | |
16. |
Which of this class is used for creating a client for server-client operations? |
A. | serverClientjava |
B. | Client.java |
C. | AddClient.java |
D. | ServerClient.java |
Answer» D. ServerClient.java | |
17. |
The processes that participate in supporting remote method invocation are |
A. | Client |
B. | Server |
C. | Object Registry |
D. | All of the above |
Answer» E. | |
18. |
Which of these values is returned by read () method is end of file (EOF) is encountered? |
A. | 0 |
B. | 1 |
C. | -1 |
D. | Null |
Answer» D. Null | |
19. |
Interfaces helps in which type of inheritance |
A. | Multiple inheritance |
B. | Multilevel inheritance |
C. | Hierarchical inheritance |
D. | None of above |
Answer» B. Multilevel inheritance | |
20. |
Which statement is static and synchronized in JDBC API? |
A. | executeQuery() |
B. | executeUpdate() |
C. | getConnection() |
D. | prepareCall() |
Answer» D. prepareCall() | |
21. |
Match the following (a) Datagram Socket (i) UDP connection(b) URL (ii) provides a necessary framework of debugging java programs (c) java.net (iii) makes it possible to communicate over a network with java programs (d) sun.tools.debug (iv) is a java object that represents WWW address |
A. | a-i, b-iv, c-iii, d-ii |
B. | a-i, b-iv, c-ii, d-iii |
C. | a-ii, b-iii, c-i, d-iv |
D. | a-ii, b-i, c-iii, d-iv |
Answer» B. a-i, b-iv, c-ii, d-iii | |
22. |
The keyword used to create a constant variable |
A. | const |
B. | static |
C. | final |
D. | none of these |
Answer» D. none of these | |
23. |
Which is the super class of all exception classes |
A. | Exception |
B. | Object |
C. | Error |
D. | Throwable |
Answer» E. | |
24. |
The method toString() is a public member of the class _____________. |
A. | Object |
B. | String |
C. | Writer |
D. | Output |
Answer» B. String | |
25. |
The default layout manager of a Frame is |
A. | Flowlayout |
B. | Gridlayout |
C. | BorderLayout |
D. | BoxLayout |
Answer» D. BoxLayout | |
26. |
Which is the keyword used to inherit a class to another? |
A. | Inherits |
B. | extends |
C. | implements |
D. | import |
Answer» C. implements | |
27. |
What is the value of y if x = 2? |
A. | 2 |
B. | 3 |
C. | 7 |
D. | 9 |
Answer» E. | |
28. |
The method in Graphics class to set the drawing color |
A. | setForeground() |
B. | setDrawingColor() |
C. | setBrushColor() |
D. | setColor() |
Answer» E. | |
29. |
Two-way selection in Java is implemented using ________. |
A. | if statements |
B. | for loops |
C. | if...else statements |
D. | sequential statements |
Answer» D. sequential statements | |
30. |
Runnable is a |
A. | Class |
B. | Method |
C. | Variable |
D. | Interface |
Answer» E. | |
31. |
The use of final keyword with method definition |
A. | Supports method overriding |
B. | implements dynamic method dispatch |
C. | Prevents method overriding |
D. | none of these |
Answer» D. none of these | |
32. |
What is the value of the expression 2 & 3 ? |
A. | 2 |
B. | 3 |
C. | 6 |
D. | 5 |
Answer» B. 3 | |
33. |
Which of the following is the highest class in the event delegation model? |
A. | java.util.EventListner |
B. | java.util.EventObject |
C. | java.util.AWTEvent |
D. | java.util.event.AWTEvent |
Answer» C. java.util.AWTEvent | |
34. |
Which of this package is used for all the text related modifications? |
A. | java.text |
B. | java.awt |
C. | java.lang.text |
D. | java.text.mofify |
Answer» B. java.awt | |
35. |
Program which executes applet is known as |
A. | applet engine |
B. | virtual machine |
C. | JVM |
D. | None of above |
Answer» B. virtual machine | |
36. |
A message string is returned by which method of an Exception object? |
A. | printMessage() |
B. | getMessage() |
C. | printStackTrace() |
D. | traceMessage() |
Answer» C. printStackTrace() | |
37. |
The method sqrt() is defined in the class |
A. | System |
B. | Root |
C. | Math |
D. | Arithmetic |
Answer» D. Arithmetic | |
38. |
How do you create a Reader object from an InputStream object? |
A. | Use the static createReader() method of InputStream class |
B. | Use the static createReader() method of Reader class |
C. | Create an InputStreamReader object passing the InputStream object and an argument to the InputStreamReader constructor. |
D. | Create an OutputStreamReader object, passing the InputStream object as an argument to the OutputStreamReader constructor. |
Answer» D. Create an OutputStreamReader object, passing the InputStream object as an argument to the OutputStreamReader constructor. | |
39. |
The method used to set Fonts is |
A. | setFontName() |
B. | setFont() |
C. | setFontText() |
D. | none of these |
Answer» C. setFontText() | |
40. |
Which of these methods is used to begin the execution of a thread? |
A. | run() |
B. | start() |
C. | runThread() |
D. | startThread() |
Answer» C. runThread() | |
41. |
Which of these is the method which is executed first before execution of any other thing takesplace in a program? |
A. | main method |
B. | finalize method |
C. | static method |
D. | private method |
Answer» D. private method | |
42. |
JAR stands for? |
A. | Java Archive |
B. | Java Archive Runner |
C. | Java Application Runner |
D. | None of the above |
Answer» B. Java Archive Runner | |
43. |
Which one of the following does not extends java.awt.Component |
A. | CheckBox |
B. | Canvas |
C. | CheckbocGroup |
D. | Label |
Answer» D. Label | |
44. |
The method used to draw an ellipse is |
A. | drawEllipse() |
B. | drawCircle() |
C. | drawOval() |
D. | none of these |
Answer» D. none of these | |
45. |
If class Dog has a subclass Retriever, which of the following is true? |
A. | Because of single inheritance, Dog can have no other subclasses. |
B. | Because of single inheritance, Retriever can extend no other class except Dog. |
C. | The relationship between these classes implies that Dog “is-a” Retriever. |
D. | The relationship between these classes implies that Retriever “has-a” Dog. |
Answer» C. The relationship between these classes implies that Dog “is-a” Retriever. | |
46. |
Consider the following list. int[] intList = {35, 12, 27, 18, 45, 16, 38}; What is the minimum number of comparisons that have to be made to find 18 using a sequential search on intList? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» E. | |
47. |
What is default layout manager for panels and applets? |
A. | Flowlayout |
B. | Gridlayout |
C. | BorderLayout |
D. | none |
Answer» B. Gridlayout | |
48. |
The keyword used to create an object |
A. | class |
B. | this |
C. | new |
D. | malloc |
Answer» D. malloc | |
49. |
You read the following statement in a Java program that compiles and executes. submarine.dive(depth); What can you say for sure? |
A. | Depth must be an int |
B. | Dive must be a method. |
C. | Dive must be the name of an instance fie |
Answer» C. Dive must be the name of an instance fie | |
50. |
The method which is automatically invoked during garbage collection. |
A. | destructor |
B. | terminate() |
C. | finalize() |
D. | destroy() |
Answer» D. destroy() | |