You are on page 1of 465

Action

QuestionText QuestionType Choice1 Choice2 Choice3 Choice4 Choice5


class A, B and C are in multilevel inheritance MCQ Constructor of Constructor of Constructor of Constructor of
hierarchy repectively . In the main method of A executes C executes C executes A executes
some other class if class C object is created, in first, followed first followed first followed first followed
what sequence the three constructors execute? by the by the by the by the
constructor of constructor of constructor of constructor of
ADD B and C A and B B and A C and B
A) A call to instance method can not be made MCQ Only B is Only A is Both are Both are
from static context. TRUE TRUE TRUE FALSE
B) A call to static method can be made from
ADD
non static context.
A) No argument constructor is provided to all MCQ Only A is All are TRUE B and C is All are FALSE
Java classes by default TRUE TRUE
B) No argument constructor is provided to the
class only when no constructor is defined.
C) Constructor can have another class object
as an argument
D) Access specifiers are not applicable to
ADD
Constructor
Which modifier is used to control access to MCQ default public transient synchronized
ADD
critical code in multi-threaded programs?
Which of the following sentences is true? MCQ Only A and C All are TRUE All are FALSE Only A is
A) Access to data member depends on the is TRUE TRUE
scope of the class and the scope of data
members
B) Access to data member depends only on the
scope of the data members
C) Access to data member depends on the
scope of the method from where it is accessed
ADD
Which modifier indicates that the variable might MCQ synchronized volatile transient default
be modified asynchronously, so that all threads
will get the correct value of the variable.
ADD
A constructor may return value including class MCQ true false
ADD
type
When we use both implements & extends MCQ we must use we must use we can use in extends and
keywords in a single java program then what is always always any order its implements
the order of keywords to follow? extends and implements not at all a can't be used
later we must and later we problem together
use must use
implements extends
ADD keyword. keyword.
Which of these field declarations are legal in an MCA public static int int answer; final static int public int
private final
interface? (Choose all applicable) answer = 42; answer = 42; answer = 42;
static int
ADD answer = 42;
Which of the following defines a legal abstract MCQ class Vehicle { abstract class abstract abstract class abstract class
class? abstract void Vehicle { Vehicle { Vehicle { Vehicle {
display(); } abstract void abstract void abstract void abstract void
display(); } display(); } display(); { display(); }
System.out.pri
ADD ntln("Car"); }}
Choose the correct declaration of variable in an MCQ public final static data static final final data type
interface: data type type variable; data type variablename
varaibale=intia varaiblename; =intialization;
ADD lization;
A class Animal has a subclass Mammal. Which MCQ Because of Because of Because of Because of
of the following is true: single single single single
inheritance, inheritance, inheritance, inheritance,
Mammal can Mammal can Animal can Mammal can
have no have no other have only one have no
subclasses parent than subclass siblings.
ADD Animal
Which of the following is correct for an abstract MCA An abstract An abstract An abstract Abstract class
class. (Choose TWO) class is one class is one class is one can be
which contains which contains which contains declared final
general some defined only static
purpose methods and methods
methods some
undefined
methods
ADD
Select the correct statement: MCQ Private A subclass An overriding The The overriding
methods can override method can parameter list method must
cannot be any method in declare that it of an have different
overridden in a superclass throws overriding return type as
subclasses checked method can the overridden
exceptions be a subset of method
that are not the parameter
thrown by the list of the
method it is method that it
ADD overriding is overriding
Select the correct statement: MCQ A super() or If both a If neither If super() is Calling super()
this() call must subclass and super() nor the first as the first
always be its superclass this() is statement in statement in
provided do not have declared as the body of a the body of a
explicitly as any declared the first constructor, constructor of
the first constructors, statement in this() can be a subclass will
statement in the implicit the body of a declared as always work,
the body of a default constructor, the second since all
constructor. constructor of this() will statement superclasses
the subclass implicitly be have a default
will call super() inserted as constructor.
when run the first
ADD statement.
The concept of multiple inheritance is MCQ (A) (A) & (C) (D) (B) & (C)
implemented in Java by

(A) extending two or more classes


(B) extending one class and implementing one
or more interfaces
(C) implementing two or more interfaces
ADD
(D) all of these
Given a derived class method which overrides MCQ super keyword this keyword by creating an cannot call
one of it’s base class methods. With derived instance of the because it is
class object you can invoke the overridden base class overridden in
ADD
base method using: derived class
All data members in an interface are by default MCQ abstract and public and public ,static default and
ADD final abstract and final abstract
Which of the following statements is true MCQ It can only be Only one child
It must be It must be
regarding the super() method? used in the class can useused in the used in the
parent's it last statement first statement
constructor of the of the
ADD constructor. constructor.
Is it possible if a class definition implements two MCQ No—if a class No—a class Yes— either Yes—since
interfaces, each of which has the same implements may not of the two the definitions
definition for the constant? several implement variables can are the same
interfaces, more than one be accessed it will not
each constant interface through : matter
must be interfaceName
defined in only .variableName
one interface
ADD
Which collection class allows you to grow or MCQ java.util.Hash java.util.Linke java.util.List java.util.Array java.util.Vector
shrink its size and provides indexed access to Set dHashSet List
its elements, but its methods are not
ADD
synchronized?
static int binarySearch(List list, Object key) is a MCQ Vector class ArrayList class Collection Collections
ADD
method of __________ interface class
static void sort(List list) method is part of MCQ Collection Collections Vector class ArrayList class
ADD
________ interface class
next() method of Scanner class will return MCQ Integer Long int String
ADD
_________
int indexOf(Object o) - What does this method MCQ null -1 none of the
ADD
return if the element is not found in the List? listed options
A) It is a good practice to store heterogenous MCQ A and B is A and D is A and C is B and C is
data in a TreeSet. TRUE TRUE TRUE TRUE
B) HashSet has default initial capacity (16) and
loadfactor(0.75)
C)HashSet does not maintain order of Insertion
D)TreeSet maintains order of Inserstion
ADD
A)Property files help to decrease coupling MCQ A and B is A and D is A and C is B and D is
B) DateFormat class allows you to format dates TRUE TRUE TRUE TRUE
and times with customized styles.
C) Calendar class allows to perform date
calculation and conversion of dates and times
between timezones.
ADD
D) Vector class is not synchronized
Which interface does java.util.Hashtable MCQ Java.util.Map Java.util.List Java.util.Table Java.util.Colle
ADD
implement? ction
Which collection class allows you to access its MCQ java.util.Sorte java.util.TreeM java.util.TreeS java.util.Hasht
elements by associating a key with an element's dMap ap et able
value, and provides synchronization?
ADD
You wish to store a small amount of data and MCQ 1 2 3 4
make it available for rapid access. You do not
have a need for the data to be sorted,
uniqueness is not an issue and the data will
remain fairly static Which data structure might
be most suitable for this requirement?

1) TreeSet
2) HashMap
3) LinkedList
ADD
4) an array
A) Iterator does not allow to insert elements MCQ A and B is A and D is A and C is B and D is
during traversal TRUE TRUE TRUE TRUE
B) Iterator allows bidirectional navigation.
C) ListIterator allows insertion of elements
during traversal
D) ListIterator does not support bidirectional
ADD
navigation
Object get(Object key) - What does this method MCQ -1 null none of the
return if the key is not found in the Map? listed options
ADD
A) The purpose of the method overriding is to MCQ Only A is Only B is True Both A and B Both A and B
perform different operation, though input TRUE is True is FALSE
remains the same.
B) one of the important Object Oriented
principle is the code reusability that can be
ADD
achieved using abstraction
Which three are legal array declarations? MCA int [] char [] int [6] Dog myDogs Dog myDogs
ADD
(Choose THREE) myScores []; myChars; myScores; []; [7];
Given classes A, B, and C, where B extends A, MCQ It is not super.doIt() his.super.doIt( ((A) A.this.doIt()
and C extends B, and where all classes possible ) this).doIt();
implement the instance method void doIt(). How
can the doIt() method in A be
ADD
called from an instance method in C?
How many objects and reference variables are MCQ Two objects Three objects Four objects Two objects
created by the following lines of code? and three and two and two and two
Employee emp1, emp2; reference reference reference reference
emp1 = new Employee() ; variables. variables variables variables.
ADD
Employee emp3 = new Employee() ;
Consider the following code and choose the MCQ false true 1
correct option:
public class Test {
public static void main(String[] args) {
String name="ALDPR7882E";
System.out.println(name.endsWith("E") &
ADD
name.matches("[A-Z]{5}[0-9]{4}[A-Z]"));}}
A)A string buffer is a mutable sequence of MCQ Only A is Only B is Both A and B Both A and B
characters. TRUE TRUE is TRUE is FALSE
B) sequece of characters in the string buffer
ADD
can not be changed.
For two string objects obj1 and obj2: MCQ Only A is Only B is Both A and B Both A and B
A) Use of obj1 == obj2 tests whether two String TRUE TRUE is TRUE is FALSE
object references refer to the same object
B) obj1.equals(obj2) compares the sequence of
characters in obj1 and obj2.
ADD
How can you force garbage collection of an MCQ Garbage Call Call Call Set all
object? collection System.gc() System.gc() Runtime.gc(). references to
cannot be passing in a the object to
forced reference to new
the object to values(null, for
be garbage example).
ADD collected
Which statements describe guaranteed MCA An object is The finilize() The finalize() An object will The garbage
behaviour of the garbage collection and deleted as method will method will not be collector will
finalization mechanisms? (Choose TWO) soon as there eventually be never be garbage use a mark
are no more called on called more collected as and sweep
references every object than once on long as it algorithm
that denote an object possible for a
the object live thread to
access it
through a
ADD reference.
Which of the following statements about arrays MCQ Person[] p []; Person p[][] = Person[] p = Person p[5];
is syntactically wrong? new new
ADD Person[2][]; Person[5];
Which collection implementation is suitable for MCQ TreeMap HashSet Vector LinkedList ArrayList
maintaining an ordered sequence of
objects,when objects are frequently inserted in
and removed from the middle of the sequence?
ADD
Which of these statements are true? MCA HashTable is ArrayList is a LinkedList is a Stack is a
a sub class of sub class of subclass of subclass of
ADD Dictionary Vector ArrayList Vector
Which of the following statements are true MCA String is a Double has a Character has Byte extends String is the
regarding wrapper classes? (Choose TWO) wrapper class compareTo() a intValue() Number wrapper class
method method of char
ADD
Which statements are true about maps? MCA The return Changes The Map All keys in a All Map
(Choose TWO) type of the made in the interface map are implementatio
values() Set view extends the unique ns keep the
method is set returned by Collection keys sorted
keySet() will interface
be reflected in
the original
ADD map
Which of the following statements is TRUE MCQ An overflow A continue A loop may If a variable of
regarding a Java loop? error can only statement have multiple type int
occur in a loop doesn’t exit points overflows
transfer during the
control to the execution of a
test statement loop, it will
of the for loop cause an
ADD exception
Choose TWO correct options: MCA To write an To write OutputStream Subclasses of
object to a file,
characters to is the abstract the class
you use the an superclass of Reader are
class outputstream, all classes that used to read
ObjectFileWrityou have to represent an character
er make use of outputstream streams.
the class of bytes.
CharacterOut
ADD putStream.
The term 'Java Platform' refers to MCQ Java Compiler Java Runtime Java Java
________________. (Javac) Environment Database Debugger
(JRE) Connectivity
ADD (JDBC)
Which of the following statement gives the use MCQ Holds the Holds the Holds the Holds the
of CLASSPATH? location of location of location of location of
Core Java Java User Defined Java Software
Class Library Extension classes,
(Bootstrap Library packages and
ADD classes) JARs
Which of the following options give the valid MCA String[] args String args[] String [][]args String args String[] args[]
argument types for main() method? (Choose 2)
ADD
Which of the following are true about MCA Packages can Packages can Packages can Sub packages Class and
packages? (Choose 2) contain only contain both contain non- should be Interfaces in
Java Source Classes and java elements declared as the sub
files Interfaces such as private in packages will
(Compiled images, xml order to deny be
Classes) files etc. importing automatically
them available to
the outer
packages
without using
import
ADD statement.
Which of the following statements are true MCA Object class is Object class Object class Object class Object class
regarding java.lang.Object class? (Choose 2) an abstract cannot be has the core provides the implements
class instantiated methods for method for Serializable
directly thread Set interface
synchronizatio implementatio internally
n n in Collection
ADD framework
Which of the following option gives one possible MCQ To maintain Helps the Helps JVM to Helps
use of the statement 'the name of the public the uniform compiler to find and Javadoc to
class should match with its file name'? standard find the execute the build the Java
source file that classes Documentatio
corresponds n easily
to a class,
when it does
not find a
class file while
compiling

