CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
Template for generation of Questions
Date:
Module Name: java
Question: 1 Which class cannot be a subclass in java
A: abstract class
B: parent class
C: Final class
D: None of above
Question: 2 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
Question: 3 Runnable is
A. Class
B. Method
C. Variable
D. Interface
Question: 4 Which is a reserved word in the Java programming language?
A:
method
B:
native
C:
subclasses
DASDM Term End Examination
Page 1
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
D:
reference
Question: 5 What is the stored in the object obj in following lines of code?
box obj;
A:
Memory address of allocated memory of object.
B:
NULL
C:
Any arbitrary pointer
D:
Garbage
Question: 6 What is the process of defining more than one method in a class
differentiated by method signature?
A:
Function overriding
B:
Function overloading
C:
Function doubling
D:
none of the mentioned
Question: 7 Which of the following is a method having same name as that of its
class?
A:
finalize
B:
delete
C:
class
D:
constructor
Question: 8 Which method can be defined only once in a program?
A:
main method
B:
finalize method
C:
static method
D:
private method
DASDM Term End Examination
Page 2
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
Question: 9 Package of drawstring() method is
A. java.applet
B. java.io
C. javax.swing
D. java.awt
Question: 10 Which of these methods can be used to output a sting in an applet?
A:
display()
B:
print()
C:
drawString()
D:
transient()
Question: 11 Which method executes only once
A. start() method
B. init() method
C. stop() method
D. destroy() method
Question: 12 A class member declared protected becomes member of subclass of
which type?
A:
public member
B:
private member
C:
protected member
D:
static member
Question:13 Thread class is available in
A. java.io package
B. java.lang package
C. java.awt package
D. java.util package
DASDM Term End Examination
Page 3
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
Question: 14 Which of this access specifies can be used for a class so that its
members can be accessed by a different class in the same package?
A:
Public
B:
Protected
C:
No Modifier
D:
All of the mentioned
Question: 15 Which of these access specifiers must be used for main() method?
A:
private
B:
public
C:
protected
D:
None of the mentioned
Question: 16 Minimum threads in a program are
A. 1
B. 2
C. 5
D. Many
Question: 17 Which of these keywords is not a part of exception handling?
A:
try
B:
finally
C:
thrown
D:
catch
Question: 18 Which of these keywords must be used to monitor for exceptions?
A:
try
DASDM Term End Examination
Page 4
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
B:
finally
C:
throw
D:
catch
Question: 19 Which of these keywords must be used to handle the exception
thrown by try block in some rational manner?
A:
try
B:
finally
C:
throw
D:
catch
Question: 20 What is the output of this program?
class exception_handling {
public static void main(String args[]) {
try {
System.out.print("Hello" + " " + 1 / 0);
}
catch(ArithmeticException e) {
System.out.print("World");
}
}
}
a) Hello
b) World
c) HelloWorld
d) Hello World
Question: 21 Which of these class is superclass of all other classes?
A:
Math
DASDM Term End Examination
Page 5
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
B:
Process
C:
System
D:
Object
Question: 22 If method have same name as class name and method dont
have any return type then it is known as
A. Destructors
B. Object
C. Variable
D. Constructor
Question: 23 Which of these standard collection classes implements a dynamic
array?
A:
AbstractList
B:
LinkedList
C:
ArrayList
D:
AbstractSet
Question: 24 Which of these methods can be used to obtain a static array from an
ArrayList object?
a) Array()
b) covertArray()
c) toArray()
d) covertoArray()
DASDM Term End Examination
Page 6
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
Question: 25 Which of these method is used to reduce the capacity of an
ArrayList object?
a) trim()
b) trimSize()
c) trimTosize()
d) trimToSize()
Question: 26 Which of these method is used to add an element to the start of a
LinkedList object?
a) add()
b) first()
c) AddFirst()
d) addFirst()
Question: 27 Which of these methods can be used to delete the last element in a
LinkedList object?
a) remove()
b) delete()
c) removeLast()
d) deleteLast()
Question: 28 Which of these method is used to change an element in a LinkedList
Object?
a) change()
b) set()
c) redo()
d) add()
DASDM Term End Examination
Page 7
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
Question: 29 What is multithreaded programming?
a) Its a process in which two different processes run simultaneously.
b) Its a process in which two or more parts of same process run simultaneously.
c) Its a process in which many different process are able to access same information.
d) Its a process in which a single process can access information from many sources.
Question: 30 Methods that have same name, but different Parameter list and
different definition known as
A. Overriding
B. Constructor
C. Overloading
D. none of these
View Answer
Question: 31 Which of these method of Thread class is used to find out the
priority given to a thread?
a) get()
b) ThreadPriority()
c) getPriority()
d) getThreadPriority()
Question: 32 Which function of pre defined class Thread is used to check weather
current thread being checked is still running?
a) isAlive()
b) Join()
c) isRunning()
d) Alive()
Question: 33 Which of these interface is implemented by Thread class?
a) Runnable
DASDM Term End Examination
Page 8
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
b) Connections
c) Set
d) MapConnections
Question: 34 Which of these statement is incorrect?
a) A thread can be formed by implementing Runnable interface only.
b) A thread can be formed by a class that extends Thread class.
c) start() method is used to begin execution of the thread.
d) run() method is used to begin execution of a thread before start() method in special
cases.
Question: 35 Which of these class contains the methods used to write in a file?
a) FileStream
b) FileInputStream
c) BUfferedOutputStream
d) FileBufferStream
Question: 36 Which of these exception is thrown by close() and read() methods?
a) IOException
b) FileException
c) FileNotFoundException
d) FileInputOutputException
Question: 37 Which of these class is used to read and write bytes in a file?
a) FileReader
b) FileWriter
c) FileInputStream
d) InputStreamReader
Question: 38 Which of these class can be used to implement input stream that
uses a character array as the source?
DASDM Term End Examination
Page 9
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
a) BufferedReader
b) FileReader
c) CharArrayReader
d) FileArrayReader
Question: 39 Package of drawstring() method is
a) java.applet
b) java.io
c) javax.swing
d) java.awt
Question: 40 which one method is used to set the close operation?
A:
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
B:
SetDefaultCloseOperation(jFrame.EXIT_ON_CLOSE)
C:
setDefaultCloseOperation()
D:
none
Question: 41 which one method is used to set the visibility of the frame?
A:
setVisible(true).
B:
setVisible(false).
C:
setVisible()
D:
none.
Question: Which method is used for getting the language in internationalization?
A:
getDisplayLanguage()
B:
GetdisplayLanguage()
C:
GetDisplayLanguage().
D:
none.
Question: 43 which one method used to set the state of the frame ?
A:
setExtendedState()
B:
SetExtendedState()
DASDM Term End Examination Page 10
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
C:
none
D:
can not say
Question: 44 Which of these packages contains all the event handling interfaces?
a) java.lang
b) java.awt
c) java.awt.event
d) java.event
Question: 45 Which of these interfaces handles the event when a component is
added to a container?
a) ComponentListener
b) ContainerListener
c) FocusListener
d) InputListener
Question: 46 Which of these functions is called to display the output of an applet?
a) display()
b) print()
c) displayApplet()
d) PrintApplet()
Question: 47 Which of these methods can be used to output a sting in an applet?
a) display()
b) print()
c) drawString()
d) transient().
DASDM Term End Examination Page 11
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
Question: 48 Which of these package is used for analyzing code during run-time?
a) java.applet
b) java.awt
c) java.io
d) java.lang.reflect
.
Question: 49 Which of these package is used for handling security related issues
in a program?
a) java.security
b) java.lang.security
c) java.awt.image
d) java.io.security
Question: 50 Which of these class allows us to get real time data about private
and protected member of a class?
a) java.io
b) GetInformation
c) ReflectPermission
d) MembersPermission
Question: 51 Which of these package is used for invoking a method remotely?
a) java.rmi
b) java.awt
c) java.util
d) java.applet
Question: 52 What is the length of the application box made by this program?
import java.awt.*;
import java.applet.*;
DASDM Term End Examination Page 12
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
public class myapplet extends Applet {
public void paint(Graphics g) {
g.drawString("A Simple Applet", 20, 20);
}
}
a) 20
b) 50
c) 100
d) System dependent.
Question: 53 Which of these class is necessary to implement datagrams?
a) DatagramPacket
b) DatagramSocket
c) Both of the mentioned
d) None of the mentioned
Question: 54 Which of these method of DatagramPacket is used to find the port
number?
a) port()
b) getPort()
c) findPort()
d) recievePort()
Question: 55 Which of these is a protocol for breaking and sending packets to an
address across a network?
a) TCIP/IP
b) DNS
c) Socket
d) Proxy Server
DASDM Term End Examination Page 13
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
Question: 56 Which of these interface abstractes the output of messages from
httpd?
a) LogMessage
b) LogResponse
c) Httpdserver
d) httpdResponse
Question: 57 Which of these is a standard for communicating multimedia content
over email?
a) http
b) https
c) Mime
d) httpd
Question: 58 Which of these method of MimeHeader is used to return the string
equivalent of the values stores on MimeHeader?
a) string()
b) toString()
c) convertString()
d) getString()
Question: 59 Which of these is an instance variable of class httpd?
a) port
b) cache
c) log
d) All of the mentioned
Question: 60 Which of these is an instance variable of httpd that is a Hashtable?
DASDM Term End Examination Page 14
CENTRE FOR DEVELOPMENT OF ADVANCED
COMPUTING
Advanced Computing Training School
a) port
b) cache
c) log
d) stopFlag
DASDM Term End Examination Page 15