 
         On Java  |  More Q&A Click Here
 On Java  |  More Q&A Click Here
| # | Question | Options | Answer | 
|---|---|---|---|
| 1 | Which of those doesn’t have an index based structure? | Set | |
| 2 | java.util.Collections is a: | Class | |
| 3 | Methods such as reverse, shuffle are offered in: | Collections | |
| 4 | Which of those allows duplicate elements? | List | |
| 5 | Which allows the storage of a null key and null values? | HashMap | |
| 6 | Which interface should be implemented for sorting on basis of many criteria’s? | Comparator | |
| 7 | What guarantees type-safety in a collection? | Generics | |
| 8 | The most used interfaces from the collection framework are? | Map | |
| 9 | The root interface of Java collection framework hierarchy is – | List/Set | |
| 10 | Which of those is synchronized? | Vector | |
| 11 | ArrayList implements that of the following? | All of these | |
| 12 | Which of those permits the storage of the many null values? | All of these | |
| 13 | Which doesn’t permit to store a null value? | TreeSet | |
| 14 | TreeMap implements? | Navigable Map | |
| 15 | Which of these standard collection classes implements a dynamic array? | ArrayList | |
| 16 | Which of these method of ArrayList class is used to obtain present size of an object? | size() | |
| 17 | Which of the below does not implement Map interface? | Vector | |
| 18 | How to externally synchronize hashmap? | Collections.synchronizedMap(new HashMap()); | |
| 19 | How can we remove an object from ArrayList? | remove() method and using Iterator | |
| 20 | Which class provides thread safe implementation of List? | CopyOnWriteArrayList | |
| 21 | What is the relation between hashset and hashmap? | HashSet internally implements HashMap | |
| 22 | Which of these object stores association between keys and values? | Map | |
| 23 | Which of these classes provide implementation of map interface? | HashMap | |
| 24 | Which of these methods can be used to obtain set of all keys in a map? | keySet() | |
| 25 | Which of these are legacy classes? | All of the mentioned | |
| 26 | Which of the following is not OOPS concept in Java? | Compilation | |
| 27 | When does method overloading is determined? | At compile time | |
| 28 | When Overloading does not occur? | 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? | Abstraction | |
| 30 | Which concept of Java is achieved by combining methods and attribute into a class? | Encapsulation | |
| 31 | What is it called where child object gets killed if parent object is killed? | Composition | |
| 32 | Which component is used to compile, debug and execute java program? | JDK | |
| 33 | Which component is responsible for converting bytecode into machine specific code? | JVM | |
| 34 | Which component is responsible to run java program? | JRE | |
| 35 | Which component is responsible to optimize bytecode to machine code? | JIT | |
| 36 | Which of the below is invalid identifier with the main method? | private | |
| 37 | What is use of interpreter? | 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(); | |
| 39 | Which of these operators is used to allocate memory for an object? | new | |
| 40 | Which of the following statements is correct? | 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 overloading | |
| 42 | Which of the following is a method having same name as that of it’s class? | constructor | |
| 43 | Which method can be defined only once in a program? | main method | |
| 44 | Which keyword is used by the method to refer to the object that invoked it? | this | |
| 45 | Which function is used to perform some action when the object is to be destroyed? | finalize() | |
| 46 | What is false about 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 | |
| 48 | What is the process by which we can control what parts of a program can access the members of a class? | Encapsulation | |
| 49 | Which of these is used as default for a member of a class if no access specifier is used for it? | private | |
| 50 | What is use of interpreter? | They read high level code and execute them | |
| 51 | What is the extension of compiled java classes? | .class | |
| 52 | Which of the below is invalid identifier with main method? | private | |
| 53 | Which of these package is used for text formatting in Java programming language? | java.text | |
| 54 | Which environment variable is used to set java path? | JAVA_HOME | |
| 55 | Which of these can not be used for a variable name in Java? | keyword | |
| 56 | Literals in java must be appended by which of these? | L and I | |
| 57 | What is true of final class? | Final class cannot be inherited | |
| 58 | All the variables of interface should be ? | public,static and final | |
| 59 | How can a protected modifier be accessed? | 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? | private | |
| 61 | All the variables of class should be ideally declared as ? | private | |
| 62 | Which one of the following is not an access modifier? | Void | |
| 63 | Which of the following is not a valid flow control statement? | exit() | |
| 64 | What is true about do statement? | 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? | do-while | |
| 66 | Which of these method of class StringBuffer is used to find the length of current character sequence? | length() | |
| 67 | Which of these method of class String is used to remove leading and trailing whitespaces? | trim() | |
| 68 | Which of this method of class String is used to extract a substring from a String object? | substring() | |
| 69 | Which of these method of class String is used to compare two String objects for their equality? | equals() | |
| 70 | Which of these is an incorrect statement? | 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? | length() | |
| 72 | Which of these methods can be used to search an element in a list? | binaryserach() | |
| 73 | Which of these cannot be declared static? | object | |
| 74 | Which of these keywords is used to prevent content of a variable from being modified? | final | |
| 75 | Arrays in Java are implemented as? | object | |
| 76 | Where is array stored in memory? | heap space | |
| 77 | Can you make an array volatile? | True | |
| 78 | Which of these is an incorrect Statement? | It is necessary to use new operator to initialize an array. | |
| 79 | Which of these classes is super class of Exception class? | Throwable | |
| 80 | Which of these methods return description of an exception? | getMessage() | |
| 81 | Which of these statements is incorrect? | try need not to be followed by anything | |
| 82 | Which of these keywords are used for generating an exception manually? | throw | |
| 83 | Which of these keywords are used for the block to handle the exceptions generated by try block? | catch | |
| 84 | Which of these keywords are used for the block to be examined for exceptions? | try | |
| 85 | What is the use of try and catch? | All of Above | |
| 86 | Which of these exceptions will occur if we try to access the index of an array beyond its length? | ArrayIndexOutOfBoundsException | |
| 87 | A single try block must be followed by which of these? | finally & catch | |
| 88 | Which of these clause will be executed even if no exceptions are found? | finally | |
| 89 | Which of these class is related to all the exceptions that are explicitly thrown? | Throwable | |
| 90 | Which of these keywords is used to generate an exception explicitly? | throw | |
| 91 | What exception thrown by parseInt() method? | NumberFormatException | |
| 92 | Which of these handles the exception when no catch is used? | Default handler | |
| 93 | Which of these class is related to all the exceptions that cannot be caught? | Error | |
| 94 | Which part of code gets executed whether exception is caught or not? | finally | |
| 95 | Which of the following keywords is used for throwing exception manually? | throw | |
| 96 | What would be the result if a class extends two interfaces and both have a method with same name and signature? | Compile time error | |
| 97 | Which of the following is used for implementing inheritance through class? | extends | |
| 98 | Which of the following is used for implementing inheritance through an interface? | implements | |
| 99 | Static members are not inherited to subclass. | False | |
| 100 | If super class and subclass have same variable name, which keyword should be used to use super class? | super |