FliQi Education App Download
प्रश्न-बैंक · Programmer Java

Multithreading — प्रश्न और उत्तर

Programmer Java · 89 जाँचे हुए (verified) प्रश्न

  • 89 जाँचे हुए प्रश्न
  • हिंदी + English

पहले 10 प्रश्नों के उत्तर और हल यहीं खुले हैं; बाक़ी 20 के उत्तर और हल FliQi Question Bank app में।

भाषा
प्रश्न 1उत्तर + हल
नीचे दिया गया जावा कोड क्या दर्शाता है?
class MyThread extends Thread {
    public void run() {
        System.out.println("Thread running...");
    }
}
public class Main {
    public static void main(String[] args) {
        MyThread thread = new MyThread();
        thread.start();
    }
}
What does the following Java code snippet demonstrate?
class MyThread extends Thread {
    public void run() {
        System.out.println("Thread running...");
    }
}
public class Main {
    public static void main(String[] args) {
        MyThread thread = new MyThread();
        thread.start();
    }
}
  1. AThread क्लास को extend करके और run() method को ओवरराइड करके नया थ्रेड बनाना।Creating a new thread by extending the Thread class and overriding the run() method.
  2. BRunnable interface लागू करके और run() method को ओवरराइड करके नया थ्रेड बनाना।Creating a new thread by implementing the Runnable interface and overriding the run() method.
  3. Cमुख्य थ्रेड (main thread) शुरू करना।Starting the main thread.
  4. Dदूसरे थ्रेड के ख़त्म होने का इंतज़ार करना।Waiting for another thread to finish its execution.

सही उत्तर / Answer: (A)

हल / Solution
यहाँ MyThread क्लास Thread को extend करती है और उसके run() method को ओवरराइड (override) करती है। main में उसकी वस्तु बनाकर start() बुलाया गया है, जिससे JVM नया थ्रेड बनाता है और उसी पर run() चलता है। इसलिए पहला विकल्प सही है। दूसरा विकल्प Runnable लागू करने वाला तरीक़ा बताता है, जो इस कोड में नहीं है। मुख्य थ्रेड तो JVM ख़ुद शुरू करता है, और इंतज़ार कराने के लिए join() चाहिए होता।
Here the class MyThread extends Thread and overrides its run() method. In main an object of it is created and start() is called, so the JVM makes a new thread and runs the overridden code on it. That is why the first option is correct. The second option describes the Runnable route, which this code does not use. The main thread is started by the JVM itself, and waiting for a thread would need join().
प्रश्न 2उत्तर + हल
जावा में डीमन थ्रेड (daemon thread) और कचरा बीनने (garbage collection) का क्या संबंध है?
In Java, what is the relationship between daemon threads and garbage collection?
  1. Aडीमन थ्रेड कचरा बीनने में भाग नहीं ले सकते।Daemon threads cannot participate in garbage collection.
  2. Bकचरा बीनते समय डीमन थ्रेड अपने आप चल पड़ते हैं।Daemon threads are automatically invoked during garbage collection.
  3. Cडीमन थ्रेड कचरा बीनना होने ही नहीं देते।Daemon threads prevent garbage collection from occurring.
  4. Dकचरा बीनते समय डीमन थ्रेड अपने आप रोक दिए जाते हैं।Daemon threads are automatically paused during garbage collection.

सही उत्तर / Answer: (B)

हल / Solution
जावा में कचरा बीनने का काम (garbage collection) JVM ख़ुद एक डीमन थ्रेड (daemon thread) से कराता है; प्रोग्राम उसे बुलाता नहीं, वह पीछे अपने आप चलता रहता है। इसलिए दूसरा विकल्प सही है। पहला विकल्प उलटा है, क्योंकि यह काम डीमन थ्रेड ही करते हैं। तीसरा भी ग़लत है, डीमन थ्रेड कचरा बीनने से रोकते नहीं। चौथा भी ग़लत है; कचरा बीनने के लिए डीमन थ्रेड ख़ास तौर पर रोके नहीं जाते।
In Java the garbage collector itself is run by the JVM on a daemon thread; the program never calls it, and it simply works in the background. That is why the second option is right. The first option is the reverse, since this work is exactly what daemon threads do. The third is wrong because daemon threads do not stop collection from happening, and they are not specially paused for it either.
प्रश्न 3उत्तर + हल
Java में programmer के बनाए thread की default हैसियत क्या होती है?
In Java, what is the default status of a thread created by the programmer?
  1. AdaemonDaemon
  2. Bnon-daemonNon-daemon
  3. CinterruptedInterrupted
  4. DbackgroundBackground

