FIFA-2022 Career Guide Free Tutorials Go to Your University Placement Preparation 
1 like 0 dislike
in Technical Questions by Goeduhub's Expert (5.8k points)

MCQ's based on Java Concepts along with answers

2 Answers

0 like 0 dislike
by Goeduhub's Expert (5.8k points)
edited by
Best answer

Java MCQ's Questions Set 1

Q.1. Which of the following option leads to the portability and security of Java?

  1. Bytecode is executed by JVM
  2. The applet makes the Java code secure and portable
  3. Use of exception handling
  4. Dynamic binding between objects

Answer:- (1)

The Java programs executed by the JVM that makes the code portable and secure. Because JVM prevents the code from generating its side effects. The Java code is portable, as the same byte code can run on any platform.

Q.2. _____ is used to find and fix bugs in the Java programs.

  1. JVM
  2. JRE
  3. JDK
  4. JDB

Answer:- (4)

The Java Debugger (JDB or jdb) is a command-line java debugger that debugs the java class. It is a part of the Java Platform Debugger Architecture (JPDA) that helps in the inspections and debugging of a local or remote Java Virtual Machine (JVM).

Q.3. Which of the following is a valid declaration of a char?

  1. char ch = '\utea';
  2. char ca = 'tea';
  3. char cr = \u0223;
  4. char cc = '\itea';

Answer:- (1)

Q.4. What is the return type of the hashCode() method in the Object class?

  1. Object
  2. int
  3. long
  4. void

Answer:- (2)

Q.5. Which of the following tool is used to generate API documentation in HTML format from doc comments in source code?

  1. javap tool
  2. javaw command
  3. Javadoc tool
  4. javah command

Answer:- (3)

Q.6. Which method of the Class.class is used to determine the name of a class represented by the class object as a String?

  1. getClass()
  2. intern()
  3. getName()
  4. toString()

Answer:- (3)

Q.7.  What do you mean by nameless objects?

  1. An object created by using the new keyword.
  2. An object of a superclass created in the subclass.
  3. An object without having any name but having a reference.
  4. An object that has no reference.

Answer:- (4)

The nameless objects are basically referred to as anonymous objects. The anonymous objects do not have any names. When an object is initialized but is not assigned to any reference variable, it is called an anonymous object.

Q.8.  An interface with no fields or methods is known as a ______.

  1. Runnable Interface
  2. Marker Interface
  3. Abstract Interface
  4. CharSequence Interface

Answer:- (2)

Q.9. Which option is false about the final keyword?

  1. A final method cannot be overridden in its subclasses.
  2. A final class cannot be extended.
  3. A final class cannot extend other classes.
  4. A final method can be inherited.

Answer:- (3)

Q.10. In java, jar stands for_____.

  1. Java Archive Runner
  2. Java Application Resource
  3. Java Application Runner
  4. None of the above

Answer:- (4)

jar stands for Java ARchive

Q.11. Which of the given methods are of Object class?

  1. notify(), wait( long msecs ), and synchronized()
  2. wait( long msecs ), interrupt(), and notifyAll()
  3. notify(), notifyAll(), and wait()
  4. sleep( long msecs ), wait(), and notify()

Answer:- (3)

Q.12.  Which of the following is a mutable class in java?

  1. java.lang.String
  2. java.lang.Byte
  3. java.lang.Short
  4. java.lang.StringBuilder

Answer:- (4)

Q.13. If a thread goes to sleep

  1. It releases all the locks it has.
  2. It does not release any locks.
  3. It releases half of its locks.
  4. It releases all of its lock except one.

Answer:- (2)

The sleep() method does not release any locks of an object for a specific time or until an interrupt occurs. It leads to the poor performance or deadlock of threads.

Q.14. Which of the following modifiers can be used for a variable so that it can be accessed by any thread or a part of a program?

  1. global
  2. transient
  3. volatile
  4. default

Answer:- (3)

Q.15. Which of the following is true about inheritance in Java?

  1. Private methods are final.
  2. Protected members are accessible within a package and inherited classes outside the package.
  3. Protected methods are final.
  4. We cannot override private methods. 

Answer:- (1), (2) and (4)

Q.16. What is the use of \w in regex?

  1. Used for a whitespace character
  2. Used for a non-whitespace character
  3. Used for a word character
  4. Used for a non-word character

Answer:- (3)

Q.17. What is the use of the intern() method?

  1. It returns the existing string from memory
  2. It creates a new string in the database
  3. It modifies the existing string in the database
  4. None of the above

Answer:- (1)

Q.18. In which memory a String is stored, when we create a string using new operator?

  1. Stack
  2. String memory
  3. Heap memory
  4. Random storage space

Answer:- (3)

Q.19. What do you mean by chained exceptions in Java?

  1. Exceptions occurred by the VirtualMachineError
  2. An exception caused by other exceptions
  3. Exceptions occur in chains with discarding the debugging information
  4. None of the above

Answer:- (2)

Q.20. Which of the following is true about the anonymous inner class?

  1. It has only methods
  2. Objects can't be created
  3. It has a fixed class name
  4. It has no class name

Answer:- (4)

Java MCQ's Questions Set 2

For Java Interview Questions Click here

 Technical-MCQs For Placement Preparation

Best Gadgets for Engineers 

0 like 0 dislike
by Goeduhub's Expert (9.3k points)
edited by

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

Related questions

1 like 0 dislike
1 answer 104k views
1 like 0 dislike
2 answers 35.7k views
1 like 0 dislike
2 answers 177k views
0 like 0 dislike
2 answers 30.8k views
0 like 0 dislike
2 answers 45.5k views

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs


About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © Social::   |  | 


Free Online Directory