CodingJava

13 Most asked questions in viva from APPLET

JAVA applet MCQ questions

Top 13 Questions from Applet. (First try it yourself, then check the answers given below)

Which of these functions is calles to display the output of an applet?

A) display()

B) print()

C) displayApplet()

D) PrintApplet()

2. Which of these methods ca be used to output a sting in applet?

A) display()

B) print()

C) drawString()

D) transient()

3. What does AWT stands for?

A) All Window Tools

B) All Writing Tools

C) Abstract Window Toolkit

D) Abstruct Writing Toolkit

4. which of these is a part of AWT?

A) display()

B) print()

C) drawString()

D) transient()

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

A) transient

B) volatile

C) global

D) No modifier is needed

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

A) getInfo

B) Info

C) instanceof

D) getInfoof

7. What is the massage is displayes in the applet 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);

}

}

A) A Simple Applet

B) A Simple Applet 20 20

C) Compilation Error

D) Runtime Error

8. What is the length of the application box made by the program?

import java.awt.*;

import java.applet.*;

public class myapplet extends Applet {

public void paint(Graphics g){

g.drawString(“A Simple Applet”, 20, 20);

}

}

A) 20

B) 50

C) 100

D) System dependent

9. What is the length of the application box made  by this program?

import java.awtr.*;

import java.applet.*;

public class myapplet extends Applet{

Graphic g;

g. drawString(” A Simple Applet”, 20 20);

}

}

A) 20

B) Default value

C) Compilation Error

D) Runtime Error

10. 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();

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.println((char)i);

}

}

catch (IOException c) {

e.printStackTrace();

}

}

}

A) abc

B) abcd

C) abcde

D) None of the mentioned

11. When we invoke repaint() for a java.awt.Component object, the AWT invokes the method:

A) draw()

B) update()

C) show()

D) paint()

12. What does the following line of code do?

Textfield text = new Textfield(10);

A) Creates text object that can hold 10 rows of text

B) Creates the object text and initializes it with the value 10

C) The code is illegal

D) Creates text object that can hold 10 columns of text

13. Which of the following applet tags is leagal to embed an applet class named Test into a Web page?

A) <applet code = Test.class width = 200 height =100>

B) <applet class = Test width = 200 height = 100>

C) <applet> code = Test.class width = 200 height = 100>

D) <applet code = Test.class width = 200 height = 100

Answers:

  1.  B.
  2.  C.
  3. C.
  4.  B.
  5. B.
  6. C.
  7. A.
  8. A.
  9. C.
  10. D.
  11. B.
  12. D.
  13. A.

 

 

 

 

Tags

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close