Java
Java
Semester VI
A. logical.
B. physical.
C. up normal.
D. collection of.
ANSWER: A
6. Object is a _______ entity.
A. normal.
B. physical.
C. logical.
D. normal.
ANSWER: B
7. ______ can appear anywhere in the body of a java method.
A. definition.
B. declaration.
C. determine.
D. package.
ANSWER: B
8. ______ must be the first non comment statement in the file.
A. package.
B. class.
C. object.
D. declaration.
ANSWER: A
9. _______ is passed to a method by use of call-by-reference.
A. variables.
B. objects.
C. methods.
D. operators.
ANSWER: B
10. Every method of a ________ is implicitly final.
A. static class.
B. dynamic class.
C. final class.
D. abstract class.
ANSWER: C
11. A _______ object cannot be modified after it is created.
A. double.
B. int.
C. string.
D. main.
ANSWER: C
12. A ____ class may not have any abstract method.
A. abstract.
B. static.
C. final.
D. public.
ANSWER: C
13. What will be the result of the expression 13 & 25?
A. 38.
B. 25.
C. 9.
D. 12.
ANSWER: C
14. What will be result of expression 9 | 9?
A. 1.
B. 18.
C. 9.
D. 12.
ANSWER: C
15. _________ Operators are overloaded for string objects?
A. -, +.
B. +, =.
C. <<, >>.
D. ++, --.
ANSWER: B
16. If an expression contains double, int, float, long, then whole expression will promoted into which of these data types?.
A. .long
B. int.
C. double.
D. float.
ANSWER: C
17. ________ is valid for if statement?
A. An integer expression.
B. A Boolean expression.
C. A character expression.
D. A legal expression.
ANSWER: B
18. A package is a collection of ______.
A. keywords.
B. classes and interfaces.
C. editing tools.
D. views.
ANSWER: B
19. ________ statement is valid for array declaration.
A. int number ();.
B. float number ();.
C. float number [];.
D. count Int [];.
ANSWER: C
20. What is the output of relational operators?.
A. integer.
B. boolean.
C. character.
D. double.
ANSWER: B
21. Which of these operators can skip evaluating right hand operand?.
A. !.
B. |.
C. &.
D. &&.
ANSWER: D
22. Which exception is thrown by the read () method of Input Stream class?
A. Exception.
B. ClassNotFoundException.
C. read Exception.
D. IOException.
ANSWER: D
23. Which of the following denotes a javadoc comment?
A. //#.
B. /*.
C. /**.
D. //**.
ANSWER: C
24. Using the keyword interface you can fully abstract a _________.
A. method.
B. keyword
C. class.
D. variables.
ANSWER: C
25. One interface can inherit another by use of the keyword _____.
A. public.
B. extends.
C. method name.
D. class name.
ANSWER: B
26. An exception is an __________ condition that arises in a code.
A. abnormal.
B. casual.
C. unfortunate.
D. opposite.
ANSWER: A
27. ______ is at the top of the exception class hierarchy.
A. try.
B. throwable.
C. exception class.
D. catch.
ANSWER: B
28. In java thread to thread communication is called _____.
A. passing.
B. sending.
C. messaging.
D. calling.
ANSWER: C
29. Which of these access specifiers can be used for an interface?.
A. public.
B. protected.
C. private.
D. All of the mentioned.
ANSWER: A
30. Java programs perform I/O through _______.
A. i/o methods.
B. i/o package.
C. streams.
D. compiler.
ANSWER: C
31. In java a _______ is a sequence of characters.
A. string.
B. arrayChar.
C. groupChar.
D. collection.
ANSWER: A
32. The String is defined in _______ namespace.
A. java.Lang.
B. java.String.
C. java.Char.
D. java.Awt.
ANSWER: A
33. __________ is a special member function.
A. method.
B. class.
C. use defined function.
D. constructor.
ANSWER: D
34. Keyword _____ is always a reference to the object.
A. new.
B. this.
C. invoke.
D. class.
ANSWER: B
35. ________ is the mechanism that binds together the code and the data.
A. polymorphism.
B. encapsulation.
C. inheritance.
D. together.
ANSWER: B
36. Java is designed for _______ environment of the internet.
A. development.
B. deducting.
C. distributed.
D. web design.
ANSWER: C
37. ______ is a small unit of a process.
A. method.
B. thread.
C. applet.
D. stream.
ANSWER: B
38. Wrapper class is a wrapper around a _______ data type.
A. normal.
B. central.
C. primitive.
D. concrete.
ANSWER: C
39. Once an interface has been defined, one or more _____ can implement that interface.
A. class.
B. object.
C. methods.
D. keywords.
ANSWER: A
40. Variable declared as _________ do not occupy memory on a per instance basis.
A. static.
B. final.
C. abstract.
D. Ccde.
ANSWER: B
41. ______ must be the first statement executed inside a subclass Constructor.
A. final().
B. super().
C. static().
D. dec().
ANSWER: B
42. The ________ connects classes and objects.
A. dot.
B. super.
C. new.
D. variable.
ANSWER: A
43. The ________ statement is used to terminate a statement sequence.
A. break.
B. switch.
C. continue.
D. wait.
ANSWER: A
44. Multidimensional arrays are actually __________.
A. arrays of element.
B. arrays and variable.
C. arrays of arrays.
D. arrays of Square.
ANSWER: C
45. ______ statement in java is multiway branch statement.
A. declaration.
B. case.
C. multi.
D. switch.
ANSWER: D
46. _______ can be declared inside interface declarations.
A. Variables.
B. Classes.
C. Methods.
D. Keywords.
ANSWER: A
47. The _______ supports several constructors to create an empty String.
A. string class.
B. super class.
C. empty class.
D. upper class.
ANSWER: B
48. __________ is used for initialize the value to the String object.
A. character literals.
B. string literals.
C. string group literals.
D. group literals.
ANSWER: B
49. ____ operators which concatenates two strings.
A. +.
B. ++.
C. -.
D. ++, ++.
ANSWER: A
50. _______ method is a thread mechanism.
A. synchronize.
B. user defined.
C. keyword.
D. normal.
ANSWER: A
51. Java programs are _________ independent.
A. platform.
B. procedural.
C. high level.
D. Secure.
ANSWER: A
52. A java program can be run in any computer running under any ________.
A. operating system.
B. interface system.
C. machine system.
D. moral system.
ANSWER: A
53. A java program must contain a______ method.
A. user defined.
B. main.
C. local.
D. return.
ANSWER: B
54. Which of these class holds a collection of static methods and variables?.
A. Void .
B. Process.
C. Runtime .
D. System.
ANSWER: D
55. _________ operator is used to create an array.
A. new .
B. public.
C. key.
D. main.
ANSWER: A
56. Which of these class is used to create an object whose character sequence is mutable?.
A. String().
B. StringBuffer().
C. Both of the mentioned.
D. None of the mentioned.
ANSWER: B
57. The variable defined in class is called ________ variable.
A. local.
B. minimum.
C. instance.
D. define.
ANSWER: C
58. A special type of method that is used to initialize an object is called________.
A. constructor.
B. destructor.
C. modification.
D. editor.
ANSWER: A
59. Class is considered ________ of an object and instance.
A. min.
B. local.
C. template.
D. keyword.
ANSWER: C
60. String constants are said to be_____ of string class.
A. objects.
B. char.
C. data.
D. variable.
ANSWER: A
61. Methods having same name and differ type signature are called _____methods.
A. overriding.
B. over read.
C. super.
D. overloading.
ANSWER: D
62. Methods having same name, same type signature are called _____ methods.
A. overriding.
B. overloading.
C. overwriting.
D. overreading.
ANSWER: A
63. A method without the body is called ________ method.
A. view.
B. class.
C. abstract.
D. user defined.
ANSWER: C
64. A class having an abstract method is to be declared as _______.
A. class.
B. abstract.
C. class name.
D. method name.
ANSWER: B
65. Package statement helps to create many classes to have ______ name.
A. differ.
B. vanity.
C. same.
D. punch.
ANSWER: C
66. The default package that is implicitly called in a java program is _________.
A. java.Lang.
B. java.System.
C. java. Window.
D. java.Lang.System.
ANSWER: A
67. User defined exception can be created using _________ class.
A. catch.
B. try.
C. throwable.
D. get.
ANSWER: C
68. Which of these keywords is not a part of exception handling?.
A. finally.
B. catch.
C. thrown.
D. try.
ANSWER: C
69. Exception that is identified during compile time is called ______ exception.
A. user defined.
B. checked.
C. undefined.
D. defined.
ANSWER: B
70. When several tasks are handled by a single CPU, it is called _________.
A. multitasking.
B. task.
C. simultaneous.
D. taker.
ANSWER: A
71. Threads can be created by extending _________ class.
A. new.
B. operator.
C. thread.
D. super thread.
ANSWER: C
72. Threads can be created by implementing ________ interface.
A. new.
B. creator.
C. main.
D. runnable.
ANSWER: D
73. When a thread is created using new operator, the thread is in _____ state.
A. new.
B. old.
C. horizontal.
D. default.
ANSWER: A
74. At any one instance of time _____ threads will be in running state.
A. many.
B. two.
C. three.
D. one.
ANSWER: D
75. Which of these classes are used by character streams for input and output operations?.
A. InputStream.
B. Writer.
C. ReadStream.
D. InputOutputStream.
ANSWER: B
76. The wrapper classes are defined in _________ packages.
A. java. Lan.
B. java. Lang.
C. java. Nill.
D. java.Math.
ANSWER: B
77. The capacity if StringBuffer is defined as _________.
A. Length+12.
B. Length+13.
C. Length+15.
D. Length+16.
ANSWER: D
78. To compare the contents of two objects ______ method is used.
A. equals.
B. not equals.
C. multiple.
D. delay.
ANSWER: A
79. Which of these class is used to read from byte array?.
A. InputStream.
B. BufferedInputStream.
C. ArrayInputStream.
D. ByteArrayInputStream.
ANSWER: D
80. Graphics object can only be drawn on _________.
A. view.
B. windows.
C. applet.
D. zoom.
ANSWER: B
81. 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: A
82. What is garbage collection in the context of Java?
A. The operating system periodically deletes all of the java files available on the~~~system.
B. Any package imported in a program and not used is automatically deleted.
C. When all references to an object are gone, the memory used by the object is~~~automatically reclaimed.
D. The JVM checks the output of any Java program and deletes anything that~~~doesn't make sense.
ANSWER: C
83. What output is displayed as the result of executing the following statement?System.out.println ("// Looks like a comment.");
A. string.
B. integer.
C. boolean.
D. character.
ANSWER: A
90. Which of these is the method which is executed first before execution of any other thing takes place in a program?.
A. main method.
B. finalize method.
C. static method.
D. private method.
ANSWER: C
91. Which of the following methods are methods of the String class?
A. delete( ).
B. append( ).
C. reverse( ).
D. replace( ).
ANSWER: D
92. If you run the code below, what gets printed out?String s=new String ("Bicycle"); int iBegin=1; char iEnd=3; System.out.println (s.substring (iBegin, iEnd));
A. Bic.
B. ic.
C. icy.
D. error: no method matching substring(int, char).
ANSWER: B
93. Given the following declarations String s1=new String("Hello") ; String s2=new String("there"); String s3=new String(); Which of the following are legal operations?
A. s3=s1 + s2;.
B. s3=s1 - s2;.
C. s3=s1 & s2.
D. s3=s1 && s2.
ANSWER: A
94. Which of the following classes is used to perform basic console I/O?
A. system.
B. security Manager.
C. math.
D. runtime.
ANSWER: A
95. Which of these keywords is used to define packages in Java?,
A. pkg
B. Pkg.
C. package.
D. Package.
ANSWER: C
96. Which of the following are true about the Error and Exception classes?
A. Both classes extend Throwable.
B. The Error class is final and the Exception class is not.
C. The Exception class is final and the Error is not.
D. Both classes implement Throwable.
ANSWER: A
97. Which of the following are true?
A. The Void class extends the Class class.
B. The Float class extends the Double class.
C. The System class extends the Runtime class.
D. The Integer class extends the Number class.
ANSWER: D
98. Which of the following will output -4.0?
A. System.out.println(Math.floor(-4.7));.
B. System.out.println(Math.round(-4.7));.
C. System.out.println(Math.ceil(-4.7));.
D. System.out.println(Math.Min(-4.7));.
ANSWER: C
99. What is the default return type to main() __________.
A. void.
B. double.
C. float.
D. int.
ANSWER: D
100. Which of the following statements are true?
A. UTF characters are all 8-bits.
B. UTF characters are all 16-bits.
C. UTF characters are all 24-bits.
D. Unicode characters are all 16-bits.
ANSWER: D
101. You execute the code below in an empty directory. What is the result? File f1 = new File ("dirname");F ile f2 = new File (f1, "filename");
125. The .dot operator connects the following two entities _____.
A. a class member and a class object
B. a class object and a class
C. a class and a member of that class.
D. a class object and a member of that class.
ANSWER: A
126. Which layout should you use to organize the components of a container in a tabular~~~form?
A. Card Layout.
B. BorederLayout.
C. Flow Layout.
D. Grid Layout.
ANSWER: D
127. An Applet has its Layout Manager set to the default of FlowLayout. What code~~~would be the correct to change to another Layout Manager?
A. setLayoutManager(new GridLayout());.
B. setLayout(new GridLayout(2,2));.
C. setGridLayout(2,2,)).
D. setBorderLayout();.
ANSWER: B
128. How do you indicate where a component will be positioned 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: D
129. 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 method.
D. Use the updateLayout method.
ANSWER: A
130. Which of the following may contain a menu bar?
A. A panel.
B. A frame.
C. An applet.
D. A menu bar.
ANSWER: B
131. The type long can be used to store values in the following range:
A.
B. -264 to 264.
C.
D. -232 to 232 - 1.
ANSWER: C
132. What will be the content of array variable table after executing the following code?~~~for(int i = 0; i < 3; i + +)~~~for(int j = 0; j < 3; j + +)if(j = i) table[i][j] =
1;else table[i][j] = 0;
A. 0 0 0 0 0 0 0 0 0.
B. 1 0 0 1 1 0 1 1 1.
C. 1 0 0 0 1 0 0 0 1.
D. 0 0 1 0 1 0 1 0 0.
ANSWER: C
133. Which of the following classes are not available in the java.lang package?
A. Stack.
B. Object.
C. Math.
D. String.
ANSWER: A
134. Which of the following are not the wrapper classes?
A. Byte.
B. Vector.
C. Integer.
D. Short.
ANSWER: C
135. Which of the following method is not belonging to the String class?
A. length().
B. reverse().
C. compareTo() .
D. equals().
ANSWER: B
136. If not assigned a value, a variable of type char has the following default value:
A. \uffff'.
B. \u0000'.
C. " " (space).
D. '\u0001'.
ANSWER: B
137. Given the code String s = new String("abc"); Which of the following call is not valid?
A. s.trim().
B. s.replace('a', 'A').
C. s.substring (3).
D. s.setCharAt (1,'A').
ANSWER: B
138. The methods wait() and notify() are defined in?
A. java.lang.String.
B. java.lang.Object.
C. java.lang.Runnable.
D. java.lang.Thread.
ANSWER: B
139. Given the following code:~~~class Base { int x = 10; }~~~class Derived extends Base~~~{ int x = 20; }~~~Base b = new Base();~~~Derived d = new Derived (
);~~~Base bd = new Derived(); The statement~~~System.out.println(b.x + " " + d.x + " " + bd.x);~~~will produce the output
A. 10 20 20.
B. 20 10 20.
C. 20 20 10.
D. 10 20 10.
ANSWER: D
140. When we implement the Runnable interface, we must define the method
A. run().
B. start().
C. init().
D. main().
ANSWER: A
141. 15 & 29 =?
A. 44.
B. 14.
C. 13.
D. 12.
ANSWER: C
142. Identify the statements that are not correct:
A. Int a = 13, a>>2 = 3.
B. Int b = -8, b>>1 = -4.
C. Int a = 13, a>>>2 = 3.
D. Container.
ANSWER: A
149. 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. drawString().
D. drawPolygon().
ANSWER: A
150. DataInput is ________________.
A. an interface that defines methods to read primitive data types.
B. an abstract class defined in java.io.
C. a class we can use to read primitive data types.
D. an interface that defines methods to open files.
ANSWER: A
151. Which of the following method can be used to change the size of a JAVA.awt.Component object?
A. dimension().
B. setSize().
C. area().
D. size().
ANSWER: B
152. What method is used to specify a container's layout?
A. setLayout().
B. setSize().
C. area().
D. resize().
ANSWER: A
153. 27 | 8 = ?
A. 8.
B. 27.
C. 19.
D. 35.
ANSWER: B
154. What will be the result of the expression : a % b~~~when a and b are of type int and their values are a = -17 and b = -6?
A. -5.
B. -23.
C. 0.
D. 5.
ANSWER: D
155. Choose the operations that can be performed on String objects:
A. +=.
B. -.
C. %.
D. ^.
ANSWER: A
156. (1 | 4) + (4 & 2) = ?(in base ten)
A. 1.
B. 5.
C. 2.
D. 8.
ANSWER: B
157. Given the declarations~~~boolean b;~~~short x1 = 100, x2 = 200, x3 = 300; Which of the following statement is evaluated to true?
A. b = x1 * 2 == x2;
B. b = x1 + x2 != 3 * x1;
C. b = (x3 - 2*x2<0) && ((x3 = 400)<2**x2);
D. b = (x3 - 2*x2>0) || ((x3 = 400) 2*x2);
ANSWER: A
158. Which of the following represent legal flow control statements?
A. break;
B. break();
C. continue(inner);
D. exit();
ANSWER: A
159. A class can be converted to a thread by implementing the interface ____________.
A. Thread.
B. Runnable.
C. Start.
D. Yield.
ANSWER: B
160.
A. TRUE.
B. FALSE.
C. Compilation Error.
D. Run-time Error.
ANSWER: A
161.
A. No output.
B. 3 and 5.
C. 1, 3 and 5.
D. 3.
ANSWER: B
162. Which Control Statements allow the program to choose different paths of execution?
A.
B. if-else.
C. selection.
D. for.
ANSWER: C
163. ________ are stored in hierarchical manner.
A. packages.
B. interfaces.
C. classes.
D. Threads.
ANSWER: A
164. After the following code fragment, what is the value in a?~~~String s; int a;~~~s = "Foolish boy."; a = s.indexOf("fool");
A. -1.
B. 0.
C. 4.
D. random value.
ANSWER: A
165. What is an infinite loop?
A. A loop that functions infinitely well.
B. A loop that runs forever.
C. A loop that never starts.
D. A loop that will never function.
ANSWER: B
166. What is the difference between a TextArea and a TextField?
A. A TextArea can handle multiple lines of text.
B. A textarea can be used for output.
C. TextArea is not a class.
D. String.
ANSWER: A
173. Given the following statement: huey.setDouble(8.0*32.2+1.0);~~~What must be the data type of huey?.
A. DoubleField.
B. TextField.
C. intField.
D. double.
ANSWER: A
174. Given the following code fragment:~~~int A[];int i = 0;A = new int A[4];~~~while (i < 4)~~~{~~~A[i] = 10;~~~i = i + 1;~~~}~~~What is the value of A[3]?.
A. 0.
B. 3.
C. 10.
D. 9.
ANSWER: C
175. What is the value of k after the following code fragment?~~~int k = 0;~~~int n = 12~~~while (k < n)~~~{~~~k = k + 1;~~~}
A. 0.
B. 11.
C. 12.
D. 10.
ANSWER: C
176. When an instance of a class, or object, is specified as a parameter to a method, ______ to the said object is passed to the method.
A. a reference.
B. formal parameter.
C. references.
D. actual parameter.
ANSWER: A
177. The modulus operator (%) in JAVA can be used only with variables of ______ type.
A. double & char.
B. int & double.
C. int.
D. double.
ANSWER: B
178. An array of objects, which may have_______ type of different classes.
A. different.
B. same.
C. mixed mode.
D. common.
ANSWER: A
179. Which of the following statement is false?
A. The sleep() method should be enclosed in try ... catch block.
B. The yield() method should be enclosed in try ... catch block.
C. A thread can be temporarily suspended from running by using the wait() method.
D. A suspended thread using suspend() method can be revived using the resume() method.
ANSWER: B
180. When Java source code is compiled, each individual class is put into its own output file named after the class and using the ______ extension.
A. .h.
B. . java.
C. >java.
D. .class.
ANSWER: D
181. Java was conceived by __________.
A. microsoft.
B. oracle.
C. sun microsystem.
D. intel.
ANSWER: C
182. An _________ is a special kind of Java program that is designed to be transmitted over the internet.
A. viewlet.
B. applet.
C. servlet.
D. object.
ANSWER: B
183. When you read your e-mail, you are viewing _________ data.
A. active.
B. passive.
C. active and passive.
D. active or passive.
ANSWER: B
184. There are ________ types of comments in Java.
A. one.
B. two.
C. three.
D. four.
ANSWER: D
185. Java enables the creation of cross-platform programs by compiling into an intermediate representation called Java ____________.
A. byte code.
B. firewall.
C. tetra code.
D. view code.
ANSWER: A
186. What class is the top of the AWT event hierarchy?
A. iostream class
B. java.awt.AWTEvent class
C. io.awt.AWTEvent class
D. java.Event class
ANSWER: B
187. What does J2SE mean?
A. Java 2 Platform Standard Edition.
B. Java 2 Internet Standard Edition.
C. Java 2 Platform Independent Standard Edition.
D. Java 2 Systems Edition.
ANSWER: A
188. Java support RMI. What does this RMI stands for?
A. Random Memory Interface.
B. Remote Method Invocation.
C. Random Method Invocation.
D. Remote Memory Interface.
ANSWER: B
189. _________ is a feature that allows one interface to be used for a general class of actions.
A. Class.
B. Inheritance.
C. Polymorphism.
D. Interface.
ANSWER: C
190. What method must be implemented by all threads?
A. run() method
B. call() method
C. super() method
D. polymorphism.
ANSWER: D
197. Does a class inherit the constructors of its super class?
A. Yes
B. Sometimes Yes
C. Always No
D. Sometimes no
ANSWER: C
198. Methods declared as static have several restrictions:~~~1) They can only call other static methods.~~~2) They must only access static data.~~~3) They cannot refer
to this or super in any way~~~Which of these are true?
A. 1 and 2.
B. 1 and 3.
C. 2 and 3.
D. 1, 2 and 3.
ANSWER: D
199. finalize( ) is only called just prior to _________.
A. initialization.
B. runtime.
C. garbage collection.
D. destruction.
ANSWER: C
200. The data or variables, defined within a class are called _______ variables.
A. object.
B. class.
C. instance.
D. schema.
ANSWER: C
201. In this example class_var = new classname ( ); the class name followed by parentheses~~~specifies the _________ for the class.
A. destructor.
B. constructor.
C. variables.
D. memory.
ANSWER: B
202. What is meant by timeslicing or time sharing?
A. Timeslicing is the method of de-allocating CPU time to individual threads in a priority schedule.
B. Timeslicing is the method of allocating CPU space to individual threads in a priority schedule.
C. Timeslicing is the method of allocating CPU time to individual threads in a priority schedule.
D. Timeslicing is the method of de-allocating CPU space to individual threads in a priority schedule.
ANSWER: A
203. Which of the following statements correctly describes an interface?
A. It's a concrete class.
B. It's a superclass.
C. It's a type of abstract class.
D. It's a subclass.
ANSWER: C
204. You would use the ____ operator to create a single instance of a named class.
A. new.
B. dot.
C. equals.
D. <>.
ANSWER: A
205. Java's garbage collector runs as a ______ priority thread waiting for _______ priority threads to relinquish the processor. Choose the correct sequence.
A. high, low.
B. high, high.
C. low, low.
D. low, high.
ANSWER: A
206. What is the default thread at the time of starting the program?
A. Main Thread.
B. Thread Group.
C. Child Thread.
D. Thread Pool.
ANSWER: A
207. What is the use of valueOf( ) method?
A. It converts data from its internal format into a human-readable form.
B. It converts integer value to string.
C. It converts string to int value.
D. It converts string to float value.
ANSWER: D
208. What are the part in executing a Java program and their purposes?
A. Java Compiler.
B. Java Interpreter.
C. Java Pre-processor.
D. Directive Pre-processor.
ANSWER: A
209. What is the priority of the Garbage collector thread of jdk?
A. Low-Priority.
B. Highest Priority.
C. Medium Priority.
D. Decided At Runtime.
ANSWER: A
210. An interface contains __________ methods.
A. non-abstract.
B. implemented.
C. unimplemented.
D. abstract.
ANSWER: C
211. Which of the following statements are true?
A. UTF characters are all 8-bits.
B. UTF characters are all 16-bits.
C. UTF characters are all 24-bits.
D. Unicode characters are all 16-bits.
ANSWER: D
212. What are the constants defined by Byte, Short, Integer and Long? 1. MAX_VALUE, 2.~~~MIN_VALUE 3. TYPE.
A. 1, 2.
B. 2, 3.
C. 1, 2, 3.
D. 1, 3.
ANSWER: C
213. What is the unit for 1000 in the below statement? ob.sleep(1000)
A. Long milliseconds.
B. Double milliseconds.
C. Int milliseconds.
D. Float milliseconds.
ANSWER: A
214. What will be the result of compiling the following code?~~~public class Test~~~{~~~static int age;~~~public static void main (String args [])~~~{~~~age = age +
1;~~~System.out.println("The age is " + age);~~~}~~~}
A. Compiles and runs with no output.
B. 2.
C. 4.
D. 8.
ANSWER: D
221. Which of the function is used to convert String to Number in java program?
A. toNumber ().
B. conString().
C. valueOf() .
D. toString().
ANSWER: C
222. Interface methods can be declared with which the following modifiers?
A. public.
B. private.
C. synchronized.
D. native.
ANSWER: A
223. The class that inherits is called a __________.
A. superclass.
B. subclass.
C. instance class.
D. instantiate class.
ANSWER: B
224. All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character).
A. are public.
B. are final.
C. are serializable.
D. are private.
ANSWER: D
225. What is the file extension of compiled java program?
A. .class.
B. .java.
C. .css.
D. .html.
ANSWER: A
226. Can you write a Java class that could be used both as an applet as well as an application?
A. Yes
B. No
C. D. ANSWER: A
227. A subclass is also called as ____________.
A. inner class.
B. nested class.
C. derived class.
D. hidden class.
ANSWER: C
228. ____________ is not a package in java.
A. awt.
B. net.
C. io.
D. ip.
ANSWER: D
229. What is the output of the following program?~~~class example~~~{~~~public static void main(String args[])~~~{~~~int j;~~~do~~~{~~~j++;~~~} while(j <
0);~~~System.out.println(j);~~~}~~~}
A. The program does not compile as j is not initialized.
B. The program compiles but does not run.
C. The program compiles and runs but does not print anything.
D. The program prints 0.
ANSWER: A
230. _____ is used to manage the memory allocation.
A. New.
B. Keyword.
C. Const.
D. Allow.
ANSWER: A
231. AWT stands for_________________.
A. abstract window toolkit.
B. abstract window toolbar.
C. access window toolkit.
D. access window toolbar.
ANSWER: A
232. Polymorphism is derived from a ___________ word.
A. greek
B. English
C. java
D. Indian
ANSWER: A
233. Integers are whole values ________ numbers.
A. signed.
B. unsigned.
C. model.
D. Byte.
ANSWER: A
234. Single characters are represented through ______ type.
A. String.
B. char.
C. array.
D. nothing.
ANSWER: B
235. Numbers with fractional are called __________.
A. double.
B. float.
C. int.
D. long.
ANSWER: B
236. Single character in java is called _____literals.
A. char.
B. String.
C. java.
D. compile.
ANSWER: A
237. The ______ refers to the validity of a variable.
A. scope.
B. variable.
C. float.
D. method.
ANSWER: A
238. Which of the following is not a class?
A. TextField.
B. Label.
C. Int.
D. Scrollbar.
ANSWER: C
239. Package is a collection of __________.
A. classes.
B. variables.
C. functions.
D. concept.
ANSWER: A
240. The dot operator is used to access the instance ______.
A. object.
B. variable.
C. model.
D. value.
ANSWER: B
241. A method can be called only on its ___________.
A. variable.
B. object.
C. method.
D. delay.
ANSWER: B
242. Constructor will have the same name as ______________.
A. class.
B. function.
C. file.
D. package.
ANSWER: A
243. _________ Keyword is used to invoke the current object.
A. NEW
B. THAT
C. THIS
D. ME
ANSWER: C
244. ___________ is a collection of classes.
A. package.
B. variable.
C. class.
D. exception.
ANSWER: A
245. ___________ value cannot be updated.
A. end.
B. final.
C. static.
D. view.
ANSWER: B
246. Inheritance allows _______ of sub classes.
A. creation.
B. updation.
C. view.
D. display.
ANSWER: A
247. ______ is a keyword.
A. static.
B. display.
C. view.
D. maintain.
ANSWER: A
248. When a method calls itseif, it is called __________.
A. recursion.
B. distance.
C. display.
D. problem.
ANSWER: A
249. ________ class must give a concrete method.
A. abstract.
B. constructor.
C. least.
D. program.
ANSWER: A
250. Java was developed by the company
A. Sun Microsystems
B. Microsoft
C. Borland
D. IBM
ANSWER: A