Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

java AWT

Total questions: 12

Worksheet time: 6mins

Name
Class
Date
1.

The following example shows the creation of a

import java.applet.*;

import java.awt.*;


public class Main extends Applet{

public void paint(Graphics g){

g.drawString("Welcome in Java Applet.",40,20);

}

}

a)

a. Banner using Applet

b)

b. Basic Applet

c)

c. Display clock

d)

d. None of the above

2.

The APPLET tag is used to start an applet from both an HTML document and from an applet viewer.

a)

a. True

b)

b. False

3.

What invokes immediately after the start() method and also any time the applet needs to repaint itself in the browser?

a)

a. stop()

b)

b. init()

c)

c. paint()

d)

d. destroy()

4.

import java.awt.*;

import java.applet.*;

public class myapplet extends Applet {

public void paint(Graphics g) {

g.drawString("A Simple Applet", 20, 20);

}

}

a)

a) A Simple Applet

b)

b) A Simple Applet 20 20

c)

c) Compilation Error

d)

d) Runtime Error

5.

import java.awt.*;

import java.applet.*;

public class myapplet extends Applet {

Graphic g;

g.drawString("A Simple Applet", 20, 20);

}

a)

a) 20

b)

b) Default value

c)

c) Compilation Error

d)

d) Runtime Error

6.

How would you change the text of a label to the text contained by an integer named num;

a)

label.setText(num);

b)

label.updateText(num);

c)

label.setTest("num");

d)

label.setText(num+ "");

7.

What object type handles Java's layouts?

a)

Layout Manager

b)

Layout Scheduler

c)

Layout Operator

d)

Layout Director

8.

Which of the following layouts would be good to use for manually placing objects on a GUI?

a)

Flow Layout

b)

Border Layout

c)

Grid Layout

d)

Null Layout

9.

What method(s) must we include in order to implement ActionListener?

a)

paintComponent

b)

actionEvent

c)

actionPerformed

d)

keyPressed

10.

Execution of a java thread begins on which method call?

a)

Run ()

b)

Start ()

c)

Execute ()

d)

Launch ()

11.

How many ways a thread can be created in Java multithreading?

a)

1

b)

2

c)

5

d)

10

12.

Which method is used to make main thread to wait for all child threads

a)

Join ()

b)

Sleep ()

c)

Wait ()

d)

Stop ()