Exercise/Homework EH44

Exercise/Homework EH44

<p>CPSC426 Jave EH44 1</p><p>Exercise/Homework EH44 </p><p>Q1: The browser that executes an applet is generically known as the ______. a.applet storage. b.applet container. c.applet viewer. d.applet executer.</p><p>ANS: </p><p>Q2: You can start an applet initially by using the appletviewer. The applet can be restarted by using which of the following Applet menu items? a.save. b.quit. c.tag. d.reload.</p><p>ANS: </p><p>Q3: Every Java applet or application is composed of at least one: a.public method b.data member c.public class declaration d.imported class</p><p>ANS:</p><p>Q4: When an applet container loads an applet, the container calls three of the applet’s methods. In sequence, these three methods are: a.start, init, stop. b.start, init, paint. c.init, start, stop. d.init, start, paint.</p><p>ANS: </p><p>Q5: To draw on an applet, the programmer must access the ______object in the applet's paint method. a.drawstring b.drawLine c.Graphics d.Pixel</p><p>ANS: </p><p>Q6: When an applet container encounters an HTML file that specifies an applet to execute, the applet container automatically loads ______of the applet from the same directory as that of the HTML file. a.the .java file b.the .class file c.the main line d.the .htm file</p><p>ANS: CPSC426 Jave EH44 2</p><p>Q7: Which of the following will not produce an error when trying to load and run a program with the appletviewer? a.Placing additional characters, such as commas, between the components in the <applet> tag. b.Omitting the ending </applet> tag. c.Creating an applet that is less than 640 pixels by 480 pixels. d.Running the appletviewer with a file name that does not end with .html or .htm .</p><p>ANS: </p><p>Q8: Which method is called once by the applet container when an applet is loaded for execution. a.start b.init c.paint d.load</p><p>ANS: </p><p>Q9: Which method is called by the applet container when the applet is being removed from memory. a.stop b.remove c.destroy d.end</p><p>ANS: </p><p>Q10: Which method should be used to draw a line of text on an applet? a.Graphics method drawText. b.Text method drawLine. c.Graphics method drawLine. d.Graphics method drawString.</p><p>ANS: </p><p>Q11: To draw a single black line from (0, 15) to (20, 25), call the method ______in the paint method. a.g.drawLine( 0, 15, 20, 25 ); b.g.drawString( "black", 0, 15 ); c.g.drawLine( 0, 15, 20, 10 ); d.g.drawLine( 15, 0, 25, 20 );</p><p>ANS: </p><p>Q12: The Java platform uses the ______to prevent code that is downloaded to your local computer from accessing local system resources, such as files. a.blackbox security model. b.sandbox security model. c.whitebox security model. d.download security model.</p><p>ANS: CPSC426 Jave EH44 3</p><p>Q13: Write an applet that draws rectangles of different sizes and locations.</p><p>ANS: CPSC426 Jave EH44 4</p><p>Q14: Write an applet that allows the user to input values for the arguments required by method drawRect, then draws a rectangle using the four input values.</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us