Java MCQ Questions - Java Applets

This section focuses on the "Java Applets" in Java programming. These Multiple Choice Questions (MCQ) should be practiced to improve the Java programming skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. An applet is a Java class that extends the?

A. java.Applet class
B. java class
C. Applet class
D. java.applet.Applet class

View Answer


2. Applets are designed to be embedded within an __________.

A. Javascript
B. Css
C. HTML
D. SQL

View Answer


3. Which of the following is required to view an applet?

A. JCM
B. JDM
C. JVM
D. Java class

View Answer


4. Which method is automatically called after the browser calls the init method?

A. start
B. stop
C. destroy
D. paint

View Answer


5. Which method is only called when the browser shuts down normally?

A. start
B. stop
C. destroy
D. paint

View Answer


6. Which of these operators can be used to get run time information about an object?

A. getInfo
B. Info
C. instanceof
D. getinfoof

View Answer


7. Which method causes the audio clip to replay continually?

A. public void play()
B. public void loop() 
C. public void stop()
D. None of the above

View Answer


8. paint() is an abstract method defined in AWT.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer


9. ___________ method is defined in Graphics class, it is used to output a string in an applet.

A. display()
B. Print()
C. drawString()
D. transient()

View Answer


10. What will be output for the following code?

 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 Simple Applet
B. A Simple Applet 20 20
C. Compilation Error
D. Runtime Error

View Answer



Discussion



* You must be logged in to add comment.