A question bank for every class and subject

Practice questions, with answers and explanations included

794 questions available

Refine

All questions

794 results
501

Which method is used to retrieve the text typed into a jTextField?

MCQ Easy
a. setText()
b. getText()
c. isEditable()
d. setVisible()
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
getText()
Explanation: getText() is a getter method used to retrieve the text/content of a component like jTextField.
502

Convert: 1 KB = ______ GB (Hint: use the conversion chain).

SHORT Hard
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: 1 KB = 1 x 1024^2 GB = 1048576 GB.
503

A constructor that initializes all data members with default values and takes no parameters is called a:

MCQ Medium
a. Copy constructor
b. Parameterized constructor
c. Parameter-less (default) constructor
d. Static constructor
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Parameter-less (default) constructor
Explanation: A parameter-less (default) constructor takes no parameters and typically initializes members with default values.
504

Which component allows only a single line of confidential input, hiding characters with an echo character (default '*')?

MCQ Easy
a. jTextArea
b. jPasswordField
c. jTextField
d. jLabel
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
jPasswordField
Explanation: jPasswordField is used for confidential single-line input, replacing each character with an echo character (default asterisk).
505

Convert: 2 KB = ______ GB (Hint: use the conversion chain).

SHORT Hard
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: 2 KB = 2 x 1024^2 GB = 2097152 GB.
506

Which keyword is used to create a new object of a class in Java?

MCQ Easy
a. create
b. new
c. make
d. object
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
new
Explanation: The keyword 'new' is used to create a new object of a class, e.g., Book book1 = new Book();
507

Which component is preferred over checkboxes when many options are available and space needs to be saved?

MCQ Medium
a. jRadioButton
b. jList
c. jTextArea
d. jLabel
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
jList
Explanation: jList is preferred over checkboxes when multiple options need to be selected from a large set, as it saves space.
508

Convert: 3 KB = ______ GB (Hint: use the conversion chain).

SHORT Hard
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: 3 KB = 3 x 1024^2 GB = 3145728 GB.
509

Which operator is used to access data members and method members of an object?

MCQ Easy
a. Colon (:)
b. Dot (.)
c. Arrow (->)
d. Hash (#)
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Dot (.)
Explanation: The dot (.) operator is used to access data/method members of an object, e.g., book1.display();
510

Which JOptionPane method shows a modal dialog box that prompts the user for text input?

MCQ Medium
a. showMessageDialog()
b. showConfirmDialog()
c. showInputDialog()
d. showOptionDialog()
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
showInputDialog()
Explanation: showInputDialog() displays a modal dialog with a text box for the user to enter input.
511

Convert: 1 MB = ______ TB (Hint: use the conversion chain).

SHORT Hard
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: 1 MB = 1 x 1024^2 TB = 1048576 TB.
512

Why do all Java classes have access to methods like hashCode() and wait() even without defining them?

MCQ Hard
a. They are keywords, not methods
b. All Java classes inherit from the base class Object
c. They are automatically generated randomly
d. They must be imported manually
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
All Java classes inherit from the base class Object
Explanation: All Java classes inherit from the base class Object, which defines methods like hashCode() and wait() that become available to every class.
513

Getter methods in Java GUI components typically start with which word?

MCQ Easy
a. set
b. get
c. is
d. has
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
get
Explanation: Getter methods extract information from an object and typically start with 'get' (e.g., getText()).
514

Convert: 2 MB = ______ TB (Hint: use the conversion chain).

SHORT Hard
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: 2 MB = 2 x 1024^2 TB = 2097152 TB.
515

Which access modifier makes a data member or method visible ONLY within its own class?

MCQ Easy
a. public
b. private
c. static
d. final
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
private
Explanation: The private access modifier restricts visibility of a member to within its own class only.
516

Deleting a parent (container) control also deletes all its child controls.

TRUE FALSE Medium
a. TRUE
b. FALSE
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
TRUE
Explanation: Since child controls are placed inside a parent/container control, deleting the parent deletes all its children.
517

Convert: 3 MB = ______ TB (Hint: use the conversion chain).

SHORT Hard
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: 3 MB = 3 x 1024^2 TB = 3145728 TB.
518

By default (if no access modifier is specified), what is the visibility of a class member in Java?

MCQ Medium
a. private
b. public
c. protected
d. It has no visibility
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
public
Explanation: By default, all members of a class are public, meaning they are visible both within and outside the class.
519

Two components on the SAME form can have identical names.

TRUE FALSE Medium
a. TRUE
b. FALSE
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
FALSE
Explanation: Objects on the same form cannot have the same name, though two different forms may contain objects with the same name.
520

Convert: 1 Bytes = ______ MB (Hint: use the conversion chain).

SHORT Hard
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: 1 Bytes = 1 x 1024^2 MB = 1048576 MB.