Create Software Components 

Using Java Level 2

 

 

Course Info

Scheme

Resources

Tutorials

Java Demos

Utilities

Links


 

    Quiz 2

Applets, Applications & Java File Types 

There are 15 questions

Question 1.         

A Java program consists of a collection of one or more...

 

(a)   classes

(b)   packages

(c)   applets 

(d)   methods

Question 2.         

A Java class is named with the first letter in lowercase. True or false?

___________________________

Question 3.         

A block containing code for carrying out a specific function is called a...

(a)   class

(b)   block

(c)   file

(d)   method

Question 4.         

A Java application must have a method called...

(a)   paint

(c)   main

(d)   class

(e)   drawstring  

Question 5.         

Which of the following  can you use to create comment lines which are ignored by the Java compiler? 

(a)   /

(b)   //

(c)   *

(d)   /*

Question 6.         

To draw various items on an applet window you must have a method called...

(a)   paint

(c)   main

(d)  class

(e)  drawstring  

Question 7.         

You can draw a string on a Java applet window using the...

(a)   System.out.println method

(b)   paint method

(c)   main method 

(d)   drawstring method

Question 8.   

You can output a string to a display window using the...

(a)   System.out.println method

(b)   paint method

(c)   main method 

(d)   drawstring method

Question 9.         

Which one of the following is the correct syntax for viewing an applet called MyApplet?

(a)   appletviewer MyApplet.java

(b)   appletviewer MyApplet.class

(c)   appletviewer MyApplet

(d)   appletviewer MyApplet.html

Question 10.         

Which one of the following is the correct syntax for compiling the MyApplet source code into bytecode?

(a)   java MyApplet.java

(b)   java MyApplet.class

(c)   javac MyApplet.java

(d)   appletviewer MyApplet.html

Question 11.         

Which one of the following is FALSE?

(a)   java is the Java compiler

(b)   Java bytecode is stored in a .class file

(c)   Java source code is not stored in a HTML file

(d)   javac is the Java compiler

Question 12.         

Which one of the following is FALSE?

(a)   Some Web browsers cannot run Java applets

(b)   To run an applet a HTML file is required

(c)   To run a Java application, a method called main is required.

(d)   Computers without the Java Virtual Machine can run Java applications.

Question 13.         

The JIT compiler enables Java programs to run faster because the bytecode is... 

(a)   interpreted line by line

(c)   compiled into native machine code

(d)   converted into HTML code

(e)   translated into native bytecode  

Question 14.         

Say you have completed and compiled the Java code for a program called anApplet.  Complete the APPLET statement below so that a web browser will display your applet.

<APPLET code= _____________  width=300 height=200> </Applet>

Question 15.         

What is the purpose of the following code fragment?

 

void main(String args[])

{

...some code in here

}

  

(a)   A required method to start an applet for the first time

(b)   A method all user-defined classes must have

(c)   A place to declare variables

(d)   A required method in an application

 

        

 

  Site Home 

Java Home   

  Forum  

Course Info

Welcome

Overview

Assessment

Qualification

Scheme of Work

Assignments

Resources

Information

Blackboard

Learning Center

Web Materials

Reading

Java Demos

Utilities

Links

Lecture Materials

Tutorials & Notes

Exercises

Activities

Quizzes

 

Site Home

Top

Unit Home

ADR 2002