Core Java Questions: Quiz! Exam

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Varun26
V
Varun26
Community Contributor
Quizzes Created: 1 | Total Attempts: 3,811
Questions: 30 | Attempts: 3,811

SettingsSettingsSettings
Core Java Questions: Quiz! Exam - Quiz

.


Questions and Answers
  • 1. 

    Consider the following listed items: A. Employee() { } B. public Employee() { } C. private Employee() { } Consider the following statements: I.   no-argument constructor, that does not allow instantiation from within the package II.  no-argument constructor, that does not allow instantiation from outside the package III. no-argument constructor Which of the following option gives the exact matches of above listed items and statements?   Consider the following listed items: A. Employee() { } B. public Employee() { } C. private Employee() { } Consider the following statements: I.   no-argument constructor, that does not allow instantiation from within the package II.  no-argument constructor, that does not allow instantiation from outside the package III. no-argument constructor Which of the following option gives the exact matches of above listed items and statements?{  

    • A.

      A-I, B-II, C-III

    • B.

      A-III, B-I, C-II

    • C.

      A-II, B-III, C-I

    • D.

      A-II, B-I, C-III

    Correct Answer
    C. A-II, B-III, C-I
    Explanation
    Option A-II, B-III, C-I gives the exact matches of the listed items and statements. This means that option A represents a no-argument constructor that does not allow instantiation from within the package, option B represents a no-argument constructor that does not allow instantiation from outside the package, and option C represents a no-argument constructor.

    Rate this question:

  • 2. 

    Which of the following statement is true regarding constructors?

    • A.

      Abstract classes cannot have constructors

    • B.

      Default Constructors are Optional for all classes

    • C.

      can be overloaded across inherited classes

    • D.

      Default Constructors are optional only for the classes that does not have constructors

    Correct Answer
    D. Default Constructors are optional only for the classes that does not have constructors
    Explanation
    The correct answer is that default constructors are optional only for the classes that do not have constructors. This means that if a class does not have any constructors defined, the compiler will automatically provide a default constructor. However, if a class already has one or more constructors defined, the default constructor must be explicitly defined if it is needed.

    Rate this question:

  • 3. 

    Which of the following keyword is used to define user-defined annotation type?

    • A.

      Interface

    • B.

      Annotate

    • C.

      Annotation

    • D.

      Meta

    • E.

      Metadata

    Correct Answer
    A. Interface
    Explanation
    The correct answer is "Interface" because user-defined annotation types in Java are defined using the keyword "interface". Annotations are a way to add metadata or additional information to code, and by defining annotation types using the "interface" keyword, users can create their own custom annotations with specific properties and behaviors.

    Rate this question:

  • 4. 

    Which of the following options give the annotation types that are predefined by the language specification itself? 1) Deprecated 2) Override 3)SuppressWarnings 4) Documented 5) Target

    • A.

      2,3,4

    • B.

      1,2,3

    • C.

      3,4,5

    • D.

      1,2,5

    • E.

      1,3,4

    Correct Answer
    B. 1,2,3
    Explanation
    The correct answer is 1, 2, and 3. These annotation types (Deprecated, Override, and SuppressWarnings) are predefined by the language specification itself. Annotation types are used to provide metadata about the program elements like classes, methods, and variables. The Deprecated annotation indicates that a program element is no longer recommended for use. The Override annotation is used to indicate that a method is intended to override a method in a superclass. The SuppressWarnings annotation is used to suppress specific compiler warnings.

    Rate this question:

  • 5. 

    Which of the following option gives the super type of all Annotation types?

    • A.

      Java.lang.Annotation

    • B.

      Java.lang.annotation.Annotation

    • C.

      Java.annotation.Annotation

    • D.

      There is no super type for an Annotation type. An Annotation type is just an interface definition

    Correct Answer
    B. Java.lang.annotation.Annotation
    Explanation
    The correct answer is "java.lang.annotation.Annotation". This is because the package "java.lang.annotation" contains the Annotation interface, which serves as the super type for all other Annotation types. The other options mentioned are either incorrect or do not exist.

    Rate this question:

  • 6. 

    Which of the following is true about Annotations?

    • A.

      An annotation is a special kind of modifier

    • B.

      An annotation can be declared at public, private, protected and package access levels

    • C.

      Annotation methods allow wrapper types as its return types, as an alternative to its equivalent primitive types

    • D.

      Annotations can replace interfaces in Java

    Correct Answer
    A. An annotation is a special kind of modifier
    Explanation
    Annotations are a special kind of modifier in Java. Unlike other modifiers such as public, private, protected, or package, annotations provide additional information about the code but do not directly modify its behavior. They can be used to add metadata, specify constraints, or enable certain functionalities. Annotations are declared using the @ symbol followed by the annotation name. They can be applied to various program elements such as classes, methods, variables, or parameters. Annotations are widely used in Java for documentation purposes, code analysis, and frameworks like Spring and Hibernate.

    Rate this question:

  • 7. 

    Consider the following Statements: A: WeakHashMap is synchronized. B: All Set implementation Rejects Duplicates but is ordered. Which of the following option is true regarding the above statements?

    • A.

      Statement B is True and Statement A is false

    • B.

      Both the Statements A and B are false

    • C.

      Statement A is True and Statement B is false

    • D.

      Both the Statements A and B are true

    Correct Answer
    B. Both the Statements A and B are false
  • 8. 

    Consider the following list of items in Column A and column B Column A 1) Vector 2) HashSet 3) TreeSet 4) ArrayList Column B A) It is not ordered or sorted B) It compares and stores the data in a sorting order C) Permits all elements including NULL. D) It tries to optimize storage management by maintaining a capacity and a capacity Increment. Which of the following option gives the valid match between the Items in Column A and Statements in Column B?  

    • A.

      2-A, 3-B, 4-C, 1-D

    • B.

      1-A, 2-B, 3-C, 4-D

    • C.

      1-A, 3-B, 4-C, 2-D

    • D.

      2-A, 4-B, 3-C, 1-D

    Correct Answer
    A. 2-A, 3-B, 4-C, 1-D
    Explanation
    The correct match between the items in Column A and the statements in Column B is as follows: HashSet (2) is not ordered or sorted (A), TreeSet (3) compares and stores the data in a sorting order (B), ArrayList (4) permits all elements including NULL (C), and Vector (1) tries to optimize storage management by maintaining a capacity and a capacity Increment (D).

    Rate this question:

  • 9. 

    Which of the following statements give the advantages of using a Generic Collection? 1) Thread Safety 2) Type Safety 3) JVM Safety 4) Automatic Type Casting 5) Quicker Garbage Collection

    • A.

      2,3

    • B.

      1,2

    • C.

      4,5

    • D.

      2,4

    • E.

      1,5

    Correct Answer
    D. 2,4
    Explanation
    Using a Generic Collection provides type safety, which means that the collection can only store objects of a specific type, preventing type errors at compile-time. It also allows for automatic type casting, which means that there is no need for explicit casting when retrieving objects from the collection. However, the advantages of thread safety, JVM safety, and quicker garbage collection are not directly related to using a Generic Collection.

    Rate this question:

  • 10. 

    Consider the following scenario: A java application needs to load all the rows as objects from a database table and keep it in the memory, with the following features: * An object should be fetched based on the primary key * When a new object is added to the memory, it should get inserted to the database table * When an existing object is removed, the corresponding row should be removed from the database * When any changes are made to the object the changes have to be updated to the database. Which of the following collection implementation would be suitable for the above scenario?  

    • A.

      Linked list

    • B.

      Hash set

    • C.

      Array list

    • D.

      Hash map

    Correct Answer
    D. Hash map
    Explanation
    A hash map would be suitable for the given scenario because it allows for efficient retrieval of objects based on a key, which in this case would be the primary key. It also allows for easy insertion and removal of objects, as well as updating changes to the database. A hash map provides constant time complexity for basic operations such as get, put, remove, and update, making it a suitable choice for this scenario.

    Rate this question:

  • 11. 

    Two Client Systems A and B are connected to a Server. Client A keeps sending some messages asynchronously to Client B through the Server. The server keeps track of all the messages coming from Client A and dispatches it in the same sequences how it is received from Client A. The messages sent by Client A is delivered to Client B after a short time delay. Which of the following collection implementation the server should use to handle the messages sent by Client A?

    • A.

      Hash map

    • B.

      Hash set

    • C.

      Queue

    • D.

      Stack

    • E.

      Array list

    Correct Answer
    C. Queue
    Explanation
    The server should use a Queue to handle the messages sent by Client A. A Queue is a data structure that follows the First-In-First-Out (FIFO) principle, meaning that the first message received from Client A will be the first one to be delivered to Client B. This ensures that the messages are dispatched in the same sequence they are received from Client A, which is a requirement mentioned in the question.

    Rate this question:

  • 12. 

    Consider the following scenario: An ArrayList is populated with the names of all the employees in a company. Now the names start with the string "AR" should only be removed from the list. Which of the following option gives the correct interface that helps to accomplish the above task?{

    • A.

      Remover

    • B.

      Enumerator

    • C.

      Enumeration

    • D.

      Iterator

    • E.

      Comaprator

    Correct Answer
    D. Iterator
    Explanation
    The correct interface that helps accomplish the task of removing names starting with "AR" from the ArrayList is the iterator interface. The iterator interface provides methods like hasNext() to check if there are more elements in the list, and next() to retrieve the next element. By using the iterator, we can iterate over the ArrayList and remove any names that start with "AR" using the remove() method. This allows us to modify the ArrayList while iterating over it, ensuring that all the names starting with "AR" are removed.

    Rate this question:

  • 13. 

    Consider the following scenario: The Employee objects are populated in an ArrayList in order to show it to the user. The User Interface is designd in such a way to display one record at a time. Appropriate buttons are provided to browse through the previous and next record. Which of the following option gives the correct interface that helps to accomplish the above task?{  

    • A.

      Consider the following scenario: The Employee objects are populated in an ArrayList in order to show it to the user. The User Interface is designed in such a way to display one record at a time. Appropriate buttons are provided to browse through the previous and next records. Which of the following option gives the correct interface that helps to accomplish the above task?{ Consider the following scenario: The Employee objects are populated in an ArrayList in order to show it to the user. The User Interface is designed in such a way to display one record at a time. Appropriate buttons are provided to browse through the previous and next records. Which of the following option gives the correct interface that helps to accomplish the above task?{ List Iterator

    • B.

      Enumerator

    • C.

      Iterator

    • D.

      Enumeration

    • E.

      Browser

    Correct Answer
    A. Consider the following scenario: The Employee objects are populated in an ArrayList in order to show it to the user. The User Interface is designed in such a way to display one record at a time. Appropriate buttons are provided to browse through the previous and next records. Which of the following option gives the correct interface that helps to accomplish the above task?{ Consider the following scenario: The Employee objects are populated in an ArrayList in order to show it to the user. The User Interface is designed in such a way to display one record at a time. Appropriate buttons are provided to browse through the previous and next records. Which of the following option gives the correct interface that helps to accomplish the above task?{ List Iterator
    Explanation
    The correct option to accomplish the given task is "List Iterator". A List Iterator is used to iterate over the elements in a list in both forward and backward directions. It allows us to access the previous and next elements in the list, which is essential for browsing through the previous and next records in the ArrayList. Therefore, using a List Iterator will provide the correct interface to accomplish the given task.

    Rate this question:

  • 14. 

    Consider the following scenario: An Online Ticket Booking application designed using Java needs to store the booked date and time. Which of the following option gives the valid class that can accomplish the above task?  

    • A.

      Java.util.Calendar

    • B.

      Java.util.date

    • C.

      Java.util.dat & java.util.time

    • D.

      Java.util.timestamp

    Correct Answer
    B. Java.util.date
    Explanation
    The valid class that can store the booked date and time in the given scenario is java.util.date. This class represents a specific instant in time, with millisecond precision. It can be used to store the date and time when a ticket is booked in the Online Ticket Booking application.

    Rate this question:

  • 15. 

    An HR application is being developed in Java. A particular module needs to calculate the number of days between the project start date and end date for an employee, in order to arrive at the billable days. The given inputs are day, month, and year values for the project start date and end date. Which of the following option gives the valid class that can accomplish the above task?  

    • A.

      Java.util.Calendar

    • B.

      Java.util.Time

    • C.

      Java.util.Date

    • D.

      Java.util.Timestamp

    Correct Answer
    A. Java.util.Calendar
    Explanation
    The valid class that can accomplish the task of calculating the number of days between two dates is java.util.Calendar. This class provides various methods for manipulating dates and time, including calculating the difference between two dates. It allows us to easily retrieve the day, month, and year values from the given inputs and perform the necessary calculations to determine the number of days between the project start date and end date.

    Rate this question:

  • 16. 

    Consider the following code: interface Declare {  Declaration 1:  protected int a = 5;           Declaration 2:  public static final int e = 9; Declaration 3:  volatile int c = 7;            Declaration 4:  transient int d = 8;           } Which of the following option gives the declarations that results in compilation error

    • A.

      Declaration 2,4

    • B.

      Declaration 1,3,4

    • C.

      ~Declaration 1,2,3

    • D.

      ~Declaration 2,3,4

    Correct Answer
    B. Declaration 1,3,4
    Explanation
    Declaration 1,3,4 results in compilation error because:
    - Declaration 1 is declared as protected, which is not allowed in an interface. It should be declared as public.
    - Declaration 3 is declared as volatile, which is not allowed in an interface. Only static and final variables are allowed in an interface.
    - Declaration 4 is declared as transient, which is not allowed in an interface. Only static and final variables are allowed in an interface.

    Rate this question:

  • 17. 

    What will be the result of compiling and running the following Java program? class ThreadTest extends Thread {     private static int threadCounter = 0;     public void run() {         threadCounter++;         System.out.println(threadCounter);     }     public static void main(String[] args) {         for (int i = 0; i < 5; i++) {             new ThreadTest().start();         }     } }  

    • A.

      The program will output numbers 1 to 5 in ascending order. 

    • B.

      The program will output numbers 1 to 5 in any order. 

    • C.

      The program may throw a runtime exception due to concurrent access. 

    • D.

      The output can include repeated numbers among 1 to 5.

    Correct Answer
    D. The output can include repeated numbers among 1 to 5.
    Explanation
    The program defines a class ThreadTest that extends Thread. Each thread increments a static integer threadCounter and prints its value. Since threadCounter is static, it is shared among all instances of ThreadTest. The increment operation (threadCounter++) is not atomic and consists of three separate steps: read the value, increment it, and write it back. Without synchronization, multiple threads can interleave in these steps, leading to race conditions. This means several threads might read the same value of threadCounter before any of them writes back the incremented value. As a result, the same number can be printed multiple times, and some numbers may not appear at all. The output is nondeterministic and depends on how the threads are scheduled.

    Rate this question:

  • 18. 

    Which of the following statement is true?

    • A.

      Has-a relationships always rely on inheritance

    • B.

      Has-a relationships always rely on instance variables

    • C.

      Has-a relationships always require at least two class types

    • D.

      Has-a relationships always rely on polymorphism

    Correct Answer
    B. Has-a relationships always rely on instance variables
    Explanation
    Has-a relationships in object-oriented programming refer to the concept of one class having a reference to another class as an instance variable. This allows the class to use the functionality and properties of the other class. Therefore, the statement "Has-a relationships always rely on instance variables" is true. Instance variables are used to establish the relationship between classes and enable one class to have access to the objects and methods of another class.

    Rate this question:

  • 19. 

    Consider the following code: Line No 1:public class CallMe { Line No 2:   int i=10; Line No 3: public void view(){ Line No 4:  System.out.println(j); Line No 5: } Line No 6: class WishMe{ Line No 7:  int j=20; Line No 8:  public void view(){ Line No 9:   System.out.println(i); Line No 10:  }}} Which of the following option gives the valid output for the above code?{

    • A.

      Compilation error at line 9

    • B.

      10,20

    • C.

      20,10

    • D.

      Compilation error at 4th line

    Correct Answer
    D. Compilation error at 4th line
    Explanation
    The code will give a compilation error at line 4 because the variable "j" is not accessible inside the method "view" of the "CallMe" class. The variable "j" is declared inside the inner class "WishMe" and cannot be accessed directly from the outer class.

    Rate this question:

  • 20. 

    Consider the following code: Line No 1:public class Calculate { Line No 2:int i; Line No 3:void add() Line No 4:{System.out.println("Addition Method returns nothing");} Line No 5:int add() Line No 6:{System.out.println("Addition Method returns integer"); Line No 7: return i;} Line No 8:} Line No 9:public class TestCalculate { Line No 10: public static void main(String args[]) Line No 11: {Calculate c=new Calculate(); Line No 12:  c.add();   }} Which of the following option gives the valid output for the above code?{

    • A.

      Addition returns integer

    • B.

      Runtime error at line 12

    • C.

      Addition method returns nothin

    • D.

      Compilation error at line 5

    Correct Answer
    D. Compilation error at line 5
    Explanation
    The code will produce a compilation error at line 5 because the method "add()" is already defined with a void return type on line 3. Having two methods with the same name and different return types is not allowed in Java.

    Rate this question:

  • 21. 

    Consider the following code: Line No:1. class Super { Line No:2. public float getNum() { return 3.0f; } Line No:3. } Line No:4. public class Sub extends Super { Line No:5//insert missing code here Line No:6. } Which of the following option gives the method, when replaced at line 6, causes unsuccessful compilation? {

    • A.

      Public void getNum(double d) { }

    • B.

      Public void getNum() { }

    • C.

      Public float getNum() { return 4.0f; }

    • D.

      Public double getNum(float d) { return 4.0d; }

    Correct Answer
    B. Public void getNum() { }
    Explanation
    The correct answer is "public void getNum() { }". This method has the same name and return type as the method in the superclass, which violates the rule of method overriding. When a subclass overrides a method from the superclass, the method signature (name, return type, and parameters) must be the same. Therefore, this method would cause unsuccessful compilation.

    Rate this question:

  • 22. 

    Which of the following statement is true regarding throws declaration in Exception handling?

    • A.

      All sub class types of exceptions that come under java.lang.RuntimeException, if not handled inside a method should be declared using throws keyword

    • B.

      All sub class types of errors that come under java.lang.Error, if not handled inside a method should be declared using throws keyword

    • C.

      All sub class types of java.lang.Throwable, if not handled inside a method should be declared using throws keyword

    • D.

      All sub class types of exceptions that come under java.lang.Exception, if not handled inside a method should be declared using throws keyword

    • E.

      None of the listed options

    Correct Answer
    E. None of the listed options
  • 23. 

    Which of the following statement is true regarding the throws declarations for overridden methods?

    • A.

      The overriding method cannot declare additional exceptions which is not declared in its super class version.

    • B.

      ~When a method in the super class is declared to throw a Checked Exception, the overriding method in the sub class should also declare the same.

    • C.

      The overriding methods cannot declare to throw the Super Class types of those exceptions declared in the super class methods

    • D.

      The overriding method cannot re-declare the Unchecked exceptions, that are declared by super class method.

    Correct Answer
    A. The overriding method cannot declare additional exceptions which is not declared in its super class version.
    Explanation
    The statement is true because when a method is overridden in a subclass, it must adhere to the same or narrower exception requirements as the superclass method. This means that the overriding method cannot declare any additional exceptions that are not already declared in the superclass method. If the superclass method declares a checked exception, the overriding method in the subclass must also declare the same checked exception. Similarly, the overriding method cannot declare the super class types of the exceptions declared in the superclass method. It also cannot re-declare any unchecked exceptions that are already declared by the superclass method.

    Rate this question:

  • 24. 

    Which of the following statements are true regarding try-catch-finally blocks? 1) Catch block is optional when a RuntimeException is thrown from the try block 2) Catch block is optional, if finally block is available, provided a Checked Exception is thrown from the try block 3) Finally block is optional, irrespective of catch block 4) Both catch block and finally block are optional, either Checked exception or unchecked exception is thrown from the try block 5) Both catch block and finally block are required, irrespective of the type of exceptions thrown from the try block{  

    • A.

      3,4

    • B.

      1,2

    • C.

      2,3

    • D.

      1,3

    Correct Answer
    D. 1,3
    Explanation
    Statement 1 is true because RuntimeExceptions are unchecked exceptions and do not require a catch block.

    Statement 3 is true because the finally block is optional and can be omitted if not needed.

    Therefore, the correct answer is 1,3.

    Rate this question:

  • 25. 

    Which of the following are true regarding implementing user defined exception mechanisms? 1) It is not valid to derive a class from java.lang.Throwable 2) It is not valid to derive a class from java.lang.Error 3) It is valid to derive a class from java.lang.Exception 4) It is valid to derive a class from java.lang.RuntimeException 5) It is not valid to derive a class from java.io.IOException

    • A.

      3,4

    • B.

      3,5

    • C.

      4,5

    • D.

      1,2

    Correct Answer
    A. 3,4
    Explanation
    It is valid to derive a class from java.lang.Exception because the Exception class is the superclass of all exceptions in Java. It is also valid to derive a class from java.lang.RuntimeException because RuntimeException is a subclass of Exception and is used to represent exceptions that can be thrown during the normal operation of the Java Virtual Machine.

    Rate this question:

  • 26. 

    Which of the following are true regarding RuntimeException? 1) RuntimeException does not require a throws declaration 2) If RuntimeException is declared using throws clause, then the calling method should handle it using try-catch block 3) Any class that derives the RuntimeException will always be an unchecked exception 4) RuntimeException can be handled using a catch that handles Error 5) RuntimeException can be handled using a catch that handles Exception

    • A.

      3,4,5

    • B.

      1,2,3

    • C.

      2,3,4

    • D.

      1,3,5

    Correct Answer
    D. 1,3,5
    Explanation
    1) RuntimeException does not require a throws declaration: This is true because RuntimeException is an unchecked exception, which means that it does not need to be declared in the method signature or handled using a try-catch block.

    2) If RuntimeException is declared using throws clause, then the calling method should handle it using try-catch block: This statement is false. As mentioned in the explanation for statement 1, RuntimeException does not require a throws declaration, so there is no need to handle it using a try-catch block.

    3) Any class that derives the RuntimeException will always be an unchecked exception: This is true. RuntimeException is a subclass of Exception, and any class that extends RuntimeException will also be an unchecked exception.

    4) RuntimeException can be handled using a catch that handles Error: This statement is false. Error is a subclass of Throwable, and RuntimeException is a subclass of Exception. While both Error and Exception are throwable, they are not interchangeable in catch blocks.

    5) RuntimeException can be handled using a catch that handles Exception: This statement is true. Since RuntimeException is a subclass of Exception, it can be caught using a catch block that handles Exception.

    Rate this question:

  • 27. 

    Consider the following code: class LastException extends Exception { } class PreviousException extends LastException { } class TopException extends PreviousException { } public class ExceptionalWorld {    public static void main(String args[]) {       try {          exceptionThrower();       }       catch(LastException le) {System.out.println("Last Exception");}       catch(PreviousException pe) {System.out.println("Previous Exception");}    }      static void exceptionThrower() throws TopException {       throw new TopException();    } } Which of the following option gives the output for the above code?

    • A.

      Run time Error

    • B.

      Prints "Previous Exception

    • C.

      ~Prints "Last Exception

    • D.

      Compile Time Error

    Correct Answer
    D. Compile Time Error
    Explanation
    The code will give a compile time error because the catch blocks are in the wrong order. In Java, when catching exceptions, the catch blocks should be ordered from the most specific exception to the least specific exception. In this case, the catch block for LastException should come before the catch block for PreviousException. Since the catch blocks are in the wrong order, the code will not compile.

    Rate this question:

  • 28. 

    Which of the following options give the valid argument types for main() method? 1) String[] args 2) String args[] 3) String ...args 4) String args 5) String[] args[]  

    • A.

      1,2,3

    • B.

      2,3,4

    • C.

      1,2,4

    • D.

      1,2,5

    • E.

      1,2 only

    Correct Answer
    A. 1,2,3
    Explanation
    The valid argument types for the main() method are 1) String[] args, 2) String args[], and 3) String ...args. These options represent the different ways in which the main method can accept command-line arguments. Option 1 uses the array syntax with the argument name "args". Option 2 also uses the array syntax, but with the argument name "args" placed after the data type. Option 3 uses varargs syntax, allowing the main method to accept a variable number of arguments as an array of strings.

    Rate this question:

  • 29. 

    Which of the following options give the member methods of Object class, that cannot be overridden? 1) equals() 2) hashCode() 3) wait() 4) notify() 5) clone()

    • A.

      3,4

    • B.

      1,2

    • C.

      2,3

    • D.

      3,5

    • E.

      1,5

    Correct Answer
    A. 3,4
    Explanation
    The member methods of the Object class that cannot be overridden are wait() and notify(). These methods are used for synchronization and inter-thread communication in Java and are part of the fundamental functionality provided by the Object class. The equals(), hashCode(), and clone() methods, on the other hand, can be overridden by subclasses to provide their own implementation.

    Rate this question:

  • 30. 

    Which of the following options give the valid package names? 1) dollorpack.$pack.. 3) _score.pack.__pack 4) [email protected]@ckage.innerp@ckage 5) .package.subpackage.innerpackage{

    • A.

      1,4,5

    • B.

      2,3

    • C.

      1,5

    • D.

      1,2,3

    • E.

      2,3,4

    Correct Answer
    D. 1,2,3

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • May 15, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Mar 23, 2012
    Quiz Created by
    Varun26
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.