# | Question |
1 | To create a Window in a Java
Application that is compatible with JDK 1.1 (AWT) you can extend
what class(es)? (Choose all that apply) A. javax.swing.JFrame |
2 | Assuming that "objAppFrame"
is an object of a class that extends the Frame class, which statements
is true about the following code sample? (Choose all that apply) objAppFrame.setSize( 500, 100); A. Create a window that is 500 pixels tall
and 100 pixels wide. |
3 | To enable the "X"
button on the title bar of a Java Application to close the Java window
you must add which listener to the frame component? (Choose one) A. Frame listener |
4 | Assuming that this code will
compile, what will the following code display? (Choose all that apply) import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class MyHello_App_Frame extends java.awt.Frame { public void paint(java.awt.Graphics g) { g.drawString("Hello World",100,50); } public static void main( String args [] ) { MyHello_App_Frame objAppFrame = new MyHello_App_Frame(); objAppFrame.setTitle( "Java Application extending java.awt.Frame"); objAppFrame.setSize( 500, 100); objAppFrame.setVisible( true ); } //main() } A. Will display Hello World to the Java Console |
5 | drawString() drawString() is a method in which class? (Choose one) A. java.awt.Graphics |
6 | drawString() If the size of the application is set to 100 x 100, which of the following code samples will compile? (Choose all that apply) A. drawString("Hello World"); |
7 | setVisible() Assuming that "objAppFrame" is an object of a class that extends the Frame class, which statements is true about the following sample code? (Choose all that apply) objAppFrame.setVisible( true ); A. The setVisible() method was inherited
from the Component class. |
8 | x & y Coordinates of the
Java window Which of the following statements is true about the Java window? (Choose all that apply) A. The "x" coordinates go from left to right. |
9 | getInsets() of the Container
class Which of the following statements is true about the getInsets() method of the Container class and the Insets class. A. getInsets() returns an Insets object. B. insets.left & insets.top will determine the upper-left corner location of displayable area. C. Is used to determine where the Java window is placed inside the computer screen. D. None of the above. |
10 | setTitle() Assuming that "objAppFrame" is an object of a class that extends the Frame class, which statements is true about the following sample code? (Choose all that apply) objAppFrame.setTitle( "Hello World" ); A. Hello World will display as a content title inside of the java
window. |