Answer these 100+ Core Java MCQs and assess your grip on the subject of Core Java.
Scroll below and get started!
A. public
B. private
C. virtual
D. final
A. runtime error
B. hihow
C. howhi
D. compilation error: At Static
A. A consistent programming interface across multiple hardware platforms
B. Superior speed and performance compared to native code
C. A purely functional programming language with a minimalist design philosophy
D. Direct compilation to native code on most platforms
A. ClassName varName = new ClassName(new ClassName);
B. ClassName varName = new ClassName(arguments);
C. varName ClassName = new varName(arguments);
D. ClassName varName => new ClassName();
A. True
B. False
A. 25
B. Null
C. IllegalAccessException will be thrown
D. CompileError
E. 5
A. making an abstract class concrete
B. reducing heap size
C. creating a design contract that encapsulates implementation
D. implementing an abstract factory pattern
A. Resumes from waiting if notifyAll() is invoked for the object
B. Resumes from waiting if notify() is invoked for the object
C. Causes the current thread to wait
D. Resumes from waiting if a specified amount of time has elapsed
A. int myList [] [] = {4,9,7,0};
B. int [] myList = {"1", "2", "3"};
C. int [] myList = (5, 8, 2);
D. int myList [] = {4, 3, 7};
A. subclass
B. dynamic
C. abstract
D. overloaded
A. ensure a block of code is executed when the JVM shuts down.
B. ensure a block of code is executed only when try/catch completes without an exception
C. ensure a block of code is executed only when try/catch completes with an exception
D. ensure a block of code is always executed after a try/catch
A. Inside the same class
B. Inside the same class, or any of its superclasses
C. Inside the same class, or a subclass
D. Inside the same class or its parent class
A. camELCase
B. CAMELcase
C. CamelCase
D. camelcase
A. Convert java bytecode files into native executables
B. Compress collections of java class files into .jar archives
C. Compile java source files into bytecode class files
D. Generate C headers and stubs for native methods
A. Buddy Blocks
B. Garbage Collection
C. Virtual Memory
D. Manual Memory Management
A. finish
B. finalize
C. finally
D. final
A. Using the .equals() or .compareTo() method of one object on the other
B. Using the == operator on the .value() of each object
C. Using the &= operator on the objects
D. Using the == operator on the objects
A. "if"
B. "import"
C. "enum"
D. "finally"
A. class Child extends Parent
B. class Child : Parent
C. class Child extends Public Parent
D. class Child :: Parent
A. import. java.util.Scanner;
B. import.java.util.scanner;
C. import.java.util.scanner.
D. import java.util.Scanner;
A. Class should be abstract
B. Class should public
C. Class should be final
D. Class should be static
A. javaApi
B. documentcreate
C. javadoc
D. apicreate
A. Encapsulation reduces coupling of modules and increase cohesion inside a module
B. Encapsulation in Java makes unit testing easy
C. All of these
D. Encapsulated code is easy to change with new requirements
A. The StringBuffer object.
B. The + operator.
A. public void className()
B. public static className()
C. static className()
D. public className()
A. Suspends execution in synchronized methods only
B. Causes the hosted virtual machine to suspend all forms of execution
C. Causes all threads to suspend execution
D. Causes the current thread to suspend execution
A. Declare the class default constructor as private.
B. Declare the class as final.
C. Declare the class as abstract.
D. It’s not possible.
A. Yes
B. No
A. it will be “runnable” when start() method is called
B. it is in “runnable” state
C. it is blocked until another thread calls notify()
D. it starts running immediately
A. hashCode()
B. toString()
C. wait()
D. clone()
A. An interface implements another interface and class
B. A class implements and extends a class
C. An interrface extends a class but implements another interface
D. A class implements an interface but extends a class
A. No
B. Yes
A. this
B. Super
C. extends
D. native
A. JVM conversion of int to float values
B. Automatic insertion of brackets by an IDE
C. It doesn’t occur in Java, only in dynamically typed JVM languages like Groovy
D. JVM conversion between primitive types and reference types
A. Delegate configuration to XML file
B. Modify and inspect properties and methods of objects, even if they are protected or private
A. No
B. Yes
A. Finally
B. Compilation fails.
C. The code runs with no output.
D. An exception is thrown at runtime.
A. mentioning the Class /Jar file names during compilation only
B. by directly copying and including in the same folder as of the project
C. No the network files can not be used directly
D. Including the path and class /jar file name in the Classpath
E. mentioning the file names in the Path
A. Runtime error
B. 5
C. null
D. Compile error
A. 0 1
B. 0 0
C. 1 0
D. 1 1
A. Implement the Queue, List, and Array interfaces
B. Implement the Map interface, possibly by extending the AbstractMap class
C. Implement both the Iterator and Array interfaces
D. Extend the AbstractCollection class, thereby implementing the AbstractCollection interface
A. Allows null to be used a key or value
B. It maintains a list through all entries to retrieve data in the order it was inserted.
C. All operations are thread-safe and retrieval operations do not entail locking
D. Supports locking the entire table in a way that prevents all access
A. Compress collections of java class files into .jar archives
B. Load and execute java .class files
C. Disassemble .class files back into readable source code
D. Compile java source files into bytecode class files
A. True
B. False
A. no
B. yes
A. Not being mutable after initialization
B. A constant variable whose value cannot be changed
C. No longer able to be subclassed or overloaded
D. Belonging to a class, rather than a specific instance
A. private, public
B. private, protected, default, public
C. private, protected, public
D. protected, default, public
E. private, default, public
A. Java 6
B. Java 5
C. Java 7
D. Java 8
A. The equal() method
B. The hashCode() method
C. The constructor method
D. Both the equals() and hashCode() methods
E. (You don't need override any methods)
A. An instance of a class that implements a given interface
B. (All of these)
C. An instance of a class
D. An instance of a subclass of a class