![]() |
|
| #251 | Consider following classes:
| |
| (1) | false false true false true | |
| (2) | false true true false true | |
| (3) | true true true true true | |
| (4) | true true true false true | |
| (5) | None of the above | |
| Answer : ------------------------- | ||
| #252 | Any class may be unloaded when none of it's instances and class objects that represent this class are reachable. True Or False? | |
| (1) | True | |
| (2) | False | |
| Answer : ------------------------- | ||
| #253 | The following program will print java.lang.ArithmeticException: / by zero.
True Or False? | |
| (1) | True | |
| (2) | False | |
| Answer : ------------------------- | ||
| #254 | What will be the result of attempting to compile and run the following program?
Select 1 correct option | |
| (1) | The progarm will fail to compile | |
| (2) | Class cast exception at runtime | |
| (3) | It will print 30, 20 | |
| (4) | It will print 30, 30 | |
| (5) | It will print 20, 20 | |
| Answer : ------------------------- | ||
| #255 | The following code snippet will print true.
| |
| (1) | True | |
| (2) | False | |
| Answer : ------------------------- | ||
| #256 | Which of the following statements are true? | |
| (1) | An anonymous class cannot be inherited | |
| (2) | An anonymous class may extend another class | |
| (3) | An anonymous class may not create and start a Thread | |
| (4) | An anoymous class may not declare a constructor | |
| Answer : ------------------------- | ||
| #257 | Given:
What will be the output of the following program? Select 1 correct option. | |
| (1) | It will throw NullPointerException when run | |
| (2) | It will not compile | |
| (3) | It will print 2 and then will throw NullPointerException | |
| (4) | It will print 2 and null | |
| (5) | None of the above | |
| Answer : ------------------------- | ||
| #258 | Which of the following statements about NaNs are true ? | |
| (1) | Float.NaN == Float.NaN | |
| (2) | Float.NaN == Double.NaN | |
| (3) | Float.NaN >= 0 | |
| (4) | Float.NaN < 0 | |
| (5) | None of the above | |
| Answer : ------------------------- | ||
| #259 | What is the result of executing the following fragment of code:
Select 1 correct option | |
| (1) | Compile time error | |
| (2) | It will print true | |
| (3) | It will print false | |
| (4) | Runtime error | |
| (5) | It will print nothing | |
| Answer : ------------------------- | ||
| #260 | Given two collection objects referenced by c1 and c2, which of these statements are true? Select 2 correct options | |
| (1) | c1.retainAll(c2) will not modify c1 | |
| (2) | c1.removeAll(c2) will not modify c1 | |
| (3) | c1.addAll(c2) will return a new collection object, containing elements from both c1 and c2 | |
| (4) | For: c2.retainAll(c1); c1.containsAll(c2); 2nd statement will return true | |
| (5) | For: c2.addAll(c1); c1.retainAll(c2); 2nd statement will have no practical effect on c1 | |
| Answer : ------------------------- | ||
| #261 | What happens when the following code gets executed:
| |
| (1) | It results in the throwing of an ArithmeticExcepiton | |
| (2) | It results in the throwing of a DivedeByZeroException | |
| (3) | It displays the value 1.5 | |
| (4) | It displays the value –1 | |
| Answer : ------------------------- | ||
| #262 |
| |
| (1) | True | |
| (2) | False | |
| Answer : ------------------------- | ||
| #263 | Consider the following method:
Options Select 1 correct option | |
| (1) | The second thread should call getLocks(obj2, obj1) | |
| (2) | The second thread should call getLocks(obj1, obj2) | |
| (3) | The second thread should call getLocks() only after first thread exits out of it | |
| (4) | The second thread may call getLocks() any time and passing parameters in any order | |
| (5) | None of the above | |
| Answer : ------------------------- | ||
| #264 | Which of these statements concerning nested classes and interfaces are true? Select 3 correct options | |
| (1) | An instance of a top-level nested class has an inherent outer instance | |
| (2) | A top-level nested class can contain non-static member variables | |
| (3) | A top-level nested interface can contain static member variables | |
| (4) | A top-level nested interface has an inherent outer instance associated with it | |
| (5) | For each instance of the outer class, there can exist many instances of a non-static inner class | |
| Answer : ------------------------- | ||
| #265 | Given the following definition of class, which member variables are accessible from OUTSIDE the package com.technopark?
Select 2 correct options | |
| (1) | Member variable i | |
| (2) | Member variable j | |
| (3) | Member variable k | |
| (4) | Member variable k, but only for subclasses | |
| (5) | Member variable l | |
| Answer : ------------------------- | ||
| #266 | Which of the following are wrapper classes for primitive types? Select 1 correct option | |
| (1) | java.lang.String | |
| (2) | java.lang.Void | |
| (3) | java.lang.Null | |
| (4) | java.lang.Object | |
| (5) | None of the above | |
| Answer : ------------------------- | ||
| #267 | Which of the following statements are true? Select 2 correct options. | |
| (1) | Private methods cannot be overriden in subclasses | |
| (2) | A subclass can override any method in a non-final superclass | |
| (3) | An overriding method can declare that it throws a wider spectrum of exceptions than the method it is overriding | |
| (4) | The parameter list of an overriding method must be a subset of the parameter list of the method that it is overriding | |
| (5) | The over riding method may opt not to declare any throws clause even if the original method has a throws clause | |
| Answer : ------------------------- | ||
| #268 | Will the following code compile ? If yes , what is the output ? | |
| (1) | 0 | |
| (2) | 10 | |
| (3) | null | |
| (4) | Compile error "sample.java:10: No variable i defined in class sample" | |
| Answer : ------------------------- | ||