Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q721: When defining a method you must include a/an ....... to declare any exception that might be thrown but is not caught in the method:
- A: try block
- B: finally block
- C: catch block
- D: throws clause
View Answer
D
Q722: The classes which contain the word _____ are expected to use it to handle files
- A: Read
- B: File
- C: Stream
- D: Create
View Answer
C
Q723: Which of the following is not true about InputStream?
- A: InputStream is an abstract class
- B: FileInputStream is a subclass of InputStream
- C: InputStream opens the file automatically when it is created
- D: None of the above
View Answer
C
Q724: The ________ method of a servlet is used to handle GET request.
- A: init()
- B: get()
- C: getRequest()
- D: doGet()
View Answer
D
Q725: The ________ method of a servlet is used to handle POST request.
- A: init()
- B: post()
- C: postRequest()
- D: doPost()
View Answer
D
Q726: Which of the following statements is correct?
- A: The init method initializes a servlet
- B: The init method must be called explicitly
- C: The init method is called only once for each servlet instance
- D: The init method is called once for each request
View Answer
C
Q727: In java, how do you prevent a class from being subclassed?
- A: Mark the class as final
- B: Mark the class as static
- C: Mark the class as abstract
- D: Mark the class as final and static
View Answer
A
Q728: Which of these is a correct signature of the main method?
- A: public static void main()
- B: public static void main(String[] args)
- C: public void main(String[] args)
- D: public static void main(String args)
View Answer
B
Q729: Which of these classes is synchronized?
- A: Vector
- B: ArrayList
- C: HashMap
- D: All of the above
View Answer
A
Q730: Which of these can be used to make a thread wait for another thread to finish?
- A: join()
- B: wait()
- C: sleep()
- D: stop()
View Answer
A