सही उत्तर / Answer: (B)

हल / Solution
नया thread अपनी हैसियत बनाने वाले से लेता है। program का main thread user thread यानी non-daemon होता है, इसलिए उससे बना हर thread भी non-daemon ही रहता है। JVM तभी बंद होता है जब सारे user thread अपना काम पूरा कर लें। daemon बनाना हो तो start() से पहले setDaemon(true) लिखिए। interrupted कोई हैसियत नहीं, वह तो एक निशान है, और background नाम की कोई श्रेणी Java में है ही नहीं।
A new thread takes its status from the thread that created it. The main thread of a program is a user thread, that is non daemon, so every thread you create from it is non daemon as well. The JVM stays alive until all user threads have finished their work. To get a daemon you must call setDaemon(true) before start(). Interrupted is a flag, and background is not a Java category.
प्रश्न 4उत्तर + हल
Java में कोई daemon thread नया thread बनाए तो क्या होता है?
What happens if a daemon thread creates a new thread in Java?
  1. Aनया thread अपने बनाने वाले का daemon होना विरासत में पा जाता है।The new thread inherits the daemon status of its parent thread.
  2. Bनया thread daemon हो ही नहीं सकता।The new thread cannot be a daemon thread.
  3. Cनया thread user thread बन जाता है।The new thread becomes a user thread.
  4. Dनया thread हमेशा सबसे ऊँची प्राथमिकता पा जाता है।The new thread always gets the maximum priority.

सही उत्तर / Answer: (A)

हल / Solution
Java में नया thread अपना daemon होना बनाने वाले thread से विरासत में लेता है। इसलिए daemon thread के भीतर बना thread भी daemon ही रहेगा, जब तक start() से पहले setDaemon(false) लिखकर उसे बदल न दिया जाए। यही वजह है कि दूसरा और तीसरा विकल्प ग़लत हैं। प्राथमिकता भी विरासत में मिलती है, पर सबसे ऊँची अपने आप नहीं मिल जाती, इसीलिए चौथा विकल्प भी ग़लत है।
In Java a new thread inherits its daemon flag from the thread that created it. So a thread created inside a daemon thread is itself a daemon, unless you call setDaemon(false) on it before start(). That rules out the second and the third options. Priority is inherited as well, but the new thread certainly does not jump to the maximum priority, which is why the last option is wrong.
प्रश्न 5उत्तर + हल
daemon thread के बारे में इनमें से कौन-सी बात ग़लत है?
Which of the following statements about daemon threads is false?
  1. Adaemon thread garbage collection जैसे पीछे के कामों के लिए ठीक रहते हैं।Daemon threads are suitable for background tasks like garbage collection.
  2. Bकिसी thread को daemon बनाने के लिए start() से पहले setDaemon(true) लिखना पड़ता है।A thread becomes a daemon only if setDaemon(true) is called before start().
  3. Cdaemon thread का काम JVM बंद होने से पहले पूरा हो ही जाता है, यह पक्का है।Daemon threads are guaranteed to complete their tasks before the JVM exits.
  4. Ddaemon thread उन कामों के लिए काम आते हैं जो program के लिए ज़रूरी नहीं हैं।Daemon threads can be used for tasks that are not critical for the application.

सही उत्तर / Answer: (C)

हल / Solution
तीसरी बात ग़लत है। सारे user thread ख़त्म होते ही JVM बंद हो जाता है और daemon thread वहीं काट दिए जाते हैं, चाहे उनका काम अधूरा ही क्यों न हो। इसलिए पूरा होने की कोई गारंटी है ही नहीं। बाक़ी तीनों बातें सही हैं — पीछे के सहायक कामों के लिए वे बने ही हैं, setDaemon(true) start() से पहले लगाना ज़रूरी है, और ग़ैर-ज़रूरी कामों के लिए वे बिलकुल ठीक रहते हैं।
The third statement is the false one. Once the last user thread ends, the JVM shuts down and the daemon threads are cut off wherever they are, so nothing guarantees they will finish. The other three are true, because daemons suit background chores, setDaemon(true) must be called before start() for a thread to become one, and they are meant for work the application can live without.
प्रश्न 6उत्तर + हल
Java में JVM बंद होने पर daemon thread का क्या होता है?
In Java, what happens to daemon threads when the JVM exits?
  1. Adaemon thread अपने आप समाप्त हो जाते हैं।Daemon threads are automatically terminated.
  2. Bdaemon thread JVM के दोबारा चलने तक रोक दिए जाते हैं।Daemon threads are suspended until the JVM is restarted.
  3. Cdaemon thread JVM बंद होने के बाद भी चलते रहते हैं।Daemon threads continue running even after the JVM exits.
  4. Ddaemon thread तब तक रुके रहते हैं जब तक उन्हें हाथ से दोबारा न चलाया जाए।Daemon threads are paused until they are manually resumed.

