Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q121: Which of the following syntax is used to attach an input stream to the console?
- A: FileReader fr = new FileReader(' input.txt ') ;
- B: FileReader fr = new FileReader(FileDescriptor.in);
- C: FileReader fr = new FileReader(FileDescriptor);
- D: FileReader fr = new FileReader(console);
View Answer
B
Q122: Window frame and dialog use ________ as their default layout.
- A: Border layout
- B: Flow layout
- C: GridBag layout
- D: Grid layout
View Answer
A
Q123: There are _________ types of exceptions in Java
- A: 2
- B: 3
- C: 4
- D: 5
View Answer
A
Q124: In the given code, what exception is caught by the catch block?
- A: IOException
- B: NullPointerException
- C: FileNotFoundException
- D: ArrayIndexOutOfBoundsException
View Answer
A
Q125: Which block always executes, even if an exception is not thrown?
- A: 'try'
- B: 'catch'
- C: 'finally'
- D: 'throws'
View Answer
C
Q126: What does the 'printStackTrace()' method do?
- A: It prints the exception message
- B: It prints the stack trace of the exception
- C: It prints the exception name
- D: It prints the exception description
View Answer
B
Q127: What is the purpose of Java I/O streams?
- A: To handle exceptions
- B: To read and write data
- C: To manage memory allocation
- D: To compile Java code
View Answer
B
Q128: Which class in Java is used to read data from a file?
- A: FileReader
- B: PrintWriter
- C: BufferedReader
- D: ObjectOutputStream
View Answer
A
Q129: What does the BufferedReader class do in Java I/O?
- A: Provides compression
- B: Buffers input for efficient reading
- C: Writes data to a file
- D: Encrypts data
View Answer
B
Q130: What is the purpose of the PrintWriter class in Java?
- A: To write data to files
- B: To read data from files
- C: To buffer input data
- D: To manage network connections
View Answer
A