McqMate
These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Bachelor of Computer Applications (BCA) , Bachelor of Science in Computer Science (BSc CS) , Master of Computer Applications (MCA) , Programming Languages .
| 101. |
Java supports input/output of data through the classes included in the _______ package: a) jav |
| A. | oi |
| B. | java.out |
| C. | java.in |
| D. | java.io |
| Answer» D. java.io | |
| 102. |
The ________ method help in clearing the contents of the buffer: |
| A. | flush() |
| B. | clear() |
| C. | rub() |
| D. | vanish() |
| Answer» A. flush() | |
| 103. |
The _______ class is used to write bytes to a file: |
| A. | FileInputStream |
| B. | FileOutputStream |
| C. | FileBufferStream |
| D. | FileStringStream |
| Answer» B. FileOutputStream | |
| 104. |
The _______ class is used to read characters from the file: |
| A. | StreamReader |
| B. | CharacterReader |
| C. | InputReader |
| D. | FileReader |
| Answer» D. FileReader | |
| 105. |
DataInputStream class contains methods to read________ |
| A. | Non primitive data type |
| B. | Primitive data type |
| C. | Formatted data |
| D. | all of the above |
| Answer» B. Primitive data type | |
| 106. |
Whenever the applet requires to redraw its output, it is done by using method |
| A. | display() |
| B. | paint() |
| C. | displayApplet() |
| D. | PrintApplet() |
| Answer» B. paint() | |
| 107. |
Which of these methods can be used to output a string in an applet? |
| A. | display() |
| B. | print() |
| C. | drawString() |
| D. | transient() |
| Answer» C. drawString() | |
| 108. |
What does AWT stands for? |
| A. | All Window Tools |
| B. | All Writing Tools |
| C. | Abstract Window Toolkit |
| D. | Abstract Writing Toolkit |
| Answer» C. Abstract Window Toolkit | |
| 109. |
Which of these packages contains all the classes and methods required for event handling in Java? a) jav |
| A. | applet |
| B. | java.awt |
| C. | java.event |
| D. | java.awt.event |
| Answer» D. java.awt.event | |
| 110. |
What is an event in delegation event model used by Java programming language? |
| A. | An event is an object that describes a state change in a source. |
| B. | An event is an object that describes a state change in processing. |
| C. | An event is an object that describes any change by the user and system. |
| D. | An event is a class used for defining object, to create events. |
| Answer» A. An event is an object that describes a state change in a source. | |
| 111. |
Which of these methods are used to register a keyboard event listener? |
| A. | KeyListener() |
| B. | addKistener() |
| C. | addKeyListener() |
| D. | eventKeyboardListener() |
| Answer» C. addKeyListener() | |
| 112. |
Which of these methods are used to register a MouseMotionListener? |
| A. | addMouse() |
| B. | addMouseListener() |
| C. | addMouseMotionListner() |
| D. | eventMouseMotionListener() |
| Answer» C. addMouseMotionListner() | |
| 113. |
What is a listener in context to event handling? |
| A. | A listener is a variable that is notified when an event occurs. |
| B. | A listener is an interface that is notified when an event occurs. |
| C. | A listener is a method that is notified when an event occurs. |
| D. | None of the mentioned |
| Answer» B. A listener is an interface that is notified when an event occurs. | |
| 114. |
Which of these class is super class of all AWT events? |
| A. | AWTEvent |
| B. | EventClass |
| C. | ActionEvent |
| D. | ItemEvent |
| Answer» A. AWTEvent | |
| 115. |
Which of these events will be generated if scroll bar is manipulated? |
| A. | ActionEvent |
| B. | ComponentEvent |
| C. | AdjustmentEvent |
| D. | WindowEvent |
| Answer» C. AdjustmentEvent | |
| 116. |
Which of these events will be generated if we close a Frame window? |
| A. | ActionEvent |
| B. | ComponentEvent |
| C. | AdjustmentEvent |
| D. | WindowEvent |
| Answer» D. WindowEvent | |
| 117. |
Which of these events is generated when a button is pressed? |
| A. | ActionEvent |
| B. | KeyEvent |
| C. | WindowEvent |
| D. | AdjustmentEvent |
| Answer» A. ActionEvent | |
| 118. |
Which of these methods can be used to obtain the command name for ActionEvent object? |
| A. | getCommand() |
| B. | getActionCommand() |
| C. | getActionEvent() |
| D. | getActionEventCommand() |
| Answer» B. getActionCommand() | |
| 119. |
Which of these methods in KeyEvent class can be used to know which key is pressed? |
| A. | getKeyCode() |
| B. | getModifier() |
| C. | getActionKey() |
| D. | getActionEvent() |
| Answer» A. getKeyCode() | |
| 120. |
Which of these interfaces define a method actionPerformed()? |
| A. | ComponentListener |
| B. | ContainerListener |
| C. | ActionListener |
| D. | InputListener |
| Answer» C. ActionListener | |
| 121. |
Which of these interfaces define a method itemStateChanged()? |
| A. | ComponentListener |
| B. | ContainerListener |
| C. | ActionListener |
| D. | ItemListener |
| Answer» D. ItemListener | |
| 122. |
What are the sequences of method executed when an Applet starts execution? |
| A. | init(),start(),stop(),destroy() |
| B. | load(),start(),stop(),unload() |
| C. | init(),activate(),deactivate(),destroy() |
| D. | start(),init(),destroy(),stop() |
| Answer» A. init(),start(),stop(),destroy() | |
| 123. |
The default layout manager of an Applet is |
| A. | Flowlayout |
| B. | Gridlayout |
| C. | BorderLayout |
| D. | BoxLayout |
| Answer» A. Flowlayout | |
| 124. |
The default layout manager of a Frame is |
| A. | Flowlayout |
| B. | Gridlayout |
| C. | BorderLayout |
| D. | BoxLayout |
| Answer» C. BorderLayout | |
| 125. |
Which package consist an applet class? a) jav |
| A. | applet |
| B. | java.awt |
| C. | java.awt.applet |
| D. | java.event |
| Answer» A. applet | |
| 126. |
How do you position a component using FlowLayout? |
| A. | North, South, East, West |
| B. | Assign a row/column grid reference |
| C. | Pass a X/Y percentage parameter to the add method |
| D. | Do nothing, the FlowLayout will position the component |
| Answer» D. Do nothing, the FlowLayout will position the component | |
| 127. |
How do you change the current layout manager for a container |
| A. | Use the setLayout() method |
| B. | Once created you cannot change the current layout manager of a component |
| C. | Use the setLayoutManager() method |
| D. | Use the updateLayout() method |
| Answer» A. Use the setLayout() method | |
| 128. |
The AWT component used to display a single line of read-only text |
| A. | A checkbox |
| B. | A Label |
| C. | A button |
| D. | A TextField |
| Answer» B. A Label | |
| 129. |
The method to get the text of a Label |
| A. | getLabel() |
| B. | getText() |
| C. | getString() |
| D. | getData() |
| Answer» B. getText() | |
| 130. |
The AWT component used for taking input from user. |
| A. | A TextBox |
| B. | A Label |
| C. | A button |
| D. | A TextField |
| Answer» D. A TextField | |
| 131. |
The method to set the text of Textfield. |
| A. | setLabel() |
| B. | setString() |
| C. | setText() |
| D. | setData() |
| Answer» C. setText() | |
| 132. |
The class used to create a Radio button in awt is |
| A. | Checkbox |
| B. | RadioButton |
| C. | OptionButton |
| D. | CheckboxGroup |
| Answer» D. CheckboxGroup | |
| 133. |
A ------------ is an object that the user can see on the screen and-in most cases-interact with. |
| A. | an Event |
| B. | a window |
| C. | a Component |
| D. | a Listener |
| Answer» C. a Component | |
| 134. |
A ------------- is a component that can hold other components. |
| A. | A window |
| B. | a container |
| C. | A control |
| D. | a form |
| Answer» B. a container | |
| 135. |
The method that returns the selected item from a List component is |
| A. | getSelected() |
| B. | getSelectedString() |
| C. | getSelectedItem() |
| D. | getSelectedData() |
| Answer» C. getSelectedItem() | |
| 136. |
The class used to make a standalone application in java. |
| A. | Applet |
| B. | Panel |
| C. | Frame |
| D. | Form |
| Answer» C. Frame | |
| 137. |
------------------- is an example of container class |
| A. | Label |
| B. | Panel |
| C. | TextField |
| D. | Button |
| Answer» B. Panel | |
| 138. |
The class used to encapsulate fonts is |
| A. | Graphics |
| B. | Font |
| C. | Applet |
| D. | Component |
| Answer» B. Font | |
| 139. |
The method used to set Fonts is |
| A. | setFontName() |
| B. | setFont() |
| C. | setFontText() |
| D. | none of these |
| Answer» B. setFont() | |
| 140. |
The method setFont() is defined in---------- class |
| A. | Applet |
| B. | Font |
| C. | Container |
| D. | Component |
| Answer» D. Component | |
| 141. |
The layout manager that lets you align components at north, south, east, west directions is |
| A. | BorderLayout |
| B. | GridLayout |
| C. | FlowLayout |
| D. | GridBagLayout |
| Answer» A. BorderLayout | |
| 142. |
The layout manager that lays out a container's components in a rectangular grid. |
| A. | BorderLayout |
| B. | GridLayout |
| C. | FlowLayout |
| D. | GridBagLayout |
| Answer» B. GridLayout | |
| 143. |
The class used for drawing graphics in an application is |
| A. | Canvas |
| B. | Graphics |
| C. | Layer |
| D. | Container |
| Answer» B. Graphics | |
| 144. |
The method in Graphics class to draw a circle/oval with specified width and height. |
| A. | drawCircle() |
| B. | drawShape() |
| C. | drawOval() |
| D. | none of these |
| Answer» C. drawOval() | |
| 145. |
The method in Graphics class to set the drawing color |
| A. | setForeground() |
| B. | setDrawingColor() |
| C. | setBrushColor() |
| D. | setColor() |
| Answer» D. setColor() | |
| 146. |
The method used to draw an ellipse is |
| A. | drawEllipse() |
| B. | drawCircle() |
| C. | drawOval() |
| D. | none of these |
| Answer» C. drawOval() | |
| 147. |
Which of the following statements is legal in Java? (i) mysRef = (Mystery) mySecret; (ii) mysRef = (Mystery) secRef; |
| A. | Only (i) |
| B. | Only (ii) |
| C. | Both (i) and (ii) |
| D. | None of these |
| Answer» B. Only (ii) | |
| 148. |
In a ____ control structure, the computer executes particular statements depending on some condition(s). |
| A. | looping |
| B. | repetition |
| C. | selection |
| D. | sequence |
| Answer» C. selection | |
| 149. |
What is the value of y if x = 2? |
| A. | 2 |
| B. | 3 |
| C. | 7 |
| D. | 9 |
| Answer» D. 9 | |
| 150. |
Two-way selection in Java is implemented using ________. |
| A. | if statements |
| B. | for loops |
| C. | if...else statements |
| D. | sequential statements |
| Answer» C. if...else statements | |
Done Studing? Take A Test.
Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.