ADD
Which of the following methods are defined in MCA run() notify() terminate() wait() start()
ADD
class Thread? (Choose TWO)
wait(), notify() and notifyAll() methods belong to MCQ Thread class none of the Interrupt class Object class
ADD
________ listed options
A) Multiple processes share same memory MCQ Only C and D Only A and B Only B and C All are FALSE
location is TRUE is TRUE is TRUE
B) Switching from one thread to another is
easier than switching from one process to
another
C) Thread makes it possible to maximize
resource utilization
ADD
D) Process is a light weight program
Which of the following methods registers a MCQ start(); register(); construct(); run();
ADD
thread in a thread scheduler?
Which of the following statements can be used MCA Implement Implement Implement Extend Extend
to create a new Thread? (Choose TWO) java.lang.Thre java.lang.Thre java.lang.Run java.lang.Thre java.lang.Run
ad and ad and nable and ad and nable and
implement the implement the implement the override the override the
run() method. start() method. run() method run() method. start() method.
ADD
A) Exception is the superclass of all errors and MCQ Both A and B Only B is Only A is Both A and B
exceptions in the java language are TRUE TRUE TRUE are FALSE
B) RuntimeException and its subclasses are
ADD
unchecked exception.
Select the variable which are in MCA METHOD SOURCE CLASS RUNTIME CONSTRUCT
java.lang.annotation.RetentionPolicy class. OR
ADD
(Choose THREE)
Custom annotations can be created using MCQ @interface @inherit @include all the listed
ADD options
Choose the meta annotations. (Choose MCA Override Retention Depricated Documented Target
ADD
THREE)
All annotation types should maually extend the MCQ true false
ADD
Annotation interface. State TRUE/FALSE
If no retention policy is specified for an MCQ method class source runtime
annotation, then the default policy of
ADD
__________ is used.
Select the Uses of annotations. (Choose MCA Information Information for Compile time Runtime Information for
THREE) For the the JVM and processing the OS
Compiler deploytime
ADD processing
Which of the following is not an attribute of MCQ State Behaviour Inheritance Identity
ADD
object?
What is the advantage of runtime MCQ Efficient Code reuse Code flexibility avoiding
polymorphism? utilization of at runtime method name
memory at confusion at
ADD runtime runtime
Which of the following is an example of IS A MCQ Ford - Car Microprocesso Tea -Cup Driver -Car
ADD
relationship? r - Computer
Which of the following is not a valid relation MCQ Composition Inheritance Instantiation Segmentation
ADD
between classes?
Choose the correct option: MCQ A try Multiple catch An Error that Except in case
statement statements might be of VM
must have at can catch the thrown in a shutdown, if a
least one same class of method must try block starts
corresponding exception be declared to execute, a
catch block more than as thrown by corresponding
once. that method, finally block
or be handled will always
within that start to
method. execute.
ADD
State True or False: MCQ True False
The main() method of a program can declare
ADD
that it throws checked exception.
Which statement is true? MCQ The notifyAll() To call sleep(), The notify() The notify()
method must a thread must method is method
be called from own the lock defined in causes a
a on the object class thread to
synchronized java.lang.Thre immediately
context ad release its
ADD locks.
Which of the following is a checked exception? MCQ Arithmetic IOException NullPointerExc ArrayIndexOut
Exception eption OfBoundsExc
ADD eption
Consider the following code and choose the MCQ none of the runtime error does not compiles
correct option: listed options compile successfully
int array[] = new int[10];
ADD
array[-1] = 0;
Which statement is true? MCQ A static If a class has Variables can When a
method synchronized be protected thread sleeps,
cannot be code, multiple from it releases its
synchronized. threads can concurrent locks
still access the access
nonsynchroniz problems by
ed code. marking them
with the
synchronized
ADD keyword.
The exceptions for which the compiler doesn’t MCQ Checked Unchecked Exception all of these
ADD
enforce the handle or declare rule exceptions exceptions
Which two can be used to create a new MCA Implement Extend Implement Extend Implement
Thread? java.lang.Run java.lang.Thre java.lang.Thre java.lang.Run java.lang.Thre
nable and ad and ad and nable and ad and
implement the override the implement the override the implement the
run() method. run() method. start() method. start() method. run() method.
ADD
Which of the following statements regarding MCA static methods static methods static methods static methods
static methods are correct? (2 answers) are difficult to can be called are always do not have
maintain, using an public, direct access
because you object because they to non-static
can not reference to are defined at methods
change their an object of class-level. which are
implementatio the class in defined inside
n. which this the same
method is class.
defined.
ADD
In the given code snippet MCA ClassCastExc NumberForma IllegalStateEx IllegalArgume
try { int a = Integer.parseInt("one"); } eption tException ception ntException
what is used to create an appropriate catch
block? (Choose all that apply.)
A. ClassCastException
B. IllegalStateException
C. NumberFormatException
ADD
D. IllegalArgumentException
ADD
Which of the following methods are static? MCA sleep() yield() join() start()
Which of the following statements are true? MCA Deadlock will The wait()A thread will The notify() Both wait()
(Choose TWO) not occur if method is resume method is and notify()
wait()/notify() overloaded to
execution as overloaded to must be called
is used accept a soon as its accept a from a
duration sleep duration duration synchronized
ADD expires. context.
Which can appropriately be thrown by a MCQ ClassCastExc NullPointerExc NoClassDefFo NumberForma
programmer using Java SE technology to eption eption undError tException
create
ADD
a desktop application?
What is the keyword to use when the access of MCQ volatile synchronized final private
a method has to be restricted to only one thread
ADD
at a time
A) Checked Exception must be explicity caught MCQ Only A is Only B is Bothe A and B Both A and B
or propagated to the calling method TRUE TRUE is TRUE is FALSE
B) If runtime system can not find an appropriate
method to handle the exception, then the
runtime system terminates and uses the default
ADD
exception handler.
If a method is capable of causing an exception MCQ true false
that it does not handle, it must specify this
behavior using throws so that callers of the
method can guard themselves against such
ADD
Exception
Which of the following statements is/are true? MCQ Both Statement 2 is Both Statement 1 is
Statement 1: Writing finally block is optional. Statement 1 & TRUE but Statement 1 & TRUE but
Statement 2: When no exception occurs then Statement 2 Statement 1 is Statement 2 Statement 2 is
complete try block and finally block will execute are FALSE. FALSE. are TRUE. FALSE.
ADD
but no catch block will execute.
What happens when the constructor for MCQ throws a throws a throws a returns null
FileInputStream fails to open a file for reading? DataFormatEx FileNotFound ArrayIndexOut
ception Exception OfBoundsExc
ADD eption
What is the DataOutputStream method that MCQ writeBytes() writeFloat() write() writeDouble()
writes double precision floating point values to a
ADD
stream?
A file is readable but not writable on the file MCQ A The boolean The boolean The file is none of the
system of the host platform. What will SecurityExcep value false is value true is modified from listed options
be the result of calling the method canWrite() tion is thrown returned returned being
on a File object representing this file? unwritable to
being writable.
ADD
A) It is not possible to execute select query with MCQ Both A and B Only A is Only B is Both A and B
execute() method is FALSE TRUE TRUE is TRUE
B) CallableStatement can executes store
ADD
procedures only but not functions
A) When one use callablestatement, in that MCQ Both A and B Only A is Only B is Both A and B
case only parameters are send over network is FALSE TRUE TRUE is TRUE
not sql query.
B) In preparestatement sql query will compile
ADD
for first time only
getConnection() is method available in? MCQ DriverManage Driver ResultSet Statement PreparedState
r Class Interface Interface Interface ment Interface
ADD
Sylvy wants to develop Student management MCQ Statement CallableState PreparedState RowSet
system, which requires frequent insert operation ment ment
about student details. In order to insert student
record which statement interface will give good
ADD
performance
Which method will return boolean when we try MCQ executeUpdat executeSQL() execute() executeQuery
to execute SQL Query from a JDBC program? e() ()
ADD
An application can connect to different MCQ true false
Databases at the same time. State
ADD
TRUE/FALSE.
A) By default, all JDBC transactions are auto MCQ Only A and B Only B and C Both A and C All are TRUE
commit is TRUE is True is TRUE
B) PreparedStatement suitable for dynamic sql
and requires one time compilation
C) with JDBC it is possible to fetch information
ADD
about the database
how to register driver class in the memory? MCQ Using Using the Either None of the
forName() static method forName() or given options
which is a registerDriver( registerDriver(
static method ) method )
which is
available in
DriverManage
ADD r Class.
What is the use of wasNull() in ResultSet MCQ There is no It returns true It returns int none of the
interface? such method when last read value as listed options
in ResultSet column mentioned
interface contain SQL below: > 0 if
NULL else many columns
returns false Contain Null
Value < 0 if no
column
contains Null
Value = 0 if
one column
contains Null
value
ADD
Which of the following options contains only MCQ 1) Driver 2) 1) Driver 2) 1) Driver 2) All of the given
JDBC interfaces? Connection 3) Connection 3) Connection 3) options
ResultSet 4) ResultSet 4) ResultSet 4)
DriverManage ResultSetMeta ResultSetMeta
r 5) Class Data 5) Data 5)
Statement 6) Statement 6)
DriverManage PreparedState
r 7) ment 7)
PreparedState Callablestate
ment 8) ment 8)
Callablestate DataBaseMet
ment 9) aData
DataBaseMet
ADD aData
By default all JDBC transactions are MCQ true false
ADD
autocommit. State TRUE/FALSE.
What is the default type of ResultSet in JDBC MCQ Read Only, Updatable, Read only, Updatable,
applications? Forward Only Forward only Scroll Scroll
ADD Sensitive sensitive
Which of the following methods finds the MCQ Database.get Connection.ge DatabaseMeta ResultSetMeta
maximum number of connections that a specific MaxConnectio tMaxConnecti Data.getMaxC Data.getMaxC
ADD
driver can obtain? ns ons onnections onnections
Which of the following method can be used to MCQ executeAll() executeAllSQ execute() executeQuery executeUpdat
execute to execute all type of queries i.e. either L() () e()
ADD
Selection or Updation SQL Queries?
It is possible to insert/update record in a table MCQ true false
ADD
by using ResultSet. State TRUE/FALSE
Which of the following methods are needed for MCQ registerDriver( Class.forNam registerDriver( getConnection
loading a database driver in JDBC? ) method e() ) method and
Class.forNam
ADD e()
Carefully read the question and answer MCQ specifier Inheritance Implementatio Access Class
accordingly. n specifier
________ determines which member of a class
ADD
can be used by other classes.
Carefully read the question and answer MCQ protected final,interface public,friend final,protected private,abstra
accordingly. ,interface ct
A class can be declared as _______ if you do
not want the class to be subclassed. Using
the __________keyword we can abstract a
ADD
class from its implementation
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
The constructor of a class must not have a
ADD
return type.
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
When one method is overridden in sub class
the access specifier of the method in sub class
should be equal as method in super class.
State True or False.
ADD
Carefully read the question and answer MCQ Class Public Constructor Destructor Variable
accordingly.
Which of the following method is used to
ADD
initialize the instance variable of a class.
Carefully read the question and answer MCQ protected or protected or None of the private
accordingly. default public listed options
If display method in super class has a protected
specifier then what should be the specifier for
the overriding display method in sub class?
ADD
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
A field with default access specifier can be
accessed out side the package.
ADD
State True or False.
Carefully read the question and answer MCQ If one class is A class can be All members Protected is
accordingly. having declared as of abstract default access
Which of the following are true about protected protected protected. class are by modifier of a
access specifier? method then default child class
the method is protected
available for
subclass
which is
present in
another
ADD package
Carefully read the question and answer MCQ Constructors Constructors Constructor is Constructors
accordingly. can be can be a special type should be
Which of the following are true about overloaded overridden. of method called
constructors? which may explicitly like
have return methods
ADD type.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Constructor of an class is executed each time
ADD
when an object of that class is created
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
Object class provides a method named
getClass() which returns runtime class of an
ADD
object.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
A concrete class can extend more than one
super class whether that super class is either
ADD
concrete or abstract class
Carefully read the question and answer MCQ final protected static abstract
accordingly.
Which of the following keywords ensures that a
ADD
method cannot be overridden?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
An overriding method can also return a subtype
of the type returned by the overridden method.
ADD
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
An abstract class cannot contain non abstract
ADD
methods
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
The super() call can only be used in constructor
ADD
calls and not method calls.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
If any class has at least one abstract method
ADD
you must declare it as abstract class
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
If any method overrides one of it’s super class
methods, we can invoke the overridden method
ADD
through the this keyword.
Carefully read the question and answer MCQ Statement I & Statement I is Statement I is Statement I &
accordingly. II are TRUE TRUE & II is FALSE & II is II are FASLE
Choose the correct option. FALSE TRUE
Statement I: When an abstract class is sub
classed, the subclass should provide the
implementation for all the abstract methods in
its parent class.
Statement II: If the subclass does not implement
the abstract method in its parent class, then the
subclass must also be declared abstract.
ADD
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
Interface can be used when common
functionalities have to be implemented
ADD
differently across multiple classes.
Carefully read the question and answer MCQ Statement I & Statement I is Statement I is Statement I &
accordingly. II are TRUE TRUE & II is FALSE & II is II are FASLE
Choose the correct option. FALSE TRUE
Statement I: When all methods in a class are
abstract the class can be declared as an
interface.
Choose the correct option.
Statement II: An interface defines a contract for
ADD
classes to implement the behavior.
Carefully read the question and answer MCQ Statement I & Statement I is Statement I is Statement I &
accordingly. II are TRUE TRUE & II is FALSE & II is II are FASLE
Abstract classes can be used when FALSE TRUE
Statement I: Some implemented functionalities
are common between classes
Statement II: Some functionalities need to be
implemented in sub classes that extends the
ADD
abstract class
Carefully read the question and answer MCQ Aggregation Composition Generic Polymorphic
accordingly.
Which of the following correctly fits for the
ADD
definition 'holding instances of other objects'?
Carefully read the question and answer MCQ Statement I & Statement I is Statement I is Statement I &
accordingly. II are TRUE TRUE & II is FALSE & II is II are FASLE
Choose the correct option. FALSE TRUE
Statement I: A subclass inherits all of the
“public” and “protected” members of its parent,
no matter what package the subclass is in.
Statement II: If the subclass of any class is in
the same package then it inherits the default
access members of the parent.
ADD
Carefully read the question and answer MCQ System.free(); System.setGa System.out.gc System.gc();
accordingly. rbageCollectio ();
Which of the following is the correct syntax for n();
suggesting that the JVM to performs garbage
ADD
collection?
Carefully read the question and answer MCQ Both Statement A is Statement A is Both
accordingly. Statements A true and false and Statements A
Statement A:finalize will always run before an and B are true Statement B is Statement B is and B are
object is garbage collected false true false
Statement B:finalize method will be called only
once by the garbage collector
ADD
which of the following is true?
Carefully read the question and answer MCQ Option 2 Option 3 Option 1 Option 4
accordingly.
How can you force garbage collection of an
object?
1.Garbage collection cannot be forced
2.Call System.gc().
3.Call Runtime.gc().
4. Set all references to the object to new
ADD
values(null, for example).
Carefully read the question and answer MCQ address dot scope none of these
accordingly. resolution
Members of the classs are accessed by
ADD
_________ operator
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Garbage collector thread is a daemon thread.
ADD
State True or False.
Carefully read the question and answer MCA try catch finally access exception
accordingly.
Find the keyword which is not used to
ADD
implement exception
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
The ++ operator postfix and prefix has the
ADD
same effect
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
Garbage collection guarantee that a program
will not run out of memory. State True or False.
ADD
Carefully read the question and answer MCQ extends implements throwed Integer Boolean
accordingly.
Which of the following is not the Java keyword?
ADD
Carefully read the question and answer MCQ class new print main Object
accordingly.
_____________ Operator is used to create an
ADD
object.
Carefully read the question and answer MCQ III->I->II->IV. I->III->II->IV I->III->IV->II I->II->III->IV
accordingly.
What is the correct structure of a java program?
I: import statement
II: class declaration
III: package statement
IV: method,variable declarations
ADD
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
Threads are small process which run in shared
ADD
memory space within a process.
Carefully read the question and answer MCQ Statement1 is Statement2 is BOTH BOTH
accordingly. TRUE but TRUE but Statement1 & Statement1 &
Which of the following statements are true? Statement2 is Statement1 is Statement2 Statement2
Statement1: When a thread is sleeping as a FALSE. FALSE. are TRUE. are FALSE.
result of sleep(), it releases its locks.
Statement2: The Object.wait() method can be
ADD
invoked only from a synchronized context.
Carefully read the question and answer MCQ Runnable Running Dead Blocked Stop
accordingly.
ADD
Which of the below is invalid state of thread?
Carefully read the question and answer MCQ 1&2 1&3 2&3 1&4 2&4
accordingly.
Which two statements are true?
1.It is possible for more than two threads to
deadlock at once.
2.The JVM implementation guarantees that
multiple threads cannot enter into a
deadlocked state.
3.Deadlocked threads release once their
sleep() method's sleep duration has expired.
4.If a piece of code is capable of deadlocking,
you cannot eliminate the possibility of
deadlocking by inserting
invocations of Thread.yield().
ADD
Carefully read the question and answer MCQ void run() void start() boolean boolean
accordingly. getPriority() isAlive()
Which of these is not valid method in Thread
ADD
class
Carefully read the question and answer MCQ One Two Three Four
accordingly.
ADD
Java provides ____ ways to create Threads.
Carefully read the question and answer MCQ wait() notify() notifyAll() all the options
accordingly.
Inter thread communication is achieved using
ADD
which of the below methods?
Carefully read the question and answer MCA Synchronized Synchronized Synchronized Synchronized Synchronized
accordingly. blocks methods classes abstract interfaces
Synchronization is achieved by using which of classes
ADD
the below methods
Carefully read the question and answer MCQ Reduce Support Increase Requires less None of the
accordingly. response time parallel system overheads options.
Which of these is not a benefit of of process. operation of efficiency. compared to
ADD
Multithreading? functions. multitasking.
Carefully read the question and answer MCQ 1&2 1&3 2&3 1&4 2&4
accordingly.
Which of the following are not List
implementations?
1.Vector
2.Hashtable
3.LinkedList
ADD
4.Properties
Carefully read the question and answer MCA List Set SortedList SortedQueue
accordingly.
Which of these interface(s) are part of Java’s
ADD
core collection framework?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
foreach loop is the only option to iterate over a
ADD
Map
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
LinkedList represents a collection that does not
ADD
allow duplicate elements.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Under java.util package we have "Collections"
ADD
as Class and "Collection" as Interface
Carefully read the question and answer MCQ boolean void Object String
accordingly.
ADD
What is the return type of next() in Iterator?
Carefully read the question and answer MCQ Creates a Creates a Creates a Creates a
accordingly. Date object Date object Date object Date object
Consider the following partial code: with 0 as with '01-01- with current with current
java.util.Date date = new java.util.Date(); default value 1970 12:00:00 date and time date alone as
Which of the following statement is true AM' as default as default default value
regarding the above partial code? value value
ADD
Carefully read the question and answer MCA The Iterator The The The
accordingly. interface ListIterator ListIterator ListIterator
Which of the following are true statements? declares only interface interface interface
three extends both provides the provides
methods: the List and ability to forward and
hasNext, next Iterator determine its backward
and remove. interfaces position in the iteration
ADD List. capabilities.
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
Enumeration is having remove() method.
ADD
State True or False.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
The add method of Set returns false if you try to
ADD
add a duplicate element.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
The LinkedList class supports two constructors.
ADD
Carefully read the question and answer MCA Hash Map Array List Collection Sorted Map
accordingly.
Which of these are interfaces in the collection
ADD
framework
Carefully read the question and answer MCA java.utill.Map java.util.Array java.util.Dictio java.util.Hash
accordingly. List nary Map
Which collection class allows you to associate
ADD
its elements with key values
Carefully read the question and answer MCA Serializable SortTable SortedSet Comparable
accordingly.
TreeSet uses which two interfaces to sort the
ADD
data
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Iterator i= new HashMap().entrySet().iterator();
is this correct declaration
ADD
Carefully read the question and answer MCA The elements The elements The elements HashSet
accordingly. in the in the in the allows at most
Which statement are true for the class collection are collection arecollection are one null
HashSet? accessed guaranteed to accessed element
using a unique be unique using a unique
ADD key. key.
Carefully read the question and answer MCA All All All all
accordingly. implementatio implementatio implementatio implementatio
which are the Basic features of implementations ns are ns support ns are ns are
of interfaces in Collections Framework in java? unsynchronize having null serializable immutable
d elements. and cloneable and supports
duplicates
ADD data
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
ADD
Map is the super class of Dictionary class?
Carefully read the question and answer MCA for loop list Iterator foreach Iterator
accordingly.
what is the way to iterate over the elements of a
ADD
Map
Carefully read the question and answer MCQ Both the Statement A is Statement A is Both the
accordingly. Statements A true and false and statements A
Consider the following Statements: and B are true Statement B is Statement B is and B are
Statement A: The Iterator interface declares false true false.
only two methods: hasMoreElements and
nextElement.
Statement B: The ListIterator interface extends
both the List and Iterator interfaces.
Which of the following option is correct
ADD
regarding above given statements?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
ADD
Is "Array" a subclass of "Collection" ?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Is this true or false. Map interface is derived
ADD
from the Collection interface.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Method keySet() in Map returns a set view of
the keys contained in that map.
ADD
State True or False.
Carefully read the question and answer MCQ 1&2 1&3 2&3 1&4 2&4
accordingly.
Which of the following are synchronized?
1.Hashtable
2.Hashmap
3.Vector
ADD
4.ArrayList
Carefully read the question and answer MCQ Both Statement A is Statement A is Both
accordingly. Statements A true and false and Statements A
Consider the following statements about the and B are true Statement B is Statement B is and B are
Map type Objects: false true false
Statement A: Changes made in the set view
returned by keySet() will be reflected in the
original map.
Statement B: All Map implementations keep the
keys sorted.
Which of the following option is true regarding
ADD
the above statements?
Carefully read the question and answer MCQ comparator compare compareTo compareWith
accordingly.
When comparable interface is used which
ADD
method should be overridden?
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
Iterator is having previous() method.
ADD
State True or False.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
ADD
The ArrayList<String> is immutable.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
StringTokenizer implements the Enumeration
ADD
interface
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
The APIS of StringBuffer are synchronized
ADD
unlike that of StringBuilder
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
StringBuilder is not thread-safe unlike
ADD
StringBuffer
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
String class do not provides a method which is
used to compare two strings lexicographically.
ADD
Carefully read the question and answer MCQ Statement I & Statement I is Statement I is Statement I &
accordingly. II are TRUE TRUE & II is FALSE & II is II are FASLE
Choose the correct option. FALSE TRUE
Statement I: StringBuilder offers faster
performance than StringBuffer
Statement II: All the methods available on
StringBuffer are also available on StringBuilder
ADD
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
endsWith() member methods of String class
creates new String object. State True or False
ADD
Carefully read the question and answer MCQ Statement I & Statement I is Statement I is Statement I &
accordingly. II are TRUE TRUE & II is FALSE & II is II are FASLE
Choose the correct option. FALSE TRUE
Statement I: StringBuffer is efficient than “+”
concatenation
Statement II: Using API’s in StringBuffer the
content and length of String can be changed
ADD
which intern creates new object.
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
State whether TRUE or FALSE.
String s = new String(); is valid statement in
ADD
java
Carefully read the question and answer MCQ Comparing Searching Extracting All of above
accordingly. strings strings strings
ADD
String class contains API used for
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Propagating exceptions across modules is not
possible without throw and throws keyword.
ADD
State True or False.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
try and throws keywords are used to manually
ADD
throw an exception?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
RuntimeException is the superclass of those
exceptions that can be thrown during the
ADD
normal operation of the Java Virtual Machine.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
ADD
Error is the sub class of Throwable
Carefully read the question and answer MCA A NoClassDefFo NoClassDefFo None of the
accordingly. ClassNotFoun undError undError is a options
Which is/are true among given statements dException is means that subClass of
thrown when the class was ClassNotFoun
the reported found by the dException
class is not ClassLoader
found by the however when
ClassLoader trying to load
in the the class, it
CLASSPATH. ran into an
error reading
the class
ADD definition.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
is it valid to place some code in between try and
ADD
catch blocks.
Carefully read the question and answer MCQ Throwable throws throw RuntimeExcep
accordingly. tion
Which is the super class for Exception and
ADD
Error?
Carefully read the question and answer MCA An exception The use of finally block The death of
accordingly. arising in the System.exit() will be always the thread
If you put a finally block after a try and its finally block executed in
associated catch blocks, then once execution itself any
enters the try block, the code in that finally block circumstances
will definitely be executed except in some .
circumstances.select the correct circumstance
ADD
from given options:
Carefully read the question and answer MCQ 1&2 1&3 2&3 1&4 2&4
accordingly.
Which of the following are checked exceptions?
1.ClassNotFoundException
2.InterruptedException
3.NullPointerException
4.ArrayIndexOutOfBoundsException
ADD
Carefully read the question and answer MCQ An exception A catch block Both catch All of the listed
accordingly. which is not can have block and options
Which of the following statement is true handled by a another try finally block
regarding try-catch-finally? catch block block nested can throw
will be inside exceptions
handled by
subsequent
ADD catch blocks
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
The finally block always executes when the try
block exits.
ADD
State True or False.
Carefully read the question and answer MCQ Executing try Executing try Compile Time Runtime
accordingly. After try Runtime Exception Exception
What will be the output of following code? Executing Exception
try catch
{
System.out.println("Executing try");
}
System.out.println("After try");
catch (Exception ex)
{
System.out.println("Executing catch");
ADD
}
Carefully read the question and answer MCQ try finally throw throwable
accordingly.
Which of these keywords is used to explicitly
ADD
throw an exception?
Carefully read the question and answer MCA IOException Throwable RunTimeExce FileNotFindEx
accordingly. ption ception
which of these are the subclass of Exception
ADD
class
Carefully read the question and answer MCA try final thrown catch
accordingly.
Which of these keywords are a part of
ADD
exception handling?
Carefully read the question and answer MCA Runtime Runtime RuntimeExcep RunTimeExce
accordingly. exceptions exceptions tion is a class ption are the
what are true for RuntimeException need not be include of I/O exceptions
explicitly arithmetic exception which forces
caught in try exceptions, the
catch block as pointer programmer
it can occur exceptions to catch them
anywhere in a explicitly in try-
program. catch block
ADD
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
Within try block if System.exit(0) is called then
also finally block is going to be executed.
ADD
State True or False.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
select true or false . Statement : Throwable is
ADD
the super class of all exceptional type classes.
Carefully read the question and answer MCQ 1&2 1&5 2&3 1&4 2&4
accordingly.
Select two runtime exceptions.
1.SQLException
2.NullPointerException
3.FileNotFoundException
4.ArrayIndexOutOfBoundsException
ADD
5.IOException
Carefully read the question and answer MCA Try block if exception catch block is after switching
accordingly. always occurs, control not mandate from try block
which are true for try block needed a switches to always only to catch block
catch block following first finally followed the control
followed Catch block by try can be never come
executed back to try
block to
execute rest
of the code
ADD
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Try can be followed with either catch or finally.
State True or False.
ADD
Carefully read the question and answer MCA A checked error and Checked All runtime
accordingly. exception is a checked exceptions are exceptions are
which are correct for checked exceptions subclass of exceptions are the object of checked
throwable same. the Exception exceptions
class class or any of
its subclasses
except
Runtime
Exception
class.

