Java Applets interview questions part 1

Java Applets interview questions part 1

Take as many assements as you can to improve your validate your skill rating

Total Questions: 20

1. All Applets must import java.applet and java.awt.

Correct Answer is : TRUE

2. AppletViewer tool is available in which of the folder of JDK

Correct Answer is : bin

3. Which one of the following is a valid declaration of an applet?

Correct Answer is : public class MyApplet extends java.applet.Applet {

4. Window, Panel and ScrollPane are the subclasses of

Correct Answer is : Container class

5. Which of the following methods set the frame surface color to pink?

Correct Answer is : setBackground(Color.pink);

6. Which of these functions is called to display the output of an applet?

Correct Answer is : paint()

7. Which of these methods can be used to output a string in an applet?

Correct Answer is : drawString()

8. Which of these methods is a part of Abstract Window Toolkit (AWT) ?

Correct Answer is : paint()

9. Which of these modifiers can be used for a variable so that it can be accessed from any thread or parts of a program?

Correct Answer is : volatile

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

Correct Answer is : instanceof

11. What is the Message is displayed in the applet made by this program? import java.awt.*; import java.applet.*; public class myapplet extends Applet { public void paint(Graphics g) { g.drawString("A Simple Applet", 20, 20); } }

Correct Answer is : A Simple Applet

12. What is the length of the application box made by this program? import java.awt.*; import java.applet.*; public class myapplet extends Applet { public void paint(Graphics g) { g.drawString("A Simple Applet", 20, 20); } }

Correct Answer is : 20

13. What is the length of the application box made by this program? import java.awt.*; import java.applet.*; public class myapplet extends Applet { Graphic g; g.drawString("A Simple Applet", 20, 20); }

Correct Answer is : Compilation Error

14. What is the output of this program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdefgh"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0, length, c, 0); CharArrayReader input1 = new CharArrayReader(c); CharArrayReader input2 = new CharArrayReader(c, 1, 4); int i; int j; try { while((i = input1.read()) == (j = input2.read())) { System.out.print((char)i); } } catch (IOException e) { e.printStackTrace(); } } }

Correct Answer is : none of the mentioned

15. All Applets must import java.applet and java.awt.

Correct Answer is : TRUE

16. AppletViewer tool is available in which of the folder of JDK

Correct Answer is : bin

17. Which one of the following is a valid declaration of an applet?

Correct Answer is : public class MyApplet extends java.applet.Applet {

18. Window, Panel and ScrollPane are the subclasses of

Correct Answer is : Container class

19. Which of the following methods set the frame surface color to pink?

Correct Answer is : setBackground(Color.pink);

20. Which of these functions is called to display the output of an applet?

Correct Answer is : paint()

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon