Alien head

Basics of Applets and Servlets

Description: Test your knowledgewith basics of Applets and Servlets
Number of Questions: 15
Created by:
Tags: Java Programming Applets

Which of the following attributes of an Applet class specifies the path of the class file?

  1. CODE

  2. CODEBASE

  3. HEIGHT

  4. WIDTH

  5. ALIGN

Answer: 2
Explanation:

This attribute of Applet class specifies the path of the class file.

Which of the following methods in a SmashTransition class is used to modify the work_pixels array for the next cell in Java?

  1. init()

  2. smash()

  3. tear()

  4. sleep()

  5. run()

Answer: 2
Explanation:

This method in SmashTransition class is used to modify the work_pixels array for the next cell in Java.

________ class provides functionality that can be used while writing BeanInfo classes.

  1. PropertyChangeListener

  2. PropertyEditorManager

  3. Introspector

  4. SimpleBeanInfo

  5. PropertyEditorSupport

Answer: 4
Explanation:

This class provides functionality that can be used while writing BeanInfo classes.

For what purpose is the given JAVA statement required?
horiz1.add(Box.createHorizontalbox();

  1. To create a horizontal box on screen

  2. To create a horizontal space between a defined label and defined text field

  3. To create a position of a symbol on the screen

  4. To create a vertical space between a defined label and defined text field

  5. All of the above

Answer: 2
Explanation:

The statement provides the required space.

Which of the following specific codes does a web server send using its HTML page to a client server?

  1. ASCII code of a character

  2. Command to client server to report an Exception

  3. JAVA Applet

  4. RDBMS Applet

  5. Only 3 and 4

Answer: 3
Explanation:

JAVA Applets are specifically coded characters used with HTML pages.

when we call repaint() method for a component, the AWT calls the method:

  1. paint()

  2. update()

  3. show()

  4. draw()

  5. none of the above

Answer: 2
Explanation:

repaint calls update method

What is the virtual machine that a web browser contains at the client side called?

  1. JAVA Applet

  2. Virtual program

  3. Search Engine

  4. Applet Engine

  5. Threads

Answer: 4
Explanation:

The virtual machine used in web browser is Applet engine .

Which of the following interfaces in java.beans package allows a designer to provide a graphical user interface through which a bean may be configured?

  1. DesignMode

  2. Customizer

  3. BeanInfo

  4. None of these

Answer: 2
Explanation:

This interface in java.beans package allows a designer to provide a graphical user interface through which a bean may be configured.

Which of the following adjustment events of scroll bar is used to generate an absolute event?

  1. BLOCK_DECREMENT

  2. BLOCK_INCREMENT

  3. TRACK

  4. UNIT_DECREMENT

  5. UNIT_INCREMENT

Answer: 3
Explanation:

This adjustment event of scroll bar is used to generate an absolute event.

Which of the following parameters in applet tag specifies the number of milliseconds between each billboard?

  1. Billboards

  2. Delay

  3. Bgcolor

  4. None of these

Answer: 2
Explanation:

This parameter in applet tag specifies the number of milliseconds between each billboard.

Which of the classes in java.awt package supports automated testing of AWT based applications?

  1. Window

  2. Robot

  3. Panel

  4. None of these

Answer: 2
Explanation:

This class in java.awt package supports automated testing of AWT based applications.

Which of the following classes in Java is used to encapsulate a combo box in an applet program?

  1. JRadioButton

  2. JCheckBox

  3. JComboBox

  4. None of these

Answer: 3
Explanation:

This class in Java is a swing version that is used to encapsulate a combo box in an applet program.

What will be the output of the following code?

class Apple {
 protected int i = 20;
}
class Banana extends Apple {
 void show() {
  System.out.println(i);
 }
}
class Cat extends Banana {
 void disp() {
  System.out.println(i); //i is also available here 
 }
}
public class Fruit {
 public static void main(String[] args) {
  Cat c = new Cat();
  c.disp();
 }
}
  1. 0

  2. Compile Time Error

  3. 20

  4. 020

  5. 200

Answer: 3
Explanation:

since i is protected and it will be visible at all its sub classes

What will be the output of the following statement?
g.fillRect(40,40,200,20);

  1. Displays a rectangle of 200X200 pixels starting with top left corner at 40X40 pixels

  2. Displays a rectangle of 40X400 pixels starting with top left corner at 200X200 pixels

  3. Displays a circle of 200X200 pixels starting with top left corner at 40X40 pixels

  4. Displays a circle of 40X40 pixels starting with top left corner at 200X200 pixels

  5. None of the above

Answer: 1
Explanation:

This statement will draw the rectangle of 200X200 at left corner at 40X40 of the screen.

In the following Java program, it was found that these statements have generated an exception of Array Index out of bound Exception.

int b[ ] = {10,20,30};
b[50] = 100 ;

Choose the correct catch statement for the above code.

  1. catch (ArrayIndexOutOfBoundsException aie) {
     aie.printStackTrace();
     System.out.println("array size is less than what you are trying to access")
    }
    
  2. catch (ArrayIndexOutOfBoundsException aie) {
     System.out.println("array size is less than what you are trying to access")
    }
    
  3. catch (aie) {
     aie.printStackTrace();
     System.out.println("array size is less than what you are trying to access")
     }
    
  4. throw (ArrayIndexOutOfBoundsException aie) {
     aie.printStackTrace();
     System.out.println(array size is less than what you are trying to access ')
     }
    
  5. throw (aie) {
     aie.printStackTrace();
     System.out.println(array size is less than what you are trying to access)
    }
    
Answer: 1
Explanation:

Catch routines are defined in this form. 

+ View questions