MCQOPTIONS
Saved Bookmarks
This section includes 1671 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.
| 801. |
Thread priority in Java is? |
| A. | Integer |
| B. | Float |
| C. | double |
| D. | long |
| Answer» B. Float | |
| 802. |
Which of these are types of multitasking? |
| A. | Process based |
| B. | Thread based |
| C. | Process and Thread based |
| D. | None of the mentioned |
| Answer» D. None of the mentioned | |
| 803. |
What is multithreaded programming? |
| A. | It’s a process in which two different processes run simultaneously |
| B. | It’s a process in which two or more parts of same process run simultaneously |
| C. | It’s a process in which many different process are able to access same information |
| D. | It’s a process in which a single process can access information from many sources |
| Answer» C. It’s a process in which many different process are able to access same information | |
| 804. |
Which of these method of Thread class is used to find out the priority given to a thread? |
| A. | get() |
| B. | ThreadPriority() |
| C. | getPriority() |
| D. | getThreadPriority() |
| Answer» D. getThreadPriority() | |
| 805. |
Which of these method is used to begin the execution of a thread? |
| A. | run() |
| B. | start() |
| C. | runThread() |
| D. | startThread() |
| Answer» C. runThread() | |
| 806. |
Which of these method is used to implement Runnable interface? |
| A. | stop() |
| B. | run() |
| C. | runThread() |
| D. | stopThread() |
| Answer» C. runThread() | |
| 807. |
What is synchronization in reference to a thread? |
| A. | It’s a process of handling situations when two or more threads need access to a shared resource |
| B. | It’s a process by which many thread are able to access same shared resource simultaneously |
| C. | It’s a process by which a method is able to access many different threads simultaneously |
| D. | It’s a method that allow too many threads to access any information require |
| Answer» B. It’s a process by which many thread are able to access same shared resource simultaneously | |
| 808. |
Which of these method is used to explicitly set the priority of a thread? |
| A. | set() |
| B. | make() |
| C. | setPriority() |
| D. | makePriority() |
| Answer» D. makePriority() | |
| 809. |
Which of these method waits for the thread to terminate? |
| A. | sleep() |
| B. | isAlive() |
| C. | join() |
| D. | stop() |
| Answer» D. stop() | |
| 810. |
What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY? |
| A. | 0 & 256 |
| B. | 0 & 1 |
| C. | 1 & 10 |
| D. | 1 & 256 |
| Answer» D. 1 & 256 | |
| 811. |
Which of these method is used to find out that a thread is still running or not? |
| A. | run() |
| B. | Alive() |
| C. | isAlive() |
| D. | checkRun() |
| Answer» D. checkRun() | |
| 812. |
Which of these method can be used to make the main thread to be executed last among all the threads? |
| A. | stop() |
| B. | sleep() |
| C. | join() |
| D. | Call() |
| Answer» C. join() | |
| 813. |
Which of these classes is super class of Exception class? |
| A. | Throwable |
| B. | System |
| C. | RunTime |
| D. | Class |
| Answer» B. System | |
| 814. |
Which of these methods return localized description of an exception? |
| A. | getLocalizedMessage() |
| B. | getMessage() |
| C. | obtainLocalizedMessage() |
| D. | printLocalizedMessage() |
| Answer» B. getMessage() | |
| 815. |
Which of these methods is used to print stack trace? |
| A. | obtainStackTrace() |
| B. | printStackTrace() |
| C. | getStackTrace() |
| D. | displayStackTrace() |
| Answer» C. getStackTrace() | |
| 816. |
Which of these methods return description of an exception? |
| A. | getException() |
| B. | getMessage() |
| C. | obtainDescription() |
| D. | obtainDescription() |
| Answer» C. obtainDescription() | |
| 817. |
Which of these classes is used to define exceptions? |
| A. | Exception |
| B. | Throwable |
| C. | Abstract |
| D. | System |
| Answer» B. Throwable | |
| 818. |
Which of these statements is incorrect? |
| A. | try block need not to be followed by catch block |
| B. | try block can be followed by finally block instead of catch block |
| C. | try can be followed by both catch and finally block |
| D. | try need not to be followed by anything |
| Answer» E. | |
| 819. |
Which of these keywords are used for generating an exception manually? |
| A. | try |
| B. | catch |
| C. | throw |
| D. | check |
| Answer» D. check | |
| 820. |
Which of these keywords are used for the block to handle the exceptions generated by try block? |
| A. | try |
| B. | catch |
| C. | throw |
| D. | check |
| Answer» C. throw | |
| 821. |
Which of these keywords are used for the block to be examined for exceptions? |
| A. | try |
| B. | catch |
| C. | throw |
| D. | check |
| Answer» B. catch | |
| 822. |
What is the use of try & catch? |
| A. | It allows us to manually handle the exception |
| B. | It allows to fix errors |
| C. | It prevents automatic terminating of the program in cases when an exception occurs |
| D. | All of the mentioned |
| Answer» E. | |
| 823. |
Which of these exceptions will occur if we try to access the index of an array beyond its length? |
| A. | ArithmeticException |
| B. | ArrayException |
| C. | ArrayIndexException |
| D. | ArrayIndexOutOfBoundsException |
| Answer» E. | |
| 824. |
Which of these exceptions handles the divide by zero error? |
| A. | ArithmeticException |
| B. | MathException |
| C. | IllegalAccessException |
| D. | IllegarException |
| Answer» B. MathException | |
| 825. |
A single try block must be followed by which of these? |
| A. | finally |
| B. | catch |
| C. | finally & catch |
| D. | none of the mentioned |
| Answer» D. none of the mentioned | |
| 826. |
Which of these clause will be executed even if no exceptions are found? |
| A. | throws |
| B. | finally |
| C. | throw |
| D. | catch |
| Answer» C. throw | |
| 827. |
Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function? |
| A. | try |
| B. | throw |
| C. | throw |
| D. | catch |
| Answer» D. catch | |
| 828. |
Which of these operator is used to generate an instance of an exception than can be thrown by using throw? |
| A. | new |
| B. | malloc |
| C. | alloc |
| D. | thrown |
| Answer» B. malloc | |
| 829. |
Which of these class is related to all the exceptions that are explicitly thrown? |
| A. | Error |
| B. | Exception |
| C. | Throwable |
| D. | Throw |
| Answer» D. Throw | |
| 830. |
Which of these keywords is used to generate an exception explicitly?vvv |
| A. | try |
| B. | finally |
| C. | throw |
| D. | catch |
| Answer» D. catch | |
| 831. |
What is the output of this program? class exception_handling { public static void main(String args[]) { try { int a = args.length; int b = 10 / a; System.out.print(a); try { if (a == 1) a = a / a - a; if (a == 2) { int []c = {1}; c[8] = 9; } } catch (ArrayIndexOutOfBoundException e) { System.out.println("TypeA"); } catch (ArithmeticException e) { System.out.println("TypeB"); } } } } |
| A. | TypeA |
| B. | TypeB |
| C. | Compile Time Error |
| D. | 0TypeB |
| Answer» D. 0TypeB | |
| 832. |
What is the output of this program? class exception_handling { public static void main(String args[]) { try { int a[] = {1, 2,3 , 4, 5}; for (int i = 0; i < 5; ++i) System.out.print(a[i]); int x = 1/0; } catch(ArrayIndexOutOfBoundsException e) { System.out.print("A"); } catch(ArithmeticException e) { System.out.print("B"); } } } |
| A. | 12345 |
| B. | 12345A |
| C. | 12345B |
| D. | Compilation Error |
| Answer» D. Compilation Error | |
| 833. |
What is the output of this program? class exception_handling { public static void main(String args[]) { try { int i, sum; sum = 10; for (i = -1; i < 3 ;++i) sum = (sum / i); } catch(ArithmeticException e) { System.out.print("0"); } System.out.print(sum); } } |
| A. | 0 |
| B. | 05 |
| C. | Compilation Error |
| D. | Runtime Error |
| Answer» D. Runtime Error | |
| 834. |
What is the output of this program? class exception_handling { public static void main(String args[]) { try { int a, b; b = 0; a = 5 / b; System.out.print("A"); } catch(ArithmeticException e) { System.out.print("B"); } } } |
| A. | A |
| B. | B |
| C. | Compilation Error |
| D. | Runtime Error |
| Answer» C. Compilation Error | |
| 835. |
What is the output of this program? class exception_handling { public static void main(String args[]) { try { System.out.print("Hello" + " " + 1 / 0); } finally { System.out.print("World"); } } } |
| A. | Hello |
| B. | World |
| C. | Compilation Error |
| D. | First Exception then World |
| Answer» E. | |
| 836. |
Which of these handles the exception when no catch is used? |
| A. | Default handler |
| B. | finally |
| C. | throw handler |
| D. | Java run time system |
| Answer» B. finally | |
| 837. |
Which of these class is related to all the exceptions that cannot be caught? |
| A. | Error |
| B. | Exception |
| C. | RuntimeExecption |
| D. | All of the mentioned |
| Answer» B. Exception | |
| 838. |
Which of these class is related to all the exceptions that can be caught by using catch? |
| A. | Error |
| B. | Exception |
| C. | RuntimeExecption |
| D. | All of the mentioned |
| Answer» C. RuntimeExecption | |
| 839. |
Which of these is a super class of all exceptional type classes? |
| A. | String |
| B. | RuntimeExceptions |
| C. | RuntimeExceptions |
| D. | Cacheable |
| Answer» D. Cacheable | |
| 840. |
At run time, error is recoverable. |
| A. | True |
| B. | False |
| Answer» C. | |
| 841. |
What exception thrown by parseInt() method? |
| A. | ArithmeticException |
| B. | ClassNotFoundException |
| C. | NullPointerException |
| D. | NumberFormatException |
| Answer» E. | |
| 842. |
Which of the following should be true of the object thrown by a thrown statement? |
| A. | Should be assignable to String type |
| B. | Should be assignable to Exception type |
| C. | Should be assignable to Throwable type |
| D. | Should be assignable to Error type |
| Answer» D. Should be assignable to Error type | |
| 843. |
Which part of code gets executed whether exception is caught or not? |
| A. | finally |
| B. | try |
| C. | catch |
| D. | throw |
| Answer» B. try | |
| 844. |
Which of the following handles the exception when catch is not used? |
| A. | finally |
| B. | throw handler |
| C. | default handler |
| D. | java run time system |
| Answer» D. java run time system | |
| 845. |
Which of the following keyword is used by calling function to handle exception thrown by called function? |
| A. | throws |
| B. | throw |
| C. | try |
| D. | catch |
| Answer» B. throw | |
| 846. |
Which of the following operators is used to generate instance of an exception which can be thrown using throw? |
| A. | thrown |
| B. | alloc |
| C. | malloc |
| D. | New |
| Answer» E. | |
| 847. |
Which of the following is a super class of all exception type classes? |
| A. | Catchable |
| B. | RuntimeExceptions |
| C. | String |
| D. | String |
| Answer» E. | |
| 848. |
Which of the following classes can catch all exceptions which cannot be caught? |
| A. | RuntimeException |
| B. | Error |
| C. | Exception |
| D. | ParentException |
| Answer» C. Exception | |
| 849. |
Which of the following keywords is used for throwing exception manually? |
| A. | finally |
| B. | TRY |
| C. | throw |
| D. | catch |
| Answer» D. catch | |
| 850. |
What is the output of this program? class exception_handling { public static void main(String args[]) { try { System.out.print("Hello" + " " + 1 / 0); } catch(ArithmeticException e) { System.out.print("World"); } } } |
| A. | Hello |
| B. | World |
| C. | HelloWorld |
| D. | Hello World |
| Answer» C. HelloWorld | |