सही उत्तर / Answer: (A)

हल / Solution
सारे user thread ख़त्म होते ही JVM बंद होने लगता है, और उसी घड़ी बचे हुए daemon thread अपने आप समाप्त कर दिए जाते हैं। उनका काम बीच में अधूरा रह जाए तो भी कोई इंतज़ार नहीं होता, यहाँ तक कि finally खंड के चलने की भी गारंटी नहीं रहती। इसीलिए ज़रूरी काम daemon thread को कभी मत सौंपिए। JVM बंद होने के बाद कोई thread चल नहीं सकता, और उसे हाथ से जगाने का सवाल ही नहीं उठता।
As soon as the last user thread finishes, the JVM begins to shut down and every daemon thread still alive is killed at that moment. Its work may be left half done, and even a finally block is not guaranteed to run. That is why important work should never be handed to a daemon thread. No thread can keep running after the JVM has gone, and none of them can be resumed by hand.
प्रश्न 7उत्तर + हल
Java में daemon thread किसे कहते हैं?
What is a daemon thread in Java?
  1. Aऐसा thread जो पीछे चलता रहता है और दूसरे thread से अलग अपना काम करता है।A thread that executes in the background and performs tasks independently of other threads.
  2. Bऐसा thread जिसे JVM अलग से समाप्त करता है।A thread that is explicitly terminated by the JVM.
  3. Cऐसा thread जिसकी प्राथमिकता बाक़ी सब से ऊँची होती है।A thread that has a higher priority than other threads.
  4. Dऐसा thread जिसे सिर्फ़ operating system बना सकता है।A thread that can only be created by the operating system.

सही उत्तर / Answer: (A)

हल / Solution
Daemon thread पीछे रहकर सहायक काम करता है, जैसे कचरा बीनने वाला garbage collector। वह मुख्य काम का हिस्सा नहीं होता, इसलिए program उसके पूरा होने का इंतज़ार नहीं करता। किसी thread को daemon बनाने के लिए start() से पहले setDaemon(true) लिखना पड़ता है, यानी programmer भी बना सकता है। उसकी प्राथमिकता अपने आप ऊँची नहीं होती। और JVM उसे अलग से चुनकर नहीं मारता, वह तो पूरा JVM बंद होते समय अपने आप चला जाता है।
A daemon thread runs in the background doing supporting work, such as garbage collection. It is not part of the main job, so the program never waits for it to finish. You make one by calling setDaemon(true) before start(), which means a programmer can certainly create them. Its priority is not raised automatically, and the JVM does not pick it out for termination, since it simply goes when the whole JVM shuts down.
प्रश्न 8उत्तर + हल
Java में deadlock का मुख्य कारण क्या होता है?
What is the primary cause of deadlocks in Java?
  1. Amemory का कम मिलनाInsufficient memory allocation
  2. Bthread scheduling का ठीक न होनाInadequate thread scheduling
  3. Cसंसाधनों का ग़लत ढंग से बाँटा जानाImproper resource allocation
  4. Dsynchronization का हद से ज़्यादा इस्तेमालExcessive use of synchronization

सही उत्तर / Answer: (C)

