java3
java3
a) statements
b) return type
c) argument list
d) None
d) None
b) False
9. What is true of the finalize() method? A
a) It may be called zero or one times.
b) It may be called zero or more times.
c) It will be called exactly once.
d) It may be called one or more times.
12. Can the Java program accept input from the command line?
A
a) Yes, using command-line arguments
b) Yes, by access command-prompt
c) No
d) None of these
13. this' keyword in java is . A
a) Used to hold the reference of the current object
b) Holds object value
c) Used to create a new instance
d) All of these
14.The 'super' keyword is used to . A
18)Which is the method that accepts data passed in the form of command-line
arguments in Java? B
a) Show() method
b) Main() method
c) Display() method
d) Print() method
19.The data that is passed at the time of running a Java program as command-
line arguments are converted into _____datatype. D
a) Integer array
b) Float array
c) Character array
d) String array
20.Which are the methods used to parse string values to the respective data
types in java. D
a) Boolean.parseBoolean(), Byte.parseByte()
b) Integer.parseInt(),Long.parseLong()
c) Float.parseFloat(), Double.parseDouble()
d) All the above
b) No
a) abstract
b) util
c) extends
d) None of the above
a) TRUE
b) FALSE
c) Abstract class can have constructors but can-not have static methods.
d) Abstract class can-not have constructors but can have static methods.
36.An abstract class in Java usually contains one or more abstract _________. B
a) constructors
b) methods
c) variables
d) None
37.Just like an Interface, you can define constants in abstract classes in Java
State TRUE or FALSE
A
a) TRUE
b) FALSE
c) -
d) –
a) Multiple
b) Multilevel
c) Hierarchal
d) Single
c) The argument-list in the method of sub-class and the method of super-class should be the same
b) FALSE
c) -
d) -
41.A successful Method-Overriding calls the method of _in Java. B
a) Superclass
b) Subclass
c) -
d) –
a) Overriding
b) Overloading
c) -
d) -
45. Which is the correct way to inherit and implement the interface? A
a) classCatimplementsIAnimal{}
b) classCatimportIAnimal{}
c) classCatextendsIAnimal{}
d) Noneiscorrect
46. which of the following is true about methods in an interface in java? A
A. Objects
B. Packages
C. Interfaces
D. NoneoftheMentioned
A. TRUE
B. FALSE
C. Canbetrueor false
D. cannotsay
A. abstract
B. static
C. final
D. private
A. Overriding
B. Inheritance
C. Polymorphism
D. Abstraction
51. Subclass also known as ? D
A. Derived class
B. Child class
C. Base class
D. Both A and B
A. Methods of a friend-class
B. Methods of the main-class
C. Way to encapsulate a group of classes, sub-packages, and interface
D. All of these
A. Classes
B. Sub Packages
C. Interfaces
D. All of the above
A. pkg
B. Pkg
C. package
D. Package
A. TRUE
B. FALSE
C. Can be true or false
D. Can-not say
56. Which of the following packages is used to includes utility classes
like Calendar, Collection, Date? D
A. java.lang
B. java.net
C. java.awt
D. java.util
A. importpkg.
B. Importpkg.
C. importpkg.*
D. Importpkg.*
58. Packages that are inside another package are the ___. D
A. packages
B. nested packages
C. util sub packages
D. sub packages
A. Class
B. Integer
C. Array
D. Byte
A. Void
B. Process
C. Runtime
D. System
b) java
c) util
62.If you import a package, subpackages will not be imported? A
A) True
B) False
A) java.lang
B) java.awt
C) java.lang.ref
D) java.io
64.In which all standard classes of java are included with in a package is ?A
A) java.lang
B) java.math
C) java.ref
D) java.util
A) Package
B) Applet
C) Browser
D) Both A &B
68. If you have classes-A and Bin package my-Package, which import
statement is correct to use them in another class? B
A) Import my-Package.*;
B) import my-Package.A,B;
C) import A,B from my-Package;
D)import class my-Package. A, my-Package. B;
69. Can two classes with the same name exist in different packages? B
c) Multiple-Inheritance, Hybrid-Inheritance
b) False
73.In a Multi-Level Inheritance Class-C inherits from Class-B and Class-B
inherits from Class-A. State TRUE or FALSE. A
a) TRUE
b) FALSE
a) No
b) YES
c) -
d) -
78.Which is the super class in Java that bundles all classes to deal with
exceptions and errors? C
a) Error
b) Exception
c) Throwable
d) Throw
79.Which are the keywords used to handle exceptions in Java? D
a) TRY, CATCH
b) FINALLY
c) THROW, THROWS
d) All the above
80.Where should you keep your Java code for checking against runtime
exceptions? A
a) Java Compiler
b) Java Runtime
c) –
83.Can you add more than one CATCH block when handling exceptions in Java?
a) NO
b) Yes
c) –
84.Where do you keep the Java code that should be executed at all times even
if an exception occurs? C
85.Choose the correct way of writing TRY CATCH FINALLY blocks in Java. D
a) try{}
catch{}
finally{}
b) try{}finally{}
c) try{}catch{}
d) All the above
86.The FINALLY block should always be accompanied by a __block in Java. A
a) TRY
b) CATCH
c) FINALLY
d) None
87.Can you catch an object of type Error in Java using TRY-CATCH blocks? A
a) Yes
a) No
b) -
c) –
88.Which is the super class of Error class in Java? C
a) RuntimeException
b) Exception
c) Throwable
d) Noneofthe above
b) Math Exception
d) Illegal Exception
b) Thread(int priority)
95.Which of the following will ensure the thread will be in running state? C
a) yield()
b) notify()
c) wait()
d) Thread.killThread()
96. Which of this method is used to tell the calling thread to give up a
monitor and go to sleep until some other thread enters the same monitor? A
a) wait()
b) notify()
c) notifyAll()
d) sleep()
98. Which of this method of Thread class is used to find out the
priority given to a thread?
C
a) get()
b) ThreadPriority()
c) getPriority()
d) getThreadPriority()
99) Which of this method of Thread class is used to Suspend a thread for a
period of time? A
a) sleep()
b) terminate()
c) suspend()
d) stop()
103) How many methods does a thread class provides for sleeping a thread?
D
a) 3
b) 1
c) 4
d) 2
b) runningThread()
c) runnableThread()
106) What is the name of the method used to start a thread execution?
C
a) run();
b) init();
c) start();
d) resume();
b) Process
b) paint()
c) displayApplet()
d) printApplet()
b) paint()
c) drawString()
d) transient()
b) print()
c) drwaString()
d) transient()
b) java class
c) Applet class
d) Java.applet.Applet class
b) CSS
c) Html
d) SQL
b) False
121)The ------class is an abstract class that represents the display area of the
applet. B
a) Display
b) Graphics
c) Text
d) Are
b) False
123)The-------- method called the first time an applet is loaded into the memory
of a computer. A
a) Init()
b) Start()
c) Stop()
d) Destroy()
b) Superclass
c) Both a and b
d) None of these
125)Which method is automatically called after the browser calls the init
method? A
a) Start
b) Stop
c) Destroy
d) Paint