ADD
Carefully read the question and answer MCQ Both Statement A is Statement A is Both
accordingly. Statements A true and false and Statements A
Which of the following statement is true and B are true Statement B is Statement B is and B are
regarding implementing user defined exception false true false
mechanisms?
Statement A: It is valid to derive a class from
java.lang.Exception
Statement B: It is valid to derive a class from
ADD
java.lang.RuntimeException
Carefully read the question and answer MCA Class Cast Array Index ClassNotFoun Number
accordingly. Exception Out Of dException Format
which are the Unchecked exceptions Bounds Exception
ADD Exception
Carefully read the question and answer MCQ IOException FileNotFound SQLException NullPointerExc
accordingly. Exception eption
Which of the following exception is not
ADD
mandatory to be handled in code?
Carefully read the question and answer MCQ statement statement statement statement
accordingly. 1:true 1:false 1:false 1:true
Statement 1:static variables can be serialized statement2:tru statement2:tru statement2:fal statement2:fal
Statement2:transient variables cannot be e e se se
serialized
ADD
which of the following is true?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State TRUE or FALSE.
getParent() gives the parent directory of the file
and isFile() Tests whether the file denoted by
the given abstract pathname is a normal file.
ADD
Carefully read the question and answer MCQ DataInput ObjectInput ObjectFilter FileFilter
accordingly.
Which of these interface is not a member of
ADD
java.io package?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
BufferedWriter constructor CAN ACCEPT
Filewriter Object as a parameter.
ADD
State True or False.
Carefully read the question and answer MCA File Writer Reader OutputStream
accordingly.
Which of these class are related to input and
ADD
output stream in terms of functioning?
Carefully read the question and answer MCQ java/system /java/system system compilation
accordingly. error
What is the output of this program?
1. import java.io.*;
2. class files {
3. public static void main(String args[]) {
4. File obj = new File("/java/system");
5. System.out.print(obj.getName());
6. }
ADD
7. }
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
isFile() returns true if called on a file or when
ADD
called on a directory
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Serialization is representing object in a
ADD
sequence of bytes. State True or False.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
An ObjectInputStream deserializes objects
previously written using an
ObjectOutputStream.
ADD
State True or False.
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
InputStream is the class used for stream of
characters.
ADD
State True or False.
Carefully read the question and answer MCA BufferedOutpu setting up it has flush() As bytes from
accordingly. tStream class BufferedOutpu method the stream are
select the correct statements about is a member tStreaman , read or
BufferedOutputStream class of Java.io an application skipped, the
package can write internal buffer
bytes to the is refilled as
underlying necessary
output stream from the
without contained
necessarily input stream,
causing a call many bytes at
to the a time.
underlying
system for
each byte
ADD written.
Carefully read the question and answer MCQ Runnable Serializable Externalizable None of the
accordingly. listed options
Which of the following is a marker interface
ADD
used for object serialization?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
DataInputStream is not necessarily safe for
ADD
multithreaded access.
Carefully read the question and answer MCA ObjectInput StringReader File String
accordingly.
Which of these class are the member class of
ADD
java.io package?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
InputStreamReader is sub class of
ADD
FilterReader.
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
The InputStream.close() method closes this
ADD
stream and releases all system resources
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Serialization is JVM independent.State True or
ADD
False.
Carefully read the question and answer MCQ 1&2 1&2&3 1&3&4 1&2&4 2&4
accordingly.
Which of the following are abstract classes?
1.Reader
2.InputStreamReader
3.InputStream
ADD
4.OutputStream
Carefully read the question and answer MCQ switch continue break label branch
accordingly.
_____________ is a multi way branch
ADD
statement
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
We can use Wrapper objects of type int, short,
char in switch case.
ADD
State True or False.
Carefully read the question and answer MCQ The number of 2 4 8 64
accordingly. bytes is
What is the number of bytes used by Java compiler
ADD
primitive long dependent
Carefully read the question and answer MCQ by value by reference Both by value none of these
accordingly. & reference
ADD
Data can be passed to the function ____
Carefully read the question and answer MCQ switch for while do …. While for..each
accordingly.
Which of the following is a loop construct that
ADD
will always be executed once?
Carefully read the question and answer MCQ compiles and compilation Runtime Error compiles and
accordingly. print 3 error prints 12
What will be the output for following code?
public class Wrapper2 {
public static void main(String[]args){
Byte b=1;
Byte a=2;
System.out.println(a+b);
}
ADD
}
Carefully read the question and answer MCQ break Jump exit goto escape
accordingly.
The ______ statement is used inside the switch
ADD
to terminate a Statement sequence
Carefully read the question and answer MCQ default break continue new none
accordingly.
Each case in switch statement should end with
ADD
________ statement
Carefully read the question and answer MCQ executeUpdat executeQuery execute() noexecute()
accordingly. e() ()
Which method executes a simple query and
ADD
returns a single Result Set object?
Carefully read the question and answer MCQ ResultSet Parametrized PreparedState Condition
accordingly. ment
Which object allows you to execute
ADD
parametrized queries?
Carefully read the question and answer MCQ 1&2 3&4 2&3 1&4 2&4
accordingly.
Which statements about JDBC are true?
1.JDBC has 5 types of Drivers
2.JDBC stands for Java DataBase Connectivity
3.JDBC is an API to access relational
databases, spreadsheets and flat files
4.JDBC is an API to bridge the object-relational
mismatch between OO programs and relational
databases
ADD
Carefully read the question and answer MCQ PreparedState Parameterized Parameterized All kinds of
accordingly. ment Statement Statement and Statements
Which type of Statement can execute CallableState (i.e. which
parameterized queries? ment implement a
sub interface
ADD of Statement)
Carefully read the question and answer MCQ Connection Connection Connection Connection
accordingly. cn=DriverMan cn=DriverMan cn=DriverMan cn=DriverMan
You are using JDBC-ODBC bridge driver to ager.getConn ager.getConn ager.getConn ager.getConn
establish a connection with a database. You ection("jdbc:o ection("jdbc:o ection("jdbc:o ection("jdbc:o
have created a DSN Mydsn. Which statement dbc"); dbc:Mydsn", dbc dbc:dsn"
will you use to connect to the database? "username", ","username", ,"username",
ADD "password"); "password"); "password");
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
The method Class.forName() is a part of JDBC
ADD
API. State True or False.
Carefully read the question and answer MCQ putConnection setConnection Connection() getConnetion(
accordingly. () () )
Connection object can be initialized using which
ADD
method of the Driver Manager class?
Carefully read the question and answer MCQ Type 1 driver Type 2 driver Type 3 driver Type 4 driver
accordingly.
Which type of driver converts JDBC calls into
the network protocol used by the database
ADD
management system directly?
Carefully read the question and answer MCQ JDBC drivers ODBC drivers Both A and B None of the
accordingly. above
The JDBC-ODBC Bridge driver translates the
JDBC API to the ODBC API and used with
ADD
which of the following:
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Type 1 & Type 3 driver types are not vendor
specific implementation of Java driver. State
ADD
True or False
Carefully read the question and answer MCQ executeUpdat executeQuery execute() noexecute()
accordingly. e() ()
Which method executes an SQL statement that
ADD
may return multiple results?
Carefully read the question and answer MCQ connection.sql db.sql pkg.sql java.sql
accordingly.
Which package contains classes that help in
connecting to a database, sending SQL
statements to the database, and processing the
ADD
query results
Carefully read the question and answer MCQ initialized started paused stopped
accordingly.
What is the state of the parameters of the
PreparedStatement object when the user clicks
ADD
on the Query button?
Carefully read the question and answer MCQ java.util.Date java.sql.Date java.sql.Time java.sql.Times
accordingly. tamp
Which of the following listed option gives the
valid type of object to store a date and time
ADD
combination using JDBC API?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
If your JDBC Connection is in auto-commit
mode, which it is by default, then every SQL
statement is committed to the database upon its
ADD
completion. State True or False.
Carefully read the question and answer MCQ Call method Call method Call method Call method
accordingly. execute() on a executeProce execute() on a run() on a
How can you execute a stored procedure in the CallableState dure() on a StoredProced ProcedureCo
database? ment object Statement ure object mmand object
ADD object
Carefully read the question and answer MCQ ResultSet Parametrized TableStateme Condition
accordingly. nt
Which object provides you with methods to
ADD
access data from the table?
Carefully read the question and answer MCQ DDL To execute DDL Support for
accordingly. statements DDL statements DDL
What is correct about DDL statements? are treated as statements, cannot be statements will
normal SQL you have to executed by be a feature of
statements, install making use of a future
and are additional JDBC, you release of
executed by support files should use the JDBC
calling the native
execute() database tools
method on a for this.
Statement (or
a sub
interface
thereof) object
ADD
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
executeUpdate() & execute() are valid methods
that can be used for executing DDL statements.
ADD
State True or False
Carefully read the question and answer MCQ ODBC written ODBC written ODBC written ODBC written
accordingly. in C language in C# in C++ in Basic
A Java program cannot directly communicate language language language
with an ODBC driver because of which of the
ADD
following:
Carefully read the question and answer MCQ Both Statement A is Statement A is Both
accordingly. Statement A True and False and Statements A
Consider the following statements: and Statement Statement B is Statement B is and B are
Statement A: The PreparedStatement object B are True. False. True. False.
enables you to execute parameterized queries.
Statement B: The SQL query can use the
placeholders which are replaced by the INPUT
parameters at runtime.
Which of the following option is True with
respect to the above statements?
ADD
Carefully read the question and answer MCQ java.jdbc and java.jdbc and java.sql and java.rdb and
accordingly. javax.jdbc java.jdbc.sql javax.sql javax.rdb
ADD
Which packages contain the JDBC classes?
Carefully read the question and answer MCQ putString() insertString() setString() setToString()
accordingly.
Which method sets the query parameters of the
ADD
PreparedStatement Object?
Carefully read the question and answer MCQ Statement PreparedState CallableState None of the
accordingly. ment ment listed options
Consider you are developing a JDBC
application, where you have to retrieve the
Employee information from the database table
based on Employee id value passed at runtime
as parameter. Which best statement API you
will use to execute parameterized SQL
ADD
statement at runtime?
Carefully read the question and answer MCQ java.util.Hash java.util.Linke java.util.List java.util.Array
accordingly. Set dHashSet List
Which collection class allows you to grow or
shrink its size and provides indexed access to
its elements, but whose methods are not
ADD
synchronized?
Carefully read the question and answer MCQ ResultSet ResultSetMeta DataSource Statement
accordingly. Data
Consider you are developing a JDBC
application, where you have to retrieve
Employee table schema information like table
columns name, columns field length and data
type etc. Which API you will use to retrieve table
ADD
schema information?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
In Thread implementation methods like wait(),
notify(), notifyAll() should be used in
synchronized context .
ADD
State true or false
Carefully read the question and answer MCQ Reader and InputStream Collection None of the
accordingly. Writer Stream and APIs listed options
Consider you are developing an application APIs OutputStream
where you have to store and retrieve data in Stream APIs
character format in file. Which API you will use
to store and retrieve the data in character
ADD
format?
Carefully read the question and answer MCQ TreeMap HashMap LinkedHashM Non of the
accordingly. ap listed options
Which of the following provides an efficient
means of storing key/value pairs in sorted
ADD
order, and allows rapid retrieval?
Carefully read the question and answer MCQ Statement PreparedState CallableState None of the
accordingly. ment ment listed options
Consider you are developing a JDBC
application, where you have to retrieve quarterly
report from database by executing database
store procedure created by database
developer. Which statement API you will use to
execute store procedure and retrieve ResultSet
ADD
information?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Interfaces are mainly used to expose behavior
or functionality not the implementation code.
ADD
State true or false
Carefully read the question and answer MCQ Reduces Allows Reduces effort Fosters All of the listed
accordingly. programming interoperability to learn and to software reuse options
Select the advantages of using Collection API’s effort among use new APIs
in java application development. unrelated APIs
ADD
Carefully read the question and answer MCA If the equals() If the equals() If the If the
accordingly. method method hashCode() hashCode()
Which statements are true about comparing returns true, returns false, comparison comparison
two instances of the same class, given that the the the == returns == returns
equals() and hashCode() methods have been hashCode() hashCode() true, the true, the
properly overridden? comparison comparison equals() equals()
== might == might method must method might
ADD return false return true return true return true
Carefully read the question and answer MCQ Declare the Declare the Declare the None of the
accordingly. ProgrammerA ProgrammerA ProgrammerA listed options
Consider you are developing java application in nalyst class nalyst class nalyst class
a team consists of 20 developers and you have has abstract has private has final
been asked to develop class by Name
ProgrammerAnalyst and to ensure that other
developers in team use ProgrammerAnalyst
class only by creating object and team member
should not be given provision to inherit and
modify any functionality written in
ProgrammerAnalyst class using inheritance.
How do you achieve this requirement in
ADD
development scenario?
Carefully read the question and answer MCQ finalization Serialization Synchronizatio Deserialization
accordingly. n
Consider a development scenario where you
want to write the object data into persistence
storage devices (like file, disk etc.).Using which
of the below concept you can achieve the given
ADD
requirement?
Carefully read the question and answer MCQ By By Two thread in A thread can
accordingly. multithreading multitasking Java can have exist only in
Which of the following statement is incorrect? CPU’s idle CPU’s idle same priority two states,
time is time is running and
minimized, minimized, blocked.
and we can and we can
take maximum take maximum
ADD use of it. use of it.
Carefully read the question and answer MCQ Using Thread Using object Using object None of the
accordingly. Synchronizatio serialization deserialization listed options
Consider you are developing an ATM n
application for ABC Bank using java application.
Several account holders of ABC Bank have
opted for add-on cards. There is a chance that
two users may access the same account at
same time and do transaction simultaneously
knowingly or unknowingly from different ATM
machine from same or different bank branches.
As developer you have to ensure that when one
user login to account until he finishes his
transaction account should be locked to other
users who are trying access the same account.
How do you implement given requirement
programmatically using java?
ADD
Carefully read the question and answer MCQ main method finalize static block private
accordingly. method code method
Which of these is executed first before
execution of any other thing takes place in a
ADD
program?
Carefully read the question and answer MCQ Check Check Check None of the
accordingly. whether you whether you whether you listed options
Consider you are trying to persist or store object have have have marked
of Customer class using ObjectOutputStream implemented implemented Customer
class in java. When you are trying to persist Customer Customer class methods
customer object data java code is throwing class with class with with
runtime exception without persisting object Serializable Externalizable synchronized
information. Please suggest what is the key interface interface keyword
important factor you have consider in code in
order to persist customer object data.
ADD
Carefully read the question and answer MCQ java.lang.Strin java.lang.Dou java.lang.Strin java.lang.Char
accordingly. g ble gBuffer acter
Which class does not override the equals() and
hashCode() methods, inheriting them directly
ADD
from class Object?
Carefully read the question and answer MCQ Any one will Both of them None of them It is dependent
accordingly. be executed will be will be on the
What will happen if two thread of same priority first executed executed operating
are called to be processed simultaneously? lexographicall simultaneousl system.
ADD y y
Carefully read the question and answer MCQ FALSE TRUE
accordingly.
In Thread implementation making method
synchronized is always better in order to
increase application performance rather than
using synchronize block to synchronize certain
block of statements written in java inside the
method.
ADD
State True or False.
Carefully read the question and answer MCQ Generics Generics and When All of the
accordingly. provide type parameterized designing your mentioned
Which of the following is incorrect statement safety by types own
regarding the use of generics and shifting more eliminate the collections
parameterized types in Java? type checking need for down class (say, a
responsibilities casts when linked list),
to the using Java generics and
compiler. Collections. parameterized
types allow
you to achieve
type safety
with just a
single class
definition as
opposed to
defining
multiple
classes.
ADD
Carefully read the question and answer MCQ Mark Mark Make Make
accordingly. Employee Employee Employee Employee
Consider the development scenario where you class with class with final class methods class methods
have created Employee class with abstract keyword private public
implementation code and as per the project keyword
requirement you have to ensure that developer
in team reusing code written in Employee class
only using inheritance by extending the
employee class but not by creating the instance
of Employee object directly. Please suggest the
solution to implement given requirement?
ADD
Carefully read the question and answer MCQ java.util.Map java.util.Set java.util.List java.util.Collec
accordingly. tion
You need to store elements in a collection that
guarantees that no duplicates are stored and all
elements can be accessed in natural order.
ADD
Which interface provides that capability?
Carefully read the question and answer MCQ Implement Implement Implement None of the
accordingly. using Arrays using using file API’s listed options
Consider you are developing shopping cart Collection
application you have to store details of items API’s.
purchased by the each customer in
intermediate memory before storing purchase
details in actual database permanently note that
number of different items purchased by
customer is not definite it may vary. How do you
implement given requirement using java
considering best performance of the
ADD
application?
Consider the following code and choose the MCQ Compiles and Compiles and Compiles and Compilation
correct option: display 2 runs without display 0 error
class X { int x; X(int x){x=2;}} any output
class Y extends X{ Y(){} void displayX(){
System.out.print(x);}
public static void main(String args[]){
ADD
new Y().displayX();}}
Consider the following code and choose the MCQ Compiles and Compiles and Compiles but Compilation
correct option: prints show() prints throws runtime error
class Test{ private void display(){ Display() exception
System.out.println("Display()");} show()
private static void show() { display();
System.out.println("show()");}
public static void main(String arg[]){
ADD
show();}}
Consider the following code and choose the MCQ Compilation Comiples and Compiles but Compiles and
correct option: error prints From A throws runtime display 3
class A{ A(){System.out.print("From A");}} exception
class B extends A{ B(int z){z=2;}
public static void main(String args[]){
ADDnew B(3);}}
class One{ MCQ 0,0 compiles compile error none of these
int var1; successfully
One (int x){ but runtime
var1 = x; error
}}
class Derived extends One{
int var2;
void display(){
System.out.println("var
1="+var1+"var2="+var2);
}}
class Main{
public static void main(String[] args){
Derived obj = new Derived();
obj.display();
}}
consider the code above & select the proper
ADD
output from the options.
Consider the following code and choose the MCQ code compiles code compiles j can not be compliation
correct option: fine and will but will not initialized error
package aj; class A{ protected int j; } display 23 display output
package bj; class B extends A
{ public static void main(String ar[]){
ADD
System.out.print(new A().j=23);}}
class Order{ MCQ compile error Man Dog Cat Dog Man Cat Cat Ant Dog
Order(){ Ant Ant Man
System.out.println("Cat");
}
public static void main(String... Args){
Order obj = new Order();
System.out.println("Ant");
}
static{
System.out.println("Dog");
}
{
System.out.println("Man");
}}
consider the code above & select the proper
ADD
output from the options.
public class MyAr { MCQ Unresolved Compilation None of the
public static void main(String argv[]) { compilation and output of given options
MyAr m = new MyAr(); problem: The null
m.amethod(); local variable
} i1 may not
public void amethod() { have been
final int i1; initialized
System.out.println(i1);
}
}
ADD
What is the Output of the Program?
class MyClass1 MCQ Compilation Runtime 2500 50
{ error Exception
private int area(int side)
{
return(side * side);
}
public static void main(String args[ ])
{
MyClass1 MC = new MyClass1( );
int area = MC.area(50);
System.out.println(area);
}
}
ADDWhat would be the output?
class Sample MCQ 100 100 1 2 1 2 100 100 10 20 1 2 100 1 2 10 20 100
{int a,b; 10 20 10 20 100 100
Sample()
{ a=1; b=2;
System.out.println(a+"\t"+b);
}
Sample(int x)
{ this(10,20);
a=b=x;
System.out.println(a+"\t"+b);
}
Sample(int a,int b)
{ this();
this.a=a;
this.b=b;
System.out.println(a+"\t"+b);
}
}
class This2
{ public static void main(String args[])
{
Sample s1=new Sample (100);
}
}
ADD
What is the Output of the Program?
Consider the following code and choose the MCQ prints Hi Hello Compiler Error Runs but no Runtime Error
correct option: output
public class MyClass {
public static void main(String arguments[]) {
amethod(arguments);
}
public void amethod(String[] arguments) {
System.out.println(arguments[0]);
System.out.println(arguments[1]);
}
}
ADD
Command Line arguments - Hi, Hello
Given: MCQ int Long Short Long Compilation An exception
public class Yikes { fails. is thrown at
runtime.
public static void go(Long n)
{System.out.print("Long ");}
public static void go(Short n)
{System.out.print("Short ");}
public static void go(int n) {System.out.print("int
");}
public static void main(String [] args) {
short y = 6;
long z = 7;
go(y);
go(z);
}
}
ADD
What is the result?
abstract class MineBase { MCQ A Sequence A Sequence IndexOutOfBo Compilation
abstract void amethod(); of 5 zero's will of 5 one's will undes Error Error occurs
static int i; be printed like be printed like and to avoid
} 00000 11111 them we need
public class Mine extends MineBase { to declare
public static void main(String argv[]){ Mine class as
int[] ar=new int[5]; abstract
for(i=0;i < ar.length;i++)
System.out.println(ar[i]);
}
ADD
}
What will be the result when you attempt to MCQ Compile time A random A random A compile time
compile this program? error referring number number error as
public class Rand{ to a cast between 1 between 0 random being
public static void main(String argv[]){ problem and 10 and 1 an undefined
int iRand; method
iRand = Math.random();
System.out.println(iRand);
}
ADD
}
Which of the following declarations are correct? MCA boolean b = byte b = 256; String s = int i = new
ADD
(Choose TWO) TRUE; “null”; Integer(“56”);
What will be the result when you try to compile MCQ 200 100 followed Compile time 100
and run the following code? by 200 error
private class Base{
Base(){
int i = 100;
System.out.println(i);
}
}

public class Pri extends Base{


static int i = 200;
public static void main(String argv[]){
Pri p = new Pri();
System.out.println(i);
}
ADD
}
Suppose class B is sub class of class A: MCQ Only B and C Only A is All are FALSE Only A and C
A) If class A doesn't have any constructor, then is TRUE TRUE is TRUE
class B also must not have any constructor
B) If class A has parameterized constructor,
then class B can have default as well as
parameterized constructor
C) If class A has parameterized constructor
then call to class A constructor should be made
explicitly by constructor of class B
ADD
What will be printed out if you attempt to MCQ default zero default zero Compilation default
compile and run the following code ? one two Error
public class AA {
public static void main(String[] args) {
int i = 9;
switch (i) {
default:
System.out.println("default");
case 0:
System.out.println("zero");
break;
case 1:
System.out.println("one");
case 2:
System.out.println("two");
}
}
ADD
}
Consider the following code and choose the MCQ Compiles but Compiles and Compilation Compiles and
correct option: no output diplay 0 error display 1
package aj; private class S{ int roll;
S(){roll=1;} }
package aj; class T
{ public static void main(String ar[]){
ADD
System.out.print(new S().roll);}}
public class Q { MCQ Compiler 2 1 Compiler
public static void main(String argv[]) { Error: anar is Error: size of
int anar[] = new int[] { 1, 2, 3 }; referenced array must be
System.out.println(anar[1]); before it is defined
} initialized
ADD
}
Which statements, when inserted at (1), will not MCA i= i = this.suns; this = new this.i = 4; this.suns =
result in compile-time errors? this.planets; ThisUsage(); planets;
public class ThisUsage {
int planets;
static int suns;
public void gaze() {
int i;
// (1) INSERT STATEMENT HERE
}
ADD
}
Given the following code what will be output? MCQ Error: 10 and 40 10, and 20 20 and 40
public class Pass{ amethod
static int j=20; parameter
public static void main(String argv[]){ does not
int i=10; match variable
Pass p = new Pass();
p.amethod(i);
System.out.println(i);
System.out.println(j);
}

public void amethod(int x){


x=x*2;
j=j*2;
}
ADD
}
class Order{ MCQ Dog Ant Dog Man Cat Man Dog Ant Dog Man Ant
Order(){ Ant
System.out.println("Cat");
}
public static void main(String... Args){
System.out.println("Ant");
}
static{
System.out.println("Dog");
}
{
System.out.println("Man");
}}
consider the code above & select the proper
ADD
output from the options.
public class c123 { MCQ Hellow It is not Compilation Runs without
private c123() { possible to Error any output
System.out.println("Hellow"); declare a
} constructor as
public static void main(String args[]) { private
c123 o1 = new c123();
c213 o2 = new c213();
}
}
class c213 {
private c213() {
System.out.println("Hello123");
}
}