हल / Solution
Deadlock की जड़ यही है कि संसाधन ग़लत ढंग से बाँटे और माँगे जाते हैं। एक thread पहला lock पकड़े-पकड़े दूसरा माँगता है और दूसरा thread उलटे क्रम में, बस घेरा बन गया। memory कम पड़ने पर OutOfMemoryError मिलता है, deadlock नहीं। scheduler सिर्फ़ बारी तय करता है, घेरा नहीं बनाता। synchronization ज़्यादा होने से रफ़्तार घटती है, पर असली दोष क्रम का है, गिनती का नहीं।
Deadlock grows out of the way resources are asked for and held. One thread holds the first lock and asks for the second while another does it the other way round, and the ring closes. Shortage of memory gives an OutOfMemoryError, not a deadlock. The scheduler only decides whose turn it is and cannot build the ring. Heavy synchronization slows a program, but the real fault lies in the ordering.
प्रश्न 9उत्तर + हल
Java में deadlock को program के भीतर से पकड़ने के लिए कौन-सी विधि दी गई है?
Which method is used to detect deadlocks programmatically in Java?
  1. AThread वर्ग की checkDeadlock()checkDeadlock() in Thread class
  2. BRuntime वर्ग की detectDeadlock()detectDeadlock() in Runtime class
  3. CSystem वर्ग की findDeadlock()findDeadlock() in System class
  4. DJava ऐसी कोई सीधी विधि देता ही नहीं।There is no direct method provided by Java to detect deadlocks.

सही उत्तर / Answer: (D)

हल / Solution
Java की मूल कक्षाओं में deadlock पकड़ने की कोई सीधी विधि है ही नहीं। Thread में checkDeadlock(), Runtime में detectDeadlock() और System में findDeadlock() — ये तीनों नाम गढ़े हुए हैं और Java में मिलेंगे ही नहीं। असल में deadlock ढूँढ़ने के लिए thread dump देखा जाता है या jconsole तथा jstack जैसे औज़ार लगाए जाते हैं। सबसे अच्छा तरीक़ा तो रोकथाम है — lock हमेशा एक ही क्रम में लीजिए, ताकि घेरा बने ही नहीं।
The core Java classes offer no direct call for finding a deadlock. The names in the other options are invented, since Thread has no checkDeadlock(), Runtime has no detectDeadlock() and System has no findDeadlock(). In practice you look at a thread dump or use tools such as jconsole and jstack to see which threads are stuck. The best cure is prevention, so always take your locks in one fixed order.
प्रश्न 10उत्तर + हल
deadlock बनने के लिए इनमें से कौन-सी शर्तें एक साथ पूरी होनी चाहिए?
Which of the following conditions must be satisfied for a deadlock to occur?
  1. Amutual exclusion, hold and wait, no preemption और circular waitMutual exclusion, hold and wait, no preemption, and circular wait.
  2. Bno mutual exclusion, hold and wait, no preemption और circular waitNo mutual exclusion, hold and wait, no preemption, and circular wait.
  3. Cmutual exclusion, no hold and wait, no preemption और circular waitMutual exclusion, no hold and wait, no preemption, and circular wait.
  4. Dmutual exclusion, hold and wait, preemption और no circular waitMutual exclusion, hold and wait, preemption, and no circular wait.

सही उत्तर / Answer: (A)

हल / Solution
Deadlock के लिए चारों शर्तें एक साथ चाहिए। mutual exclusion यानी संसाधन एक समय में एक ही thread के पास रहे। hold and wait यानी एक lock पकड़े हुए दूसरे की माँग करना। no preemption यानी lock ज़बरदस्ती छीना न जा सके। और circular wait यानी इंतज़ार का घेरा पूरा बन जाना। इनमें से एक भी शर्त तोड़ दीजिए तो deadlock बनेगा ही नहीं, इसीलिए बाक़ी तीनों विकल्प ग़लत हैं।
All four conditions must hold at the same time. Mutual exclusion means a resource is held by one thread only. Hold and wait means a thread keeps one lock while asking for another. No preemption means a lock cannot be taken away by force. Circular wait means the chain of waiting closes into a ring. Break any single one of them and the deadlock cannot form, so the other options fail.
आगे के 20 प्रश्नों के उत्तर और हल app मेंFliQi Question Bank — अभ्यास, हल और आपकी प्रगति
App खोलिए
प्रश्न 11उत्तर app में
Java में deadlock किसे कहते हैं?
What is a deadlock in Java?
  1. Aजब कोई thread किसी दूसरे के lock छोड़ने के इंतज़ार में अनिश्चित काल तक रुका रहे।It occurs when a thread is suspended indefinitely waiting for another thread to release a lock.
  2. Bजब कोई thread दूसरे के पास पड़े संसाधन के इंतज़ार में रुकी हुई अवस्था में चला जाए।It happens when a thread enters a blocked state because it has to wait indefinitely for a resource held by another thread.
  3. Cजब दो या अधिक thread आगे बढ़ ही न पाएँ क्योंकि हर एक दूसरे के lock छोड़ने की राह देख रहा है।It occurs when two or more threads are unable to proceed because each is waiting for the other to release a lock.
  4. Dजब कोई thread अचानक बीच में ही समाप्त हो जाए।It is a situation where a thread terminates unexpectedly.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 13उत्तर app में
