Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q711: What if the main method is declared as private?
- A: The program does not compile
- B: The program compiles but does not run
- C: The program compiles and runs properly
- D: The program throws an exception on compile time
View Answer
B
Q712: A member variable or method prefixed by the protected access modifier can be accessed:
- A: Within the same class
- B: Within the sub-class
- C: Within the same package
- D: All of the above
View Answer
D
Q713: A top level class without any modifier is accessible to
- A: any class
- B: any class within the same package
- C: any class within the same file
- D: any subclass of this class
View Answer
B
Q714: A top level class may have only the following access modifier.
- A: Package
- B: Private
- C: Protected
- D: Public
View Answer
D
Q715: Given a one-dimensional array arr, what is the correct way of getting the number of elements in arr
- A: arr.length
- B: arr.length – 1
- C: arr.size – 1
- D: arr.length()
View Answer
A
Q716: In Java, which of these classes implement the LayoutManager interface?
- A: RowLayout
- B: ColumnLayout
- C: GridBagLayout
- D: FlowLayoutManager
View Answer
C
Q717: Which of the following belongs to a category of checked exception?
- A: Null Pointer exception
- B: IOException
- C: Array index out of bounds
- D: NumberFormatException
View Answer
B
Q718: Which of the following exception belongs to a category of unchecked exception?
- A: IOException
- B: Null Pointer exception
- C: AWTException
- D: ClassNotFoundException
View Answer
B
Q719: All the exceptions and errors in java are inherited from _____ class.
- A: Exception
- B: Error
- C: Throwable
- D: IOException
View Answer
C
Q720: Which of the following package needs to be imported while handling files?
- A: java.util
- B: java.io
- C: java.awt
- D: javax.swing
View Answer
B