S A M P L E
CPS 1 (Ramm) Spring 1998 28 January 1998
Quiz #2
Name ___________________ Honor Code________________________ Section _____
(Note: Getting your Name and Section right is worth one point. If we can't
decipher your name or section, it's wrong.)
A. True or false questions regarding HTML and Web Page
3 examples (there will be more):
1) The H in HTML stands for Header information. (True/False?)
2) The HTML tag
is used to indicate the start of large italic text.
(True/False?)
3) In HTML,
is used to start major paragraphs while
is used to
separate individual lines. (True/False?)
B. Assume the applet below is run on the Web or the appletviewer. On the
back sketch what the screen would look like after the middle button is
pushed.
import java.awt.*;
public class Eat extends java.applet.Applet
{
TextField mInstruct,mAnswer;
Button bChinese,bMexican,bItalian;
public void init ()
{
mInstruct = new TextField(80);
mInstruct.setText("What kind of food do you like?");
bChinese = new Button("Chinese");
bMexican = new Button("Mexican");
bItalian = new Button("Italian");
mAnswer = new TextField(80);
add(mInstruct) ;
add(bChinese) ;
add(bMexican) ;
add(bItalian) ;
add(mAnswer) ;
}
public boolean action(Event e,Object obj)
{
if (e.target == bChinese)
{
mAnswer.setText("Mandarin House");
return true;
}
if (e.target == bMexican)
{
mAnswer.setText("Margaret's Cantina");
return true;
}
if (e.target == bItalian)
{
mAnswer.setText("Aurora");
return true;
}
return false;
}
}