0% found this document useful (0 votes)
153 views14 pages

Java MCQ

The document contains a series of multiple-choice questions (MCQs) related to Java programming, focusing on its features, tools, and concepts. Each question is followed by the correct answer, providing insights into Java's portability, security, and various classes and methods. It serves as a study guide for individuals preparing for Java-related examinations or interviews.

Uploaded by

yashswami284
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
153 views14 pages

Java MCQ

The document contains a series of multiple-choice questions (MCQs) related to Java programming, focusing on its features, tools, and concepts. Each question is followed by the correct answer, providing insights into Java's portability, security, and various classes and methods. It serves as a study guide for individuals preparing for Java-related examinations or interviews.

Uploaded by

yashswami284
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JAVA MCQ BY SAMPAT SIR [RAJASTHAN COMPUTER TEACHER

VACANCY]
Q. Which of the following option leads to the portability
and security of Java?
निम्ननिनित में से कौि सा निकल्प जािा की पोर्टेनिनिर्टी और सुरक्षा की
ओर िे जाता है?
[Link] is executed by JVM
[Link] applet makes the Java code secure and portable
C. Use of exception handling
[Link] binding between objects

Answer: (a) Bytecode is executed by the JVM.

Q. Which of the following is not a Java features?


निम्ननिनित में से कौि जािा फीचर िहीं है?
[Link]
[Link] Neutral
C. Use of pointers
[Link]-oriented

Answer: (c) Use of pointers


 The Java language does not support pointers
Q. _____ is used to find and fix bugs in the Java programs.
जािा प्रोग्राम में िग को िोजिे और ठीक करिे के निए _____ का उपयोग
ककया जाता है।
[Link]
[Link]
C. JDK
[Link]

Answer: (d) JDB


 Java Debugger (JDB)
 Java Platform Debugger Architecture (JPDA)
 Java Virtual Machine (JVM)
 JDK (Java Development Kit)

Q. What is the return type of the hashCode() method in the


Object class?
ऑब्जेक्र्ट क्िास में हैशकोड () Method का ररर्टिन type क्या है?
[Link]
[Link]
C. long
[Link]

Answer: (b) int


Q. Which of the following tool is used to generate API
documentation in HTML format from doc comments in
source code?
सोसन कोड में doc कमेंट्स से एचर्टीएमएि फॉमेर्ट में API डॉक्यूमेंर्टेशि
जेिरे र्ट करिे के निए निम्ननिनित में से ककस र्टूि का इस्तेमाि ककया जाता
है?
[Link] tool
[Link] command
C. Javadoc tool
[Link] command

Answer: (c) Javadoc tool

Q. Which of the following creates a List of 3 visible items


and multiple selections abled?
निम्ननिनित में से कौि 3 visible items और multiple selections
list की सूची ििाता है?
[Link] List(false, 3)
[Link] List(3, true)
C. new List(true, 3)
[Link] List(3, false)

Answer: (b) new List(3, true)


Q. Which method of the [Link] is used to determine
the name of a class represented by the class object as a
String?
क्िास ऑब्जेक्र्ट द्वारा स्टस्रिंग के रूप में दशानए गए क्िास के िाम को
निर्ानररत करिे के निए क्िास.क्िास की ककस निनर् का उपयोग ककया
जाता है?
[Link]()
[Link]()
C. getName()
[Link]()
Answer: (c) getName()
 It is a non-static method, and available in the
[Link] package.

Q. In which process, a local variable has the same name


as one of the instance variables?
ककस प्रकिया में, एक local variable का िही िाम होता है जो एक
instance variables का होता है?
[Link]
[Link] Shadowing
C. Abstraction
[Link]-threading
Answer: (b) Variable Shadowing
Q. Which package contains the Random class?
ककस पैकेज में रैं डम क्िास है?
[Link] package
[Link] package
C. [Link] package
[Link] package

Answer: (a) [Link] package

Q. What do you mean by nameless objects?


nameless objects से आप क्या समझते हैं?
[Link] object created by using the new keyword.
[Link] object of a superclass created in the subclass.
C. An object without having any name but having a
reference.
[Link] object that has no reference.

Answer: (d) An object that has no reference.


एक ऐसा ऑब्जेक्र्ट नजसका कोई रे फरें स िा हो
Q. An interface with no fields or methods is known as a
______.
नििा ककसी फील्ड या निनर्यों िािे इिं र्टरफे स को ______ के रूप में जािा जाता
है।
[Link] Interface
[Link] Interface
C. Abstract Interface
[Link] Interface

Answer: (b) Marker Interface

Q. Which of the following is an immediate subclass of the


Panel class?
[Link] class
[Link] class
C. Frame class
[Link] class

