Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Chapter 20 Applets – absolute java test bank


 

Download  file with the answers

Not a member!
Create a FREE account here to get access and download this file with answers


Chapter 20
Applets
 Multiple Choice
1) HTML stands for:
(a) Hyperlink Making Language
(b) Hyper Markup Language
(c) Hypertext Markup Language
(d) Homepage Markup Language

2) URL stands for:
(a) Unified Resource Locator
(b) Uniform Reader Locator
(c) Uniform Resource Locator
(d) Uniform Resource Language

3) Java _____________ were intended to be run over the Internet.
(a) applications
(b) applets
(c) both A and B
(d) none of the above

4) To use the JApplet class, you must import the ______________ package.
(a) java.awt
(b) java.lang
(c) java.util
(d) javax.swing

5) Applets do not normally have constructors. The ___________ method performs the initialization of instance variables.
(a) setJMenuBar()
(b) init()
(c) paint()
(d) close()

6) The class ___________ converts a digital picture to an icon for us in an applet.
(a) ImageIcon
(b) JAppletIcon
(c) IconImage
(d) IconJApplet

7) When you place an applet in an HTML document, you give the name of the _____________ file for the applet.
(a) .java
(b) .class
(c) both A & B
(d) none of the above

 True/False
1) The terms HTML document and HTML page mean the same thing.

2) HTML is part of the Java language.

3) The purpose of the address tag is to contain the e-mail address for contacting the document’s maintainer as well as the date that the document was last modified.

4) HTML is case sensitive.

5) Images can be embedded within HTML pages.

6) HTML is a high-level language.

7) An applet class is normally defined as a derived class of the class JApplet.

8) Applets normally do not contain a main method.

9) Applets do not support JMenus.

10) An applet is embedded within an HTML document by adding a reference to a valid class file within the tag.

 Short Answer/Essay
1) Create an HTML block that will display “Absolute Java” in the largest standard heading.
Answer:

Absolute Java

2) Write an HTML comment containing the phrase “This is a comment.”
Answer: <!—This is a comment –>
3) Write an HTML statement to create a hyperlink to www.java.sun.com. The link should read “Java Doc”.
Answer: Java Doc
4) Write a complete Java applet that displays the phrase “Welcome to my world!” in the center of the applet.
Answer:
import javax.swing.JApplet;
import javax.swing.JLabel;
import java.awt.Container;
import java.awt.BorderLayout;

public class myApplet extends JApplet
{
public void init()
{
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
JLabel label = new JLabel(“Welcome to my world!”);
contentPane.add(label, BorderLayout.CENTER);
}
}
5) Create an HTML page for the applet created in number 4 above (the class file is named myApplet.class).
Answer:

6) What are the steps for converting a Swing application to an Applet?
1) Replace extends JFrame with extends Applet.
2) Remove the main method.
3) Replace the constructor with a no-parameter method named init. The body of init can be the same as the body of the constructor.
4) Delete any invocation of super.
5) Delete any method invocations that serve to program the close-window button , such as the setDefaultCloseOperation of the JFrame class.
6) Delete any invocation of setTitle.
7) Delete any invocation of setSize.

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!