Skip to main content

Web Design and Development MCQs with Answers

Practice important Web Design and Development MCQs with answers and explanations.

Multiple Choice Questions

Q361: What happens if you call start() on a thread that has already started?
  • A: It restarts the thread
  • B: It throws an exception
  • C: It does nothing
  • D: It stops the thread
View Answer
B

Q362: What is the primary difference between using Runnable interface and Thread class for multithreading?
  • A: Runnable requires thread creation, Thread does not
  • B: Thread class can be extended, Runnable cannot
  • C: Runnable requires extending a class, Thread does not
  • D: Both achieve the same result with different approaches
View Answer
D

Q363: In the PriorityEx.java example, what priority is assigned to the 'first' thread?
  • A: MAX_PRIORITY
  • B: MIN_PRIORITY
  • C: NORM_PRIORITY
  • D: 5
View Answer
B

Q364: Which class provides methods to manage thread priorities in Java?
  • A: Thread
  • B: Runnable
  • C: ExecutorService
  • D: Scheduler
View Answer
A

Q365: What issue may arise from using thread priorities in Java?
  • A: Priority mapping differences between JVM and OS
  • B: Increased CPU usage
  • C: Faster thread execution
  • D: Enhanced memory management
View Answer
A

Q366: What is the output of the ThreeLoopTest program with sequential execution?
  • A: All loops run simultaneously
  • B: Loops run one after another
  • C: Loops run in reverse order
  • D: Loops run in random order
View Answer
B

Q367: What keyword is used in Java to prevent a field from being serialized?
  • A: static
  • B: final
  • C: transient
  • D: volatile
View Answer
C

Q368: In the ThreadTest.java example using inheritance, what is the role of the Worker class?
  • A: It manages thread priorities
  • B: It provides the thread execution code
  • C: It initializes the thread scheduler
  • D: It handles thread synchronization
View Answer
B

Q369: What exception is thrown if an invalid priority is set for a thread?
  • A: IllegalArgumentException
  • B: IllegalThreadStateException
  • C: NullPointerException
  • D: ArrayIndexOutOfBoundsException
View Answer
A

Q370: Which method should be called to execute code in a thread?
  • A: run()
  • B: start()
  • C: execute()
  • D: runThread()
View Answer
B

Test Your Knowledge

Take a timed quiz on Web Design and Development

🚀 Start Quiz Now