Web Design and Development MCQs with Answers
Practice important Web Design and Development MCQs with answers and explanations.
Multiple Choice Questions
Q701: If we remove static from main then program __________
- A: Program cannot compile
- B: Program will compile and work properly
- C: Run time errors
- D: Exception throws in main
View Answer
A
Q702: If we remove String array from main then program __________
- A: Program cannot compile
- B: Program will compile and work properly
- C: Run time errors
- D: Exception throws in main
View Answer
A
Q703: Which of the following methods are invoked by the AWT to support paint and repaint operations?
- A: paint( )
- B: repaint( )
- C: draw( )
- D: redraw( )
View Answer
A
Q704: When defining a method you must include a ___________ 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
Q705: Aside from the Scanner class, which of the following classes can be used for text-file file input?
- A: ObjectInputStream
- B: BufferedReader
- C: StringTokenizer
- D: None of these
View Answer
B
Q706: Which of the following statements is true regarding Vectors with no specified base type?
- A: A base type is needed, because Java needs to know how to allocate memory.
- B: No base type is needed, because Java will use the Object class as a base type.
- C: If a base type is not specified the code will not compile.
- D: No base type is needed because Vectors default to storing String objects.
View Answer
B
Q707: A serializable class must implement the method(s) _________.
- A: readObject and writeObject
- B: Either readObject or writeObject, or both, depending upon the desired behavior
- C: No need to implement any method
- D: None of the given option
View Answer
B
Q708: Which of the following are passed as an argument to the paint ( ) method?
- A: A Canvas object
- B: A Graphics object
- C: An Image object
- D: A paint object
View Answer
B
Q709: The code below draws a line. What color is the line? g.setColor(Color.red.green.yellow.red); g.drawLine(0, 0, 100,100);
- A: Red
- B: Green
- C: Yellow
- D: Black
View Answer
D
Q710: What if the static modifier is removed from the signature of the main method?
- 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
A