a. 123
b. 321
c. 3
d. No output
e. 32
A. if (x.equals(y[0])) {
b. if (x != y[0].toString()) {
c. if (x & y[0]) {
d. if (!x.equals(y[0])) {
a. charAt(16)
B. charAt(15)
C. charAt(12)
D. charAt(13)
a. 25 38 52 67
b. 25 39 54 70
c. 26 40 55 71
d. 27 41 56 72
a. throw new Error();
B. throw new Throwable();
C. throw new ExceptionOneOne();
D. throw new Exception();
E. throw new ExceptionOneTwo();
A. The program compiles and prints "Not Equal".
B. The program compiles and prints "Equal".
C. The compiler objects to line 3.
D. The compiler objects to using == with primitives in line 4.
A. Get Entertained
B. EntertainedGet
C. Entertained Get
D. GetEntertained
E. Ge Enerained
A. Compilation Error 'a.z is not visible'
B. Prints:1 0 0 1 0
C. Prints: 0 0 0 0 0
D. Prints: 1 1 0 1 1
E. Runtime Error
A. public class Employee implements Info extends Data { public void load(){ /*do something*/ } public void Info.load(){ /*do something*/ } }
b. public class Employee extends Info implements Data { public void load() { /*do something*/ } }
c. public class Employee implements Info extends Data { public void Data.load(){ /*do something*/ } public void load(){ /*do something*/ } }
d. public class Employee implements Info extends Data { public void load() { /*do something*/ } }
e. public class Employee extends Info implements Data public void load(){ /*do something*/ } public void Info.load(){ /*do something*/ } }
A. Classes and their Objects.
B. Declaration methods and classes.
C. Classes and interfaces.
D. Only declaration elements in class.
E. Classes and comments.
Answer: a. The object for the inner class Circle2 should be created in main() method
B. The variable at line 2 should be declared as final
C. The variable at line 4 should be declared as final
D. The inner class Circle 2 should be an abstract class
E. The method at line 6 should be defined as final method
Answer: a. 10 10
B. Compilation Error. Duplicate identifer ID found
C. 20 20
D. 10 20
E. 20
A. One thread cannot tell another thread to sleep
B. If a threads priority is explicitly set, it is set to 1
C. The join() method joins the current thread to wait list of current object
D. No locks are released when a thread goes to sleep
E. yield() changes the priority of a thread
Answer: a. It can be achieved by avoiding explicit calls to the base class constructor
b. It can be achieved by placing the call to the superclass with a super keyword, which is placed in a try block with a catch block to handle the IOException thrown by the super class
c. It can be achieved by catching the Exception objects thrown by the super class constructors, using its parent class Exception
d. It cannot be done with the above definition of the base class
A. Subclasses of Exceptions can be caught using try-catch
B. Error type objects can be handled only by JVM
C. Error is the subclass of Exception
D. Subclasses of Error are unchecked
E. Subclasses of Throwable can be caught using try-catch
A. Race condition
B. Lock starvation condition
C. Deadlock condition
D. Lock release condition
A. if equals() is true then == is also true
B. Equals compares hash value and == compares character sequence
C. No difference;they are essentially the same
D. ==compares object's memory address but equals character sequence
E. == works on numbers equals() works on characters
True
False
Answer: a. FilterInputStream and FilterOutputStream
B. FileReader, BufferedReader, FileWriter and BufferedWriter
C. ObjectInputStream, ObjectOutputStream
D. InputStream, OuptutStream
A. parent, base
B. derived, base
C. base, derived
D. super, base
A. Annotations cannot have user-defined types as members.
B. Annotations improve the program performance.
C. Annotations can be declared without members
D. Annotations reduces the memory usage.
E. Annotation members can have default values.
Answer: a. Size: 33
B. Size: 36
C. Size: 63
D. Size: 66
E. Compilation error
A. DBMetaData
B. MetaData
C. DatabaseMetaData
D. ResultSetMetaData
E. SchemaMetaData
Answer: a. The class compiles, and each Widget will get a unique wNumber reflecting the order in which the Widgets were created.
b. The class compiles and each Widget will get a wNumber, but we cannot guarantee that the number will be unique.
c. The compiler objects to the addWidget call of a static method in line 10.
d. A runtime error occurs in the addWidget method.
A. Static methods are extremely polymorphic
B. Use of final keyword is a way to achieve polymorphism
C. The reference variable type determines which methods to be called
D. Polymorphic method invocations apply only to overridden instance methods
E. Only member methods can be polymorphic not attributes
a. Compiler complains about private memebers is not accessible from main() method
b. Throws a Runtime error 'Illegal forward reference'
C. 6000
D. Compiler complains about forward referencing of member variables first and second
A. private void main(String a[]) { } // Compiles successfully and on running displays the message 'Main method not public'
B. public static void main(String a[]) { } // Compiles and runs successfully
C. static void main(String a[]) { } // Compiles and runs successfully
D. public static void Main(String args[]) { } // Compiles and runs successfully
E. public void main(String a[]) { } // Compiles successfully and on running displays the message 'Main method not static'
Two
No objects is elligible
Three
Four
Answer: a. Prints 198
B. Runtime Error
C. Prints 99
D. Compilation Error 'tr.i is not a valid field'.
A. DriverManager
B. CallableStatement
C. Connection
D. Statement
E. SQLWarning
A. Queue
B. Map
C. List
D. Set
A. the Set of key-value pairs contained in the Map
B. The Collection of values contained in the Map
C. It is an inner interface inside Map interface
d. the Set of keys contained in the Map
A. t1 uses CharArrayReader, t2 uses CharArrayWriter and FileReader
B. t1 uses Reader, t2 uses Writer and Reader
C. t1 uses ArrayReader, t2 uses ArrayWriter and FileReader
D. t1 uses CharArrayWriter, t2 uses CharArrayReader and FileWriter
A. Polymorphism
B. Association
C. Persistence
D. Inheritance
E. Aggregation
A. A non-static inner class should be instantiated, using the instance of the outer class
B. A static inner class can be instantiated without instantiating the outer class
C. On instantiating an outer class will instantiate its inner class also
D. A class defined inside a method can be instantiated anywhere from the class
E. An inner class defined as a member of a class cannot be instantiated within the same class
A. Code 1: implements Comparable Code 2: public int compareTo(Object o) { Student s = (Student) o; return this.studentName.compareTo(s.studentName); }
b. Code 1: implements Comparator Code 2: public int compareTo(Object o) { Student s = (Student) o; return this.studentName.compareTo(s.studentName); }
c. Code 1: implements Comparator Code 2: public int compare(Object o1, Object o2) { Student s1 = (Student) o1; Student s2 = (Student) o2; return s1.studentName.compareTo(s2.studentName); }
A. Traversing collection class implementations
B. Traversing SQL ResultSets
C. Incrementing or decrementing counter variable of a for loop
d. Traverse through all the variables declared inside a method
E. Traversing array objects
A. a new class implementation of Set which can navigate the ResultSet object
B. a SortedMap extended with navigation methods for Lists.
c. a SortedMap extended with navigation methods reporting closest matches for given search targets.
D. a SortedMap extended with navigation methods for Sets.
A. tools to convert the project to native executables
B. integrated Debugging tools
c. effective memory management through Garbage Collection
E. automatic Code Generation
D. automatic compilation and Build
A. to keep objects alive only while they are in use (reachable) by clients
B. to allow clean up after finalization but before the space is reclaimed
C. to delete objects from a container if the clients are no longer referencing them and memory is tight
D. to keep objects alive provided there is enough memory
A. Line 1 : throw new FileNotFoundException(); Line 2 : throw new IOException(); Line 3 : throw new Exception();
b. Line 1 : throw new Exception(); Line 2 : throw new IOException(); Line 3 : throw new FileNotFoundException();
c. The code is wrong. Exceptions should be caught in reversed hierarchy order.
A. An IllegalThreadStateException is thrown at run-time
b. The program compiles and runs without error
C. None of the listed options
A. Prints: 3, 4, 8
B. Prints: 7, 2, 6
C. None of the listed options
A. Compiles and executes successfully Prints "Run method executed"
B. Compilation Error
c. Compiles and on execution Prints "Run method executed" then throws Runtime exception
D. Compiles and on execution Prints "Run method executed"
Quiz Review Timeline +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Wait!
Here's an interesting quiz for you.