Complete Latest java Interview Questions and Answers for Freshers and Experienced

Java is a popular, general-purpose programming language that is widely used for developing desktop, web, and mobile applications. It is known for its "write once, run anywhere" philosophy, which allows Java code to be executed on multiple platforms without modification.


Home->Java Interview Questions and Answers

If you're looking for information on Java interview questions, you've come to the right place! This guide will provide you with a comprehensive list of common Java interview questions and answers.

Java Interview Questions and Answers Play Quiz On Java  |  More Q&A Click Here

# Question Options Answer
1 Which of those doesn’t have an index based structure?
  • List
  • Set
  • Map
  • Queue
  • Set
    2 java.util.Collections is a:
  • Class
  • Interface
  • Object
  • None of the above
  • Class
    3 Methods such as reverse, shuffle are offered in:
  • Object
  • Collection
  • Collections
  • Apache Commons Collections
  • Collections
    4 Which of those allows duplicate elements?
  • Set
  • List
  • All
  • None of the above
  • List
    5 Which allows the storage of a null key and null values?
  • Hashtable
  • HashMap
  • Set
  • None of the above
  • HashMap
    6 Which interface should be implemented for sorting on basis of many criteria’s?
  • Comparator
  • Comparable
  • Serializable
  • None of the above
  • Comparator
    7 What guarantees type-safety in a collection?
  • Generics
  • Abstract classes
  • Interfaces
  • Collection
  • Generics
    8 The most used interfaces from the collection framework are?
  • List
  • Map
  • Set
  • Queue
  • Map
    9 The root interface of Java collection framework hierarchy is –
  • Collection
  • Root
  • Collections
  • List/Set
  • List/Set
    10 Which of those is synchronized?
  • ArrayList
  • LinkedList
  • Vector
  • None of the above
  • Vector
    11 ArrayList implements that of the following?
  • List
  • RandomAccess
  • Cloneable
  • All of these
  • All of these
    12 Which of those permits the storage of the many null values?
  • Set
  • List
  • None of these
  • All of these
  • All of these
    13 Which doesn’t permit to store a null value?
  • TreeSet
  • LinkedHashSet
  • HashSet
  • None
  • TreeSet
    14 TreeMap implements?
  • Dictionary
  • HashMap
  • AbstractMap
  • Navigable Map
  • Navigable Map
    15 Which of these standard collection classes implements a dynamic array?
  • LinkedList
  • AbstractSet
  • AbstractList
  • ArrayList
  • ArrayList
    16 Which of these method of ArrayList class is used to obtain present size of an object?
  • capacity()
  • index()
  • size()
  • length()
  • size()
    17 Which of the below does not implement Map interface?
  • HashMap
  • Hashtable
  • Vector
  • EnumMap
  • Vector
    18 How to externally synchronize hashmap?
  • HashMap.synchronize(HashMap a);
  • Collections.synchronizedMap(new HashMap());
  • HashMap a = new HashMap();
  • Collections.synchronize(new HashMap());
  • Collections.synchronizedMap(new HashMap());
    19 How can we remove an object from ArrayList?
  • remove() method and using Iterator
  • delete() method
  • using Iterator
  • remove() method
  • remove() method and using Iterator
    20 Which class provides thread safe implementation of List?
  • ArrayList
  • List
  • HashList
  • CopyOnWriteArrayList
  • CopyOnWriteArrayList
    21 What is the relation between hashset and hashmap?
  • HashMap is the interface; HashSet is the concrete class
  • HashMap internally implements HashSet
  • HashSet internally implements HashMap
  • HashSet is the interface; HashMap is the concrete class
  • HashSet internally implements HashMap
    22 Which of these object stores association between keys and values?
  • Map
  • Array
  • Hash table
  • String
  • Map
    23 Which of these classes provide implementation of map interface?
  • LinkedList
  • ArrayList
  • HashMap
  • DynamicList
  • HashMap
    24 Which of these methods can be used to obtain set of all keys in a map?
  • keyall()
  • getAll()
  • getKeys()
  • keySet()
  • keySet()
    25 Which of these are legacy classes?
  • Vector
  • All of the mentioned
  • Stack
  • Hashtable
  • All of the mentioned
    26 Which of the following is not OOPS concept in Java?
  • Inheritance
  • Encapsulation
  • Polymorphism
  • Compilation
  • Compilation
    27 When does method overloading is determined?
  • At run time
  • At compile time
  • At coding time
  • At execution time
  • At compile time
    28 When Overloading does not occur?
  • More than one method with same name but different method signature and different number or type of parameters.
  • More than one method with same name, same signature but different number of signature.
  • More than one method with same name, same signature, same number of parameters but different type
  • More than one method with same name, same number of parameters and type but different signature
  • More than one method with same name, same number of parameters and type but different signature
    29 Which concept of Java is a way of converting real world objects in terms of class?
  • Polymorphism
  • Encapsulation
  • Abstraction
  • Inheritance
  • Abstraction
    30 Which concept of Java is achieved by combining methods and attribute into a class?
  • Encapsulation
  • Inheritance
  • Polymorphism
  • Abstraction
  • Encapsulation
    31 What is it called where child object gets killed if parent object is killed?
  • Aggregation
  • Composition
  • Encapsulation
  • Association
  • Composition
    32 Which component is used to compile, debug and execute java program?
  • JVM
  • JDK
  • JIT
  • JRE
  • JDK
    33 Which component is responsible for converting bytecode into machine specific code?
  • JVM
  • JDK
  • JIT
  • JRE
  • JVM
    34 Which component is responsible to run java program?
  • JVM
  • JDK
  • JIT
  • JRE
  • JRE
    35 Which component is responsible to optimize bytecode to machine code?
  • JVM
  • JDK
  • JIT
  • JRE
  • JIT
    36 Which of the below is invalid identifier with the main method?
  • public
  • static
  • private
  • final
  • private
    37 What is use of interpreter?
  • They convert bytecode to machine language code
  • They read high level code and execute them
  • They are intermediated between JIT and JVM
  • It is a synonym for JIT
  • They read high level code and execute them
    38 Which of the following is a valid declaration of an object of class Box?
  • Box obj = new Box();
  • Box obj = new Box;
  • obj = new Box();
  • new Box obj;
  • Box obj = new Box();
    39 Which of these operators is used to allocate memory for an object?
  • malloc
  • alloc
  • new
  • give
  • new
    40 Which of the following statements is correct?
  • Public method is accessible to all other classes in the hierarchy
  • Public method is accessible only to subclasses of its parent class
  • Public method can only be called by object of its class
  • Public method can be accessed by calling object of the public class
  • Public method is accessible to all other classes in the hierarchy
    41 What is the process of defining more than one method in a class differentiated by method signature?
  • Method overriding
  • Method overloading
  • Method doubling
  • None of the mentioned
  • Method overloading
    42 Which of the following is a method having same name as that of it’s class?
  • finalize
  • delete
  • class
  • constructor
  • constructor
    43 Which method can be defined only once in a program?
  • main method
  • finalize method
  • static method
  • private method
  • main method
    44 Which keyword is used by the method to refer to the object that invoked it?
  • import
  • catch
  • abstract
  • this
  • this
    45 Which function is used to perform some action when the object is to be destroyed?
  • finalize()
  • delete()
  • main()
  • none of the mentioned
  • finalize()
    46 What is false about constructor?
  • Constructors cannot be synchronized in Java
  • Java does not provide default copy constructor
  • Constructor can have a return type
  • “this” and “super” can be used in a constructor
  • Constructor can have a return type
    47 Which of these access specifier must be used for class so that it can be inherited by another subclass?
  • public
  • private
  • protected
  • none of the mentioned
  • public
    48 What is the process by which we can control what parts of a program can access the members of a class?
  • Polymorphism
  • Abstraction
  • Encapsulation
  • Recursion
  • Encapsulation
    49 Which of these is used as default for a member of a class if no access specifier is used for it?
  • public
  • public, within its own package
  • protected
  • private
  • private
    50 What is use of interpreter?
  • They are intermediated between JIT and JVM
  • It is a synonym for JIT
  • They convert bytecode to machine language code
  • They read high level code and execute them
  • They read high level code and execute them
    51 What is the extension of compiled java classes?
  • .txt
  • .class
  • .js
  • .java
  • .class
    52 Which of the below is invalid identifier with main method?
  • private
  • final
  • static
  • public
  • private
    53 Which of these package is used for text formatting in Java programming language?
  • java.awt
  • java.awt.text
  • java.io
  • java.text
  • java.text
    54 Which environment variable is used to set java path?
  • CLASSPATH
  • JAVA_HOME
  • MAVEN_HOME
  • JAVA
  • JAVA_HOME
    55 Which of these can not be used for a variable name in Java?
  • identifier
  • identifier & keyword
  • keyword
  • None of these
  • keyword
    56 Literals in java must be appended by which of these?
  • L
  • L and I
  • D
  • l
  • L and I
    57 What is true of final class?
  • Final class cannot be instantiated
  • Final class cannot be inherited
  • Final class cause compilation failure
  • Final class cause runtime failure
  • Final class cannot be inherited
    58 All the variables of interface should be ?
  • default and static
  • default and final
  • protect, static and final
  • public,static and final
  • public,static and final
    59 How can a protected modifier be accessed?
  • accessible by all
  • accessible only within package
  • accessible only within the class
  • accessible within package and outside the package but through inheritance only
  • accessible within package and outside the package but through inheritance only
    60 Which of the following modifier means a particular variable cannot be accessed within the package?
  • protected
  • default
  • private
  • public
  • private
    61 All the variables of class should be ideally declared as ?
  • default
  • private
  • public
  • protected
  • private
    62 Which one of the following is not an access modifier?
  • Void
  • Protected
  • Private
  • Public
  • Void
    63 Which of the following is not a valid flow control statement?
  • continue
  • break
  • return
  • exit()
  • exit()
    64 What is true about do statement?
  • do statement executes the code more than once always
  • do statement executes the code of a loop at least once
  • do statement does not get execute if condition is not matched in the first iteration
  • do statement checks the condition at the beginning of the loop
  • do statement executes the code of a loop at least once
    65 Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
  • while
  • for
  • if
  • do-while
  • do-while
    66 Which of these method of class StringBuffer is used to find the length of current character sequence?
  • Length()
  • capacity()
  • Capacity()
  • length()
  • length()
    67 Which of these method of class String is used to remove leading and trailing whitespaces?
  • Trim()
  • doTrim()
  • startsWith()
  • trim()
  • trim()
    68 Which of this method of class String is used to extract a substring from a String object?
  • Substring()
  • tostring()
  • substring()
  • SubString()
  • substring()
    69 Which of these method of class String is used to compare two String objects for their equality?
  • Isequal()
  • isequal()
  • Equals()
  • equals()
  • equals()
    70 Which of these is an incorrect statement?
  • String objects are mutable, they cannot be changed
  • StringBuffer class is used to store string in a buffer for later use
  • String object can point to some other reference of String variable
  • String objects are immutable, they cannot be changed
  • StringBuffer class is used to store string in a buffer for later use
    71 Which of this method of class String is used to obtain a length of String object?
  • Sizeof()
  • length()
  • get()
  • lengthof()
  • length()
    72 Which of these methods can be used to search an element in a list?
  • get()
  • binaryserach()
  • sort()
  • find()
  • binaryserach()
    73 Which of these cannot be declared static?
  • variable
  • method
  • class
  • object
  • object
    74 Which of these keywords is used to prevent content of a variable from being modified?
  • last
  • final
  • constant
  • static
  • final
    75 Arrays in Java are implemented as?
  • object
  • class
  • variable
  • method
  • object
    76 Where is array stored in memory?
  • first generation memory
  • stack space
  • heap space and stack space
  • heap space
  • heap space
    77 Can you make an array volatile?
  • No
  • Not possible
  • True
  • False
  • True
    78 Which of these is an incorrect Statement?
  • Array can be initialized when they are declared.
  • Array can be initialized using comma separated expressions surrounded by curly braces.
  • It is necessary to use new operator to initialize an array.
  • None of these
  • It is necessary to use new operator to initialize an array.
    79 Which of these classes is super class of Exception class?
  • Class
  • RunTime
  • Throwable
  • System
  • Throwable
    80 Which of these methods return description of an exception?
  • obtainException()
  • obtainDescription()
  • getMessage()
  • getException()
  • getMessage()
    81 Which of these statements is incorrect?
  • try can be followed by both catch and finally block
  • try need not to be followed by anything
  • try block need not to be followed by catch block
  • try block can be followed by finally block instead of catch block
  • try need not to be followed by anything
    82 Which of these keywords are used for generating an exception manually?
  • check
  • try
  • catch
  • throw
  • throw
    83 Which of these keywords are used for the block to handle the exceptions generated by try block?
  • check
  • throw
  • try
  • catch
  • catch
    84 Which of these keywords are used for the block to be examined for exceptions?
  • try
  • catch
  • throw
  • check
  • try
    85 What is the use of try and catch?
  • It allows to fix errors
  • It prevents automatic terminating of the program in cases when an exception occurs
  • It allows us to manually handle the exception
  • All of Above
  • All of Above
    86 Which of these exceptions will occur if we try to access the index of an array beyond its length?
  • ArrayIndexException
  • ArithmeticException
  • ArrayIndexOutOfBoundsException
  • ArrayException
  • ArrayIndexOutOfBoundsException
    87 A single try block must be followed by which of these?
  • try
  • finally
  • catch
  • finally & catch
  • finally & catch
    88 Which of these clause will be executed even if no exceptions are found?
  • catch
  • throw
  • finally
  • throws
  • finally
    89 Which of these class is related to all the exceptions that are explicitly thrown?
  • Exception
  • Throw
  • Error
  • Throwable
  • Throwable
    90 Which of these keywords is used to generate an exception explicitly?
  • catch
  • throw
  • finally
  • try
  • throw
    91 What exception thrown by parseInt() method?
  • NullPointerException
  • NumberFormatException
  • ArithmeticException
  • ClassNotFoundException
  • NumberFormatException
    92 Which of these handles the exception when no catch is used?
  • throw handler
  • Java run time system
  • Default handler
  • finally
  • Default handler
    93 Which of these class is related to all the exceptions that cannot be caught?
  • Exception
  • RuntimeExecption
  • Error
  • All of above
  • Error
    94 Which part of code gets executed whether exception is caught or not?
  • throw
  • try
  • finally
  • catch
  • finally
    95 Which of the following keywords is used for throwing exception manually?
  • catch
  • throw
  • try
  • finally
  • throw
    96 What would be the result if a class extends two interfaces and both have a method with same name and signature?
  • Code runs successfully
  • First called method is executed successfully
  • Runtime error
  • Compile time error
  • Compile time error
    97 Which of the following is used for implementing inheritance through class?
  • implements
  • inherited
  • using
  • extends
  • extends
    98 Which of the following is used for implementing inheritance through an interface?
  • extends
  • inherited
  • implements
  • using
  • implements
    99 Static members are not inherited to subclass.
  • return 0
  • return values
  • False
  • True
  • False
    100 If super class and subclass have same variable name, which keyword should be used to use super class?
  • this
  • classname
  • super
  • upper
  • super
    101 In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?
  • Protected
  • Public
  • Static
  • Private
  • Private
    102 All classes in Java are inherited from which class?
  • java.class.object
  • java.lang.class
  • java.lang.Object
  • java.class.inherited
  • java.lang.Object
    103 Using which of the following, multiple inheritance in Java can be implemented?
  • Multithreading
  • Private methods
  • Interfaces
  • Protected methods
  • Interfaces
    104 Which of this keyword must be used to inherit a class?
  • extends
  • extent
  • this
  • super
  • extends
    105 Which of these is supported by method overriding in Java?
  • class
  • Polymorphism
  • Encapsulation
  • Abstraction
  • Polymorphism
    106 If a class inheriting an abstract class does not define all of its function then it will be known as?
  • A simple class
  • interface
  • Abstract
  • Static class
  • Abstract
    107 Which of these is not abstract?
  • Queue
  • List
  • AbstractList
  • Thread
  • Thread
    108 Which of this package is used for handling security related issues in a program?
  • java.lang.security
  • java.awt.image
  • java.security
  • java.io.security
  • java.security
    109 Which of these methods can randomize all elements in a list?
  • randomize()
  • rand()
  • ambiguous()
  • shuffle()
  • shuffle()
    110 Which of these must contain a unique element?
  • List
  • Set
  • Collection
  • Array
  • Set
    111 Which of these interface handle sequences?
  • Collection
  • Comparator
  • List
  • Set
  • List
    112 Which of these is a method of ListIterator used to obtain index of previous element?
  • back()
  • previous()
  • goBack()
  • previousIndex()
  • previousIndex()
    113 Which of these methods can be used to move to next element in a collection?
  • hasNext()
  • shuffle()
  • move()
  • next()
  • next()
    114 Which of these return type of hasNext() method of an iterator?
  • Boolean
  • Double
  • Integer
  • Collections Object
  • Boolean
    115 What is Collection in Java?
  • A group of classes
  • A group of interfaces
  • A group of objects
  • All of above
  • A group of objects
    116 Which of these methods deletes all the elements from invoking collection?
  • refresh()
  • delete()
  • reset()
  • clear()
  • clear()
    117 Which of these classes is not part of Java’s collection framework?
  • Stack
  • Queue
  • Array
  • Maps
  • Maps
    118 Which of these packages contain all the collection classes?
  • java.net
  • java.lang
  • java.util
  • java.awt
  • java.util
    119 Which of these methods is used to retrieve the elements in properties object at specific location?
  • ElementAt()
  • get()
  • getProperty()
  • Elementat()
  • getProperty()
    120 Which of these method is used to insert value and its key?
  • addElement()
  • insertElement()
  • put()
  • set()
  • put()
    121 Which of these class object uses the key to store value?
  • Hashtable
  • Dictionary
  • Map
  • All of above
  • All of above
    122 Which of these methods is used to add elements in vector at specific location?
  • set()
  • add()
  • addElement()
  • AddElement()
  • addElement()
    123 Which of these are legacy classes?
  • Vector
  • Stack
  • Hashtable
  • All of Above
  • All of Above
    124 Which of these methods can be used to obtain set of all keys in a map?
  • keyall()
  • keySet()
  • getAll()
  • getKeys()
  • keySet()
    125 Which of these method is used to remove all keys/values pair from the invoking map?
  • removeAll()
  • clear()
  • remove()
  • delete()
  • remove()
    126 Which of the following is not OOPS concept in Java?
  • Inheritance
  • Encapsulation
  • Polymorphism
  • Compilation
  • Compilation
    127 Which of the following is a type of polymorphism in Java?
  • Compile time polymorphism
  • Execution time polymorphism
  • Multiple polymorphism
  • Multilevel polymorphism
  • Compile time polymorphism
    128 When does method overloading is determined?
  • At run time
  • At compile time
  • At coding time
  • At execution time
  • At compile time
    129 When Overloading does not occur?
  • More than one method with same name but different method signature and different number or type of parameters
  • More than one method with same name, same signature but different number of signature
  • More than one method with same name, same signature, same number of parameters but different type
  • More than one method with same name, same number of parameters and type but different signature
  • More than one method with same name, same number of parameters and type but different signature
    130 Which concept of Java is a way of converting real world objects in terms of class?
  • Polymorphism
  • Encapsulation
  • Abstraction
  • Inheritance
  • Abstraction
    131 Which concept of Java is achieved by combining methods and attribute into a class?
  • Encapsulation
  • Inheritance
  • Polymorphism
  • Abstraction
  • Encapsulation
    132 What is it called if an object has its own lifecycle and there is no owner?
  • Aggregation
  • Composition
  • Encapsulation
  • Association
  • Association
    133 What is it called where child object gets killed if parent object is killed?
  • Aggregation
  • Composition
  • Encapsulation
  • Association
  • Composition
    134 What is it called where object has its own lifecycle and child object cannot belong to another parent object?
  • Aggregation
  • Composition
  • Encapsulation
  • Association
  • Aggregation
    135 Method overriding is combination of inheritance and polymorphism?
  • True
  • False
  • None
  • All of the above
  • True
    136 What is the stored in the object obj in following lines of Java code? -> box obj;
  • Memory address of allocated memory of object
  • NULL
  • Any arbitrary pointer
  • Garbage
  • NULL
    137 Which of these keywords is used to make a class?
  • class
  • struct
  • int
  • none of the mentioned
  • class
    138 Which of the following is a valid declaration of an object of class Box?
  • Box obj = new Box();
  • Box obj = new Box;
  • obj = new Box();
  • new Box obj;
  • Box obj = new Box();
    139 Which of these statement is incorrect?
  • Every class must contain a main() method
  • Applets do not require a main() method at all
  • There can be only one main() method in a program
  • main() method must be made public
  • Every class must contain a main() method
    140 Which of the following statements is correct?
  • Public method is accessible to all other classes in the hierarchy
  • Public method is accessible only to subclasses of its parent class
  • Public method can only be called by object of its class
  • Public method can be accessed by calling object of the public class
  • Public method is accessible to all other classes in the hierarchy
    141 What is the return type of a method that does not return any value?
  • int
  • float
  • void
  • double
  • void
    142 Which of the following is a method having same name as that of it’s class?
  • finalize
  • delete
  • class
  • constructor
  • constructor
    143 Which method can be defined only once in a program?
  • main method
  • finalize method
  • static method
  • private method
  • main method
    144 Which of this statement is incorrect?
  • All object of a class are allotted memory for the all the variables defined in the class
  • If a function is defined public it can be accessed by object of other class by inheritance
  • main() method must be made public
  • All object of a class are allotted memory for the methods defined in the class
  • All object of a class are allotted memory for the methods defined in the class
    145 What is the return type of Constructors?
  • int
  • float
  • void
  • none of the mentioned
  • none of the mentioned
    146 Which keyword is used by the method to refer to the object that invoked it?
  • import
  • catch
  • abstract
  • this
  • this
    147 Which operator is used by Java run time implementations to free the memory of an object when it is no longer needed?
  • delete
  • free
  • new
  • none of the mentioned
  • none of the mentioned
    148 Which function is used to perform some action when the object is to be destroyed?
  • finalize()
  • delete()
  • main()
  • none of the mentioned
  • finalize()
    149 Which of the following statements are incorrect?
  • default constructor is called at the time of object declaration
  • constructor can be parameterized
  • finalize() method is called when a object goes out of scope and is no longer needed
  • finalize() method must be declared protected
  • finalize() method is called when a object goes out of scope and is no longer needed
    150 What is true about private constructor?
  • Private constructor ensures only one instance of a class exist at any point of time
  • Private constructor ensures multiple instances of a class exist at any point of time
  • Private constructor eases the instantiation of a class
  • Private constructor allows creating objects in other classes
  • Private constructor ensures only one instance of a class exist at any point of time
    151 What would be the behaviour if this() and super() used in a method?
  • Runtime error
  • Throws exception
  • compile time error
  • Runs successfully
  • compile time error
    152 What is false about constructor?
  • Constructors cannot be synchronized in Java
  • Java does not provide default copy constructor
  • Constructor can have a return type
  • this and super can be used in a constructor
  • Constructor can have a return type
    153 What is true about Class.getInstance()?
  • Class.getInstance calls the constructor
  • Class.getInstance is same as new operator
  • Class.getInstance needs to have matching constructor
  • Class.getInstance creates object if class does not have any constructor
  • Class.getInstance creates object if class does not have any constructor
    154 What is true about protected constructor?
  • Protected constructor can be called directly
  • Protected constructor can only be called using super()
  • Protected constructor can be used outside package
  • protected constructor can be instantiated even if child is in a different package
  • Protected constructor can only be called using super()
    155 What is not the use of this keyword in Java?
  • Passing itself to another method
  • Calling another constructor in constructor chaining
  • Referring to the instance variable when local variable has the same name
  • Passing itself to method of the same class
  • Passing itself to method of the same class
    156 What would be the behaviour if one parameterized constructor is explicitly defined?
  • Compilation error
  • Compilation succeeds
  • Runtime error
  • Compilation succeeds but at the time of creating object using default constructor, it throws compilation error
  • Compilation succeeds but at the time of creating object using default constructor, it throws compilation error
    157 What would be behaviour if the constructor has a return type?
  • Compilation error
  • Runtime error
  • Compilation and runs successfully
  • Only String return type is allowed
  • Compilation error
    158 What is the process of defining two or more methods within same class that have same name but different parameters declaration?
  • method overloading
  • method overriding
  • method hiding
  • none of the mentioned
  • method overloading
    159 Which of these can be overloaded?
  • Methods
  • Constructors
  • All of the mentioned
  • None of the mentioned
  • All of the mentioned
    160 Which of these is correct about passing an argument by call-by-value process?
  • Copy of argument is made into the formal parameter of the subroutine
  • Reference to original argument is passed to formal parameter of the subroutine
  • Copy of argument is made into the formal parameter of the subroutine and changes made on parameters of subroutine have effect on original argument
  • Reference to original argument is passed to formal parameter of the subroutine and changes made on parameters of subroutine have effect on original argument
  • Copy of argument is made into the formal parameter of the subroutine
    161 What is the process of defining a method in terms of itself, that is a method that calls itself?
  • Polymorphism
  • Abstraction
  • Encapsulation
  • Recursion
  • Recursion
    162 Which of these access specifiers must be used for main() method?
  • private
  • public
  • protected
  • none of the mentioned
  • public
    163 Which of these is used to access a member of class before object of that class is created?
  • public
  • private
  • static
  • protected
  • static
    164 Which of these is used as a default for a member of a class if no access specifier is used for it?
  • private
  • public
  • public, within its own package
  • protected
  • private
    165 What is the process by which we can control what parts of a program can access the members of a class?
  • Polymorphism
  • Abstraction
  • Encapsulation
  • Recursion
  • Encapsulation
    166 Which of the following statements are incorrect?
  • public members of class can be accessed by any code in the program
  • private members of class can only be accessed by other members of the class
  • private members of class can be inherited by a subclass, and become protected members in subclass
  • protected members of a class can be inherited by a subclass, and become private members of the subclass
  • private members of class can be inherited by a subclass, and become protected members in subclass
    167 Which of these access specifier must be used for class so that it can be inherited by another subclass?
  • public
  • private
  • protected
  • none of the mentioned
  • public
    168 Which one of the following is not an access modifier?
  • Public
  • Private
  • Protected
  • Void
  • Void
    169 All the variables of class should be ideally declared as?
  • private
  • public
  • protected
  • default
  • private
    170 Which of the following modifier means a particular variable cannot be accessed within the package?
  • private
  • public
  • protected
  • default
  • private
    171 How can a protected modifier be accessed?
  • accessible only within the class
  • accessible only within package
  • accessible within package and outside the package but through inheritance only
  • accessible by all
  • accessible within package and outside the package but through inheritance only
    172 What happens if constructor of class A is made private?
  • Any class can instantiate objects of class A
  • Objects of class A can be instantiated only within the class where it is declared
  • Inherited class can instantiate objects of class A
  • classes within the same package as class A can instantiate objects of class A
  • Objects of class A can be instantiated only within the class where it is declared
    173 All the variables of interface should be?
  • default and final
  • default and static
  • public, static and final
  • protect, static and final
  • public, static and final
    174 What is true of final class?
  • Final class cause compilation failure
  • Final class cannot be instantiated
  • Final class cause runtime failure
  • Final class cannot be inherited
  • Final class cannot be inherited
    175 How many copies of static and class variables are created when 10 objects are created of a class?
  • 1, 10
  • 10, 10
  • 10, 1
  • 1, 1
  • 1, 10
    176 Which is the modifier when there is none mentioned explicitly?
  • protected
  • private
  • public
  • default
  • default
    177 String in Java is a?
  • class
  • object
  • variable
  • character array
  • class
    178 Which of these method of String class is used to obtain character at specified index?
  • char()
  • Charat()
  • charat()
  • charAt()
  • charAt()
    179 Which of these keywords is used to refer to member of base class from a subclass?
  • upper
  • super
  • this
  • none of the mentioned
  • super
    180 Which of these method of String class can be used to test to strings for equality?
  • isequal()
  • isequals()
  • equal()
  • equals()
  • equals()
    181 Which of the following statements are incorrect?
  • String is a class
  • Strings in java are mutable
  • Every string is an object of class String
  • Java defines a peer class of String, called StringBuffer, which allows string to be altered
  • Strings in java are mutable
    182 Which of this keyword can be used in a subclass to call the constructor of superclass?
  • super
  • this
  • extent
  • extends
  • super
    183 What is the process of defining a method in a subclass having same name & type signature as a method in its superclass?
  • Method overloading
  • Method overriding
  • Method hiding
  • None of the mentioned
  • Method overriding
    184 Which of these keywords can be used to prevent Method overriding?
  • static
  • constant
  • protected
  • final
  • final
    185 Which of these is supported by method overriding in Java?
  • Abstraction
  • Encapsulation
  • Polymorphism
  • None of the mentioned
  • Polymorphism
    186 What is not type of inheritance?
  • Single inheritance
  • Double inheritance
  • Hierarchical inheritance
  • Multiple inheritance
  • Double inheritance
    187 Using which of the following, multiple inheritance in Java can be implemented?
  • Interfaces
  • Multithreading
  • Protected methods
  • Private methods
  • Interfaces
    188 All classes in Java are inherited from which class?
  • java.lang.class
  • java.class.inherited
  • java.class.object
  • java.lang.Object
  • java.lang.Object
    189 In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?
  • Protected
  • Private
  • Public
  • Static
  • Private
    190 If super class and subclass have same variable name, which keyword should be used to use super class?
  • super
  • this
  • upper
  • classname
  • super
    191 Static members are not inherited to subclass.
  • True
  • False
  • Not Sure
  • None
  • True
    192 Which of the following is used for implementing inheritance through an interface?
  • inherited
  • using
  • extends
  • implements
  • implements
    193 Which of the following is used for implementing inheritance through class?
  • inherited
  • using
  • extends
  • implements
  • extends
    194 What would be the result if a class extends two interfaces and both have a method with same name and signature? Lets assume that the class is not implementing that method.
  • Runtime error
  • Compile time error
  • Code runs successfully
  • First called method is executed successfully
  • Compile time error
    195 Which of these class is superclass of every class in Java?
  • String class
  • Object class
  • Abstract class
  • ArrayList class
  • Object class
    196 Which of these method of Object class can clone an object?
  • Objectcopy()
  • copy()
  • Object clone()
  • clone()
  • Object clone()
    197 Which of these method of Object class is used to obtain class of an object at run time?
  • get()
  • void getclass()
  • Class getclass()
  • None of the mentioned
  • Class getclass()
    198 Which of these keywords can be used to prevent inheritance of a class?
  • super
  • constant
  • class
  • final
  • final
    199 Which of these keywords cannot be used for a class which has been declared final?
  • abstract
  • extends
  • abstract and extends
  • none of the mentioned
  • abstract
    200 Which of these class relies upon its subclasses for complete implementation of its methods?
  • Object class
  • abstract class
  • ArrayList class
  • None of the mentioned
  • abstract class
    201 Which of these keywords are used to define an abstract class?
  • abst
  • abstract
  • Abstract
  • abstract class
  • abstract
    202 Which of these is not abstract?
  • Thread
  • AbstractList
  • List
  • None of the Mentioned
  • Thread
    203 If a class inheriting an abstract class does not define all of its function then it will be known as?
  • Abstract
  • A simple class
  • Static class
  • None of the mentioned
  • Abstract
    204 Which of these is not a correct statement?
  • Every class containing abstract method must be declared abstract
  • Abstract class defines only the structure of the class not its implementation
  • Abstract class can be initiated by new operator
  • Abstract class can be inherited
  • Abstract class can be initiated by new operator
    205 Which of these packages contains abstract keyword?
  • java.lang
  • java.util
  • java.io
  • java.system
  • java.lang
    206 Which of these class is superclass of String and StringBuffer class?
  • java.util
  • java.lang
  • ArrayList
  • None of the mentioned
  • java.lang
    207 Which of these operators can be used to concatenate two or more String objects?
  • +
  • +=
  • &
  • ||
  • +
    208 Which of this method of class String is used to obtain a length of String object?
  • get()
  • Sizeof()
  • lengthof()
  • length()
  • length()
    209 Which of these constructors is used to create an empty String object?
  • String()
  • String(void)
  • String(0)
  • None of the mentioned
  • String()
    210 Which of these is an incorrect statement?
  • String objects are immutable, they cannot be changed
  • String object can point to some other reference of String variable
  • StringBuffer class is used to store string in a buffer for later use
  • None of the mentioned
  • StringBuffer class is used to store string in a buffer for later use
    211 Which of this method of class String is used to extract a substring from a String object?
  • substring()
  • Substring()
  • SubString()
  • None of the mentioned
  • substring()
    212 Which of these method of class String is used to remove leading and trailing whitespaces?
  • startsWith()
  • trim()
  • Trim()
  • doTrim()
  • trim()
    213 What is the value returned by function compareTo() if the invoking string is greater than the string compared?
  • zero
  • value less than zero
  • value greater than zero
  • none of the mentioned
  • value greater than zero
    214 Which of the following statement is correct?
  • replace() method replaces all occurrences of one character in invoking string with another character
  • replace() method replaces only first occurrences of a character in invoking string with another character
  • replace() method replaces all the characters in invoking string with another character
  • replace() replace() method replaces last occurrence of a character in invoking string with another character
  • replace() method replaces all occurrences of one character in invoking string with another character
    215 Which of these method of class String is used to compare two String objects for their equality?
  • equals()
  • Equals()
  • isequal()
  • Isequal()
  • equals()
    216 Which of these methods is used to compare a specific region inside a string with another specific region in another string?
  • regionMatch()
  • match()
  • RegionMatches()
  • regionMatches()
  • regionMatches()
    217 Which of these methods of class String is used to check whether a given object starts with a particular string literal?
  • startsWith()
  • endsWith()
  • Starts()
  • ends()
  • startsWith()
    218 What is the value returned by function compareTo() if the invoking string is less than the string compared?
  • zero
  • value less than zero
  • value greater than zero
  • none of the mentioned
  • value less than zero
    219 Which of these data type value is returned by equals() method of String class?
  • char
  • int
  • boolean
  • all of the mentioned
  • boolean
    220 Which of these class is used to create an object whose character sequence is mutable?
  • String()
  • StringBuffer()
  • String() & StringBuffer()
  • None of the mentioned
  • StringBuffer()
    221 Which of this method of class StringBuffer is used to concatenate the string representation to the end of invoking string?
  • concat()
  • append()
  • join()
  • concatenate()
  • append()
    222 Which of these method of class StringBuffer is used to find the length of current character sequence?
  • length()
  • Length()
  • capacity()
  • Capacity()
  • length()
    223 Which of the following statement is correct?
  • reverse() method reverses all characters
  • reverseall() method reverses all characters
  • replace() method replaces first occurrence of a character in invoking string with another character
  • replace() method replaces last occurrence of a character in invoking string with another character
  • reverse() method reverses all characters
    224 Which of these methods of class StringBuffer is used to extract a substring from a String object?
  • substring()
  • Substring()
  • SubString()
  • None of the mentioned
  • substring()
    225 Which of this method of class StringBuffer is used to reverse sequence of characters?
  • reverse()
  • reverseall()
  • Reverse()
  • reverseAll()
  • reverse()
    226 Which of this method of class StringBuffer is used to get the length of the sequence of characters?
  • length()
  • capacity()
  • Length()
  • Capacity()
  • length()
    227 Which of these is a process of writing the state of an object to a byte stream?
  • Serialization
  • Externalization
  • File Filtering
  • All of the mentioned
  • Serialization
    228 Which of these process occur automatically by the java runtime system?
  • Serialization
  • Garbage collection
  • File Filtering
  • All of the mentioned
  • Serialization
    229 Which of these is an interface for control over serialization and deserialization?
  • Serializable
  • Externalization
  • FileFilter
  • ObjectInput
  • Externalization
    230 Which of these interface extends DataOutput interface?
  • Serializable
  • Externalization
  • ObjectOutput
  • ObjectInput
  • ObjectOutput
    231 Which of these is a method of ObjectOutput interface used to finalize the output state so that any buffers are cleared?
  • clear()
  • flush()
  • fflush()
  • close()
  • flush()
    232 Which of these is method of ObjectOutput interface used to write the object to input or output stream as required?
  • write()
  • Write()
  • StreamWrite()
  • writeObject()
  • writeObject()
    233 Which of these is a process of extracting/removing the state of an object from a stream?
  • Serialization
  • Externalization
  • File Filtering
  • Deserialization
  • Deserialization
    234 Which of these process occur automatically by java run time system?
  • Serialization
  • Memory allocation
  • Deserialization
  • All of the mentioned
  • All of the mentioned
    235 Which of these interface extends DataInput interface?
  • Serializable
  • Externalization
  • ObjectOutput
  • ObjectInput
  • ObjectInput
    236 Which of these class extend InputStream class?
  • ObjectStream
  • ObjectInputStream
  • ObjectOutput
  • ObjectInput
  • ObjectInputStream
    237 How an object can become serializable?
  • If a class implements java.io.Serializable class
  • If a class or any superclass implements java.io.Serializable interface
  • Any object is serializable
  • No object is serializable
  • If a class or any superclass implements java.io.Serializable interface
    238 What is serialization?
  • Turning object in memory into stream of bytes
  • Turning stream of bytes into an object in memory
  • Turning object in memory into stream of bits
  • Turning stream of bits into an object in memory
  • Turning object in memory into stream of bytes
    239 What is deserialization?
  • Turning object in memory into stream of bytes
  • Turning stream of bytes into an object in memory
  • Turning object in memory into stream of bits
  • Turning stream of bits into an object in memory
  • Turning stream of bytes into an object in memory
    240 How many methods Serializable has?
  • 1
  • 2
  • 3
  • 0
  • 0
    241 What type of members are not serialized?
  • Private
  • Protected
  • Static
  • Throwable
  • Static
    242 If member does not implement serialization, which exception would be thrown?
  • RuntimeException
  • SerializableException
  • NotSerializableException
  • UnSerializedException
  • NotSerializableException
    243 Which of the following methods is used to avoid serialization of new class whose super class already implements Serialization?
  • writeObject()
  • readWriteObject()
  • writeReadObject()
  • unSerializaedObject()
  • writeObject()
    244 Which of the following methods is not used while Serialization and DeSerialization?
  • readObject()
  • readExternal()
  • readWriteObject()
  • writeObject()
  • readWriteObject()
    245 Which of these package contains classes and interfaces for networking?
  • java.io
  • java.util
  • java.net
  • java.network
  • java.net
    246 Which of these is a protocol for breaking and sending packets to an address across a network?
  • TCP/IP
  • DNS
  • Socket
  • Proxy Server
  • TCP/IP
    247 How many ports of TCP/IP are reserved for specific protocols?
  • 10
  • 1024
  • 2048
  • 512
  • 1024
    248 How many bits are in a single IP address?
  • 8
  • 16
  • 32
  • 64
  • 32
    249 Which of these is a full form of DNS?
  • Data Network Service
  • Data Name Service
  • Domain Network Service
  • Domain Name Service
  • Domain Name Service
    250 Which of these class is used to encapsulate IP address and DNS?
  • DatagramPacket
  • URL
  • InetAddress
  • ContentHandler
  • InetAddress
    251 Which of these interface abstractes the output of messages from httpd?
  • LogMessage
  • LogResponse
  • Httpdserver
  • httpdResponse
  • LogMessage
    252 Which of these class is used to create servers that listen for either local or remote client programs?
  • httpServer
  • ServerSockets
  • MimeHeader
  • HttpResponse
  • ServerSockets
    253 Which of these is a standard for communicating multimedia content over email?
  • http
  • https
  • Mime
  • httpd
  • Mime
    254 Which of these methods is used to make raw MIME formatted string?
  • parse()
  • toString()
  • getString()
  • parseString()
  • parse()
    255 Which of these class is used for operating on request from the client to the server?
  • http
  • httpDecoder
  • httpConnection
  • httpd
  • httpd
    256 Which of these method of MimeHeader is used to return the string equivalent of the values stores on MimeHeader?
  • string()
  • toString()
  • convertString()
  • getString()
  • toString()
    257 Which of these is an instance variable of class httpd?
  • port
  • cache
  • log
  • All of the mentioned
  • All of the mentioned
    258 Which of these methods of httpd class is used to read data from the stream?
  • getDta()
  • GetResponse()
  • getStream()
  • getRawRequest()
  • getRawRequest()
    259 Which of these method of httpd class is used to get report on each hit to HTTP server?
  • log()
  • logEntry()
  • logHttpd()
  • logResponse()
  • logEntry()
    260 Which of these methods are used to find a URL from the cache of httpd?
  • findfromCache()
  • findFromCache()
  • serveFromCache()
  • getFromCache()
  • serveFromCache()
    261 Which of these variables stores the number of hits that are successfully served out of cache?
  • hits
  • hitstocache
  • hits_to_cache
  • hits.to.cache
  • hits.to.cache
    262 Which of these method of httpd class is used to write UrlCacheEntry object into local disk?
  • writeDiskCache()
  • writetoDisk()
  • writeCache()
  • writeDiskEntry()
  • writeDiskCache()
    263 Which of these method is used to start a server thread?
  • run()
  • start()
  • runThread()
  • startThread()
  • run()
    264 Which of these method is called when http daemon is acting like a normal web server?
  • Handle()
  • HandleGet()
  • handleGet()
  • Handleget()
  • handleGet()
    265 Which of these standard collection classes implements a dynamic array?
  • AbstractList
  • LinkedList
  • ArrayList
  • AbstractSet
  • ArrayList
    266 Which of these class can generate an array which can increase and decrease in size automatically?
  • ArrayList()
  • DynamicList()
  • LinkedList()
  • MallocList()
  • ArrayList()
    267 Which of these method of ArrayList class is used to obtain present size of an object?
  • size()
  • length()
  • index()
  • capacity()
  • size()
    268 Which of these methods can be used to obtain a static array from an ArrayList object?
  • Array()
  • convertArray()
  • toArray()
  • convertoArray()
  • toArray()
    269 Which of these method is used to reduce the capacity of an ArrayList object?
  • trim()
  • trimSize()
  • trimTosize()
  • trimToSize()
  • trimToSize()
    270 Map implements collection interface?
  • True
  • False
  • No idea
  • All of the above
  • False
    271 Which of the below does not implement Map interface?
  • HashMap
  • Hashtable
  • EnumMap
  • Vector
  • Vector
    272 What is the premise of equality for IdentityHashMap?
  • Reference equality
  • Name equality
  • Hashcode equality
  • Length equality
  • Reference equality
    273 What happens if we put a key object in a HashMap which exists?
  • The new object replaces the older object
  • The new object is discarded
  • The old object is removed from the map
  • It throws an exception as the key already exists in the map
  • The new object replaces the older object
    274 If two threads access the same hashmap at the same time, what would happen?
  • ConcurrentModificationException
  • NullPointerException
  • ClassNotFoundException
  • RuntimeException
  • ConcurrentModificationException
    275 If large number of items are stored in hash bucket, what happens to the internal structure?
  • The bucket will switch from LinkedList to BalancedTree
  • The bucket will increase its size by a factor of load size defined
  • The LinkedList will be replaced by another hashmap
  • Any further addition throws Overflow exception
  • The bucket will switch from LinkedList to BalancedTree
    276 How can we remove an object from ArrayList?
  • remove() method
  • using Iterator
  • remove() method and using Iterator
  • delete() method
  • remove() method and using Iterator
    277 How to sort elements of ArrayList?
  • Collection.sort(listObj);
  • Collections.sort(listObj);
  • listObj.sort();
  • Sorter.sortAsc(listObj);
  • Collections.sort(listObj);
    278 When two threads access the same ArrayList object what is the outcome of the program?
  • Both are able to access the object
  • ConcurrentModificationException is thrown
  • One thread is able to access the object and second thread gets Null Pointer exception
  • One thread is able to access the object and second thread will wait till control is passed to the second one
  • ConcurrentModificationException is thrown
    279 How is Arrays.asList() different than the standard way of initialising List?
  • Both are same
  • Arrays.asList() throws compilation error
  • Arrays.asList() returns a fixed length list and doesn’t allow to add or remove elements
  • We cannot access the list returned using Arrays.asList()
  • Arrays.asList() returns a fixed length list and doesn’t allow to add or remove elements
    280 What is the difference between length() and size() of ArrayList?
  • length() and size() return the same value
  • length() is not defined in ArrayList
  • size() is not defined in ArrayList
  • length() returns the capacity of ArrayList and size() returns the actual number of elements stored in the list
  • length() returns the capacity of ArrayList and size() returns the actual number of elements stored in the list
    281 Which class provides thread safe implementation of List?
  • ArrayList
  • CopyOnWriteArrayList
  • HashList
  • List
  • CopyOnWriteArrayList
    282 Which of the below is not an implementation of List interface?
  • RoleUnresolvedList
  • Stack
  • AttibuteList
  • SessionList
  • SessionList
    283 What does Collections.emptySet() return?
  • Immutable Set
  • Mutable Set
  • The type of Set depends on the parameter passed to the emptySet() method
  • Null object
  • Immutable Set
    284 What is the relation between hashset and hashmap?
  • HashSet internally implements HashMap
  • HashMap internally implements HashSet
  • HashMap is the interface; HashSet is the concrete class
  • HashSet is the interface; HashMap is the concrete class
  • HashSet internally implements HashMap
    285 What is the difference between TreeSet and SortedSet?
  • TreeSet is more efficient than SortedSet
  • SortedSet is more efficient than TreeSet
  • TreeSet is an interface; SortedSet is a concrete class
  • SortedSet is an interface; TreeSet is a concrete class
  • SortedSet is an interface; TreeSet is a concrete class
    286 What happens if two threads simultaneously modify TreeSet?
  • ConcurrentModificationException is thrown
  • Both threads can perform action successfully
  • FailFastException is thrown
  • IteratorModificationException is thrown
  • ConcurrentModificationException is thrown
    287 What is the unique feature of LinkedHashSet?
  • It is not a valid class
  • It maintains the insertion order and guarantees uniqueness
  • It provides a way to store key values with uniqueness
  • The elements in the collection are linked to each other
  • It maintains the insertion order and guarantees uniqueness
    288 Which of these standard collection classes implements a linked list data structure?
  • AbstractList
  • LinkedList
  • HashSet
  • AbstractSet
  • LinkedList
    289 Which of these classes implements Set interface?
  • ArrayList
  • HashSet
  • LinkedList
  • DynamicList
  • HashSet
    290 Which of these method is used to add an element to the start of a LinkedList object?
  • add()
  • first()
  • AddFirst()
  • addFirst()
  • addFirst()
    291 Which of these method of HashSet class is used to add elements to its object?
  • add()
  • Add()
  • addFirst()
  • insert()
  • add()
    292 Which of these methods can be used to delete the last element in a LinkedList object?
  • remove()
  • delete()
  • removeLast()
  • deleteLast()
  • removeLast()
    293 Which of this method is used to change an element in a LinkedList Object?
  • change()
  • set()
  • redo()
  • add()
  • set()
    294 Which of these object stores association between keys and values?
  • Hash table
  • Map
  • Array
  • String
  • Map
    295 Which of these classes provide implementation of map interface?
  • ArrayList
  • HashMap
  • LinkedList
  • DynamicList
  • HashMap
    296 Which of these method is used to remove all keys/values pair from the invoking map?
  • delete()
  • remove()
  • clear()
  • removeAll()
  • remove()
    297 Which of these method Map class is used to obtain an element in the map having specified key?
  • search()
  • get()
  • set()
  • look()
  • get()
    298 Which of these methods can be used to obtain set of all keys in a map?
  • getAll()
  • getKeys()
  • keyall()
  • keySet()
  • keySet()
    299 Which of these method is used add an element and corresponding key to a map?
  • put()
  • set()
  • redo()
  • add()
  • put()
    300 Which of these class object can be used to form a dynamic array?
  • ArrayList
  • Map
  • Vector
  • ArrayList & Vector
  • ArrayList & Vector
    301 Which of these are legacy classes?
  • Stack
  • Hashtable
  • Vector
  • All of the mentioned
  • All of the mentioned
    302 Which of these is the interface of legacy?
  • Map
  • Enumeration
  • HashMap
  • Hashtable
  • Enumeration
    303 What is the name of a data member of class Vector which is used to store a number of elements in the vector?
  • length
  • elements
  • elementCount
  • capacity
  • elementCount
    304 Which of these methods is used to add elements in vector at specific location?
  • add()
  • set()
  • AddElement()
  • addElement()
  • addElement()
    305 Which of these class object has an architecture similar to that of array?
  • Bitset
  • Map
  • Hashtable
  • All of the mentioned
  • Bitset
    306 Which of these method is used to make a bit zero specified by the index?
  • put()
  • set()
  • remove()
  • clear()
  • clear()
    307 Which of these method is used to calculate number of bits required to hold the BitSet object?
  • size()
  • length()
  • indexes()
  • numberofBits()
  • length()
    308 Which of these packages contain all the collection classes?
  • java.lang
  • java.util
  • java.net
  • java.awt
  • java.util
    309 Which of these classes is not part of Java’s collection framework?
  • Maps
  • Array
  • Stack
  • Queue
  • Maps
    310 Which of this interface is not a part of Java’s collection framework?
  • List
  • Set
  • SortedMap
  • SortedList
  • SortedList
    311 Which of these methods deletes all the elements from invoking collection?
  • clear()
  • reset()
  • delete()
  • refresh()
  • clear()
    312 What is Collection in Java?
  • A group of objects
  • A group of classes
  • A group of interfaces
  • None of the mentioned
  • A group of objects
    313 Which of these return type of hasNext() method of an iterator?
  • Integer
  • Double
  • Boolean
  • Collections Object
  • Boolean
    314 Which of these methods is used to obtain an iterator to the start of collection?
  • start()
  • begin()
  • iteratorSet()
  • iterator()
  • iterator()
    315 Which of these methods can be used to move to next element in a collection?
  • next()
  • move()
  • shuffle()
  • hasNext()
  • next()
    316 Which of these iterators can be used only with List?
  • Setiterator
  • ListIterator
  • Literator
  • None of the mentioned
  • ListIterator
    317 Which of these is a method of ListIterator used to obtain index of previous element?
  • previous()
  • previousIndex()
  • back()
  • goBack()
  • previousIndex()
    318 Which of these exceptions is thrown by remover() method?
  • IOException
  • SystemException
  • ObjectNotFoundExeception
  • IllegalStateException
  • IllegalStateException
    319 When does Exceptions in Java arises in code sequence?
  • Run Time
  • Compilation Time
  • Can Occur Any Time
  • None of the mentioned
  • Run Time
    320 Which of these keywords is not a part of exception handling?
  • try
  • finally
  • thrown
  • catch
  • thrown
    321 Which of these keywords must be used to monitor for exceptions?
  • try
  • finally
  • throw
  • catch
  • try
    322 Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
  • try
  • finally
  • throw
  • catch
  • catch
    323 Which of these keywords is used to manually throw an exception?
  • try
  • finally
  • throw
  • catch
  • throw
    324 Which of the following keywords is used for throwing exception manually?
  • finally
  • try
  • throw
  • catch
  • throw
    325 Which of the following classes can catch all exceptions which cannot be caught?
  • RuntimeException
  • Error
  • Exception
  • ParentException
  • Error
    326 Which of the following is a super class of all exception type classes?
  • Catchable
  • RuntimeExceptions
  • String
  • Throwable
  • Throwable
    327 Which of the following operators is used to generate instance of an exception which can be thrown using throw?
  • thrown
  • alloc
  • malloc
  • new
  • new
    328 Which of the following keyword is used by calling function to handle exception thrown by called function?
  • throws
  • throw
  • try
  • catch
  • throws
    329 Which of the following handles the exception when a catch is not used?
  • finally
  • throw handler
  • default handler
  • java run time system
  • default handler
    330 Which part of code gets executed whether exception is caught or not?
  • finally
  • try
  • catch
  • throw
  • finally
    331 Which of the following should be true of the object thrown by a thrown statement?
  • Should be assignable to String type
  • Should be assignable to Exception type
  • Should be assignable to Throwable type
  • Should be assignable to Error type
  • Should be assignable to Throwable type
    332 Which of these is a super class of all exceptional type classes?
  • String
  • RuntimeExceptions
  • Throwable
  • Cacheable
  • Throwable
    333 Which of these class is related to all the exceptions that can be caught by using catch?
  • Error
  • Exception
  • Runtime Exception
  • All of the mentioned
  • Exception
    334 Which of these class is related to all the exceptions that cannot be caught?
  • Error
  • Exception
  • RuntimeExecption
  • All of the mentioned
  • Error
    335 Which of these handles the exception when no catch is used?
  • Default handler
  • finally
  • throw handler
  • Java run time system
  • Default handler
    336 What exception thrown by parseInt() method?
  • ArithmeticException
  • ClassNotFoundException
  • NullPointerException
  • NumberFormatException
  • NumberFormatException
    337 Which of these keywords is used to generate an exception explicitly?
  • try
  • finally
  • throw
  • catch
  • throw
    338 Which of these class is related to all the exceptions that are explicitly thrown?
  • Error
  • Exception
  • Throwable
  • Throw
  • Throwable
    339 Which of these operator is used to generate an instance of an exception than can be thrown by using throw?
  • new
  • malloc
  • alloc
  • thrown
  • new
    340 Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function?
  • try
  • throw
  • throws
  • catch
  • throws
    341 Which of these clause will be executed even if no exceptions are found?
  • throws
  • finally
  • throw
  • catch
  • finally
    342 A single try block must be followed by which of these?
  • finally
  • catch
  • finally & catch
  • none of the mentioned
  • finally & catch
    343 Which of these exceptions handles the divide by zero error?
  • Arithmetic Exception
  • Math Exception
  • Illegal Access Exception
  • illegal Exception
  • Arithmetic Exception
    344 Which of these exceptions will occur if we try to access the index of an array beyond its length?
  • ArithmeticException
  • ArrayException
  • ArrayIndexException
  • ArrayIndexOutOfBoundsException
  • ArrayIndexOutOfBoundsException
    345 Which of these classes is used to define exceptions?
  • Exception
  • Throwable
  • Abstract
  • System
  • Exception
    346 Which of these methods return description of an exception?
  • getException()
  • getMessage()
  • obtainDescription()
  • obtainException()
  • getMessage()
    347 What is the use of try & catch?
  • It allows us to manually handle the exception
  • It allows to fix errors
  • It prevents automatic terminating of the program in cases when an exception occurs
  • All of the mentioned
  • All of the mentioned
    348 Which of these keywords are used for generating an exception manually?
  • try
  • catch
  • throw
  • check
  • throw
    349 Which of these statements is incorrect?
  • try block need not to be followed by catch block
  • try block can be followed by finally block instead of catch block
  • try can be followed by both catch and finally block
  • try need not to be followed by anything
  • try need not to be followed by anything

    Are you preparing for a Java developer interview? Brush up on your skills with our comprehensive collection of Java interview questions. Covering everything from basic syntax to advanced concepts, our questions will help you demonstrate your knowledge and experience with the Java programming language.This page is designed to test a candidate's understanding of the key concepts in the Java programming language and their ability to apply that knowledge to real-world situations. Get ready to impress your interviewer and land your dream job with our Java interview question page

    This page provides a comprehensive collection of Java questions and answers, covering a wide range of topics related to the language, such as:

    • Basic syntax and data types
    • Object-oriented programming concepts
    • Control structures, such as loops and conditions
    • Exception handling
    • Collections and generics
    • Multithreading and concurrency
    • Advanced topics such as functional programming and design patterns

    Additionally, you will also find useful tips on how to prepare for your Java interview, such as reviewing your coding skills, studying up on the latest technologies and trends, and practicing your interviewing skills.

    Whether you are a junior developer or an experienced professional, this guide will help you ace your Java interview and land your dream job. So, whether you are looking for your first job as a developer or looking to make a change in your career, this guide will be a valuable resource for you.