Java में notify() विधि का उद्देश्य क्या है?
What is the purpose of the notify() method in Java?
  1. Aयह किसी object पर रुके सभी thread को जगा देती है।It wakes up all threads waiting on a particular object.
  2. Bयह इंतज़ार कर रहे किसी एक thread को आगे बढ़ने की सूचना देती है।It notifies a single waiting thread to resume its execution.
  3. Cयह किसी object पर रुके सभी thread समाप्त कर देती है।It terminates all threads waiting on a particular object.
  4. Dयह चालू thread का चलना रोक देती है।It pauses the execution of the current thread.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 14उत्तर app में
Java में wait() विधि क्या करती है?
What does the wait() method in Java do?
  1. Aयह thread का चलना तब तक रोक देती है जब तक कोई दूसरा thread उसे सूचित न करे।It suspends the execution of a thread until it is notified by another thread.
  2. Bयह किसी दूसरे thread को चलने का संकेत भेजती है।It sends a signal to another thread to resume its execution.
  3. Cयह thread का चलना हमेशा के लिए रोक देती है।It stops the execution of a thread indefinitely.
  4. Dयह प्रतीक्षा के दौरान object का lock पकड़े रहती है।It keeps holding the lock on the object while waiting.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 15उत्तर app में
Java में interthread communication के लिए कौन-सी विधियाँ काम आती हैं?
Which methods are used for interthread communication in Java?
  1. Await() और notify()wait() and notify()
  2. Bsleep() और wakeup()sleep() and wakeup()
  3. Csuspend() और resume()suspend() and resume()
  4. Dstart() और stop()start() and stop()
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 16उत्तर app में
Java में interthread communication किसे कहते हैं?
What is interthread communication in Java?
  1. Aअलग-अलग मशीनों पर चल रहे thread के बीच की बातचीत को।It refers to communication between threads running on different machines.
  2. Bthread का सीधे एक-दूसरे को संदेश भेजना।It involves threads sending messages directly to each other.
  3. Cthread का आपस में तालमेल बिठाकर अपना काम क्रम में करना।It allows threads to cooperate and synchronize their actions.
  4. Dthread का बिना synchronization सीधे memory साझा करना।It enables threads to share memory directly without synchronization.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 17उत्तर app में
Java में synchronization के भीतर wait() और notify() का काम क्या है?
In Java, what is the use of the wait() and notify() methods in synchronization?
  1. Aये object पर लगा lock छोड़ देते हैं।They release the lock on an object.
  2. Bये चालू thread का चलना रोक देते हैं।They pause the execution of the current thread.
  3. Cये thread को किसी शर्त के पूरा होने का इंतज़ार करने की सुविधा देते हैं।They provide a mechanism for threads to wait for a condition to be satisfied.
  4. Dये thread का चलना समाप्त कर देते हैं।They terminate the thread's execution.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 18उत्तर app में
Java में synchronization का लाभ इनमें से कौन-सा नहीं है?
Which of the following is NOT a benefit of synchronization in Java?
  1. Arace condition रोकनाPreventing race conditions
  2. Bthread safety देनाEnsuring thread safety
  3. Cसमानांतरता (parallelism) बढ़ानाImproving parallelism
  4. Dआँकड़े बिगड़ने से बचानाAvoiding data corruption
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 19उत्तर app में
Java में synchronized विधि या खंड इस्तेमाल करने का उद्देश्य क्या है?
What is the purpose of using synchronized methods or blocks in Java?
  1. Acode की रफ़्तार बढ़ाना।To improve the performance of the code.
  2. Bकई thread वाले माहौल में आँकड़ों की एकरूपता बनाए रखना।To ensure data consistency in multithreaded environments.
  3. Cएक विधि को एक साथ छूने वाले thread की गिनती बढ़ाना।To increase the number of threads accessing a method simultaneously.
  4. Ddeadlock की हालत रोकना।To prevent deadlock situations.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 20उत्तर app में
