Skip to main content

Web Design and Development MCQs with Answers

Practice important Web Design and Development MCQs with answers and explanations.

Chapter: 0
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
Correct Answer: A
Chapter: 0
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
Correct Answer: A
Chapter: 0
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( )
Correct Answer: A
Chapter: 0
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
Correct Answer: D
Chapter: 0
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
Correct Answer: B
Chapter: 0
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.
Correct Answer: B
Chapter: 0
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
Correct Answer: B
Chapter: 0
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
Correct Answer: B
Chapter: 0
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
Correct Answer: D
Chapter: 0
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
Correct Answer: A
Chapter: 0
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
Correct Answer: B
Chapter: 0
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
Correct Answer: D
Chapter: 0
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
Correct Answer: B
Chapter: 0
Q714:
A top level class may have only the following access modifier.
A. Package
B. Private
C. Protected
D. Public
Correct Answer: D
Chapter: 0
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()
Correct Answer: A
Chapter: 0
Q716:
In Java, which of these classes implement the LayoutManager interface?
A. RowLayout
B. ColumnLayout
C. GridBagLayout
D. FlowLayoutManager
Correct Answer: C
Chapter: 0
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
Correct Answer: B
Chapter: 0
Q718:
Which of the following exception belongs to a category of unchecked exception?
A. IOException
B. Null Pointer exception
C. AWTException
D. ClassNotFoundException
Correct Answer: B
Chapter: 0
Q719:
All the exceptions and errors in java are inherited from _____ class.
A. Exception
B. Error
C. Throwable
D. IOException
Correct Answer: C
Chapter: 0
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
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Web Design and Development

🚀 Start Quiz Now