Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Chapter: 0
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
Correct Answer:
D
Chapter: 0
Q722:
The classes which contain the word _____ are expected to use it to handle files
A. Read
B. File
C. Stream
D. Create
Correct Answer:
C
Chapter: 0
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
Correct Answer:
C
Chapter: 0
Q724:
The ________ method of a servlet is used to handle GET request.
A. init()
B. get()
C. getRequest()
D. doGet()
Correct Answer:
D
Chapter: 0
Q725:
The ________ method of a servlet is used to handle POST request.
A. init()
B. post()
C. postRequest()
D. doPost()
Correct Answer:
D
Chapter: 0
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
Correct Answer:
C
Chapter: 0
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
Correct Answer:
A
Chapter: 0
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)
Correct Answer:
B
Chapter: 0
Q729:
Which of these classes is synchronized?
A. Vector
B. ArrayList
C. HashMap
D. All of the above
Correct Answer:
A
Chapter: 0
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()
Correct Answer:
A
Chapter: 0
Q731:
___________ is the process of converting a byte stream into an object.
A. Deserialization
B. Serialization
C. None of the above
D. Both A & B
Correct Answer:
A
Chapter: 0
Q732:
Which of these methods are used to make a thread wait for another thread to finish?
A. wait()
B. notify()
C. join()
D. notifyAll()
Correct Answer:
C