ADD
What is the output?
class A { MCQ This is j: 5 i This is i: 3 j This is i: 7 j This is k: 7 i
int i, j; and k: 3 7 and k: 5 7 and k: 3 5 and j: 3 7

A(int a, int b) {
i = a;
j = b;
}
void show() {
System.out.println("i and j: " + i + " " + j);
}
}
class B extends A {
int k;

B(int a, int b, int c) {


super(a, b);
k = c;
}
void show(String msg) {
System.out.println(msg + k);
}
}
class Override {
public static void main(String args[]) {
B subOb = new B(3, 5, 7);
subOb.show("This is k: "); // this calls show()
in B
subOb.show(); // this calls show() in A
}
ADD
} What would be the ouput?
public class MyAr { MCQ Compilation Garbage It is not
static int i1; Error Value possible to
public static void main(String argv[]) { access a static
MyAr m = new MyAr(); variable in
m.amethod(); side of non
} static method
public void amethod() {
System.out.println(i1);
}
}
ADD
What is the output of the program?
Given: MCQ Meal() Lunch() Meal() Meal() Lunch() Cheese()
package QB; PortableLunch Cheese() PortableLunch Sandwich()
() Cheese() Lunch() () Sandwich() Meal() Lunch()
class Meal { Sandwich() PortableLunch Cheese() PortableLunch
Meal() { () Sandwich() ()
System.out.println("Meal()");
}
}
class Cheese {
Cheese() {
System.out.println("Cheese()");
}
}
class Lunch extends Meal {
Lunch() {
System.out.println("Lunch()");
}
}
class PortableLunch extends Lunch {
PortableLunch() {
System.out.println("PortableLunch()");
}
}
class Sandwich extends PortableLunch {
private Cheese c = new Cheese();

public Sandwich() {
System.out.println("Sandwich()");
}
}
ADD
public class MyClass7 {
Consider the following code and choose the MCQ compiles and compilation Compiles and Compiles and
correct option: display 0 error display 4 display 3
class A{ int a; A(int a){a=4;}}
class B extends A{ B(){super(3);} void
displayA(){
System.out.print(a);}
public static void main(String args[]){
ADDnew B().displayA();}}
class Order{ MCQ Cat Ant Dog Dog Cat Ant Ant Cat Dog none
Order(){
System.out.println("Cat");
}
public static void main(String... Args){
Order obj = new Order();
System.out.println("Ant");
}
static{
System.out.println("Dog");
}}
consider the code above & select the proper
ADD
output from the options.
What will happen if a main() method of a MCQ The compiler The compiler The program The program
"testing" class tries to access a private instance will will find the will compile will compile
variable of an object using dot notation? automatically error and will and run successfully,
change the not make a successfully but the .class
private .class file file will not run
variable to a correctly
public variable
ADD
What will be the result of compiling the following MCQ The program A compilation A compilation A compilation
program? will compile error will occur error will occur error will occur
public class MyClass { without errors. at (Line no 2), at (Line no 1), at (2), since
long var; since the class since the class does
public void MyClass(long param) { var = param; does not have constructors not have a
} // (Line no 1) a constructor cannot specify default
public static void main(String[] args) { that takes one a return value constructor
MyClass a, b; argument of
a = new MyClass(); // (Line no 2) type int.
}
ADD
}
public class MyClass { MCQ String: String int: 27, String: Compilation Runtime
static void print(String s, int i) { first, int: 11 int: Int first String: Error Exception
System.out.println("String: " + s + ", int: " + i); 99, String: Int String first, int:
} first 27

static void print(int i, String s) {


System.out.println("int: " + i + ", String: " + s);
}

public static void main(String[] args) {


print("String first", 11);
print(99, "Int first");
}
}What would be the output?

ADD
Here is the general syntax for method definition: MCQ The If the The The
returnValue returnType is returnValue returnValue
accessModifier returnType methodName( can be any void then the must be the must be
parameterList ) type, but will returnValue same type as exactly the
{ be can be any the same type as
Java statements automatically type returnType, or the
converted to be of a type returnType.
return returnValue; returnType that can be
} when the converted to
method returnType
returns to the without loss of
What is true for the returnType and the caller information
returnValue?
ADD
11. class Mud { MCQ 3 1 2
12. // insert code here
13. System.out.println("hi");
14. }
15. }
And the following five fragments:
public static void main(String...a) {
public static void main(String.* a) {
public static void main(String... a) {
public static void main(String[]... a) {
public static void main(String...[] a) {
How many of the code fragments, inserted
ADD
independently at line 12, compile?
package QB; MCQ methodRadius sp.methodRad Nothing to add Sphere.metho
class Sphere { (x); ius(x); dRadius();
protected int methodRadius(int r) {
System.out.println("Radious is: "+r);
return 0;
}
}
package QB;
public class MyClass {
public static void main(String[] args) {
double x = 0.89;
Sphere sp = new Sphere();
// Some code missing
}
} to get the radius value what is the code of line
ADD
to be added ?
Consider the following code and choose the MCQ Compiles and Compiles and Compilation Compiles but
correct option: displays Hi throws run fails doesn't
class A{ private void display(){ time exception display
System.out.print("Hi");} anything
public static void main(String ar[]){
ADD
display();}}
class One{ MCQ var1=10 , 0,0 compile error runtime error
int var1; var2=10
One (int x){
var1 = x;
}}
class Derived extends One{
int var2;
Derived(){
super(10);
var2=10;
}
void display(){
System.out.println("var1="+var1+" ,
var2="+var2);
}}
class Main{
public static void main(String[] args){
Derived obj = new Derived();
obj.display();
}}
consider the code above & select the proper
ADD
output from the options.
public class MyAr { MCQ Compile time Compilation It is not
public static void main(String argv[]) { error because and output of possible to
MyAr m = new MyAr(); i has not been null declare a
m.amethod(); initialized static variable
} in side of non
public void amethod() { static method
static int i1; or instance
System.out.println(i1); method.
} Because
} Static
What is the Output of the Program? variables are
class level
dependencies.
ADD
Consider the following code and choose the MCQ Compilation Compiles but Compiles and None of the
correct option: error throws run displays listed options
class A{ int z; A(int x){z=x;} } time exception nothing
class B extends A{
public static void main(String arg){
ADD
new B();}}
public class c1 { MCQ Hello It is not Compilation Can't create
private c1() possible to Error object
{ declare a because
System.out.println("Hello"); constructor constructor is
} private private
public static void main(String args[])
{
c1 o1=new c1();
}
}

ADD
What is the output?
Consider the following code and choose the MCQ Compiles and Compiles and Compiles but Compilation
correct option: prints show() prints throws runtime error
class Test{ private static void display(){ Display() exception
System.out.println("Display()");} show()
private static void show() { display();
System.out.println("show()");}
public static void main(String arg[]){
ADD
show();}}
Consider the following code and choose the MCQ Compiles and Compiles and Compiles but Compilation
correct option: display Hi throw run time doesn't fails
class A{ private static void display(){ exception display
System.out.print("Hi");} anything
public static void main(String ar[]){
ADD
display();}}
Which of the following will print -4.0 MCQ System.out.pri System.out.pri System.out.pri System.out.pri
ntln(Math.ceil(- ntln(Math.floor ntln(Math.roun ntln(Math.min(-
ADD 4.7)); (-4.7)); d(-4.7)); 4.7));
class Test{ MCQ hello Runtime Error compiles but does not
static void method(){ no output compile
this.display();
}
static display(){
System.out.println(("hello");
}
public static void main(String[] args){
new Test().method();
}
}
consider the code above & select the proper
ADD
output from the options.
Consider the following code and choose the MCQ Compilation Compiles and Compiles and Compiles and
best option: error display 0 display 2 runs without
class Super{ int x; Super(){x=2;}} any output
class Sub extends Super { void displayX(){
System.out.print(x);}
public static void main(String args[]){
ADDnew Sub().displayX();}}
Consider the following code and choose the MCQ Compilation Compiles and Compiles and Compiles but
correct option: error display 0 display 23 no output
package aj; class S{ int roll =23;
private S(){} }
package aj; class T
{ public static void main(String ar[]){
ADD
System.out.print(new S().roll);}}
What will happen when you attempt to compile MCQ The code will The compiler The code will The compiler
and run this code? compile and will complain compile but will complain
abstract class Base{ run, printing that the Base complain at that the
abstract public void myfunc(); out the words class has non run time that method
public void another(){ "My Func" abstract the Base class myfunc in the
System.out.println("Another method"); methods has non base class
} abstract has no body,
} methods nobody at all
to print it
public class Abs extends Base{
public static void main(String argv[]){
Abs a = new Abs();
a.amethod();
}
public void myfunc(){
System.out.println("My Func");
}
public void amethod(){
myfunc();
}
ADD
}
Given: MCQ Compilation Cannot add The code runs A
class Pizza { fails. Toppings with no output. NullPointerExc
java.util.ArrayList toppings; eption is
public final void addTopping(String topping) { thrown
toppings.add(topping);
}
}
public class PepperoniPizza extends Pizza {
public void addTopping(String topping) {
System.out.println("Cannot add Toppings");
}
public static void main(String[] args) {
Pizza pizza = new PepperoniPizza();
pizza.addTopping("Mushrooms");
}
}
ADD
What is the result?
Consider the following code and choose the MCQ sal details sal details per compilation per details sal
correct option: details error details
interface employee{
void saldetails();
void perdetails();
}
abstract class perEmp implements employee{
public void perdetails(){
System.out.println("per details"); }}
class Programmer extends perEmp{
public void saldetails(){
perdetails();
System.out.println("sal details"); }
public static void main(String[] args) {
perEmp emp=new Programmer();
ADDemp.saldetails(); }}
Consider the following code and choose the MCQ 3 4 compilation Compiles but
correct option: error error at
interface A{ runtime
int i=3;}
interface B{
int i=4;}
class Test implements A,B{
public static void main(String[] args) {
System.out.println(i);
}
ADD
}
Consider the following code: MCQ Illegal at Legal at Definitely legal Definitely legal
// Class declarations: compile time compile time, at runtime, but at runtime,
class Super {} but might be the cast and the cast
class Sub extends Super {} illegal at operator (Sub) operator (Sub)
// Reference declarations: runtime is not strictly is needed.
Super x; needed.
Sub y;
Which of the following statements is correct for
ADD
the code: y = (Sub) x?
Consider the following code and choose the MCQ Hello A Compilation Hello B Compiles but
correct option: error error at
class A{ runtime
void display(){ System.out.println("Hello A"); }}
class B extends A{
void display(){
System.out.println("Hello B"); }}
public class Test {
public static void main(String[] args) {
A a=new B();
B b= a;
b.display(); }}
ADD
Consider the following code and choose the MCQ 150 mph Compilation Compiles but 90 mph
correct option: error error at run
abstract class Car{ time
abstract void accelerate();
}class Lamborghini extends Car{
@Override
void accelerate() {
System.out.println("90 mph");
} void nitroBooster(){
System.out.print("150 mph"); }
public static void main(String[] args) {
Car mycar=new Lamborghini();
ADDmycar.nitroBooster(); }}
Consider the code below & select the correct MCQ A,B,E A,C,D B,D,E C,D,E
ouput from the options:
1. public class Mountain {
2. protected int height(int x) { return 0; }
3. }
4. class Alps extends Mountain {
5. // insert code here
6. }
Which five methods, inserted independently at
line 5, will compile? (Choose three.)
A. public int height(int x) { return 0; }
B. private int height(int x) { return 0; }
C. private int height(long x) { return 0; }
D. protected long height(long x) { return 0; }
ADD
E. protected long height(int x) { return 0; }
Consider the following code and choose the MCQ sum of byte 7 Compilation sum of int7 Compiles but
correct option: error error at
class A{ runtime
void display(byte a, byte b){
System.out.println("sum of byte"+(a+b)); }
void display(int a, int b){
System.out.println("sum of int"+(a+b)); }
public static void main(String[] args) {
ADDnew A().display(3, 4); }}
Consider the following code and choose the MCQ A Compilation Compiles but Runs but no
correct option: error error at run output
interface console{ time
int line;
void print();}
class a implements console{
public void print(){
System.out.print("A");}
public static void main(String ar[]){
ADDnew a().print();}}
Consider the following code and choose the MCQ Hello A Compilation Hello B Compiles but
correct option: error error at
class A{ runtime
void display(){ System.out.println("Hello A"); }}
class B extends A{
void display(){
System.out.println("Hello B"); }}
public class Test {
public static void main(String[] args) {
A a=new B();
B b= (B)a;
b.display(); }}
ADD
Given: MCA p0 = p1; p2 = p4; p1 = p1 = p2;
11. class ClassA {} (ClassB)p3;
12. class ClassB extends ClassA {}
13. class ClassC extends ClassA {}
and:
21. ClassA p0 = new ClassA();
22. ClassB p1 = new ClassB();
23. ClassC p2 = new ClassC();
24. ClassA p3 = new ClassB();
25. ClassA p4 = new ClassC();
ADD
Which TWO are valid? (Choose two.)
Consider the following code and choose the MCQ Hello A Compilation Hello B Compiles but
correct option: error error at
class A{ runtime
void display(){ System.out.println("Hello A"); }}
class B extends A{
void display(){
System.out.println("Hello B"); }}
public class Test {
public static void main(String[] args) {
B b=(B) new A();
b.display(); }}
ADD
Given: MCQ s 14 s 16 s 10 Compilation
interface DeclareStuff { fails.
public static final int Easy = 3;
void doStuff(int t); }
public class TestDeclare implements
DeclareStuff {
public static void main(String [] args) {
int x = 5;
new TestDeclare().doStuff(++x);
}
void doStuff(int s) {
s += Easy + ++s;
System.out.println("s " + s);
}
ADD
} What is the result?
Consider the following code and choose the MCQ A Compilation Compiles but Runs but no
correct option: error error at run output
interface console{ time
int line=10;
void print();}
class a implements console{
void print(){
System.out.print("A");}
public static void main(String ar[]){
ADDnew a().print();}}
Which declaration can be inserted at (1) without MCA int total = total final double protected int int AREA = r * public static
causing a compilation error? + r + s; circumference CODE = s; MAIN = 15;
interface MyConstants { = 2 * Math.PI * 31337;
int r = 42; r;
int s = 69;
// (1) INSERT CODE HERE
ADD
}
Given : MCQ No—there No—but a Yes—an Yes—any
must always object of object can be object can be
Day d; be an exact parent type assigned to a assigned to
BirthDay bd = new BirthDay("Raj", 25); match can be reference any reference
d = bd; // Line X between the assigned to a variable of the variable.
variable and variable of parent type.
Where Birthday is a subclass of Day. State the object child type.
ADD
whether the code given at Line X is correct:
class Animal { MCQ run time error generic noise bark compile error
void makeNoise() {System.out.println("generic
noise"); }
}
class Dog extends Animal {
void makeNoise() {System.out.println("bark"); }
void playDead() { System.out.println("roll over");
}
}
class CastTest2 {
public static void main(String [] args) {
Animal a = new Dog();
a.makeNoise();
}
}
consider the code above & select the proper
output from the options.
ADD
interface Vehicle{ MCQ Auto Bicycle Auto compile error runtime error
void drive();
}
final class TwoWheeler implements Vehicle{
int wheels = 2;
public void drive(){
System.out.println("Bicycle");
}
}
class ThreeWheeler extends TwoWheeler{
public void drive(){
System.out.println("Auto");
}}
class Test{
public static void main(String[] args){
ThreeWheeler obj = new ThreeWheeler();
obj.drive();
}}
consider the code above & select the proper
ADD
output from the options.
Consider the code below & select the correct MCQ 3 Compilation Compiles but 9
ouput from the options: error error at run
class A{ time
static int sq(int n){
return n*n; }}
public class Test extends A{
static int sq(int n){
return super.sq(n); }
public static void main(String[] args) {
ADDSystem.out.println(new Test().sq(3)); }}
Given: MCQ No—a No—a No—a Yes—the
public static void main( String[] args ) { variable must variable must variable must variable can
SomeInterface x; ... } always be an always be an always be a refer to any
Can an interface name be used as the type of a object object primitive type object whose
variable reference type reference type class
or a primitive implements
ADD type the interface
Given : MCQ The code will The code will The code will The code will
What would be the result of compiling and fail to compile fail to compile compile and compile and
running the following program? because the because a call print 23, when print 29, when
// Filename: MyClass.java max() method to a max() run. run.
public class MyClass { in B passes method is
public static void main(String[] args) { the arguments ambiguous.
C c = new C(); in the call
System.out.println(c.max(13, 29)); super.max(y,
} x) in the wrong
} order.
class A {
int max(int x, int y) { if (x>y) return x; else return
y; }
}
class B extends A{
int max(int x, int y) { return super.max(y, x) - 10;
}
}
class C extends B {
int max(int x, int y) { return super.max(x+10,
y+10); }
ADD
}
Given: MCQ Compilation If you define D Compilation If you define D
interface A { public void methodA(); } fails, due to an e = (D) (new fails, due to an e = (D) (new
interface B { public void methodB(); } error in line 3 E()), then error in line 7 E()), then
interface C extends A,B{ public void methodC(); e.methodB() e.methodB()
} //Line 3 invokes the invokes the
class D implements B { version of version of
public void methodB() { } //Line 5 methodB() methodB()
} defined at line defined at line
class E extends D implements C { //Line 7 9 5
public void methodA() { }
public void methodB() { } //Line 9
public void methodC() { }
}
ADD
What would be the result?
class Animal { MCQ run time error generic noise bark compile error
void makeNoise() {System.out.println("generic
noise"); }
}
class Dog extends Animal {
void makeNoise() {System.out.println("bark"); }
void playDead() { System.out.println("roll over");
}
}
class CastTest2 {
public static void main(String [] args) {
Dog a = (Dog) new Animal();
a.makeNoise();
}
}
consider the code above & select the proper
output from the options.
ADD
Consider the code below & select the correct MCQ Canada Compilation Compiles but null
ouput from the options: error error at run
time
class Money {
private String country = "Canada";
public String getC() { return country; } }
class Yen extends Money {
public String getC() { return super.country; }
public static void main(String[] args) {
ADD
System.out.print(new Yen().getC() ); } }
Which Man class properly represents the MCQ A B C D
relationship "Man has a best friend who is a
Dog"?
A)class Man extends Dog { }
B)class Man implements Dog { }
C)class Man { private BestFriend dog; }
ADD
D)class Man { private Dog bestFriend; }
Consider the following code and choose the MCQ display Compilation Compiles but Runs but no
correct option: error error at run output
interface Output{ time
void display();
void show();
}
class Screen implements Output{
void show() {System.out.println("show");}
void display(){ System.out.println("display");
}public static void main(String[] args) {
ADDnew Screen().display();}}
Consider the following code and choose the MCQ display Compilation Compiles but Runs but no
correct option: error error at run output
interface Output{ time
void display();
void show();
}
class Screen implements Output{
void display(){ System.out.println("display");
}public static void main(String[] args) {
ADDnew Screen().display();}}
Consider the following code and choose the MCQ 150 mph Compilation 90 mph Compiles but
correct option: error error at
abstract class Car{ runtime
abstract void accelerate();
}
class Lamborghini extends Car{
@Override
void accelerate() {
System.out.println("90 mph"); }
void nitroBooster(){
System.out.print("150 mph"); }
public static void main(String[] args) {
Car mycar=new Lamborghini();
Lamborghini lambo=(Lamborghini) mycar;
ADDlambo.nitroBooster();}}
Given the following classes and declarations, MCA The Bar class The statement The statement The statement
which statements are true? is a subclass a.j = 5; is b.f(); is legal. a.g(); is legal.
// Classes of Foo. legal.
class Foo {
private int i;
public void f() { /* ... */ }
public void g() { /* ... */ }
}
class Bar extends Foo {
public int j;
public void g() { /* ... */ }
}
// Declarations:
Foo a = new Foo();
ADD
Bar b = new Bar();
Consider the given code and select the correct MCQ Compilation of Compilation of Compilation of Compilation of
output: both classes A both classes class A will class B will
& B will fail will succeed fail. fail.
class SomeException { Compilation of Compilation of
} class B will class A will
succeed succeed
class A {
public void doSomething() { }
}

class B extends A {
public void doSomething() throws
SomeException { }
ADD
}
Given: MCQ This is a final This is a final Compilation illegal Some
class A { method illegal method Some error error message
final void meth() { error message
System.out.println("This is a final method.");
}
}
class B extends A {
void meth() {
System.out.println("Illegal!");
}
}
class MyClass8{
public static void main(String[] args) {
A a = new A();
a.meth();
B b= new B();
b.meth();
}
}What would be the result?
ADD
Consider the code below & select the correct MCQ 000 47 7 0 Compilation 47 47 47
ouput from the options: error
abstract class Ab{ public int getN(){return 0;}}
class Bc extends Ab{ public int getN(){return
7;}}
class Cd extends Bc { public int getN(){return
47;}}
class Test{
public static void main(String[] args) {
Cd cd=new Cd();
Bc bc=new Cd();
Ab ab=new Cd();
System.out.println(cd.getN()+" "+
ADD bc.getN()+" "+ab.getN()); }}
Given: MCQ class AllMath interface abstract class class AllMath
interface DoMath extends AllMath AllMath implements
{ DoMath { implements implements MathPlus {
double getArea(int r); double MathPlus { DoMath, double
} getArea(int r); double MathPlus { getArea(int
interface MathPlus } getVol(int x, public double rad); }
{ int y); } getArea(int
double getVolume(int b, int h); rad) { return
} rad * rad *
/* Missing Statements ? */ 3.14; } }
ADD
Select the correct missing statements.
interface interface_1 { MCQ From F1 Compile time Create an Runtime Error
void f1(); function in error object for
} Class_1 Class Interface only
class Class_1 implements interface_1 {
void f1() {
System.out.println("From F1 funtion in Class_1
Class");
}
}
public class Demo1 {
public static void main(String args[]) {
Class_1 o11 = new Class_1();
o11.f1();
}
ADD
}
interface A{} MCQ B b=c; A a2=(B)c; C c2=(C)(B)c; A a1=(Test)c;
class B implements A{}
class C extends B{}
public class Test extends C{
public static void main(String[] args) {
C c=new C();
/* Line6 */}}

Which code, inserted at line 6, will cause a


ADD
java.lang.ClassCastException?
Given the following classes and declarations, MCA The B class is The statement The statement The statement The statement
which statements are true? a subclass of b.f(); is legal a.j = 5; is a.g(); is legal b.i = 3; is
// Classes A. legal. legal.
class A {
private int i;
public void f() { /* ... */ }
public void g() { /* ... */ }
}
class B extends A{
public int j;
public void g() { /* ... */ }
}
// Declarations:
A a = new A();
B b = new B();
ADD
Select the three correct answers.
Consider the code below & select the correct MCQ 100 Compilation Compiles but Compiles but
ouput from the options: error error at run no output
time
class Mountain{
int height;
protected Mountain(int x) { height=x; }
public int getH(){return height;}}

class Alps extends Mountain{


public Alps(int h){ super(h); }
public Alps(){ this(100); }
public static void main(String[] args) {
System.out.println(new Alps().getH());
}
ADD
}
Consider the following code and choose the MCQ sal details sal details per compilation per details sal
correct option: details error details
interface employee{
void saldetails();
void perdetails();
}
abstract class perEmp implements employee{
public void perdetails(){
System.out.println("per details"); }}
class Programmer extends perEmp{
public static void main(String[] args) {
perEmp emp=new Programmer();
ADDemp.saldetails(); }}
Consider the following code and choose the MCQ Fun Time Compilation Fun Run Compiles but
correct option: error error at
abstract class Fun{ runtime
void time(){
System.out.println("Fun Time"); }}
class Run extends Fun{
void time(){
System.out.println("Fun Run"); }
public static void main(String[] args) {
Fun f1=new Run();
ADDf1.time(); }}
What will be the result when you try to compile MCQ Error at 200 100 followed 100
and run the following code? compile time by 200
class Base1 {
Base1() {
int i = 100;
System.out.println(i);
}
}

public class Pri1 extends Base1 {


static int i = 200;

public static void main(String argv[]) {


Pri1 p = new Pri1();
System.out.println(i);
}
ADD
}
What will be the output of the program? MCQ 4, 4 4, 5 5, 4 Compilation
fails
class SuperClass
{
public Integer getLength()
{
return new Integer(4);
}
}

public class SubClass extends SuperClass


{
public Long getLength()
{
return new Long(5);
}

public static void main(String[] args)


{
SuperClass sp = new SuperClass();
SubClass sb = new SubClass();
System.out.println(
sp.getLength().toString() + "," +
sub.getLength().toString() );
}
ADD
}
What is the output for the following code: MCQ run time compile time hello hellohello
abstract class One{ exception error
private abstract void test();
}
class Two extends One{
void test(){
System.out.println("hello");
}}
class Test{
public static void main(String[] args){
Two obj = new Two();
obj.test();
}
ADD
}
What is the output : MCQ hello compile error runtime error none
interface A{
void method1();
void method2();
}
class Test implements A{
public void method1(){
System.out.println("hello");}}
class RunTest{
public static void main(String[] args){
Test obj = new Test();
obj.method1();
ADD
}}
What is the result of attempting to compile and MCQ 1 2 3 4
run the following code?
import java.util.Vector; import
java.util.LinkedList; public class Test1{ public
static void main(String[] args) { Integer int1 =
new Integer(10); Vector vec1 = new Vector();
LinkedList list = new LinkedList();
vec1.add(int1); list.add(int1); if(vec1.equals(list))
System.out.println("equal"); else
System.out.println("not equal"); } } 1. The code
will fail to compile. 2. Runtime error due to
incompatible object comparison 3. Will run and
print "equal". 4. Will run and print "not equal".

ADD
TreeSet<String> s = new TreeSet<String>(); MCA The size of s The size of s The size of The size of s The size of
TreeSet<String> subs = new is 4 is 5 subs is 3 is 7 subs is 1
TreeSet<String>();
s.add("a"); s.add("b"); s.add("c"); s.add("d");
s.add("e");

subs = (TreeSet)s.subSet("b", true, "d", true);


s.add("g");
s.pollFirst();
s.pollFirst();
s.add("c2");
System.out.println(s.size() +" "+ subs.size());
ADD
Which statement is true about the following MCQ The program The program The program The program
program? will compile will compile will compile will not
import java.util.ArrayList; and print the and print the and throw a compile
import java.util.Collections; following following runtime
import java.util.List; output: [B] output: [B,A] exception
public class WhatISThis {
public static void main(String[] na){
List<StringBuilder> list=new
ArrayList<StringBuilder>();
list.add(new StringBuilder("B"));
list.add(new StringBuilder("A"));
list.add(new StringBuilder("C"));
Collections.sort(list,Collections.reverseOrder());
System.out.println(list.subList(1,2));
}
}
ADD
Given: MCQ 1 12 14 123
public class Venus {
public static void main(String[] args) {
int [] x = {1,2,3};
int y[] = {4,5,6};
new Venus().go(x,y);
}
void go(int[]... z) {
for(int[] a : z)
System.out.print(a[0]);
}
ADD
} What is the result?
Consider the code below & select the correct MCQ 2 -4 3 -5 2 -6 3 -4
ouput from the options:
public class Test{
public static void main(String[] args) {
String
[]colors={"orange","blue","red","green","ivory"};
Arrays.sort(colors);
int s1=Arrays.binarySearch(colors, "ivory");
int s2=Arrays.binarySearch(colors, "silver");
System.out.println(s1+" "+s2); }}
ADD
Consider the following code was executed on MCQ Wed Jun 01 244 JUN 01 PST JUN 01 GMT JUN 01
June 01, 1983. What will be the output? 1983 1983 1983 1983
class Test{
public static void main(String args[]){
Date date=new Date();
SimpleDateFormat sd;
sd=new SimplpeDateFormat("E MMM dd
yyyy");
ADDSystem.out.print(sd.format(date));}}
Consider the following code and choose the MCQ 3 5 compilation Compiles but
correct option: error error at run
class Data{ Integer data; Data(Integer time
d){data=d;}
public boolean equals(Object o){return true;}
public int hasCode(){return 1;}}
class Test{
public static void main(String ar[]){
Set<Data> s=new HashSet<Data>();
s.add(new Data(4));
s.add(new Data(2));
s.add(new Data(4));
s.add(new Data(1));
s.add(new Data(2));
ADDSystem.out.print(s.size());}}
Given: MCQ 3, 2, 1, 1, 2, 3, Compilation The code runs
public static Iterator reverse(List list) { fails. with no output.
Collections.reverse(list);
return list.iterator();
}
public static void main(String[] args) {
List list = new ArrayList();
list.add("1"); list.add("2"); list.add("3");
for (Object obj: reverse(list))
System.out.print(obj + ", ");
}
ADD
What is the result?
Given: MCQ true false Compile time Runtime
import java.util.Arrays; error Exception
import java.util.HashSet;
import java.util.Set;

public class MainClass {

public static void main(String[] a) {


String elements[] = { "A", "B", "C", "D", "E" };
Set set = new
HashSet(Arrays.asList(elements));

elements = new String[] { "A", "B", "C", "D" };


Set set2 = new
HashSet(Arrays.asList(elements));

System.out.println(set.equals(set2));
}
} What is the result of given code?

ADD
import java.util.StringTokenizer; MCQ Today is Today is Both none of the
class ST{ Holiday Holiday listed options
public static void main(String[] args){
String input = "Today is$Holiday";
StringTokenizer st = new
StringTokenizer(input,"$");
while(st.hasMoreTokens()){
System.out.println(st.nextElement());
ADD
}}
Consider the following code and choose the MCQ Compilation prints 3,4,2,1, prints 1,2,3,4 Compiles but
correct option: error exception at
class Test{ runtime
public static void main(String args[]){
Integer arr[]={3,4,3,2};
Set<Integer> s=new
TreeSet<Integer>(Arrays.asList(arr));
s.add(1);
for(Integer ele :s){
ADD System.out.println(ele); } }}
Consider the following code and choose the MCQ [1,4,6,8] [1,8,6,4] [1,4,6,8,9] [1,4,6,8,9]
correct option: [4,6,8,9] [8,6,4,9] [4,6,8,9] [4,6,8]
class Test{
public static void main(String args[]){
TreeSet<Integer> ts=new TreeSet<Integer>();
ts.add(1);
ts.add(8);
ts.add(6);
ts.add(4);
SortedSet<Integer> ss=ts.subSet(2, 10);
ss.add(9);
System.out.println(ts);
System.out.println(ss);
}}
ADD
Inorder to remove one element from the given MCQ tSet.clear(new tSetdelete(ne tSet.remove(n tSet.drop(new
Treeset, place the appropriate line of code Integer("1")); w ew Integer("1"));
public class Main { Integer("1")); Integer("1"));
public static void main(String[] args) {
TreeSet<Integer> tSet = new
TreeSet<Integer>();
System.out.println("Size of TreeSet : " +
tSet.size());
tSet.add(new Integer("1"));
tSet.add(new Integer("2"));
tSet.add(new Integer("3"));
System.out.println(tSet.size());
// remove the one element from the Treeset
System.out.println("Size of TreeSet after
removal : " + tSet.size());
}
ADD
}
Consider the following code and choose the MCQ The before() The before() The before() The before()
correct option: method will method will method will method will
public static void before() { print 1 2 print 1 2 3 throw an not compile
Set set = new TreeSet(); exception at
set.add("2"); runtime
set.add(3);
set.add("1");
Iterator it = set.iterator();
while (it.hasNext())
System.out.print(it.next() + " ");
ADD
}
Given: MCQ Compilation aAaA aAa AAaa AaA AaA AAaa
import java.util.*; fails. AAaa AaA aAa aAaA aAaA aAa

public class LetterASort{


public static void main(String[] args) {
ArrayList<String> strings = new
ArrayList<String>();
strings.add("aAaA");
strings.add("AaA");
strings.add("aAa");
strings.add("AAaa");
Collections.sort(strings);
for (String s : strings) { System.out.print(s + " ");
}
}
}
ADD
What is the result?
Consider the following code and select the MCQ [1,3,2] [1,3,3,2] [1,3,2,1,3,2] [3,1,2] [3,1,1,2]
correct output:
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class Lists {
public static void main(String[] args) {
List<String> list=new ArrayList<String>();
list.add("1");
list.add("2");
list.add(1, "3");
List<String> list2=new LinkedList<String>(list);
list.addAll(list2);
list2 =list.subList(2,5);
list2.clear();
System.out.println(list);
}
}
ADD
Given: MCQ A, B, C, B, C, A, Compilation An exception
public static Collection get() { fails. is thrown at
Collection sorted = new LinkedList(); runtime.
sorted.add("B"); sorted.add("C");
sorted.add("A");
return sorted;
}
public static void main(String[] args) {
for (Object obj: get()) {
System.out.print(obj + ", ");
}
}
ADD
What is the result?
Given: MCQ Compilation The code runs An exception Compilation Compilation
10. interface A { void x(); } fails because with no output. is thrown at fails because fails because
11. class B implements A { of an error in runtime of an error in of an error in
public void x() { } line 25 line 21 line 23.
public void y() { } }
12. class C extends B {
public void x() {} }
And:
20. java.util.List<a> list = new
java.util.ArrayList</a>();
21. list.add(new B());
22. list.add(new C());
23. for (A a:list) {
24. a.x();
25. a.y();;
26. }
ADD
What is the result?
What will be the output of following code? MCQ [2,3,7,5] [2,3,4,5,6] [2,3,7,5,4,6] [2,3,4,5,6,7]
class Test{
public static void main(String args[]){
TreeSet<Integer> ts=new TreeSet<Integer>();
ts.add(2);
ts.add(3);
ts.add(7);
ts.add(5);
SortedSet<Integer> ss=ts.subSet(1,7);
ss.add(4);
ss.add(6);
System.out.print(ss);}}
ADD
Consider the following code and choose the MCQ {2=Two, {4=Four, {4=Four, {2=Two,
correct output: 4=Four, 6=Six, 6=Six, 6=Six} 4=Four,
class Test{ 7=Seven} 7=Seven} 6=Six}
public static void main(String args[]){
TreeMap<Integer, String> hm=new
TreeMap<Integer, String>();
hm.put(2,"Two");
hm.put(4,"Four");
hm.put(1,"One");
hm.put(6,"Six");
hm.put(7,"Seven");
SortedMap<Integer, String>
sm=hm.subMap(2,7);
SortedMap<Integer,String>
sm2=sm.tailMap(4);
System.out.print(sm2);
ADD
}}
Which of the given options is similar to the MCQ value = value sum = sum + value = value value = value
following code: + sum; sum = 1; value = + sum; + ++sum;
sum + 1; value + sum;
ADD
value += sum++ ;
Which will legally declare, construct, and MCQ int [] myList = int [] myList = int myList [] [] int myList [] =
ADD
initialize an array? {"1", "2", "3"}; (5, 8, 2); = {4,9,7,0}; {4, 3, 7};
Consider the code below & select the correct MCQ Compilation The variable The variable Compiles but
ouput from the options: error first is set to first is set to error at
public class Test { null. elements[0]. runtime
public static void main(String[] args) {
String[] elements = { "for", "tea", "too" };
String first = (elements.length > 0)
?elements[0] : null;
ADDSystem.out.println(first); }}
Consider the following code and choose the MCQ Hello World Compilation Compiles but Compiles but
correct option: error error at run run without
class Test{ time output
interface Y{
void display(); }
public static void main(String[] args) {
new Y(){
public void display(){
System.out.println("Hello World"); }
ADD}.display(); }}
class Test{ MCQ 48 94 Compiles but Compilation
public static void main(String[] args){ error at run error
byte b=(byte) (45 << 1); time
b+=4;
System.out.println(b); }}
What should be the output for the code written
ADD
above?
What is the value of y when the code below is MCQ 1 2 3 4
executed?
int a = 4;
ADD int b = (int)Math.ceil(a % 3 + a / 3.0);
Consider the following code and choose the MCQ Hello World Compilation Compiles but Compiles but
correct option: error error at run run without
class Test{ time output
interface Y{
void display(); }
public static void main(String[] args) {
Y y=new Y(){
public void display(){
System.out.println("Hello World"); } };
ADDy.display(); }}
What is the output of the following program? MCQ A sequence of A sequence of compile time Compiles but
public class demo { five 10's are Garbage Error no output
public static void main(String[] args) { printed Values are
int arr[5]; printed
for (int i = 0; i < arr.length; i++) {
arr[i] = arr[i] + 10;
}
for (int j = 0; j < arr.length; j++)
System.out.println(arr[j]);

}
ADD
}
What will be the result of the following program? MCQ The program The program The program The program Compilation
public class Init { will compile, will compile, will compile, will compile, error
String title; and print and print and print | and print
boolean published; |null|false|0|0. |null|true|0|0.0| |false|0|0.0|0.0 |null|false|0|0.
static int total; 0|0.0|, when 100.0|, when |, when run 0|100.0|, when
static double maxPrice; run run run
public static void main(String[] args) {
Init initMe = new Init();
double price;
if (true)
price = 100.00;
System.out.println("|" + initMe.title + "|" +
initMe.published + "|" +
Init.total + "|" + Init.maxPrice + "|" + price+ "|");
}
}

ADD
Consider the following code and choose the MCQ 4 Compilation Compiles but
correct option: error error at run
class Test{ time
static class A{
interface X{
int z=4; } }
static void display(){
System.out.println(A.X.z); }
public static void main(String[] args) {
ADDdisplay(); }}
Here is the general syntax for method definition: MCQ The The If the The
returnValue returnValue returnType is returnValue
accessModifier returnType methodName( must be can be any void then the must be the
parameterList ) exactly the type, but will returnValue same type as
{ same type as be can be any the
Java statements the returnType automatically type returnType, or
converted to be of a type
return returnValue; returnType that can be
} when the converted to
method returnType
returns to the without loss of
What is true for the returnType and the caller. information.
returnValue?
ADD
class C{ MCQ compile time compile time prints 34,56 runtime none of the
public static void main (String[] args) { error at line 2 error at line 4 exception listed options
byte b1=33; //1
b1++; //2
byte b2=55; //3
b2=b1+1; //4
System.out.println(b1+""+b2);
}}
Consider the code above & select the correct
ADD
output.
What will be the output of the program? MCQ args[2] = 2 args[2] = 3 args[2] = null An exception
is thrown at
public class CommandArgs runtime
{
public static void main(String [] args)
{
String s1 = args[1];
String s2 = args[2];
String s3 = args[3];
String s4 = args[4];
System.out.print(" args[2] = " + s2);
}
}

and the command-line invocation is

ADD
> java CommandArgs 1 2 3 4
Consider the following code snippet: MCQ 10, 1 11, 1 10, 0 11 , 0
int i = 10;
int n = ++i%5;
What are the values of i and n after the code is
ADD
executed?
Consider the following code and choose the MCQ 3 Compilation Compiles but
correct option: error error at run
class Test{ time
class A{ static int x=3; }
static void display(){
System.out.println(A.x); }
public static void main(String[] args) {
ADDdisplay(); }}
Consider the following code and choose the MCQ value: 0 count: value: 0 count: value: 1 count: value: 1 count:
correct output: 0 1 1 2

int value = 0;
int count = 1;
value = count++ ;
System.out.println("value: "+ value + " count: "
ADD
+ count);
What will be the output of the program? MCQ 012 23 000 An exception
is thrown at
public class CommandArgsTwo runtime
{
public static void main(String [] argh)
{
int x;
x = argh.length;
for (int y = 1; y <= x; y++)
{
System.out.print(" " + argh[y]);
}
}
}

and the command-line invocation is

ADD
> java CommandArgsTwo 1 2 3
class Test{ MCQ compiles and var = 1 does not run time error
public static void main(String[] args){ runs with no compile
int var; output
var = var +1;
System.out.println("var ="+var);
}}
consider the code above & select the proper
ADD
output from the options.
Consider the following code and select the MCQ Hello World Compilation Compiles but Compiles but
correct output: error error at run run without
class Test{ time output
interface Y{
void display(); }
public static void main(String[] args) {
new Y(){
public void display(){
System.out.println("Hello World"); } };
ADD
}}
Which of the following will declare an array and MCQ Array a = new int [] a = int a [] = new int [5] array;
initialize it with five numbers? Array(5); {23,22,21,20,1 int[5];
ADD 9};
What is the output of the following program? MCQ 13 13.5 13 Compilation Runtime Error
public class MyClass Error
{
public static void main( String[] args )
{
private static final int value =9;
float total;
total = value + value / 2;
System.out.println( total );
}
ADD
}
As per the following code fragment, what is the MCQ -1 4 random value
value of a?
String s;
int a;
s = "Foolish boy.";
ADD
a = s.indexOf("fool");
Consider the code below & select the correct MCQ Compilation A A
ouput from the options: error ParseExceptio NumberForma
class Test{ n is thrown by tException is
public static void main(String[] args) { the parse thrown by the
parse("Four"); } method at parse method
static void parse(String s){ runtime at runtime
try {
double d=Double.parseDouble(s);
}catch(NumberFormatException nfe){
d=0.0; }finally{
ADD System.out.println(d); } }}
Consider the code below & select the correct MCQ t7 t9 a9 Compilation
ouput from the options: error
class A{
public int a=7;
public void add(){
this.a+=2; System.out.print("a"); }}

public class Test extends A{


public int a=2;
public void add(){
this.a+=2; System.out.print("t"); }
public static void main(String[] args) {
A a =new Test();
a.add();
ADDSystem.out.print(a.a); }}
Consider the following code: MCQ x = -7, y = 1, z x = 3, y = 2, z x = 4, y = 1, z x = 4, y = 2, z
int x, y, z; =5 =6 =5 =6
y = 1;
z = 5;
x = 0 - (++y) + z++;
After execution of this, what will be the values of
ADD
x, y and z?
What will be the output of the program ? MCQ 10, 9, 8, 7, 6, 9, 8, 7, 6, 5, Compilation An exception
fails is thrown at
public class Test runtime
{
public static void main(String [] args)
{
signed int x = 10;
for (int y=0; y<5; y++, x--)
System.out.print(x + ", ");
}
ADD
}
Consider the following code snippet: MCQ 10, 1 11, 1 10, 0 11 , 0
int i = 10;
int n = i++%5;
What are the values of i and n after the code is
ADD
executed?
What is the output of the following: MCQ a: 9 b:11 a: 10 b: 9 a: 9 b:9 a: 0 b:9

int a = 0;
int b = 10;

a = --b ;
ADD
System.out.println("a: " + a + " b: " + b );
Consider the given code and select the correct MCQ 26 282 Compiles but Compilation
output: error at run error
class Test{ time
public static void main(String[] args){
int num1 = 012;
int num2 = 0x110;
int sum =num1+=num2;
ADD
System.out.println("Ans = "+sum); }}
What will happen if you attempt to compile and MCQ 19 followed by 19 follwed by Compile time 10 followed by
run the following code? 11 20 error 1
Integer ten=new Integer(10);
Long nine=new Long (9);
System.out.println(ten + nine);
int i=1;
ADD
System.out.println(i + ten);
Which of the following are correct variable MCA int #ss; int 1ah; int _; int $abc;
ADD
names? (Choose TWO)
Which of the following lines of code will compile MCQ Line 1, Line 5 Line 5 Line 1, Line 3, Line 3 Line 4
without warning or error? Line 5
1) float f=1.3;
2) char c="a";
3) byte b=257;
4) boolean b=null;
ADD
5) int i=10;
Consider the code below & select the correct MCQ 23 13 2 3
ouput from the options:

public class Test {


public static void main(String [] args) {
int x = 5;
boolean b1 = true;
boolean b2 = false;
if ((x == 4) && !b2 )
System.out.print("1 ");
System.out.print("2 ");
if ((b2 = true) && b1 )
ADD
System.out.print("3 "); }
Consider the code below & select the correct MCQ disp X = 6 disp X = 5 disp X = 5 Compilation
ouput from the options: main X=6 main X=5 main X=6 error
public class Test {
public static void main(String[] args) {
int x=5;
Test t=new Test();
t.disp(x);
System.out.println("main X="+x);
}
void disp(int x) {
System.out.println("disp X = "+x++);
ADD
}}
Given the following piece of code: MCQ 0 6 1 7 2 8 3 8 0 6 1 7 2 8 3 9 0 5 1 5 2 5 3 5 compilation
public class Test { fails
public static void main(String args[]) {
int i = 0, j = 5 ;
for( ; (i < 3) && (j++ < 10) ; i++ ) {
System.out.print(" " + i + " " + j );
}
System.out.print(" " + i + " " + j );
}
}
ADD
what will be the output?
Identify the statements that are correct: MCQ (A), (B) & (C) (A), (B), (C) & (C) & (D) (A) & (B)
(A) int a = 13, a>>2 = 3 (D)
(B) int b = -8, b>>1 = -4
(C) int a = 13, a>>>2 = 3
ADD
(D) int b = -8, b>>>1 = -4
Consider the following code and choose the MCQ Compilation Compiles but 4
correct option: error error at run
class Test{ time
class A{
interface X{
int z=4; } }
static void display(){
System.out.println(new A().X.z); }
public static void main(String[] args) {
ADDdisplay(); }}
Given MCQ 83886080 and 2 and 2 and - 83886080 and
class MybitShift -2 83886080 83886080 2
{
public static void main(String [] args)
{
int a = 0x5000000;
System.out.print(a + " and ");
a = a >>> 25;
System.out.println(a);
}
ADD
}
1. public class LineUp { MCQ A B C D
2. public static void main(String[] args) {
3. double d = 12.345;
4. // insert code here
5. }
6. }
Which code fragment, inserted at line 4,
produces the output | 12.345|?

A. System.out.printf("|%7f| \n", d);


B. System.out.printf("|%3.7f| \n", d);
C. System.out.printf("|%7.3d| \n", d);
ADD
D. System.out.printf("|%7.3f| \n", d);
Here is the general syntax for method definition: MCQ It must always It can be The access It can be
be private or omitted, but if modifier must omitted, but if
accessModifier returnType methodName( public not omitted agree with the not omitted it
parameterList ) there are type of the must be
{ several return value private or
Java statements choices, public
including
return returnValue; private and
} public

What is true for the accessModifier?


ADD
State the class relationship that is being MCQ Aggregation Simple Dependency Composition
implemented by the following code: Association
class Employee
{
private int empid;
private String ename;
public double getBonus()
{
Accounts acc = new Accounts();
return acc.calculateBonus();
}
}

class Accounts
{
public double calculateBonus(){//method's
code}
ADD
}
Say that class Rodent has a child class Rat and MCQ rod = mos pkt = rat pkt = null rod = rat
another child class Mouse. Class Mouse has a
child class PocketMouse. Examine the following

Rodent rod;
Rat rat = new Rat();
Mouse mos = new Mouse();
PocketMouse pkt = new PocketMouse();

Which one of the following will cause a compiler


error?
ADD
Consider the code below & select the correct MCQ 92 91 Compilation 82
ouput from the options: error

public class Test {


int squares = 81;
public static void main(String[] args) {
new Test().go(); }
void go() {
incr(++squares);
System.out.println(squares); }
ADD
void incr(int squares) { squares += 10; } }
Consider the following code and choose the MCQ 10 27 24 11
correct option:
public class Test {
public static void main(String[] args) {
StringBuffer sb=new
StringBuffer("YamunaRiver");
ADDSystem.out.println(sb.capacity()); }}
Examine this code: MCQ result = result.concat( result+stringA result =
stringA.concat stringA, +stringB+strin concat(String
String stringA = "Wild"; ( stringB, gC; A).concat(Stri
String stringB = " Irish"; stringB.concat stringC ); ngB).concat(S
String stringC = " Rose"; ( stringC ) ); tringC)
String result;

Which of the following puts a reference to "Wild


ADD
Irish Rose" in result?
Consider the following code and choose the MCQ hi hi hi world world Compilation
correct option: error
class Test {
public static void main(String[] args) {
new Test().display(1,"hi");
new Test().display(2,"hi", "world" ); }
public void display(int x,String... s) {
ADDSystem.out.print(s[s.length-x] + " "); }}
Consider the following code and choose the MCQ K A R I
correct option:
public class Test {
public static void main(String[] args) {
String name="vikaramaditya";
System.out.println(name.substring(2,
ADD
5).toUpperCase().charAt(2));}}
What will be the result when you attempt to MCQ Compilation Compilation Compilation Compile time
compile and run the following code?. and output the and output the and output the error
public class Conv string "Hello" string "ello" string elloH
{
public static void main(String argv[]){
Conv c=new Conv();
String s=new String("ello");
c.amethod(s);
}

public void amethod(String s){


char c='H';
c+=s;
System.out.println(c);
}
ADD
}
Examine this code: MCQ result = result.concat( result+stringA result =
stringA.concat stringA, +stringB+strin concat(String
String stringA = "Hello "; ( stringB, gC; A).concat(Stri
String stringB = " World"; stringB.concat stringC ); ngB).concat(S
String stringC = " Java"; ( stringC ) ); tringC)
String result;
Which of the following puts a reference to "Hello
ADD
World Java" in result?
Consider the following code and choose the MCQ 203 204 205 Compilation
correct option: error
public class Test {
public static void main(String[] args) {
String name="vikaramaditya";
System.out.println(name.codePointAt(2)+name.
ADD
charAt(3)); }}
Consider the following code and choose the MCQ acctna iccratna ctna tna
correct option:
public class Test {
public static void main(String[] args) {
StringBuffer sb = new
StringBuffer("antarctica");
sb.reverse();
sb.replace(2, 7, "c");
sb.delete(0,2);
ADDSystem.out.println(sb); }}
Which code can be inserted at Line X to print MCQ if(s==s2) if(s.equals(s2) if(s.equalsIgno if(s.noCaseMa if(s.equalIgnor
"Equal"? ) reCase(s2)) tch(s2)) eCase(s2))
public class EqTest{
public static void main(String argv[]){
EqTest e=new EqTest();
}

EqTest(){
String s="Java";
String s2="java";
// Line X
{
System.out.println("Equal");
}else
{
System.out.println("Not equal");
}
}
ADD
}
Given: MCA Compilation The first line of The first line of The second The second
public class Theory { fails output is abc output is abcd line of output line of output
public static void main(String[] args) { abc false abc false is abcd abc is abcd abcd
String s1 = "abc"; false true
String s2 = s1;
s1 += "d";
System.out.println(s1 + " " + s2 + " " +
(s1==s2));

StringBuffer sb1 = new StringBuffer("abc");


StringBuffer sb2 = sb1;
sb1.append("d");
System.out.println(sb1 + " " + sb2 + " " +
(sb1==sb2));
}
}
ADD
Which are true? (Choose all that apply.)
Consider the following code and choose the MCQ bat at atm Compilation
correct option: error
class Test {
public static void main(String args[]) {
String name=new String("batman");
int ibegin=1;
char iend=3;
System.out.println(name.substring(ibegin,
iend));
ADD
}}
Consider the following code and choose the MCQ 78abc abc78 Compilation Compiles but
correct option: error exception at
public class Test { run time
public static void main(String[] args) {
String data="78";
ADDSystem.out.println(data.append("abc")); }}
Given: MCQ 1 4 Compilation
String test = "This is a test"; fails.
String[] tokens = test.split("\s");
System.out.println(tokens.length);
ADD
What is the result?
Consider the following code and choose the MCQ acitcratna acitrcratna accircratna accrcratna
correct option:
public class Test {
public static void main(String[] args) {
StringBuffer sb = new
StringBuffer("antarctica");
sb.reverse();
sb.insert(4, 'r');
sb.replace(2, 4, "c");
ADDSystem.out.println(sb); }}
Consider the following code and choose the MCQ hi hi hi world world Compilation
correct option: error
class Test {
public static void main(String[] args) {
new Test().display("hi", 1);
new Test().display("hi", "world", 2); }
public void display(String... s, int x) {
ADD
System.out.print(s[s.length-x] + " "); } }
What does this code write: MCQ abc def abc def ghi abc def + abc def +ghi

StringTokenizer stuff = new StringTokenizer(


"abc def+ghi", "+");
System.out.println( stuff.nextToken() );
ADD
System.out.println( stuff.nextToken() );
Consider the following code and choose the MCQ abcdefabcdef none of the
correct option: abcabcDEFD abcdefabcDE listed options
class Test { EF F
public static void main(String args[]) {
String s1 = "abc";
String s2 = "def";
String s3 = s1.concat(s2.toUpperCase( ) );
ADD
System.out.println(s1+s2+s3); } }
Consider the following code and choose the MCQ 4 2 6 Compilation
correct option: error
public class Test {
public static void main(String[] args) {
String name="Anthony Gomes";
int a=111;
ADDSystem.out.println(name.indexOf(a)); }}
class StringManipulation{ MCQ Cognizant Cognizant Cognizant Technology
public static void main(String[] args){ Technology Technology Solutions Solutions
String str = new String("Cognizant"); Solutions
str.concat(" Technology");
StringBuffer sbf = new StringBuffer("
Solutions");
System.out.println(str+sbf);
}}
consider the code above & select the proper
ADD
output from the options.
What is the result of the following: MCQ One ring to One ring to One ring to Different
rule them all, rule them all, rule them all,\n Starts
String ring = "One ring to rule them all,\n"; One ring to One ring to One ring to
String find = "One ring to find them."; find them. find them. find them.

if ( ring.startsWith("One") &&
find.startsWith("One") )
System.out.println( ring+find );
else
ADD
System.out.println( "Different Starts" );
Consider the following code and choose the MCQ -6 6 Compilation
correct option: error
public class Test {
public static void main(String[] args) {
String name="Anthony Gomes";
System.out.println(name.replace('n',
ADD
name.charAt(3)).compareTo(name)); }}
Consider the following code and choose the MCQ The code will The program The program The program The program
correct option: fail to compile will print will print will print will print
class MyClass { because the str3str1str2,wh str3,when run str3str1,when str3str2,when
String str1="str1"; expression en run run run
String str2 ="str2"; str3.concat(str
String str3="str3"; 1) will not
str1.concat(str2); result in a
System.out.println(str3.concat(str1)); valid
} argument for
} the println()
ADD method
Consider the following code and choose the MCQ tica anta Compilation Complies but
correct option: error exception at
public class Test { run time
public static void main(String[] args) {
StringBuffer sb = new
StringBuffer("antarctica");
sb.delete(0,6);
ADDSystem.out.println(sb); }}
Consider the following code and choose the MCQ 788232 7914 Compilation Compiles but
correct option: error exception at
public class Test { run time
public static void main(String[] args) {
String data="7882";
ADDdata+=32; System.out.println(data); }}
class X2 MCQ 1 2 3
{
public X2 x;
public static void main(String [] args)
{
X2 x2 = new X2(); /* Line 6 */
X2 x3 = new X2(); /* Line 7 */
x2.x = x3;
x3.x = x2;
x2 = new X2();
x3 = x2; /* Line 11 */
}
}

after line 11 runs, how many objects are eligible


ADD
for garbage collection?
Which statement is true? MCQ A B C D
A. A class's finalize() method CANNOT be
invoked explicitly.
B. super.finalize() is called implicitly by any
overriding finalize() method.
C. The finalize() method for a given object is
called no more than once by the garbage
collector.
D. The order in which finalize() is called on two
objects is based on the order in which the two
objects became finalizable.
ADD
Which of the following allows a programmer to MCQ x.delete() x.finalize() Runtime.getR Only the
destroy an object x? untime().gc() garbage
collection
system can
destroy an
ADD object.
Given : MCQ This is java Thi is java This i java Thi i java none of the
public class MainOne { listed options
public static void main(String args[]) {
String str = "this is java";
System.out.println(removeChar(str,'s'));
}

public static String removeChar(String s, char


c) {
String r = "";
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) != c)
r += s.charAt(i);
}
return r;
}
ADD} What would be the result?
Consider the following code and choose the MCQ 1 2 3
correct option:
public class X
{
public static void main(String [] args)
{
X x = new X();
X x2 = m1(x); /* Line 6 */
X x4 = new X();
x2 = x4; /* Line 8 */
doComplexStuff(); }
static X m1(X mx) {
mx = new X();
return mx; }}
After line 8 runs. how many objects are eligible
ADD
for garbage collection?
Examine the following code: MCQ count < 9 count+1 <= 8 count < 8 count != 8

int count = 1;
while ( ___________ )
{
System.out.print( count + " " );
count = count + 1;
}
System.out.println( );

What condition should be used so that the code


prints:

ADD
12345678
Given: MCQ 2 24 234 246
public class Breaker2 {
static String o = "";
public static void main(String[] args) {
z:
for(int x = 2; x < 7; x++) {
if(x==3) continue;
if(x==5) break z;
o = o + x;
}
System.out.println(o);
}
}
ADD
What is the result?
Consider the following code and choose the MCQ Compilation 1515 255 Compiles but
correct option: error error at run
class Test{ time
public static void main(String args[]){
String hexa = "0XFF";
int number = Integer.decode(hexa);
ADD System.out.println(number); }}
Given: MCQ Compilation granite granite atom granite atom granite
class Atom { fails. granite atom granite
Atom() { System.out.print("atom "); }
}
class Rock extends Atom {
Rock(String type) { System.out.print(type); }
}
public class Mountain extends Rock {
Mountain() {
super("granite ");
new Rock("granite ");
}
public static void main(String[] a) { new
Mountain(); }
}
ADD
What is the result?
Given: MCQ hi hi hi world world world Compilation
public class Barn { fails.
public static void main(String[] args) {
new Barn().go("hi", 1);
new Barn().go("hi", "world", 2);
}
public void go(String... y, int x) {
System.out.print(y[y.length - 1] + " ");
}
}
ADD
What is the result?
Given: MCQ 23 32 25 Compilation Runtine Error
int n = 10; Error
switch(n)
{
case 10: n = n + 1;
case 15: n = n + 2;
case 20: n = n + 3;
case 25: n = n + 4;
case 30: n = n + 5;
}
System.out.println(n);
What is the value of ’n’ after executing the
ADD
following code?
Given: MCQ 00 0001 000120 00012021
public void go() {
String o = "";
z:
for(int x = 0; x < 3; x++) {
for(int y = 0; y < 2; y++) {
if(x==1) break;
if(x==2 && y==1) break z;
o = o + x + y;
}
}
System.out.println(o);
}
What is the result when the go() method is
ADD
invoked?
What will be the output of the program? MCQ 012 012122 Compilation Compilation
fails at line 11 fails at line 12.
public class Switch2
{
final static short x = 2;
public static int y = 0;
public static void main(String [] args)
{
for (int z=0; z < 3; z++)
{
switch (z)
{
case y: System.out.print("0 "); /* Line
11 */
case x-1: System.out.print("1 "); /*
Line 12 */
case x: System.out.print("2 "); /* Line
13 */
}
}
}
ADD
}
Consider the following code and choose the MCQ Compilation Compiles but Five Three
correct output: error no output
class Test{
public static void main(String args[]){
int a=5;
if(a=3){
System.out.print("Three");}else{
ADDSystem.out.print("Five");}}}
public void foo( boolean a, boolean b) MCQ If a is true and If a is true and If a is false If a is false
{ b is false then b is true then and b is false and b is true
if( a ) the output is the output is then the then the
{ "notB" "A && B" output is output is
System.out.println("A"); /* Line 5 */ "ELSE" "ELSE"
}
else if(a && b) /* Line 7 */
{
System.out.println( "A && B");
}
else /* Line 11 */
{
if ( !b )
{
System.out.println( "notB") ;
}
else
{
System.out.println( "ELSE" ) ;
}
}
}

ADD
What would be the result?
Consider the following code and choose the MCQ Compilation true false 1
correct option: error
class Test{
public static void main(String args[]){
Long l=0l;
ADD
System.out.println(l.equals(0));}}
Consider the following code and choose the MCQ true false compilation Compiles
correct output: error
class Test{
public static void main(String args[]){
boolean flag=true;
if(flag=false){
System.out.print("TRUE");}else{
ADD System.out.print("FALSE");}}}
class Test{ MCQ R.T.Ponting C.H.Gayle Compile error none of the
public static void main(String[] args) { listed options
int x=-1,y=-1;
if(++x=++y)
System.out.println("R.T. Ponting");
else
System.out.println("C.H. Gayle");
}
}
consider the code above & select the proper
ADD
output from the options.
Given: MCQ 81 91 92 82
public class Batman {
int squares = 81;
public static void main(String[] args) {
new Batman().go();
}
void go() {
incr(++squares);
System.out.println(squares);
}
void incr(int squares) { squares += 10; }
}
ADD
What is the result?
Consider the following code and choose the MCQ 7 Compilation Compiles but None of the
correct option: error error at run listed options
class Test{ time
public static void main(String args[]){
int l=7;
Long L = (Long)l;
ADDSystem.out.println(L); }}
public class SwitchTest MCQ value = 6 value = 4 value = 2 value = 8
{
public static void main(String[] args)
{
System.out.println("value =" + switchIt(4));
}
public static int switchIt(int x)
{
int j = 1;
switch (x)
{
case 1: j++;
case 2: j++;
case 3: j++;
case 4: j++;
case 5: j++;
default: j++;
}
return j + x;
}
}
What will be the output of the program?
ADD
Given: MCQ An exception [608, 610, [608, 610, Compilation
import java.util.*; is thrown at 612, 629] 612, 629] fails.
public class Explorer3 { runtime. [608, 610, [608, 610]
public static void main(String[] args) { 629]
TreeSet<Integer> s = new TreeSet<Integer>();
TreeSet<Integer> subs = new
TreeSet<Integer>();
for(int i = 606; i < 613; i++)
if(i%2 == 0) s.add(i);
subs = (TreeSet)s.subSet(608, true, 611, true);
subs.add(629);
System.out.println(s + " " + subs);
}
}
What is the result?

ADD
Consider the code below & select the correct MCQ 0001 000120 00012021 Compilation
ouput from the options: error
public class Test{
public static void main(String[] args) {
String num="";
z: for(int x=0;x<3;x++)
for(int y=0;y<2;y++){
if(x==1) break;
if(x==2 && y==1) break z;
num=num+x+y;
ADD}System.out.println(num);}}
What will be the output of the program? MCQ x=1 x=3 Compilation The code runs
int x = 3; fails. with no output.
int y = 1;
if (x = y) /* Line 3 */
{
System.out.println("x =" + x);
ADD
}
Given: MCQ r, t, t, r, e, o, Compilation An exception
public static void test(String str) { fails. is thrown at
int check = 4; runtime.
if (check = str.length()) {
System.out.print(str.charAt(check -= 1) +", ");
} else {
System.out.print(str.charAt(0) + ", ");
}
}
and the invocation:
test("four");
test("tee");
test("to");
What is the result?
ADD
11. double input = 314159.26; MCQ b = nf.parse( b = nf.format( b = nf.equals( b =
12. NumberFormat nf = input ); input ); input ); nf.parseObject
NumberFormat.getInstance(Locale.ITALIAN); ( input );
13. String b;
14. //insert code here

Which code, inserted at line 14, sets the value


ADD
of b to 314.159,26?
int I = 0; MCQ 3 2 4 1
outer:
while (true)
{
I++;
inner:
for (int j = 0; j < 10; j++)
{
I += j;
if (j == 3)
continue inner;
break outer;
}
continue outer;
}
System.out.println(I);

ADD
What will be thr result?
What is the range of the random number r MCQ 2 <= r <= 9 3 <= r <= 10 2<= r <= 10 3 <= r <= 9
generated by the code below?
int r = (int)(Math.floor(Math.random() * 8)) + 2;
ADD
public class While MCQ There are There are There is a There is a
{ syntax errors syntax errors syntax error syntax error
public void loop() on lines 1 and on lines 1, 6, on line 6 on line 1
{ 6 and 8
int x= 0;
while ( 1 ) /* Line 6 */
{
System.out.print("x plus one is " + (x +
1)); /* Line 8 */
}
}
}

ADD
Which statement is true?
Cosider the following code and choose the MCQ Compilation 2.147483648 NumberForma Compiles but
correct option: error E9 tException at no output
class Test{ run time
public static void main(String args[]){
System.out.println(Integer.parseInt("214748364
8", 10));
ADD
}}
class AutoBox { MCQ No, Yes, 10, 100 No, Runtime Yes, 100, 100
public static void main(String args[]) { Compilation error
error
int i = 10;
Integer iOb = 100;
i = iOb;
System.out.println(i + " " + iOb);
}
} whether this code work properly, if so what
ADD
would be the result?
Consider the following code and choose the MCQ 5,6 6,5 5,5 6,6
correct output:
public class Test{
public static void main(String[] args) {
int x = 0;
int y = 10;
do {
y--;
++x;
} while (x < 5);
System.out.print(x + "," + y);
}
ADD
}
Which of the following loop bodies DOES MCQ s += i * i; s++; s = s + s * i; s *= i; Compilation
compute the product from 1 to 10 like (1 * 2 * 3 error
*4*5*
6 * 7 * 8 * 9 * 10)?
int s = 1;
for (int i = 1; i <= 10; i++)
{
<What to put here?>
ADD
}
import java.util.SortedSet; MCQ tSet.headSet tset.headset headSet HeadSet
import java.util.TreeSet;

public class Main {

public static void main(String[] args) {


TreeSet<String> tSet = new
TreeSet<String>();
tSet.add("1");
tSet.add("2");
tSet.add("3");
tSet.add("4");
tSet.add("5");
SortedSet sortedSet =_____________("3");
System.out.println("Head Set Contains : " +
sortedSet);
}
} What is the missing method in the code to get
the head set of the tree set?
ADD
What will be the output of following code? MCQ one two three four three two four one three one two three
four one two four one
TreeSet map = new TreeSet();
map.add("one");
map.add("two");
map.add("three");
map.add("four");
map.add("one");
Iterator it = map.iterator();
while (it.hasNext() )
{
System.out.print( it.next() + " " );
ADD
}
Consider the following code and choose the MCQ 23 Compilation Compiles but None of the
correct option: error error at run listed options
class Test{ time
public static void main(String args[]){
Long data=23;
ADDSystem.out.println(data); }}
Given: MCQ harrier shepherd retriever Compilation
public class Test { fails.
public enum Dogs {collie, harrier, shepherd};
public static void main(String [] args) {
Dogs myDog = Dogs.shepherd;
switch (myDog) {
case collie:
System.out.print("collie ");
case default:
System.out.print("retriever ");
case harrier:
System.out.print("harrier ");
}
}
}
ADD
What is the result?
Consider the following code and choose the MCQ 0 null Compiles but Compilation null 0
correct option: error at run error
class Test{ time
public static void main(String args[]){
Long L = null; long l = L;
System.out.println(L);
System.out.println(l);
ADD}}
Consider the following code and choose the MCQ bat man Compilation bat man spider man
correct output: error spider man
class Test{
public static void main(String args[]){
int num=3; switch(num){
case 1: case 3: case 4: {
System.out.println("bat man"); }
case 2: case 5: {
System.out.println("spider man"); }break; } }}
ADD
What is the value of ’n’ after executing the MCQ 14 28 Compilation 10 Runtime Error
following code? Error
int n = 10;
int p = n + 5;
int q = p - 10;
int r = 2 * (p - q);
switch(n)
{
case p: n = n + 1;
case q: n = n + 2;
case r: n = n + 3;
default: n = n + 4;
ADD
}
Given: MCQ very short average tall tall short short
double height = 5.5;
if(height-- >= 5.0)
System.out.print("tall ");
if(--height >= 4.0)
System.out.print("average ");
if(height-- >= 3.0)
System.out.print("short ");
else
System.out.print("very short ");
}
ADD
What would be the Result?
Consider the following code and choose the MCQ 2211 3 2 1 null 4211 3211
correct option:
class Test{
public static void main(String ar[]){
TreeMap<Integer,String> tree = new
TreeMap<Integer,String>();
tree.put(1, "one");
tree.put(2, "two");
tree.put(3, "three");
tree.put(4,"Four");
System.out.println(tree.higherKey(2));
System.out.println(tree.ceilingKey(2));
System.out.println(tree.floorKey(1));
System.out.println(tree.lowerKey(1));
ADD
}}
What is the output of the following code : MCQ good good morning compiler error runtime error
class try1{ morning ….
public static void main(String[] args) {
System.out.println("good");
while(false){
System.out.println("morning");
}
}
ADD
}
Consider the following code and choose the MCQ default default compilation brownie
correct output: brownie error
class Test{
public static void main(String args[]){
int num='b'; switch(num){
default :{
System.out.print("default");}
case 100 : case 'b' : case 'c' : {
System.out.println("brownie"); break;}
case 200: case 'e': {
ADD System.out.println("pastry"); }break; } }}
What does the following code fragment write to MCQ You win You lose You win the You lose the
the monitor? prize prize.

int sum = 21;


if ( sum != 20 )
System.out.print("You win ");
else
System.out.print("You lose ");

System.out.println("the prize.");

ADD
What does the code fragment prints?
what will be the result of attempting to compile MCQ The code will The code will The code will The code will The code will
and run the following class? fail to compile fail to compile compile compile compile
Public class IFTest{ because the because the correctly and correctly and correctly,but
public static void main(String[] args){ syntax of the if compiler will display the display the will not display
int i=10; statement is not be able to letter a,when letter b,when any output
if(i==10) incorrect determine run run
if(i<10) which if
System.out.println("a"); statement the
else else clause
System.out.println("b"); belongs to
ADD
}}
Given: MCQ 20 21 22 23 24
static void myFunc()
{
int i, s = 0;
for (int j = 0; j < 7; j++) {
i = 0;
do {
i++;
s++;
} while (i < j);
}
System.out.println(s);
}
ADD} What would be the result
Consider the following code and choose the MCQ compilation apple default default apple
correct output: error
class Test{
public static void main(String args[]){
int num=3; switch(num){
default :{
System.out.print("default");}
case 1: case 3: case 4: {
System.out.println("apple"); break;}
case 2: case 5: {
System.out.println("black berry"); }break; } }}
ADD
switch(x) MCQ 2 and 4 1 ,3 and 5 3 and 5 4 and 6
{
default:
System.out.println("Hello");
}
Which of the following are acceptable types for
x?
1.byte
2.long
3.char
4.float
5.Short
ADD
6.Long
What is the output : MCQ M.S.Dhoni all of these Virat Kohli M.S.Dhoni
class One{ Sachin Virat
public static void main(String[] args) { Kohli
int a=100;
if(a>10)
System.out.println("M.S.Dhoni");
else if(a>20)
System.out.println("Sachin");
else if(a>30)
System.out.println("Virat Kohli");}
ADD
}
What is the output : MCQ none of the runtime error compiler error success
class Test{ listed options
public static void main(String[] args) {
int a=5,b=10,c=1;
if(a>c){
System.out.println("success");
}
else{
break;
}
}
ADD
}
Consider the following code and choose the MCQ Compiles but 46 compilation 40
correct option: error at run error
class Test{ time
public static void main(String args[]){ int
x=034;
int y=12;
int ans=x+y;
System.out.println(ans);
ADD}}
Given: MCQ collie harrier Compilation collie harrier
public class Test { fails.
public enum Dogs {collie, harrier};
public static void main(String [] args) {
Dogs myDog = Dogs.collie;
switch (myDog) {
case collie:
System.out.print("collie ");
case harrier:
System.out.print("harrier ");
}
}
}
ADD
What is the result?
What will be the output of following code? MCQ Prints: false, Prints: false, Prints: false, Prints: false,
false, false false, true true, false true, true
import java.util.*;
class I
{
public static void main (String[] args)
{
Object i = new ArrayList().iterator();
System.out.print((i instanceof List)+",");
System.out.print((i instanceof Iterator)+",");
System.out.print(i instanceof ListIterator);
}
}

ADD
public class Test { MCQ 123 3 2 23
public static void main(String [] args) {
int x = 5;
boolean b1 = true;
boolean b2 = false;

if ((x == 4) && !b2 )


System.out.print("1 ");
System.out.print("2 ");
if ((b2 = true) && b1 )
System.out.print("3 ");
}
}
ADD
What is the result?
Given: MCQ 9 5 3 11 7
int a = 5;
int b = 5;
int c = 5;
if (a > 3)
if (b > 4)
if (c > 5)
c += 1;
else
c += 2;
else
c += 3;
c += 4;
What is the value of variable c after executing
ADD
the following code?
Given: MCQ Compilation pi is bigger An exception pi is bigger
Float pi = new Float(3.14f); fails. than 3. occurs at than 3. Have a
if (pi > 3) { runtime. nice day.
System.out.print("pi is bigger than 3. ");
}
else {
System.out.print("pi is not bigger than 3. ");
}
finally {
System.out.println("Have a nice day.");
}
ADD
What is the result?
Consider the following code and choose the MCQ Compilation j = -1 j=0 j=1
correct option: fails
int i = l, j = -1;
switch (i)
{
case 0, 1: j = 1;
case 2: j = 2;
default: j = 0;
}
ADD
System.out.println("j = " + j);
What is the output : MCQ run time error good compile error bad
class try1{
public static void main(String[] args) {
int x=1;
if(x--)
System.out.println("good");
else
System.out.println("bad");
}
ADD
}
Given: MCQ 5,6 5,5 6,5 6,6
int x = 0;
int y = 10;
do {
y--;
++x;
} while (x < 5);
System.out.print(x + "," + y);
ADD
What is the result?
What are the thing to be placed to complete the MCQ int, int Integer, new Integer, int int, Integer
code?
class Wrap {
public static void main(String args[]) {

_______________ iOb = ___________


Integer(100);

int i = iOb.intValue();

System.out.println(i + " " + iOb); // displays


100 100
}
ADD
}
Which of the following options give the valid MCA dollorpack.$pa $$.$$.$$ _score.pack._ p@ckage.sub .package.subp
package names? (Choose 3) ck.$$pack _pack p@ckage.inne ackage.innerp
ADD rp@ckage ackage
Consider the following code and choose the MCQ compilation will display Hi will create two will not create
correct option: error once child threads any child
class Cthread extends Thread{ and display Hi thread
Cthread(){start();} twice
public void run(){
System.out.print("Hi");}
public static void main (String args[]){
Cthread th1=new Cthread();
Cthread th2=new Cthread();
ADD
}}
public class MyRunnable implements Runnable MCQ new new new new
{ Thread(MyRu MyRunnable(). Runnable(My Thread(new
public void run() nnable).run(); start(); Runnable).sta MyRunnable()
{ rt(); ).start();
// some code here
}
}
which of these will create and start this thread?

ADD
Consider the following code and choose the MCQ will not create Will create two will display Hi compilation
correct option: any child child threads once error
class Nthread extends Thread{ thread and display Hi
public void run(){ twice
System.out.print("Hi");}
public static void main(String args[]){
Nthread th1=new Nthread();
Nthread th2=new Nthread();
ADD
}
Consider the following code and choose the MCQ will print Hi will print Hi Compilation will print Hi
correct option: twice and Thrice error once
class Cthread extends Thread{ throws
public void run(){ Exception at
System.out.print("Hi");} run time
public static void main (String args[]){
Cthread th1=new Cthread();
th1.run();
th1.start();
th1.run();
ADD
}}
The following block of code creates a Thread MCQ public class public class public class public class
using a Runnable target: MyRunnable MyRunnable MyRunnable MyRunnable
extends implements extends implements
Runnable target = new MyRunnable(); Runnable{publ Runnable{void Object{public Runnable{publ
Thread myThread = new Thread(target); ic void run(){}} run(){}} void run(){}} ic void run(){}}

Which of the following classes can be used to


create the target, so that the preceding code
ADD
compiles correctly?
What will be the output of the program? MCQ Prints "Inside Prints "Inside Does not Throws
Thread Inside Thread Inside compile exception at
class MyThread extends Thread Thread" Runnable" runtime
{
MyThread() {}
MyThread(Runnable r) {super(r); }
public void run()
{
System.out.print("Inside Thread ");
}
}
class MyRunnable implements Runnable
{
public void run()
{
System.out.print(" Inside Runnable");
}
}
class Test
{
public static void main(String[] args)
{
new MyThread().start();
new MyThread(new MyRunnable()).start();
}
}
ADD
Consider the following code and choose the MCQ It will start a compilation Compiles but a1 is not a
correct option: new thread error throws run Thread
class A implements Runnable{ int k; time Exception
public void run(){
k++; }
public static void main(String args[]){
A a1=new A();
ADD
a1.run();}
class Cthread extends Thread{ MCQ will print Hi will print Hi will not print will start two
public void run(){ twice and Once thread
System.out.print("Hi");} throws
public static void main (String args[]){ exception at
Cthread th1=new Cthread(); runtime
th1.run();
th1.start();
th1.start();
ADD
}}
What will be the output of the program? MCQ Compilation An exception It prints The output
fails occurs at "Thread one. cannot be
class MyThread extends Thread runtime. Thread two." determined.
{
public static void main(String [] args)
{
MyThread t = new MyThread();
t.start();
System.out.print("one. ");
t.start();
System.out.print("two. ");
}
public void run()
{
System.out.print("Thread ");
}
ADD
}
class PingPong2 { MCQ The output The output The output The output
synchronized void hit(long n) { could be 6-1 6- could be 5-1 6- could be 6-1 5- could be 6-1 6-
for(int i = 1; i < 3; i++) 2 5-1 7-1 1 6-2 5-2 2 6-2 5-1 2 5-1 5-2
System.out.print(n + "-" + i + " ");
}
}
public class Tester implements Runnable {
static PingPong2 pp2 = new PingPong2();
public static void main(String[] args) {
new Thread(new Tester()).start();
new Thread(new Tester()).start();
}
public void run() {
pp2.hit(Thread.currentThread().getId()); }
}
ADD
Which statement is true?
Given: MCQ Compilation The code An exception The code
public class Threads4 { fails. executes is thrown at executes
public static void main (String[] args) { normally, but runtime. normally and
new Threads4().go(); nothing is prints "run".
} printed.
public void go() {
Runnable r = new Runnable() {
public void run() {
System.out.print("run");
}
};
Thread t = new Thread(r);
t.start();
t.start();
}
}
ADD
What is the result?
class Thread2 { MCQ An exception Compilation The code prints Good
public static void main(String[] args) { is thrown at fails. executes Day.. Twice
new Thread2().go(); } runtime. normally and
public void go(){ prints "Good
Runnable rn=new Runnable(){ Day.."
public void run(){
System.out.println("Good Day.."); } };
Thread t=new Thread(rn);
t.start();
}}
what should be the correct output for the code
ADD
written above?
Assume the following method is properly MCQ After thread A Two seconds Two seconds After the lock
synchronized and called from a thread A on an is notified, or after thread A after lock B is on B is
object B: after two is notified. released. released, or
seconds. after two
wait(2000); seconds.

After calling this method, when will the thread A


become a candidate to get another turn at the
ADD
CPU?
Which of following set of functions are example MCQ void add(int char add(float void add(int void add(int
of method overloading x,int y) char x) char x,int y) char x,int y) void
add(int x,int y) add(float y) add(char sum(double
ADD x,char y) x,double y)
consider the code & choose the correct output: MCQ End of java.lang.Runt End of run
class Threads2 implements Runnable { method. imeException: method. run. java.lang.Runt
java.lang.Runt Problem java.lang.Runt imeException:
public void run() { imeException: imeException: Problem
System.out.println("run."); Problem Problem
throw new RuntimeException("Problem");
}
public static void main(String[] args) {
Thread t = new Thread(new Threads2());
t.start();
System.out.println("End of method.");
}
}
ADD
Consider the following code: MCQ Code output: Code output: Code output: The code will
Start Hello Start Hello Start Hello not compile.
System.out.print("Start "); world End of world Catch world File Not
try file exception. Here File not Found
{ found.
System.out.print("Hello world");
throw new FileNotFoundException();
}
System.out.print(" Catch Here "); /* Line 7 */
catch(EOFException e)
{
System.out.print("End of file exception");
}
catch(FileNotFoundException e)
{
System.out.print("File not found");
}

given that EOFException and


FileNotFoundException are both subclasses of
IOException. If this block of code is pasted in a
ADD
method, choose the best option.
Given: MCQ throw throws No code is throws
public class ExceptionTest Exception Exception necessary RuntimeExcep
{ tion
class TestException extends Exception {}
public void runTest() throws TestException {}
public void test() /* Line X */
{
runTest();
}
}
At Line X, which code is necessary to make the
code compile?
ADD
Consider the following code and choose the MCQ Compilation ParseExceptio NumberForma
correct option: fails n thrown at tException
class Test{ runtime thrown at
public static void parse(String str) { runtime
try { int num = Integer.parseInt(str);
} catch (NumberFormatException nfe) {
num = 0; } finally { System.out.println(num);
} } public static void main(String[] args) {
parse("one"); }
ADD
Which of the following statements is true? MCQ Any statement Any statement catch(X x) can The Error
that can throw that can throw catch class is a
an Error must an Exception subclasses of RuntimeExcep
be enclosed in must be X where X is a tion.
a try block. enclosed in a subclass of
ADD try block. Exception.
class Trial{ MCQ One Two One Catch One Catch One Two
public static void main(String[] args){ Catch Finally Finally Catch
try{
System.out.println("One");
int y = 2 / 0;
System.out.println("Two");
}
catch(RuntimeException ex){
System.out.println("Catch");
}
finally{
System.out.println("Finally");
}
ADD
}}
Given: MCQ Compilation finally finally null
static void test() { fails. exception
try {
String x = null;
System.out.print(x.toString() + " ");
}
finally { System.out.print("finally "); }
}
public static void main(String[] args) {
try { test(); }
catch (Exception ex) {
System.out.print("exception "); }
}
ADD
What is the result?
Given: MCQ true Not true An exception none
public void testIfA() { is thrown at
if (testIfB("True")) { runtime.
System.out.println("True");
} else {
System.out.println("Not true");
}
}
public Boolean testIfB(String str) {
return Boolean.valueOf(str);
}
What is the result when method testIfA is
ADD
invoked?
Given the following program,which statements MCQ If run with no If run with no The program If run with one
is true? arguments,the arguments,the will throw an arguments,the
Public class Exception { program will program will ArrayIndexOut program will
public static void main(String[] args) { produce no produce "The OfBoundsExc simply print
try { output end" eption the given
if(args.length == 0) return; argument
System.out.println(args[0]);
}finally {
System.out.println("The end");
ADD
}}}
class PropagateException{ MCQ Arithmetic Runtime Arithmetic compilation
public static void main(String[] args){ Exception Exception Exception error
try{ Runtime
method(); Exception
System.out.println("method() called");
}
catch(ArithmeticException ex){
System.out.println("Arithmetic Exception");
}
catch(RuntimeException re){
System.out.println("Runtime Exception");
}}
static void method(){
int y = 2 / 0;
}}
consider the code above & select the proper
ADD
output from the options.
What is wrong with the following code? MCQ Since the A try block An empty A catch block A finally block
method foo() cannot be catch block is cannot follow must always
Class MyException extends Exception{} does not catch followed by not allowed a finally block follow one or
public class Test{ the exception both a catch more catch
public void foo() { generated by and a finally blocks
try { the method block
bar(); baz(),it must
} finally { declare the
baz(); RuntimeExcep
} catch(MyException e) {} tion in a
} throws clause
public void bar() throws MyException {
throw new MyException();
}
public void baz() throws RuntimeException {
throw new RuntimeException();
}
ADD
}
Consider the following code and choose the MCQ caught exit exit Compilation exit
correct option: RuntimeExcep fails
class Test{ tion thrown at
static void display(){ run time
throw new RuntimeException();
} public static void main(String args[]){
try{display();
}catch(Exception e){ throw new
NullPointerException();}
finally{try{ display();
}catch(NullPointerException e){
System.out.println("caught");}
ADD finally{ System.out.println("exit");}}}}
class X implements Runnable MCQ Thread t = Thread t = X run = new Thread t =
{ new Thread(); new X(); Thread t = new
public static void main(String args[]) x.run(); Thread(X); new Thread(X);
{ Thread(run); t.start();
/* Missing code? */ t.start();
}
public void run() {}
}
Which of the following line of code is suitable to
ADD
start a thread ?
Which four can be thrown using the throw MCQ 1, 4, 5 and 6 1, 2, 3 and 4 2, 4, 5 and 6 2, 3, 4 and 5
statement?

1.Error
2.Event
3.Object
4.Throwable
5.Exception
ADD
6.RuntimeException
class Trial{ MCQ Try Block Try Block Finally Block Finally Block
public static void main(String[] args){ Finally Block Try Block
try{
System.out.println("Try Block");
}
finally{
System.out.println("Finally Block");
}
ADD
}}
class Animal { public String noise() { return MCQ bark meow Compilation An exception peep
"peep"; } } fails is thrown at
class Dog extends Animal { runtime.
public String noise() { return "bark"; }
}
class Cat extends Animal {
public String noise() { return "meow"; }
}
class try1{
public static void main(String[] args){
Animal animal = new Dog();
Cat cat = (Cat)animal;
System.out.println(cat.noise());
}}
consider the code above & select the proper
ADD
output from the options.
Consider the following code and choose the MCQ caught exit exit Compilation Compiles but
correct option: fails exception at
class Test{ runtime
static void display(){
throw new RuntimeException();
} public static void main(String args[]){
try{ display(); }catch(Exception e){
throw new NullPointerException();}
finally{try{ display();
}catch(NullPointerException e){
System.out.println("caught");}
ADD
System.out.println("exit");}}}
Consider the following code and choose the MCQ test end test runtime test exception test exception
correct option: end runtime end end
class Test{
static void test() throws RuntimeException {
try { System.out.print("test ");
throw new RuntimeException();
} catch (Exception ex) {
System.out.print("exception "); }
} public static void main(String[] args) {
try { test(); } catch (RuntimeException ex) {
System.out.print("runtime "); }
ADD
System.out.print("end"); } }
class Test{ MCQ Exception RuntimeExcep Exception does not
public static void main(String[] args){ occurred tion occurred compile
try{ RuntimeExcep
Integer.parseInt("1.0"); tion
}
catch(Exception e){
System.out.println("Exception occurred");
}
catch(RuntimeException ex){
System.out.println("RuntimeException");
}
}}
consider the code above & select the proper
ADD
output from the options.
class s implements Runnable MCQ prints 12 12 DeadLock Cannot Compilation
{ 12 12 determine Error
int x, y; output.
public void run()
{
for(int i = 0; i < 1000; i++)
synchronized(this)
{
x = 12;
y = 12;
}
System.out.print(x + " " + y + " ");
}
public static void main(String args[])
{
s run = new s();
Thread t1 = new Thread(run);
Thread t2 = new Thread(run);
t1.start();
t2.start();
}
ADD
} What is the output?
What will be the output of the program? MCQ hello throwit Compilation hello throwit hello throwit
caught fails RuntimeExcep caught finally
public class RTExcept tion caught after
{ after
public static void throwit ()
{
System.out.print("throwit ");
throw new RuntimeException();
}
public static void main(String [] args)
{
try
{
System.out.print("hello ");
throwit();
}
catch (Exception re )
{
System.out.print("caught ");
}
finally
{
System.out.print("finally ");
}
System.out.println("after ");
}
ADD
}
Consider the code below & select the correct MCQ 5 Compilation Compiles but
ouput from the options: error error at run
public class Test{ time
Integer i;
int x;
Test(int y){
x=i+y;
System.out.println(x);
}
public static void main(String[] args) {
new Test(new Integer(5));
ADD
}}
Consider the following code and choose the MCQ exit Compiles and Compilation Compiles but
correct option: no output fails exception at
class Test{ runtime
static void display(){
throw new RuntimeException();
}
public static void main(String args[]){
try{display();
}catch(Exception e){ }
catch(RuntimeException re){}
ADD finally{System.out.println("exit");}}}
public class MyProgram MCQ The program The program The program The program
{ will not will print Hello will print Hello will print Hello
public static void throwit() compile. world, then will world, then will world, then will
{ print that a print that a print Finally
throw new RuntimeException(); RuntimeExcep RuntimeExcep executing,
} tion has tion has then will print
public static void main(String args[]) occurred, then occurred, and that a
{ will print Done then will print RuntimeExcep
try with try block, Finally tion has
{ and then will executing. occurred.
System.out.println("Hello world "); print Finally
throwit(); executing.
System.out.println("Done with try block
");
}
finally
{
System.out.println("Finally executing ");
}
}
}
which answer most closely indicates the
behavior of the program?
ADD
class Trial{ MCQ Java is We cannot We cannot Nothing is
public static void main(String[] args){ portable have a try have a try diaplayed
try{ block without block block
System.out.println("Java is portable"); a catch block without a
}}} catch / finally
ADD block
public static void parse(String str) { MCQ Compilation A A
try { fails ParseExceptio NumberForma
float f = Float.parseFloat(str); n is thrown by tException is
} catch (NumberFormatException nfe) { the parse thrown by the
f = 0; method at parse method
} finally { runtime. at runtime.
System.out.println(f);
}
}
public static void main(String[] args) {
parse("invalid");
ADD
}
Which digit,and in what order,will be printed MCQ The program The program The program The program The program
when the following program is run? will only print 5 will only print 1 will only print will only print 1 will only print
and 4 in order 1,2 and 4 in ,4 and 5 in 1,2,4 and 5 in
Public class MyClass { order order order
public static void main(String[] args) {
int k=0;
try {
int i=5/k;
}
catch(ArithmeticException e) {
System.out.println("1");
}
catch(RuntimeException e) {
System.out.println("2");
return;
}
catch(Exception e) {
System.out.println("3");
}
finally{
System.out.println("4");
}
System.out.println("5");
}
ADD
}
Given: MCQ Synchronizing An exception Compilation Declaring the
public class TestSeven extends Thread { the run() is thrown at fails. doThings()
private static int x; method would runtime. method as
public synchronized void doThings() { make the static would
int current = x; class thread- make the
current++; safe. class thread-
x = current; safe.
}
public void run() {
doThings();
}
}
ADD
Which statement is true?
Given: MCQ X run = new Thread t = Thread t = Thread t =
class X implements Runnable X(); Thread t = new new Thread(); new
{ new Thread(X); x.run(); Thread(X);
public static void main(String args[]) Thread(run); t.start();
{ t.start();
/* Some code */
}
public void run() {}
}
Which of the following line of code is suitable to
ADD
start a thread ?
Given: MCQ X, followed by No output, X, followed by none
class X { public void foo() { System.out.print("X an Exception. and an an Exception,
"); } } Exception is followed by B.
thrown.
public class SubB extends X {
public void foo() throws RuntimeException {
super.foo();
if (true) throw new RuntimeException();
System.out.print("B ");
}
public static void main(String[] args) {
new SubB().foo();
}
}
ADD
What is the result?
Which three of the following are methods of the MCQ 1, 2, 4 2, 4, 5 1, 2, 6 2, 3, 4
Object class?

1.notify();
2.notifyAll();
3.isInterrupted();
4.synchronized();
5.interrupt();
6.wait(long msecs);
7.sleep(long msecs);
ADD
8.yield();
public class RTExcept MCQ hello throwit hello throwit hello throwit Compilation
{ caught finally caught RuntimeExcep fails
public static void throwit () after tion caught
{ after
System.out.print("throwit ");
throw new RuntimeException();
}
public static void main(String [] args)
{
try
{
System.out.print("hello ");
throwit();
}
catch (Exception re )
{
System.out.print("caught ");
}
finally
{
System.out.print("finally ");
}
System.out.println("after ");
}
ADD
}
What will happen when you attempt to compile MCQ A compile time A run time Clean compile Clean compile
and run the following code? error error and at run but no output
public class Bground extends Thread{ indicating that indicating that time the at runtime
public static void main(String argv[]){ no run method no run method values 0 to 9
Bground b = new Bground(); is defined for is defined for are printed out
b.run(); the Thread the Thread
} class class
public void start(){
for (int i = 0; i <10; i++){
System.out.println("Value of i = "
+ i);
}
}
ADD
}
Given two programs: MCA 567 5 followed by Compilation Compilation Compilation
1. package pkgA; an exception fails with an fails with an fails with an
2. public class Abc { error on line 7 error on line 8 error on line 9
3. int a = 5;
4. protected int b = 6;
5. public int c = 7;
6. }

3. package pkgB;
4. import pkgA.*;
5. public class Def {
6. public static void main(String[] args) {
7. Abc f = new Abc();
8. System.out.print(" " + f.a);
9. System.out.print(" " + f.b);
10. System.out.print(" " + f.c);
11. }
12. }
What is the result when the second program is
ADD
run? (Choose all that apply)
What will the output of following code? MCQ finished Exception compilation ArithmeticExc
fails eption
try
{
int x = 0;
int y = 5 / x;
}
catch (Exception e)
{
System.out.println("Exception");
}
catch (ArithmeticException ae)
{
System.out.println(" Arithmetic Exception");
}
ADD
System.out.println("finished");
Given: MCQ Exception A,B,Exception Compilation Compilation
11. class A { fails because fails because
12. public void process() { of an error in of an error in
System.out.print("A,"); } line 20. line 14.
13. class B extends A {
14. public void process() throws IOException {
15. super.process();
16. System.out.print("B,");
17. throw new IOException();
18. }
19. public static void main(String[] args) {
20. try { new B().process(); }
21. catch (IOException e) {
System.out.println("Exception"); }
22. }
What is the result?
ADD
Consider the following code and choose the MCQ reads data Compilation reads data Compiles but
correct option: from file error from file error at
public class Test { named jlist.lst named jlist.lst runtime
public static void main(String[] args) { in byte form in byte form
File file=new File("D:/jlist.lst"); and display it and display
byte buffer[]=new byte[(int)file.length()+1]; on console. garbage value
FileInputStream fis=new FileInputStream(file);
fis.read(buffer);
System.out.println(buffer);
}
}
ADD
Consider the following code and choose the MCQ reads data Compilation reads data Compiles but
correct option: from file one error from file error at
public class Test { byte at a time named jlist.lst runtime
public static void main(String[] args) throws and display it in byte form
IOException { on the and display
File file=new File("D:/jlist.lst"); console. garbage value
byte buffer[]=new byte[(int)file.length()+1];
FileInputStream fis=new FileInputStream(file);
int ch=0;
while((ch=fis.read())!=-1){
System.out.print((char)ch); } }}
ADD
import java.io.EOFException; MCQ The program The program The program The program
import java.io.FileInputStream; will not will compile will compile will compile,
import java.io.FileNotFoundException; compile and print and print print H|e|l|l|o|,
import java.io.IOException; because a H|e|l|l|o|Input H|e|l|l|o|End of and then
import java.io.InputStreamReader; certain error. stream. terminate
public class MoreEndings { unchecked normally.
public static void main(String[] args) { exception is
try { not caught.
FileInputStream fis = new
FileInputStream("seq.txt");
InputStreamReader isr = new
InputStreamReader(fis);
int i = isr.read();
while (i != -1) {
System.out.print((char)i + "|");
i = isr.read();
}
} catch (FileNotFoundException fnf) {
System.out.println("File not found");
} catch (EOFException eofe) {
System.out.println("End of stream");
} catch (IOException ioe) {
System.out.println("Input error");
}
}
}
Assume that the file "seq.txt" exists in the
current directory, has the required
access permissions, and contains the string
"Hello".
ADD
Which statement about the program is true?
Consider the following code and choose the MCQ I am a Person I am a Student I am a Person I am a Student
correct output: I am a Student I am a Person
public class Person{
public void talk(){ System.out.print("I am a
Person "); }
}
public class Student extends Person {
public void talk(){ System.out.print("I am a
Student "); }
}
what is the result of this piece of code:
public class Test{
public static void main(String args[]){
Person p = new Student();
p.talk();
}
ADD
}
Consider the following code and choose the MCQ Skip the first Compilation Compiles and Compiles but
correct option: seven error runs without error at
public class Test{ characters output runtime
public static void main(String[] args) throws and then
IOException { starts reading
File file = new File("d:/temp.txt"); file and
FileReader reader=new FileReader(file); display it on
reader.skip(7); int ch; console
while((ch=reader.read())!=-1){
ADD System.out.print((char)ch); } }}
Consider the following code and choose the MCQ reads data Compilation reads data Compiles but
correct option: from file error from file error at
public class Test { named jlist.lst named jlist.lst runtime
public static void main(String[] args) throws in byte form in byte form
IOException { and display it and display
File file=new File("D:/jlist.lst"); on console. garbage value
byte buffer[]=new byte[(int)file.length()+1];
FileInputStream fis=new FileInputStream(file);
fis.read(buffer);
System.out.println(new String(buffer)); }}
ADD
Which of these are two legal ways of accessing MCQ A,D B,C C,D A,B
a File named "file.tst" for reading. Select the
correct option:
A)FileReader fr = new FileReader("file.tst");
B)FileInputStream fr = new
FileInputStream("file.tst");
C)InputStreamReader isr = new
InputStreamReader(fr, "UTF8");
D)FileReader fr = new FileReader("file.tst",
ADD
"UTF8");
Consider the following code and choose the MCQ the state of Compilation Compiles but the state of
correct option: the object s1 error error at run the object s1
class std{ will be store to time will not be
int call; std(int c){call=c;} file std.txt store to the
int getCall(){return call;} file.
}
public class Test{
public static void main(String[] args) throws
IOException {
File file=new File("d:/std.txt");
FileOutputStream fos=new
FileOutputStream(file);
ObjectOutputStream oos=new
ObjectOutputStream(fos);
std s1=new std(10);
oos.writeObject(s1);
oos.close();
ADD}}
Consider the following code and choose the MCQ reads data Compilation reads data Compiles but
correct option: from file one error from file error at
public class Test { byte at a time named jlist.lst runtime
public static void main(String[] args) throws and display it in byte form
IOException { on the and ascii
File file=new File("D:/jlist.lst"); console. value
byte buffer[]=new byte[(int)file.length()+1];
FileInputStream fis=new FileInputStream(file);
int ch=0;
while((ch=fis.read())!=-1){
System.out.print(ch); } }}
ADD
import java.io.*; MCQ Compilation An exception An instance of A instance of
public class MyClass implements Serializable { fails is thrown at MyClass is MyClass and
runtime serialized an instance of
private Tree tree = new Tree(); Tree are both
serialized
public static void main(String [] args) {
MyClass mc= new MyClass();
try {
FileOutputStream fs = new
FileOutputStream(”MyClass.ser”);
ObjectOutputStream os = new
ObjectOutputStream(fs);
os.writeObject(mc); os.close();
} catch (Exception ex) { ex.printStackTrace(); }
}}

ADD
Which of the following opens the file MCQ FileOutputStre FileOutputStre DataOutputStr FileOutputStre
"myData.stuff" for output first deleting any file am fos = new am fos = new eam dos = am fos = new
with that name? FileOutputStre FileOutputStre new FileOutputStre
am( am( DataOutputStr am( new
"myData.stuff" "myData.stuff" eam( BufferedOutpu
, true ) ) "myData.stuff" tStream(
) "myData.stuff"
ADD ))
Consider the following code and choose the MCQ The file The file The file The file Compilation
correct option: system has a system has a system has a system has a error
public class Test{ new empty new empty directory directory
public static void main(String[] args) { directory directory named dir, named
File dir = new File("dir"); named dir named newDir containing a newDir,
dir.mkdir(); file f1.txt containing a
File f1 = new File(dir, "f1.txt"); try { file f1.txt
f1.createNewFile(); } catch (IOException e) { ;
}
File newDir = new File("newDir");
ADDdir.renameTo(newDir);} }
Consider the following code and choose the MCQ writes data to Compilation writes data to Compiles but
correct option: file in byte error the file in error at
public class Test { form. character runtime
public static void main(String[] args) throws form.
IOException {
String data="Confidential info";
byte buffer[]=data.getBytes();
FileOutputStream fos=new
FileOutputStream("d:/temp");
for(byte d : buffer){
ADDfos.write(d); } }}
Consider the following code and choose the MCQ creates Compilation Compiles but Compiles and
correct option: directories error error at run executes but
public class Test { names prj and time directories are
public static void main(String[] args) { lib in d: drive not created
File file=new File("d:/prj,d:/lib");
ADD
file.mkdirs();}}
Consider the following code and choose the MCQ Transfer Compilation Compiles and Compiles but
correct option: content of file error runs but error at
public class Test { data to the content not runtime
public static void main(String[] args) throws temp.txt transferred to
IOException { the temp.txt
File file=new File("d:/data");
byte buffer[]=new byte[(int)file.length()+1];
FileInputStream fis=new FileInputStream(file);
fis.read(buffer);
FileWriter fw=new FileWriter("d:/temp.txt");
fw.write(new String(buffer));}}
ADD
Consider the following code and choose the MCQ the state of Compilation Compiles but the state of
correct option: the object s1 error error at run the object s1
class std implements Serializable{ will be store to time will not be
int call; std(int c){call=c;} file std.txt store to the
int getCall(){return call;} file.
}
public class Test{
public static void main(String[] args) throws
IOException {
File file=new File("d:/std.txt");
FileOutputStream fos=new
FileOutputStream(file);
ObjectOutputStream oos=new
ObjectOutputStream(fos);
std s1=new std(10);
oos.writeObject(s1);
oos.close();
ADD}}
Given : MCQ ab abcd ab cd abcd Compilation
import java.io.*; Error
public class ReadingFor {
public static void main(String[] args) {
String s;
try {
FileReader fr = new FileReader("myfile.txt");
BufferedReader br = new BufferedReader(fr);
while((s = br.readLine()) != null)
System.out.println(s);
br.flush();
} catch (IOException e) { System.out.println("io
error"); }
}
}
And given that myfile.txt contains the following
two lines of data:
ab
cd
What is the result?
ADD
Consider the following code and choose the MCQ creates Compilation Compiles but Compiles and
correct option: directory error error at run executes but
public class Test { d:/prj/lib time directory is not
public static void main(String[] args) { created
File file=new File("d:/prj/lib");
ADDfile.mkdirs();}}
import java.io.*; MCQ s.writeInt(x); s.serialize(x); s.defaultWrite s.writeObject(x
public class MyClass implements Serializable { Object(); );
private int a;
public int getA() { return a; }
publicMyClass(int a){this.a=a; }
private void writeObject( ObjectOutputStream s)
throws IOException {
// insert code here
}
}

Which code fragment, inserted at line 15, will


allow Foo objects to be
correctly serialized and deserialized?

ADD
class CreateFile{ MCA Line 16 is An exception Line 13 Line 13
public static void main(String[] args) { never is thrown at creates a File creates a
try { executed runtime object named directory
File directory = new File("c"); //Line 13 “c” named “c” in
File file = new File(directory,"myFile"); the file
if(!file.exists()) { system.
file.createNewFile(); //Line 16
}}
catch(IOException e) {
e.printStackTrace }
}}}
If the current direcory does not consists of
directory "c", Which statements are true ?
ADD
(Choose TWO)
Give Code snipet: MCQ java.sql.Result java.sql.Driver java.sql.Driver java.sql.Conn
{// Somecode Set Manager ection
ResultSet rs = st.executeQuery("SELECT *
FROM survey");

while (rs.next()) {
String name = rs.getString("name");
System.out.println(name);
}

rs.close();
// somecode
} What should be imported related to
ADD
ResultSet?
Consider the following code & select the correct MCQ will show first Compilation Compiles but Compiles but
option for output. employee error error at run no output
String sql ="select empno,ename from emp"; record time
PreparedStatement
pst=cn.prepareStatement(sql);
System.out.println(pst.toString());
ResultSet rs=pst.executeQuery();
System.out.println(rs.getString(1)+ "
ADD
"+rs.getString(2));
Consider the code below & select the correct MCQ will show all Compilation Compiles but Compiles but
ouput from the options: row of first error error at run run without
column time output
String sql ="select * from ?";
String table=" txyz ";
PreparedStatement
pst=cn.prepareStatement(sql);
pst.setString(1,table );
ResultSet rs=pst.executeQuery();
while(rs.next()){
ADDSystem.out.println(rs.getString(1)); }
Cosider the following code & select the correct MCQ will show only Compilation will show city Compiles but
output. name error error at run
String sql ="select rollno, name from student"; time
PreparedStatement
pst=cn.prepareStatement(sql);
System.out.println(pst.toString());
ResultSet rs=pst.executeQuery();
while(rs.next()){
ADD System.out.println(rs.getString(3)); }
Given : MCQ java.sql.Driver java.sql.Driver java.sql.Driver java.sql.DataS
public class MoreEndings { java.sql.Driver ource
public static void main(String[] args) throws Manager
Exception {
Class driverClass =
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver
");
DriverManager.registerDriver((Driver)
driverClass.newInstance());
// Some code
} Inorder to compile & execute this code, what
ADD
should we import?
Carefully read the question and answer MCQ super class display display super class
accordingly. method method method method
What will be the output for following code? display display display display
class Super method 20 20 method 10 10 method 20 20 method 10 10
{
int num=20;
public void display()
{
System.out.println("super class method");
}
}
public class ThisUse extends Super
{
int num;
public ThisUse(int num)
{
this.num=num;
}
public void display()
{
System.out.println("display method");
}
public void Show()
{
this.display();
display();
System.out.println(this.num);
System.out.println(num);
}
public static void main(String[]args)
ADD
{
Carefully read the question and answer MCQ 10 11 Compilation None of the
accordingly. error listed options
What will be the output for following code?
public class Variables
{
public static void main(String[]args)
{
public int i=10;
System.out.println(i++);
}
ADD
}
Carefully read the question and answer MCQ super class super class sub class Compilation
accordingly. show method show method show method Error
What will be the output for following code? sub class super class
class Super show method show method
{
static void show()
{
System.out.println("super class show method");
}
static class StaticMethods
{
void show()
{
System.out.println("sub class show method");
}
}
public static void main(String[]args)
{
Super.show();
new Super.StaticMethods().show();
}
}
ADD
Carefully read the question and answer MCQ I II & IV III I & III
accordingly.
Which of the following statements are true
about Method Overriding?
I: Signature must be same including return type
II: If the super class method is throwing the
exception then overriding method should throw
the same Exception
III: Overriding can be done in same class
IV: Overriding should be done in two different
classes with no relation between the classes
ADD
Carefully read the question and answer MCQ super class super class Compilation None of the
accordingly. exe method exe method error listed options
What will be the output of following code? sub class super class
class Super2 display display
{ method method
public void display()
{
System.out.println("super class display
method");
}
public void exe()
{
System.out.println("super class exe method");
display();
}
}
public class InheritMethod extends Super2
{
public void display()
{

System.out.println("sub class display method");


}

public static void main(String [] args)


{

InheritMethod o=new InheritMethod();

o.exe();
ADD
}
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
The below code will compile & provide desired
output:
package p1;
class Parent {
private int doWork(){
System.out.println("Do Work - Parent");
return 0;
}
}
class Child extends Parent {
public void doWork(){
System.out.println("Do Work - Child");
}
}
class Test{
public static void main(String[] args) {
new Child().doWork();
}
ADD
}
Carefully read the question and answer MCQ 1&2 1&2&3 2&3 1&2&4 2&4
accordingly.
public interface Status
{
/* insert code here */ int MY_VALUE = 10;
}
Which are valid on commented line?
1.final
2.static
3.native
ADD
4.public
Carefully read the question and answer MCQ Child Parent Parent Child Parent Child
accordingly.
What is the outputof below code:
package p1;
class Parent {
public static void doWork() {
System.out.println("Parent");
}
}
class Child extends Parent {
public static void doWork() {
System.out.println("Child");
}
}
class Test {
public static void main(String[] args) {
Child.doWork();
}
ADD
}
Carefully read the question and answer MCQ 1&2 1&3 2&3 3&4 2&4
accordingly.
abstract public class Employee
{
protected abstract double getSalesAmount();
public double getCommision() {
return getSalesAmount() * 0.15;
}
}
class Sales extends Employee
{
// insert method here
}
Which two methods, inserted independently,
correctly complete the Sales
class?
1.double getSalesAmount() { return 1230.45; }
2. public double getSalesAmount() { return
1230.45; }
3.private double getSalesAmount() { return
1230.45; }
4.protected double getSalesAmount() { return
ADD
1230.45; }
Carefully read the question and answer MCQ Class cannot Runtime Error. WD 500 Compile Error.
accordingly. be defined
public class Client1 inside another
{ class
public static void main(String [] args)
{
PenDrive p;
PenDrive.Vendor v1=new
PenDrive.Vendor("WD",500);
System.out.println(v1.getName());
System.out.println(v1.getPrice());
}
}
class PenDrive
{
static class Vendor
{
String name;
int price;
public String getName(){ return name;}
public int getPrice(){ return price;}

Vendor(String name,int price)


{
this.name=name;
this.price=price;
}
}
}
ADD
What will be the output of the given code?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
The below code will compile & provide desired
output:
package p1;
abstract class LivingThings{
public abstract void resperate();
interface Living
{
public abstract void walk();
}
}
class Human implements LivingThings.Living{
@Override
public void walk() {
System.out.println("Human Can Walk");
}
}
class Test {
public static void main(String[] args) {
new Human().walk();
}
ADD
}
Carefully read the question and answer MCQ 10 50 20 50 20 10 10 20
accordingly.
What will be the output for following code?
class super3{
int i=10;
public super3(int num){
i=num;
}
}
public class Inherite1 extends super3{
public Inherite1(int a){
super(a);
}
public void Exe(){
System.out.println(i);
}
public static void main(String[]args){
Inherite1 o=new Inherite1(50);
super3 s=new Inherite1(20);
System.out.println(s.i);
o.Exe();
}
ADD
}
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
The below code will compile & provide desired
output:
package p1;
interface A {
public abstract void methodOne();
}
interface B extends A {
public abstract void methodTwo();
}
class C implements B{
@Override
public void methodTwo() {
System.out.println("Method Two Body");
}
}
class Test {
public static void main(String[] args) {
new C().methodTwo();
}
ADD
}
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
The below code will compile & provide desired
output:
package p1;
interface Bounceable {
void bounce();
void setBounceFactor(int bf);
private class BusinessLogic
{
int var1;
float var2;
double result(int var1,float var2){
return var1*var2;
}
}
}
class Test {
public static void main(String[] args) {
System.out.println(new
Bounceable.BusinessLogic().result(12,12345.2
2F));
}
ADD
}
Carefully read the question and answer MCQ public void public void public void All of the listed
accordingly. aM2(){} aM1(){} bM2(){} options
interface B
{
public void bM1();
public void bM2();
}
abstract class A implements B
{
public abstract void aM1();
public abstract void aM2();
public void bM1(){}
}
public class Demo extends A
{
}
In above scenario class Demo must override
ADD
which methods?
Carefully read the question and answer MCQ public void public void public void public void
accordingly. aM1(){} public bM1(){} public aM1(){} public aM1(){} public
interface A void aM2(){} void bM2(){} void aM2(){} void bM2(){}
{ public void
public abstract void aM1(); bM1(){} public
public abstract void aM2(); void bM2(){}
}
interface B extends A
{
public void bM1();
public void bM2();
}
public class Demo extends Object implements
B
{
}
In above scenario class Demo must override
ADD
which methods?
Carefully read the question and answer MCQ they're not t1's an Object they're not No Output Will
accordingly. equal equal t1's an be Displayed
What is the output of below code: Object
package p1;
public class Test {
public static void main(String[] args) {
Test t1 = new Test();
Test t2 = new Test();
if (!t1.equals(t2))
System.out.println("they're not equal");
if (t1 instanceof Object)
System.out.println("t1's an Object");
}
ADD
}
Carefully read the question and answer MCQ Human Can Compilation Runtime No Output will
accordingly. Walk Error Exception be displayed
What is the outputof below code:
package p1;
abstract class LivingThings{
public abstract int walk();
}
class Human extends LivingThings{
@Override
public void walk() {
System.out.println("Human Can Walk");
}
}
class Test {
public static void main(String[] args) {
new Human().walk();
}
ADD
}
Carefully read the question and answer MCQ 0, 0, 0 120, 60, 0 60,60,60 120, 120, 120
accordingly.
abstract class Vehicle
{
public int speed()
{
return 0;
}
}
class Car extends Vehicle
{
public int speed()
{
return 60;
}
}
class RaceCar extends Car
{
public int speed()
{
return 120;
}
}
public class Demo
{
public static void main(String [] args)
{
RaceCar racer = new RaceCar();
Car car = new RaceCar();
Vehicle vehicle = new RaceCar();
ADDSystem.out.println(racer.speed() + ", " +
Carefully read the question and answer MCQ DigiCam do Compilation DigiCam do Runtime Error
accordingly. Charge You Error Charge
What will be the output of following code? are Sending:
class InterfaceDemo MyFamily.jpg
{
public static void main(String [] args)
{
new DigiCam(){}.doCharge();
new DigiCam(){
public void writeData (String msg)
{
System.out.println("You are Sending: "+msg);
}
}.writeData("MyFamily.jpg");
}//main
}
interface USB
{
int readData();
void writeData(String input);
void doCharge();
}
abstract class DigiCam implements USB
{
public int readData(){ return 0;}
public void writeData(String input){}
public void doCharge()
{
System.out.println("DigiCam do Charge");
}
ADD
}
Carefully read the question and answer MCQ The equals Compilation This class The code will
accordingly. method does fails because must also compile as
public class Person NOT properly the private implement the Object class's
{ override the attribute hashCode equals
private String name; Object class's p.name method as method is
public Person(String name) { this.name = equals cannot be well. overridden.
name; } method. accessed.
public boolean equals(Person p)
{
return p.name.equals(this.name);
}
}
ADD
Which statement is true?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
The below code will compile & provide desired
output:
package p1;
interface A {
public abstract void methodOne();
}
interface B{
public abstract void methodTwo();
}
interface C{
public abstract void methodTwo();
}
class D implements B,C,A{
public void methodOne(){}
public void methodTwo(){
System.out.println("Method Two");}
}
class Test {
public static void main(String[] args) {
new D().methodTwo();
}
ADD
}
Carefully read the question and answer MCQ It will print It will give It will print 5 None of the
accordingly. ArithmeticExc ArithmeticExc listed options
What will be the output for following code eption and eption
public class prints 5
MethodOverloading {
int m=10,n;
public void div(int a) throws Exception{
n=m/a;
System.out.println(n);
}
public void div(int a,int b) {
n=a/b;
}
public static void main(String[]args) throws
Exception{
MethodOverloading o=new
MethodOverloading();
o.div(0);
o.div(10,2);
}
ADD
}
Carefully read the question and answer MCQ Code will not Code will Code will Runtime
accordingly. compile due to Compile compile but Exception
class InterfaceDemo weaker without any wont print any
{ access Error message
public static void main(String [] args) privilege.
{
DigiCam cam1=new DigiCam();
cam1.doCharge();
}//main
}
interface USB
{
int readData();
boolean writeData(String input);
void doCharge();
}
class DigiCam implements USB
{
public int readData(){ return 0;}
public boolean writeData(String input){ return
false; }
void doCharge(){ return;}
}
Which of the following is correct with respect to
ADD
given code?
Carefully read the question and answer MCQ 1&2 1&3 2&3 3&4 2&4
accordingly.
public abstract class Shape
{
private int x;
private int y;
public abstract void draw();
public void setAnchor(int x, int y)
{
this.x = x;
this.y = y;
}
}
Which two classes use the Shape class
correctly?
1.public class Circle implements Shape {
private int radius;
}
2.public abstract class Circle extends Shape {
private int radius;
}
3.public class Circle extends Shape {
private int radius;
public void draw();
}
4.public class Circle extends Shape {
private int radius;
public void draw() {/* code here */}
ADD
}
Carefully read the question and answer MCQ Both Statement A Statement B Neither
accordingly. Statements A alone alone Statements A
Which of the following code snippets make and B nor B
objects eligible for Garbage Collection?
Statement A: String s = "new string"; s =
s.replace('e', '3');
Statement B:String replaceable = "replaceable";
StringBuffer sb = new
StringBuffer(replaceable);replaceable = null; sb
ADD
= null;
Carefully read the question and answer MCQ line 3 line 4 line 5 line 1
accordingly.
After which line the object initially referred by str
("Hello" String object) is eligible for garbage
collection?
class Garbage{
public static void main(string[]args){
line 1:String str=new String("Hello");
line 2. String str1=str;
line 3.str=new String("Hi");
line 4.str1=new String("Hello Again");
5.return;
}
ADD
}
Carefully read the question and answer MCQ 97 a compilation None of the
accordingly. error listed options
What will be the output for following code?
public class VariableDec1
{
public static void main(String[]args)
{
int I=32;
char c=65;
char a=c+I;
System.out.println(a);
}
ADD
}
Carefully read the question and answer MCQ 1 3 4 2
accordingly.
What will be the output for following code?
public class Variabledec {
public static void main(String[]args){
boolean x = true;
int a;
if(x) a = x ? 2: 1;
else a = x ? 3: 4;
System.out.println(a);
}
ADD
}
Carefully read the question and answer MCQ 102 34 4 Compilation
accordingly. error
What will be the output for following code?
public class VariableDec
{
public static void main(String[]args)
{
int x = 1;
if(x>0 )
x = 3;
switch(x)
{
case 1: System.out.println(1);
case 0: System.out.println(0);
case 2: System.out.println(2);
break;
case 3: System.out.println(3);
default: System.out.println(4);
break;
}
}
ADD
}
Carefully read the question and answer MCQ 12,12,-1 13,12,0 13,13,0 12,13,-1
accordingly.
What will be the output for following code?
public class Operators
{
public static void main(String[]args)
{
int i=12;
int j=13;
int k=++i-j--;
System.out.println(i);
System.out.println(j);
System.out.println(k);
}
ADD
}
Carefully read the question and answer MCQ An exception The code The code Compilation
accordingly. is thrown at executes executes fails.
public class Threads runtime. normally and normally, but
{ prints "Run". nothing is
public static void main (String[] args) printed.
{
new Threads().go();
}
public void go()
{
Runnable r = new Runnable()
{
public void run()
{
System.out.print("Run");
}
};

Thread t = new Thread(r);


t.start();
t.start();
}
}
ADD
What will be the result?
Carefully read the question and answer MCQ Compile Error Important job String in run Important job No Output
accordingly. running in running in
Predict the output of below code: MyThread MyThread
package p1; String in run
class MyThread extends Thread {
public void run(int a) {
System.out.println("Important job running in
MyThread");
}
public void run(String s) {
System.out.println("String in run");
}
}
class Test {
public static void main(String[] args) {
MyThread t1=new MyThread();
t1.start();
}
ADD
}
Carefully read the question and answer MCQ Compile Error Important job Runtime Non of the
accordingly. running in Exception options
What will be the output of below code: MyThread
package p1;
class MyThread extends Thread {
public void run() {
System.out.println("Important job running in
MyThread");
}
}
class Test {
public static void main(String[] args) {
MyThread t1=new MyThread();
t1.run();
}
ADD
}
Carefully read the question and answer MCQ It will compile It will compile The code will Compilation
accordingly. and the run and calling cause an error will cause an
class Background implements Runnable{ method will start will print at compile error because
int i = 0; print out the out the time. while cannot
public int run(){ increasing increasing take a
while (true) { value of i. value of i. parameter of
i++; true.
System.out.println("i="+i);
}
return 1;
}
ADD
}//End class
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State whether TRUE or FALSE.
The below code will compile & provide desired
output:
package p1;
class MyThread extends Thread {
public void run() {
System.out.println("Important job running in
MyThread");
}
public void run(String s) {
System.out.println("String in run is " + s);
}
}
class Test {
public static void main(String[] args) {
MyThread t1=new MyThread();
t1.start();
}
ADD
}
Carefully read the question and answer MCQ You cannot An exception The code The code
accordingly. call run() is thrown at executes and executes and
public class TestDemo implements Runnable method using runtime. prints prints
{ Thread class "Runner". "RunnerRunn
public void run() object. erRunner".
{
System.out.print("Runner");
}
public static void main(String[] args)
{
Thread t = new Thread(new TestDemo());
t.run();
t.run();
t.start();
}
}
ADD
What will be the result?
Carefully read the question and answer MCQ Exactly 10 Exactly 10 The delay If “Time’s
accordingly. seconds after seconds after between Over!” is
You have created a TimeOut class as an the start the “Start!” is “Start!” being printed, you
extension of Thread, the purpose of which is to method is printed, printed and can be sure
print a “Time’s Over” message if the Thread is called, “Time’s “Time’s Over!” “Time’s Over!” that at least 10
not interrupted within 10 seconds of being Over!” will be will be printed. will be 10 seconds have
started. Here is the run method that you have printed. seconds plus elapsed since
coded: or minus one “Start!” was
public void run() { tick of the printed.
System.out.println(“Start!”); system clock.
try {
Thread.sleep(10000);
System.out.println(“Time’s Over!”);
} catch (InterruptedException e) {
System.out.println(“Interrupted!”);
}
}Given that a program creates and starts a
TimeOut object, which of the following
ADD
statements is true?
Carefully read the question and answer MCQ [10,abc] [10] Compilation [abc]
accordingly. error
What will be the output for following code?
public class collection1{
public static void main(String[]args){
Collection c=new ArrayList();
c.add(10);
c.add("abc");
Collection l=new HashSet();
l.add(20);
l.add("abc");
l.add(30);
c.addAll(l);
c.removeAll(l);
System.out.println( c );
}
ADD
}
Carefully read the question and answer MCQ Prints the Compilation Throws Prints the
accordingly. output [Green error at line no Runtime output [Green
Consider the following code: World, 1, 8 Exception World, Green
01 import java.util.Set; Green Peace] Peace] at line
02 import java.util.TreeSet; at line no 9 no 9
03
04 class TestSet {
05 public static void main(String[] args) {
06 Set set = new TreeSet<String>();
07 set.add("Green World");
08 set.add(1);
09 set.add("Green Peace");
10 System.out.println(set);
11 }
12 }
Which of the following option gives the output
ADD
for the above code?
Carefully read the question and answer MCQ int String Object set1
accordingly.
What is the data type of m in the following
code?
import java.util.*;
public class set1
{
public static void main(String [] args)
{
Set s=new HashSet();
s.add(20);
s.add("abc");
for( _____ m:s)
System.out.println(m);
}
ADD
}
Carefully read the question and answer MCA Line 1 has Line 2 has run In Line 4 null Line 4 has
accordingly. compilation time pointer neither error
As per the below code find which statements error exceptions exception will nor
are true. occur as exceptions.
public class Test { String string
public static void main(String[] args) { contains null
Line 1: ArrayList<String> myList=new value
List<String>();
Line 2: String string = new String();
Line 3: myList.add("string");
Line 4: int index = myList.indexOf("string");
System.out.println(index);
}
ADD
}
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
State TRUE or FALSE.
line 1: public class Test {
line 2: public static void main(String[] args) {
line 3: Queue queue = new LinkedList();
line 4: queue.add("Hello");
line 5: queue.add("World");
line 6: List list = new ArrayList(queue);
line 7: System.out.println(list); }
line 8: }
Above code will give run time error at line
ADD
number 3.
Carefully read the question and answer MCQ A B C D E
accordingly.
Consider the following list of code:
A) Iterator iterator =
hashMap.keySet().iterator();
B) Iterator iterator = hashMap.iterator();
C) Iterator iterator =
hashMap.keyMap().iterator();
D) Iterator iterator =
hashMap.entrySet().iterator();
E) Iterator iterator =
hashMap.entrySet.iterator();
Assume that hashMap is an instance of
HashMap type collection implementation.
Which of the following option gives the correct
partial code about getting an Iterator to the
ADD
HashMap entries?
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
List<Integer> newList=new ArrayList<integer>();
will Above statement create a new object of
Array list successfully ?
ADD
Carefully read the question and answer MCQ True False None of the
accordingly. listed options
What will be the output for following code?
public class Compare
{
public static void main(String[]args)
{
String s=new String("abc");
String s1=new String("abc");
System.out.println(s.compareTo(s1));
}
ADD
}
Carefully read the question and answer MCQ both strings both strings compilation Runtime error
accordingly. are equal are not equal error
What will be the output for following code?
public class StringCompare{
public static void main(String[]args){
if("string"=="string")
System.out.println("both strings are equal");
else
System.out.println("both strings are not equal");
}
}
ADD
Carefully read the question and answer MCQ true true false true false false true false
accordingly.
What will be the output for following code?
public class StringBuffer1
{
public static void main(String[]args)
{
StringBuffer s1=new StringBuffer("welcome");
StringBuffer s2=new StringBuffer("welcome");
System.out.println(s1.equals(s2));
System.out.println(s1.equals(s1));
}
}

ADD
Carefully read the question and answer MCQ both strings both strings compilation Strings cannot
accordingly. are equal are not equal error be compare
What will be the output for following code? using ==
public class CompareStrings{ operator
public static void main(String[]args){
String a=new String("string");
String s=new String("string");
if(a==s)
System.out.println("both strings are equal");
else
System.out.println("both strings are not equal");
}
}
ADD
Carefully read the question and answer MCQ TRUE FALSE
accordingly.
Consider the following code snippet:
String thought = "Green";
StringBuffer bufferedThought = new
StringBuffer(thought);
String secondThought =
bufferedThought.toString();
System.out.println(thought ==
secondThought);
Which of the following option gives the output of
ADD
the above code snippet?
Carefully read the question and answer MCQ Error x = Java x = Rules x = Java
accordingly. Rules
What is the output of below code:
package p1;
public class Hackathon {
public static void main(String[] args) {
String x = "Java";
x.concat(" Rules!");
System.out.println("x = " + x);
}
ADD
}
Carefully read the question and answer MCQ both strings both strings compilation Strings cannot
accordingly. are equal are not equal error be compare
What will be the output for following code? using ==
public class CompareStrings{ operator
public static void main(String[]args){
if(" string ".trim()=="string")
System.out.println("both strings are equal");
else
System.out.println("both strings are not equal");
}
}
ADD
Carefully read the question and answer MCQ 4 5 6 None of the
accordingly. listed options
What will be the output for following code?
import java.util.*;
public class StringTokens
{
public static void main(String[]args)
{
String s="India is a\n developing country";
StringTokenizer o=new StringTokenizer(s);
System.out.println(o.countTokens());
}
ADD
}
Carefully read the question and answer MCQ x = JAVA x="" x = Java x="JAVA"
accordingly.
What is the output of below code:
package p1;
public class Hackathon {
public static void main(String[] args) {
String x = "Java";
x.toUpperCase();
System.out.println("x = " + x);
}
ADD
}
Carefully read the question and answer MCQ 1&2 1&2&3 1&3 2 2&3
accordingly.
What will be the output for following code?
public class Exe3
{
public static void main(String[]args)
{
try
{
int i=10;
int j=i/0;
return;
}catch(Exception e)
{
System.out.println("welcome");
}
System.out.println("error");
}
}
1.welcome
2.error
ADD
3.compilation error
Carefully read the question and answer MCQ welcome error compilation None of the
accordingly. error listed options
What will be the output for following code?
public class Exe3 {
public static void main(String[]args){
try{
int i=10;
int j=i/0;
return;
}catch(Exception e){
try{
System.out.println("welcome");
return;
}catch(Exception e1){
}
System.out.println("error");
}
}
ADD
}
Carefully read the question and answer MCQ IOException compilation Runtime error None of the
accordingly. error listed options
What will be the output for following code?
class super5{
void Get()throws Exception{
System.out.println("IOException");
}
}
public class Exception2 extends super5{
public static void main(String[]args){
super5 o=new super5();
try{
o.Get();
}catch(IOException e){
}
}
ADD
}
Carefully read the question and answer MCQ 1&2 1&2&3 1&3&4 1&2&4 2&4
accordingly.
What will be the output of following code?
public class Exception1{
public static void main(String args[]) {
int i=1, j=1;
try {
i++;
j--;
if(i/j > 1)
i++;
} catch(ArithmeticException e) {
System.out.println(0);
} catch(ArrayIndexOutOfBoundsException e) {
System.out.println(1);
} catch(Exception e) {
System.out.println(2);
}
finally {
System.out.println(3);
}
System.out.println(4);
}
}
1.0
2.1
3.3
4.4.
ADD
Carefully read the question and answer MCQ throws catch ( throws No code is
accordingly. RuntimeExcep Exception e ) Exception necessary.
At Point X in below code, which code is tion
necessary to make the code compile?
public class Test
{
class TestException extends Exception {}
public void runTest() throws TestException {}
public void test() /* Point X */
{
runTest();
}
}
ADD
Carefully read the question and answer MCQ Shows Shows Demands a Demands a
accordingly. unhandled unhandled finally block at finally block at
Consider the following code: exception type exception type line number 4 line number 5
1 public class FinallyCatch { IOException at IOException at
2 public static void main(String args[]) { line number 4 line number 5
3 try {
4 throw new java.io.IOException();
5 }
6 }
7 }
Which of the following is true regarding the
ADD
above code?
Carefully read the question and answer MCQ 2 3 compilation
accordingly. error
What will be the output for following code?
public class Exception1{
public static void main(String args[]) {
int i=1, j=1;
try {
i++;
j--;
if(i/j > 1)
i++;
} catch(Exception e) {
System.out.println(2);
} catch(ArithmeticException e) {
System.out.println(0);
}
finally {
System.out.println(3);
}
}
ADD
}
Carefully read the question and answer MCQ hello 0 hello 0 Math hello Math hello string
accordingly. stopped problem occur problem occur problem occur
What will be the output of the below code? stopped string problem stopped
public class Test { occur problem
public static void main(String[] args) { occurs
int a = 5, b = 0, c = 0; stopped
String s = new String();
try {
System.out.print("hello ");
System.out.print(s.charAt(0));
c = a / b;
} catch (ArithmeticException ae) {
System.out.print(" Math problem occur");
} catch (StringIndexOutOfBoundsException
se) {
System.out.print(" string problem occur");
} catch (Exception e) {
System.out.print(" problem occurs");
} finally {
System.out.print(" stopped");
}
}
ADD
}
Carefully read the question and answer MCQ A,C A Compilation None of the
accordingly. error listed options
What will be the output for following code?
public class Exception1
{
public static void main(String[]args)
{
System.out.println("A");
try
{
System.exit(0);
}catch(Exception e)
{
System.out.println("B");
}
System.out.println("C");
}
}
ADD
}
Carefully read the question and answer MCQ Prints Compiler time Compile time Run time error
accordingly. Exception error User error Cannot test() method
Consider the following code: defined use Throwable does not throw
class MyException extends Throwable { } exceptions to catch the a Throwable
public class TestThrowable { should extend exception instance
public static void main(String args[]) { Exception
try {
test();
} catch(Throwable ie) {
System.out.println("Exception");
}
}

static void test() throws Throwable {


throw new MyException();
}
}
Which of the following option gives the output
ADD
for the above code?
Carefully read the question and answer MCQ exception Compilation finally finally
accordingly. finished fails exception
What will be the output of the program? finished
public class Test {
public static void aMethod() throws Exception {
try {
throw new Exception();
} finally {
System.out.print("finally");
}
}
public static void main(String args[]) {
try {
aMethod();
} catch (Exception e) {
System.out.print("exception ");
}
System.out.print("finished"); /* Line 24 */
}
}
ADD
Carefully read the question and answer MCQ Compile time A A,C Runtime error
accordingly. error
What will be the output for following code?
import java.io.*;
public class Exception1
{
public static void main(String[]args)
{
System.out.println("A");

try
{
}
catch(IOException t)
{
System.out.println("B");
}

System.out.println("C");
}
ADD
}
Carefully read the question and answer MCQ 10 11 12 None of the
accordingly. listed options
What is the value of variable "I" after execution
of following code?
public class Evaluate
{
public static void main(String[]args)
{
int i=10;
if(((i++)>12)&&(++i<15))
System.out.println(i);
else
System.out.println(i);
}
ADD
}
Carefully read the question and answer MCQ 100 Compilation code will runtime
accordingly. error execute with Exception
What will be the output for following code? out printing
public class Wrapper11
{
public static void main(String[]args)
{
Long l=100;
System.out.println(l);
}
ADD
}
Carefully read the question and answer MCQ True False Compilation Runtime
accordingly. error Exception
What will be the output for following code?
public class WrapperClass12
{
public static void main(String[]args)
{
Boolean b=true;
boolean a=Boolean.parseBoolean("tRUE");
System.out.println(b==a);
}
ADD
}
Carefully read the question and answer MCQ 10Bangalore 10 Compilation Runtime
accordingly. error Exception
What will be the output for following code?
public class WrapperClass1 {
public static void main(String[]args){
String s="10Bangalore";
int i=Integer.parseInt(s);
System.out.println(i);
}
ADD
}
Carefully read the question and answer MCQ True False compilation None of the
accordingly. error listed options
What will be the output for following code?
public class WrapperClass1 {
public static void main(String[]args){
Integer i=new Integer(10);
Integer j=new Integer(10);
System.out.println(i==j);
}
ADD
}
Carefully read the question and answer MCQ 10.98730.765 10.9873.765 Compilation 10.987
accordingly. error
The result of 10.987+”30.765” is
ADD
_________________.
Carefully read the question and answer MCQ compilation 0,6 6,0 0,5
accordingly. error
What will be the output for following code?
public class While {
static int i;
public static void main(String[]args){
System.out.println(i);
while(i<=5){
i++;
}
System.out.println(i);
}
ADD
}
Carefully read the question and answer MCQ A,Z a,z 91,97 97,91
accordingly.
What will be the output for following code?
public class While {
public static void main(String[]args){
int a='A';
int i=a+32;
while(a<='Z'){
a++;
}
System.out.println(i);
System.out.println(a);
}
ADD
}
Carefully read the question and answer MCQ Primitive Wrapper Primitive Wrapper None Of the
accordingly. Wrapper Primitive options
What will be the output of below code?
public class Test {
public static void main(String[] args) {
int i = 1;
Integer I = new Integer(i);
method(i);
method(I);
}
static void method(Integer I) {
System.out.print(" Wrapper");
}
static void method(int i) {
System.out.print(" Primitive");
}
ADD
}
Carefully read the question and answer MCQ The class The number 1 The number 2 The number 3 The program
accordingly. compiles and gets printed gets printed gets printed generates a
What happens when the following code is runs, but does with with with compilation
compiled and run. Select the one correct not print AssertionError AssertionError AssertionError error.
answer. anything.
for(int i = 1; i < 3; i++)
for(int j = 3; j >= 1; j--)
ADD assert i!=j : i;
Carefully read the question and answer MCQ The code will The code will Class.forNam "SELECT *
accordingly. not compile as display all e must be FROM
Which of the following is true with respect to no try catch values in mentioned Person" query
code given below? block specified column after must be
import java.sql.*; named Connection passed as
public class OracleDemo column1 statement parameter to
{ con.createStat
public static void main(String [] args) throws ement()
SQLException,ClassNotFoundException
{

Class.forName("oracle.jdbc.driver.OracleDriver"
);
Connection
con=DriverManager.getConnection("jdbc:oracle
:thin:@PC188681:1521:training","scott","tiger");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("SELECT *
FROM Person");
while(rs.next())
{
System.out.println(rs.getString("column1"));
}
}
}
ADD
Grade1 Grade2 Grade3 Grade4 Grade5 AnswerDescription
QuestionMedia AnswerMedia Author
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0
0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1
TEXT TEXT
1 0

0 0 TEXT TEXT
0.25 0

0.25 0.25 0.25 TEXT TEXT


0 0

0 0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0.5 0.5

0 0 TEXT TEXT
1 0

0 0 0 TEXT TEXT
0 1

0 0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0
1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 0
0 1 TEXT TEXT
0 1
0 0 TEXT TEXT
0 0
0 1 TEXT TEXT
0 1
0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0
0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0.333333 0.333333
0 0.333333 0 TEXT TEXT
1 0

0 0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 0 TEXT TEXT
0 0

0.5 0.5 0 TEXT TEXT


0 0

0 1 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0.5 0

0 0.5 TEXT TEXT


0 0.5

0 0.5 0 TEXT TEXT


0 0.5

0 0.5 0 TEXT TEXT


0 0

1 0 TEXT TEXT
0 0

0.5 0.5 TEXT TEXT


0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0.5 0.5

0 0 0 TEXT TEXT
0 0.5

0.5 0 0 TEXT TEXT


0 0

0.5 0.5 0 TEXT TEXT


0 1

0 0 TEXT TEXT
0.5 0
0 0 0.5 TEXT TEXT
0 0
0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0
0 0 TEXT TEXT
0 0

0.5 0.5 0 TEXT TEXT


0 1

0 0 TEXT TEXT
0 0.333333

0.333333 0.333333 0 TEXT TEXT


1 0
0 0 TEXT TEXT
0 0.333333
0 0.333333 0.333333 TEXT TEXT
0 1
TEXT TEXT
0 1

0 0 TEXT TEXT
0.333333 0

0.333333 0.333333 0 TEXT TEXT


0 0
0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0
0 0 TEXT TEXT
0 0
0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1
0 0 TEXT TEXT
0.5 0.5

0 0 0 TEXT TEXT
0 0.5

0 0.5 TEXT TEXT


0 0.5

0 0.5 TEXT TEXT


0.5 0.5 0 0 TEXT TEXT
0 0.33

0.33 0 0.33 TEXT TEXT


0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0
TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 0 TEXT TEXT
1 0
TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 1

0 0 0 TEXT TEXT
0 1

TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
0 1

TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

TEXT TEXT
0 1

TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
0 1

TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

TEXT TEXT
0 0

0 0.5 0.5 TEXT TEXT


0 1

TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 0 TEXT TEXT
0 1

0 0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 0 1 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0.5 0.5

0 0 0 TEXT TEXT
0 0

0 0 1 TEXT TEXT
0 0

0 0 1 TEXT TEXT
0.5 0.5

0 0 TEXT TEXT
0 1

TEXT TEXT
0 1

TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0.33 0

0.33 0.33 TEXT TEXT


1 0

TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
0 0

0.5 0.5 TEXT TEXT


0 0

0.5 0.5 TEXT TEXT


0 0

0.5 0.5 TEXT TEXT


1 0

TEXT TEXT
0 0.5

0 0.5 TEXT TEXT


0.33 0.33

0.33 0 TEXT TEXT


0 1

TEXT TEXT
0 0

0.5 0.5 TEXT TEXT


0 0

0 1 TEXT TEXT
0 1

TEXT TEXT
0 1

TEXT TEXT
1 0

TEXT TEXT
0 1

0 0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

TEXT TEXT
0 1

TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
0 1

TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

TEXT TEXT
0 1

TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
0.5 0.5

0 0 TEXT TEXT
0 1

TEXT TEXT
1 0

0 0 TEXT TEXT
0.33 0.33

0 0.33 TEXT TEXT


1 0

0 0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0.33 0

0.33 0.33 TEXT TEXT


0.5 0

0 0.5 TEXT TEXT


0.5 0.5

0 0 TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
0 0

0 0 1 TEXT TEXT
0 0

0.5 0.5 TEXT TEXT


1 0

TEXT TEXT
0.5 0

0.5 0 TEXT TEXT


1 0

0 0 TEXT TEXT
0.33 0.33

0 0.33 TEXT TEXT


0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

TEXT TEXT
0 0.33

0.33 0.33 TEXT TEXT


0 0

1 0 TEXT TEXT
0 1

TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
1 0

TEXT TEXT
0.33 0.33

0.33 0 TEXT TEXT


0 1

0 0 TEXT TEXT
1 0

TEXT TEXT
0 0.5

0.5 0 TEXT TEXT


0 1

TEXT TEXT
0 1

TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 0 TEXT TEXT
1 0

0 0 0 TEXT TEXT
1 0

TEXT TEXT
0 0

0 1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 0 TEXT TEXT
0 1

0 0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

TEXT TEXT
0 0

0 0 1 TEXT TEXT
0 0.5

0 0.5 TEXT TEXT


0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0
0.5 0.5 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0.33 0.33

0 0 0.33 TEXT TEXT


0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0.5 0

0.5 0 TEXT TEXT


0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0.5

0 0.5 0 TEXT TEXT


0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0.333333 0

0.333333 0.333333 TEXT TEXT


0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0.333333 0.333333

0 0.333333 0 TEXT TEXT


1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0.5

0.5 0 0 TEXT TEXT


0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0
0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0
0.5 0.5 TEXT TEXT
0 1

0 0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 0 TEXT TEXT
0 0

0.5 0 0.5 TEXT TEXT


0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 0

1 0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0.333333 0.333333

0.333333 0 0 TEXT TEXT


0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 0.5 0.5 TEXT TEXT


0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0.5

0.5 0 TEXT TEXT


1 0

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

TEXT TEXT
0 1

TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
1 0

TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0.5 0

0 0.5 TEXT TEXT


0 1

TEXT TEXT
0 0

0 1 0 TEXT TEXT
0 1

TEXT TEXT
0 0

0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
1 0

0 0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

1 0 0 TEXT TEXT
0 0

1 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 0

1 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
0 1

0 0 TEXT TEXT
1 0

0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
0 0

0 1 TEXT TEXT
1 0

0 0 0 TEXT TEXT
0 1

0 0 0 TEXT TEXT
0 1

0 0 TEXT TEXT
Reviewer Is Numeric

You might also like