Java Applets interview questions part 2

Java Applets interview questions part 2

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

Total Questions: 8

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

Correct Answer is : drawString()

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

Correct Answer is : paint()

3. 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

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

Correct Answer is : instanceof

5. 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

6. 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

7. 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

8. 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

Similar Interview Questions

    Search for latest jobs

    Icon
    Icon