JAVA MCQ BY SAMPAT SIR [RAJASTHAN COMPUTER TEACHER
VACANCY]
Q. Which of the following option leads to the portability
and security of Java?
निम्ननिनित में से कौि सा निकल्प जािा की पोर्टेनिनिर्टी और सुरक्षा की
ओर िे जाता है?
A.Bytecode is executed by JVM
B.The applet makes the Java code secure and portable
C. Use of exception handling
D.Dynamic binding between objects
Answer: (a) Bytecode is executed by the JVM.
Q. Which of the following is not a Java features?
निम्ननिनित में से कौि जािा फीचर िहीं है?
A.Dynamic
B.Architecture Neutral
C. Use of pointers
D.Object-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.
जािा प्रोग्राम में िग को िोजिे और ठीक करिे के निए _____ का उपयोग
ककया जाता है।
A.JVM
B.JRE
C. JDK
D.JDB
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 क्या है?
A.Object
B.int
C. long
D.void
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 डॉक्यूमेंर्टेशि
जेिरे र्ट करिे के निए निम्ननिनित में से ककस र्टूि का इस्तेमाि ककया जाता
है?
A.javap tool
B.javaw command
C. Javadoc tool
D.javah 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 की सूची ििाता है?
A.new List(false, 3)
B.new List(3, true)
C. new List(true, 3)
D.new List(3, false)
Answer: (b) new List(3, true)
Q. Which method of the Class.class is used to determine
the name of a class represented by the class object as a
String?
क्िास ऑब्जेक्र्ट द्वारा स्टस्रिंग के रूप में दशानए गए क्िास के िाम को
निर्ानररत करिे के निए क्िास.क्िास की ककस निनर् का उपयोग ककया
जाता है?
A.getClass()
B.intern()
C. getName()
D.toString()
Answer: (c) getName()
It is a non-static method, and available in the
java.lang package.
Q. In which process, a local variable has the same name
as one of the instance variables?
ककस प्रकिया में, एक local variable का िही िाम होता है जो एक
instance variables का होता है?
A.Serialization
B.Variable Shadowing
C. Abstraction
D.Multi-threading
Answer: (b) Variable Shadowing
Q. Which package contains the Random class?
ककस पैकेज में रैं डम क्िास है?
A.java.util package
B.java.lang package
C. java.awt package
D.java.io package
Answer: (a) java.util package
Q. What do you mean by nameless objects?
nameless objects से आप क्या समझते हैं?
A.An object created by using the new keyword.
B.An object of a superclass created in the subclass.
C. An object without having any name but having a
reference.
D.An 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
______.
नििा ककसी फील्ड या निनर्यों िािे इिं र्टरफे स को ______ के रूप में जािा जाता
है।
A.Runnable Interface
B.Marker Interface
C. Abstract Interface
D.CharSequence Interface
Answer: (b) Marker Interface
Q. Which of the following is an immediate subclass of the
Panel class?
A.Applet class
B.Window class
C. Frame class
D.Dialog class
Answer: (a) Applet class
Q. Which of these classes are the direct subclasses of the
Throwable class?
A.RuntimeException and Error class
B.Exception and VirtualMachineError class
C. Error and Exception class
D.IOException and VirtualMachineError class
Answer: (c) Error and Exception class
Q. What do you mean by chained exceptions in Java?
जािा में chained exceptions से आप क्या समझते हैं ?
A.Exceptions occurred by the VirtualMachineError
B.An exception caused by other exceptions
C. Exceptions occur in chains with discarding the
debugging information
D.None 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?
जि हम िए ऑपरे र्टर का उपयोग करके एक स्टस्रिंग ििाते हैं, तो एक स्टस्रिंग ककस
मेमोरी में सिंग्रहीत होती है ?
A.Stack
B.String memory
C. Heap memory
D.Random storage space
Answer: (c) Heap memory
Q. What is the use of the intern() method?
intern() पद्धनत का उपयोग क्या है?
A.It returns the existing string from memory
B.It creates a new string in the database
C. It modifies the existing string in the database
D.None of the above
Answer: (a) It returns the existing string from the memory
Q. Which of the following is a marker interface?
निम्ननिनित में से कौि एक माकन र इिं र्टरफे स है?
A.Runnable interface
B.Remote interface
C. Readable interface
D.Result interface
Answer: (b) Remote interface
Q. Which keyword is used for accessing the features of a
package?
पैकेज features access के निए ककस कीिडन का उपयोग ककया जाता है ?
A.package
B.import
C. extends
D.export
Answer: (b) import
Q. In java, jar stands for_____.
A.Java ARchive
B.Java Application Resource
C. Java Application Runner
D.None of the above
Answer: (a) Java ARchive
Q. What is the use of \w in regex?
A.Used for a whitespace character
B.Used for a non-whitespace character
C. Used for a word character
D.Used for a non-word character
Answer: (c) Used for a word character
Q. Which of the given methods are of Object class?
A.notify(), wait( long msecs ), and synchronized()
B.wait( long msecs ), interrupt(), and notifyAll()
C. notify(), notifyAll(), and wait()
D.sleep( long msecs ), wait(), and notify()
Answer: (c) notify(), notifyAll(), and wait()
Q. Which of the following is a mutable class in java?
निम्न में से कौिसी जािा की mutable class है ?
A.java.lang.String
B.java.lang.Byte
C. java.lang.Short
D.java.lang.StringBuilder
Answer: (d) java.lang.StringBuilder
StringBuilder class एक पररितनिशीि class है, क्योंकक इसे ििािे
के िाद इसे िदिा जा सकता है।
Q. What is meant by the classes and objects that
dependents on each other?
उि classes और objects से क्या तात्पयन है जो एक दूसरे पर निर्नर हैं?
A.Tight Coupling
B.Cohesion
C. Loose Coupling
D.None of the above
Answer: (a) Tight Coupling
Q. How many threads can be executed at a time?
एक समय में ककतिे थ्रेड्स एक्सीक्यूर्ट ककये जा सकते है ?
A.Only one thread
B.Multiple threads
C. Only main (main() method) thread
D.Two 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 में कौि सी नस्िनत उत्पन्न होगी?
A.Time-Lapse
B.Critical situation
C. Race condition
D.Recursion
Answer: (c) Race condition
यकद दो या दो से अनर्क थ्रेड एक ही समय में एक सामान्य सिंसार्ि तक पहुँचिे का
प्रयास कर रहे हैं। इस नस्िनत को Race condition के रूप में जािा जाता है।
Q. If a thread goes to sleep
A.It releases all the locks it has.
B.It does not release any locks.
C. It releases half of its locks.
D.It 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 के निए उपयोग ककया
जा सकता है ताकक इसे ककसी र्ी थ्रेड या प्रोग्राम के ककसी र्ाग द्वारा एक्सेस ककया
जा सके ?
A.global
B.transient
C. volatile
D.default
Answer: (c) volatile
Q. In character stream I/O, a single read/write operation
performs _____.
कै रे क्र्टर स्रीम I/O में, एक स्टसिंगि रीड/राइर्ट ऑपरे शि _____ करता है।
A.Two bytes read/write at a time.
B.Eight bytes read/write at a time.
C. One byte read/write at a time.
D.Five bytes read/ write at a time.
Answer: (a) Two bytes read/write at a time.