Java Programming MCQ (Multiple Choice Questions) - SchoolingAxis

Java Programming MCQ (Multiple Choice Questions)

 Que-  Which of these method is used to implement Runnable interface?

a. stop()

b. run()

c. runThread()

d. stopThread()


Answer- run()


Que-  Which of these method is used to begin the execution of a thread?

a. run()

b. start()

c. runThread()

d. startThread()


Answer- start()


Que-  Which of these statement is incorrect?

a. A thread can be formed by implementing Runnable interface only

b. A thread can be formed by a class that extends Thread class

c. start() method is used to begin execution of the thread

d. run() method is used to begin execution of a thread before start() method in special cases


Answer- run() method is used to begin execution of a thread before start() method in special cases


Que-  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- getPriority()


Que-  Which of these method of Thread class is used to Suspend a thread for a period of time?

a. sleep()

b. terminate()

c. suspend()

d. stop()


Answer- sleep()


Que-  Which function of pre defined class Thread is used to check weather current thread being checked is still running?

a. isAlive()

b. Join()

c. isRunning()

d. Alive()


Answer- isAlive()


Que-  Which of these keywords are used to implement synchronization?

a. synchronize

b. syn

c. synch

d. synchronized


Answer- synchronized


Que-  Which of this method is used to avoid polling in Java?

a. wait()

b. notify()

c. notifyAll()

d. all of the mentioned


Answer- all of the mentioned


Que-  Which of these method is used to tell the calling thread to give up a monitor and go to sleep until some other thread enters the same monitor?

a. wait()

b. notify()

c. notifyAll()

d. sleep()


Answer- wait()


Que-  Which of these method wakes up the first thread that called wait()?

a. wake()

b. notify()

c. start()

d. notifyAll()


Answer- notify()


Que-  Which of these method wakes up all the threads?

a. wakeAll()

b. notify()

c. start()

d. notifyAll()


Answer- notifyAll()


Que-  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 the require


Answer- It's a process of handling situations when two or more threads need access to a shared resource


Que-  What does AWT stands for?

a. All Window Tools

b. All Writing Tools

c. Abstract Window Toolkit

d. Abstract Writing Toolkit


Answer- Abstract Window Toolkit


Que-  Which of these is used to perform all input & output operations in Java?

a. streams

b. Variables

c. classes

d. Methods


Answer- streams


Que-  Which of these is a type of stream in Java?

a. Integer stream

b. Short stream

c. Byte stream

d. Long stream


Answer- Byte stream


Que-  Which of these classes are used by Byte streams for input and output operation?

a. InputStream

b. InputOutputStream

c. Reader

d. All of the mentioned


Answer- InputStream


Que-  Which of these classes are used by character streams for input and output operations?

a. InputStream

b. Writer

c. ReadStream

d. InputOutputStream


Answer- Writer


Que-  Which of these class is used to read from byte array?

a. InputStream

b. BufferedInputStream

c. ArrayInputStream

d. ByteArrayInputStream


Answer- ByteArrayInputStream


Que-  Which exception is thrown by read() method?

a. IOException

b. InterruptedException

c. SystemException

d. SystemInputException


Answer- IOException


Que-  Which of these is used to read a string from the input stream?

a. get()

b. getLine()

c. read()

d. readLine()


Answer- read()


Que-  Which of these class is used to read characters and strings in Java from console?

a. BufferedReader

b. StringReader

c. BufferedStreamReader

d. InputStreamReader


Answer- BufferedReader


Que-  Which of these class is implemented by FilterInputStream class?

a. InputStream

b. InputOutputStream

c. BufferedInputStream

d. SequenceInputStream


Answer- InputStream

Previous Post Next Post