Java में synchronized खंड के बारे में इनमें से कौन-सी बात सही है?
Which of the following is true about synchronized blocks in Java?
  1. Aइन्हें सिर्फ़ static विधियों के साथ ही लगाया जा सकता है।They can only be used with static methods.
  2. Bये सिर्फ़ एक पंक्ति तक ही ताला लगा सकते हैं।They can only synchronize a single line of code.
  3. Cइनमें ताले के लिए object साफ़-साफ़ बताना पड़ता है।They must explicitly specify the object used for synchronization.
  4. Dये कई thread वाले माहौल के लिए ठीक नहीं हैं।They are not suitable for multithreaded environments.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 21उत्तर app में
Java में synchronized खंड (block) आपको क्या करने देता है?
In Java, what does the synchronized block allow you to do?
  1. Aएक समय में सिर्फ़ एक thread को उस खंड के भीतर चलने देना।Ensure that only one thread can execute the block at a time.
  2. Bचालू thread का चलना रोक देना।Pause the execution of the current thread.
  3. Cचालू thread की प्राथमिकता बढ़ा देना।Increase the priority of the current thread.
  4. Dobject पर लगा lock छोड़ देना।Release the lock on an object.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 22उत्तर app में
Java में synchronized शब्द लगाने का उद्देश्य क्या है?
What is the purpose of the synchronized keyword in Java?
  1. Aयह बताता है कि विधि को एक समय में सिर्फ़ एक thread बुला सकता है।It indicates that a method can only be called by one thread at a time.
  2. Bयह पक्का करता है कि thread बिना किसी रुकावट लगातार चलता रहे।It ensures that a thread executes continuously without interruption.
  3. Cयह बताता है कि विधि को एक साथ अधिकतम कितने thread छू सकते हैं।It specifies the maximum number of threads that can access a method simultaneously.
  4. Dयह किसी एक thread के चलते समय बाक़ी सब thread समाप्त कर देता है।It terminates all other threads when a particular thread is executing.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 24उत्तर app में
Java में synchronization का अर्थ क्या है?
What is synchronization in Java?
  1. Aयह पक्का करता है कि एक समय में सिर्फ़ एक thread किसी खंड को चला सके।It ensures that only one thread can execute a block of code at a time.
  2. Bयह thread के चलने को तय समय के लिए रोक देता है।It suspends the execution of a thread for a specified amount of time.
  3. Cयह कई thread को एक ही खंड एक साथ चलाने देता है।It allows multiple threads to execute a block of code simultaneously.
  4. Dयह thread का चलना समाप्त कर देता है।It terminates a thread's execution.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 25उत्तर app में
Java में wait() के कारण रुके हुए thread को फिर से चलने लायक़ बनाने के लिए कौन-सी विधि काम आती है?
Which method makes a thread that is waiting because of wait() ready to run again in Java?
  1. Anotify()
  2. Bsignal()
  3. Cresume()
  4. Dinterrupt()
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 26उत्तर app में
Java में किसी thread पर suspend() विधि बुलाने पर क्या होता है?
In Java, what happens if the suspend() method is called on a thread?
  1. Aयह thread का चलना तुरंत हमेशा के लिए रोक देती है।It immediately stops the thread's execution for good.
  2. Bयह thread को तब तक रोके रखती है जब तक उसे resume() न किया जाए।It suspends the thread until it is resumed.
  3. Cयह किसी दूसरे thread की सूचना का इंतज़ार करती है।It waits for a notification from another thread.
  4. Dयह UnsupportedOperationException देती है।It throws an UnsupportedOperationException.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
प्रश्न 28उत्तर app में
Java में synchronized खंड के बाहर wait() बुलाने पर क्या होता है?
What happens if the wait() method is called outside of a synchronized block in Java?
  1. Aयह NullPointerException देता है।It throws a NullPointerException.
  2. Bयह IllegalMonitorStateException देता है।It throws an IllegalMonitorStateException.
  3. Cयह हमेशा के लिए रुका रहता है।It waits indefinitely.
  4. Dइसका कोई असर नहीं होता।It has no effect.
उत्तर और हल FliQi Question Bank app में देखें (Answer & solution in the app)
Multithreading के सभी 89 प्रश्न — उत्तर, हल और अभ्यास

FliQi Question Bank app में topic-वार अभ्यास, कठिनाई-स्तर और आपकी प्रगति।

  • पहला test मुफ़्त
  • हिंदी + English
  • जाँचे हुए उत्तर और हल

यह topic किन परीक्षाओं में आता है

Programmer Java के दूसरे topics

सभी topics