Answer: (a) Applet class


Q. Which of these classes are the direct subclasses of the
Throwable class?
[Link] and Error class
[Link] and VirtualMachineError class
C. Error and Exception class
[Link] and VirtualMachineError class
Answer: (c) Error and Exception class

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


जािा में chained exceptions से आप क्या समझते हैं ?
[Link] occurred by the VirtualMachineError
[Link] exception caused by other exceptions
C. Exceptions occur in chains with discarding the
debugging information
[Link] of the above
Answer: (b) An exception caused by other exceptions.
Q. In which memory a String is stored, when we create a
string using new operator?
जि हम िए ऑपरे र्टर का उपयोग करके एक स्टस्रिंग ििाते हैं, तो एक स्टस्रिंग ककस
मेमोरी में सिंग्रहीत होती है ?
[Link]
[Link] memory
C. Heap memory
[Link] storage space

Answer: (c) Heap memory

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


intern() पद्धनत का उपयोग क्या है?
[Link] returns the existing string from memory
[Link] creates a new string in the database
C. It modifies the existing string in the database
[Link] of the above

Answer: (a) It returns the existing string from the memory


Q. Which of the following is a marker interface?
निम्ननिनित में से कौि एक माकन र इिं र्टरफे स है?
[Link] interface
[Link] interface
C. Readable interface
[Link] interface

Answer: (b) Remote interface

Q. Which keyword is used for accessing the features of a


package?
पैकेज features access के निए ककस कीिडन का उपयोग ककया जाता है ?
[Link]
[Link]
C. extends
[Link]

Answer: (b) import


Q. In java, jar stands for_____.
[Link] ARchive
[Link] Application Resource
C. Java Application Runner
[Link] of the above

Answer: (a) Java ARchive

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


[Link] for a whitespace character
[Link] for a non-whitespace character
C. Used for a word character
[Link] for a non-word character

Answer: (c) Used for a word character


Q. Which of the given methods are of Object class?
[Link](), wait( long msecs ), and synchronized()
[Link]( long msecs ), interrupt(), and notifyAll()
C. notify(), notifyAll(), and wait()
[Link]( long msecs ), wait(), and notify()

Answer: (c) notify(), notifyAll(), and wait()

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


निम्न में से कौिसी जािा की mutable class है ?
[Link]
[Link]
C. [Link]
[Link]

Answer: (d) [Link]


 StringBuilder class एक पररितनिशीि class है, क्योंकक इसे ििािे
के िाद इसे िदिा जा सकता है।
Q. What is meant by the classes and objects that
dependents on each other?
उि classes और objects से क्या तात्पयन है जो एक दूसरे पर निर्नर हैं?
[Link] Coupling
[Link]
C. Loose Coupling
[Link] of the above

Answer: (a) Tight Coupling

Q. How many threads can be executed at a time?


एक समय में ककतिे थ्रेड्स एक्सीक्यूर्ट ककये जा सकते है ?
[Link] one thread
[Link] threads
C. Only main (main() method) thread
[Link] threads

Answer: (b) Multiple threads


Q. If three threads trying to share a single object at the
same time, which condition will arise in this scenario?
यकद तीि threads एक ही समय में एक ही िस्तु को share करिे का प्रयास
करते हैं, तो इस scenario में कौि सी नस्िनत उत्पन्न होगी?
[Link]-Lapse
[Link] situation
C. Race condition
[Link]

Answer: (c) Race condition


यकद दो या दो से अनर्क थ्रेड एक ही समय में एक सामान्य सिंसार्ि तक पहुँचिे का
प्रयास कर रहे हैं। इस नस्िनत को Race condition के रूप में जािा जाता है।

Q. If a thread goes to sleep


[Link] releases all the locks it has.
[Link] does not release any locks.
C. It releases half of its locks.
[Link] releases all of its lock except one.

Answer: (b) It does not release any locks.


Q. 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?
निम्ननिनित में से कौि सा modifiers एक variable के निए उपयोग ककया
जा सकता है ताकक इसे ककसी र्ी थ्रेड या प्रोग्राम के ककसी र्ाग द्वारा एक्सेस ककया
जा सके ?
[Link]
[Link]
C. volatile
[Link]

Answer: (c) volatile

Q. In character stream I/O, a single read/write operation


performs _____.
कै रे क्र्टर स्रीम I/O में, एक स्टसिंगि रीड/राइर्ट ऑपरे शि _____ करता है।
[Link] bytes read/write at a time.
[Link] bytes read/write at a time.
C. One byte read/write at a time.
[Link] bytes read/ write at a time.

Answer: (a) Two bytes read/write at a time.

You might also like