Java Applets and Servlets MCQs | PROGRAMMING IN JAVA Assignment 8 | NPTEL

PROGRAMMING IN JAVA Assignment 8 | NPTEL | Answer with Explanation |Java Applets and Servlets MCQs

Test Your Java Fundamentals with a Challenging MCQ Assignment on " Java Applets and Servlets IN jAVA " Sharpen your core Java skills with this engaging multiple-choice quiz (MCQ). Designed for beginners, this Assignment 8 assesses your understanding of Java Applets and Servlets Java concepts. Whether you're new to programming or refreshing your knowledge, this MCQ [ Java Applets and Servlets ] challenge is a perfect way to gauge your progress and identify areas for improvement.

Learn Java Programming for free with Computer Course - CompEduBox Android app. Share with your Friends

QUESTION 1: Which of the following is NOT a class of java.awt package?

a. Color
b. Composite
c. Container
d. Cursor
View Answer

Correct Answer: b. Composite

Detailed Solution: Composite is an interface of the java.awt package.

QUESTION 2: Which of the following is/are NOT an exception of java.awt package?

a. HeadlessException
b. AWTException
c. FontFormatException
d. IllegalStateException
View Answer

Correct Answer: d. IllegalStateException

Detailed Solution: IllegalStateException does not belong to the java.awt package.

QUESTION 3: Which of the following method is/are of class button in java.awt package?

a. getLabel()
b. setLabel(String label)
c. getCurrent()
d. getItem(int index)
View Answer

Correct Answer: a, b

Detailed Solution: setLabel(String label) method Changes this button's label to be the String argument, and getLabel() method returns the current label of the button.

QUESTION 4: Which of the following is TRUE about the following GUI?

b. There is a Frame with two Labels and two non-editable TextFields.
c. There are two Labels.
d. There is a Frame with two Labels and two TextFields.
View Answer

Correct Answer: d. There is a Frame with two Labels and two TextFields.

Detailed Solution: There is a Frame with two Labels and two TextFields in the given GUI.

QUESTION 5: Which of the following is TRUE regarding check box and radio button?

a. Check box is used for single selection item whereas radio button is used for multiple selection.
b. Check box is used for multiple selection items whereas radio button is used for single selection.
c. Both are used for multiple as well as single item selection.
d. Checkbox is always preferred than radio buttons.
View Answer

Correct Answer: b. Check box is used for multiple selection items whereas radio button is used for single selection.

Detailed Solution: Check box is used for multiple selection items whereas radio button is used for single selection. For example, if a form is asking for your favorite hobbies, there might be multiple correct answers to it; in that case, a check box is preferred. And if a form is asking about gender, there must be only one true option among the multiple choices; in that case, radio buttons are used.

QUESTION 6: Which of the following is TRUE about check box in Java?

a. A check box can be in either an "on" (true) or "off" (false) state.
b. Clicking on a check box changes its state from "on" to "off" or from "off" to "on."
c. A check box can be in an "on" (true) and in "off" (false) state simultaneously.
d. Check boxes cannot be grouped together.
View Answer

Correct Answer: a, b

Detailed Solution: A check box is a graphical component that can be in either an "on" (true) or "off" (false) state. Clicking on a check box changes its state from "on" to "off" or from "off" to "on." A check box cannot be in both “on” and “off” state simultaneously. Further, several check boxes can be grouped together under the control of a single object using the CheckboxGroup class. In a check box group, at most one button can be in the "on" state at any given time.

QUESTION 7: Which of the following method is used to remove all items from scrolling list in java.awt.list?

a. hide()
b. remove()
c. clear()
d. close()
View Answer

Correct Answer: c. clear()

Detailed Solution: The function clear() in java.awt.list is used to remove all items from the scrolling list.

QUESTION 8: Which of the following statement is FALSE about the update() in java.awt package?

a. Sets the color of the graphics context to be the foreground color of this component.
b. Calls this component's paint method to completely redraw this component.
c. Updates the component by checking an online repository.
d. Clears this component by filling it with the background color.
View Answer

Correct Answer: c. Updates the component by checking an online repository.

Detailed Solution: The update() function does not update the component by checking an online repository. Instead, it sets the color of the graphics context to be the foreground color of this component, calls this component's paint method to completely redraw the component, and clears this component by filling it with the background color.

QUESTION 9: Which of the following is the latest graphics and media package for Java?

a. Applet
b. AWT
c. Swing
d. JavaFX
View Answer

Correct Answer: d. JavaFX

Detailed Solution: JavaFX is a set of the latest graphics and media packages in Java that enables developers to design, create, test, debug, and deploy rich client applications that operate consistently across diverse platforms.

QUESTION 10: If setText(String text) is a method of Label class then why it is called non editable?

a. Because user-input is unavailable during runtime.
b. A Label is just a TextField with non-editable property turned on.
c. Labels are editable by default.
d. setText(String text) is not a method of Label class.
View Answer

Correct Answer: a. Because user-input is unavailable during runtime.

Detailed Solution: A label class is non-editable during runtime by the user, but internal functions can change the text using the setText(String text) function.

PYQ | The Joy of Computing using Python - Course | NPTEL

Learn Java Programming for free with Computer Course - CompEduBox Android app. Share with your Friends

Post a Comment

0 Comments