Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q351: In PersonInfo class, which field is marked transient to prevent serialization?
- A: name
- B: address
- C: phoneNum
- D: age
View Answer
C
Q352: What is the main benefit of multithreading in an application?
- A: Increased execution speed
- B: Reduced memory usage
- C: Concurrent execution
- D: Simplified code
View Answer
C
Q353: What does a thread in Java refer to?
- A: A lightweight process
- B: A heavy process
- C: A type of exception
- D: A network protocol
View Answer
A
Q354: Which method is used to start a thread in Java?
- A: run()
- B: start()
- C: execute()
- D: begin()
View Answer
B
Q355: What is the default priority of a thread in Java?
- A: 1
- B: 5
- C: 10
- D: 0
View Answer
B
Q356: In Java, which interface must be implemented to create a thread using the interface approach?
- A: Thread
- B: Runnable
- C: Callable
- D: Executor
View Answer
B
Q357: How do you change the priority of a thread in Java?
- A: setPriority()
- B: changePriority()
- C: updatePriority()
- D: adjustPriority()
View Answer
A
Q358: What does the run() method in a Runnable implementation contain?
- A: Thread creation code
- B: Code to be executed by the thread
- C: Code to start the thread
- D: Code to stop the thread
View Answer
B
Q359: How many threads are created in the given example with the Runnable approach in ThreadTest.java?
- A: One
- B: Two
- C: Three
- D: Four
View Answer
C
Q360: In the provided code examples, which class is used to implement the thread behavior directly?
- A: Worker
- B: Runnable
- C: Thread
- D: Executor
View Answer
C