In the name of ALLAH, the most beneficient, the most merciful

Web Design and Development (CS506)

Multiple Choice Questions (MCQs)

 

Objective Questions

Question

Which of the following methods are invoked by the AWT to support paint and repaint operations?

  1. paint( )
  2. repaint( )
  3. draw( )
  4. redraw( )

Answer: 1 Chapter No. 19 

Question

Which of the following object is passed as an argument to paintComponent() method?

  1. Image object
  2. JPanel object
  3. JFrame object
  4. Graphics object

Answer: 4 Chapter No. 18 

Question

isReadOnly() is a method of _________ object.

  1. ResultSet
  2. ResultSetMetaData
  3. DataBaseMetaData
  4. Connection

Answer: 3 Chapter No. 17 

Question

Which of the following syntax is used to get ResultSetMetaData object?

  1. None of the given
  2. ResultSetMetaData md = rs.getMetaData();
    // where rs is ResultSet object
  3. ResultSetMetaData md = st.getMetaData();
    // where st is Statement object
  4. ResultSet md = rs.getMetaData();
    // where rs is ResultSetMetaData object

Answer: 2 Chapter No. 17 

Question

Which of the following is NOT a method of ResultSet object?

  1. next()
  2. absolute(int)
  3. executeQuery(sql)
  4. updateRow()

Answer: 3 Chapter No. 16 

Question

previous() is a method of __________ object.

  1. Statement
  2. ResultSet
  3. ResultSetMetaData
  4. Connection

Answer: 2 Chapter No. 16 

Question

Which of the following statement object is used to execute simple SQL statement?

  1. Statement
  2. PreparedStatement
  3. CallableStatement
  4. None of the given

Answer: 1 Chapter No. 15 

Question

Which of the following statement object is used to execute stored procedures?

  1. Statement
  2. PreparedStatement
  3. CallableStatement
  4. None of the given

Answer: 3 Chapter No. 15 

Question

Java defines _________ for the listener interfaces having more than one event handling methods.

  1. Wrapper classes
  2. Abstract classes
  3. Concrete classes
  4. Adapter classes

Answer: 4 Chapter No. 13 

Question

WindowListener interface contains __________ methods.

  1. Four
  2. Six
  3. Seven
  4. Eight

Answer: 3 Chapter No. 12 

Question

Which of the following function will be used to register event handler with events generator (button)?

  1. addAction()
  2. addActionListener()
  3. addListener()
  4. None of the given

Answer: 2 Chapter No. 11 

Question

If a class needs to handle events generated by button then which of the following interface a class needs to implement?

  1. ComponentListener
  2. KeyListener
  3. MouseListener
  4. ActionListener

Answer: 4 Chapter No. 11 

Question

JPanel and Applet use _________ as their default layout.

  1. Flow layout
  2. Border layout
  3. Grid layout
  4. GridBag layout

Answer: 3 Chapter No. 10 

Question

Which of the following is called "pure abstract class"?

  1. Concrete class
  2. Wrapper class
  3. Interface
  4. Abstract class with no abstract method

Answer: 1 Chapter No. 9 

Question

The relationship between class and interface is called __________.

  1. Is a' relationship
  2. Has a' relationship
  3. Responds to' relationship
  4. None of the given

Answer: 3 Chapter No. 9 

Question

An instance of abstract class cannot be created.

  1. True
  2. False

Answer: 1 Chapter No. 9 

Question

Which of the following syntax attaches an output stream to console?

  1. FileWriter fw = new FileWriter(“output.txt”);
  2. FileWriter fw = new FileWriter(FileDescriptor.out);
  3. FileWriter fw = new FileWriter(FileDescriptor.in);
  4. FileWriter fw = new FileWriter(FileDescriptor);

Answer: 1 Chapter No. 8 

Question

Based on functionality, the streams can be categorized as ________

  1. Byte oriented stream and Node stream
  2. Filter stream and Character oriented stream
  3. Node stream and Filter stream
  4. Byte oriented stream and Character oriented stream

Answer: 3 Chapter No. 8 

Question

Which of the following stream read/write data in the form of bytes?

  1. FileReader
  2. FileWriter
  3. PrintWriter
  4. FileInputStream

Answer: 4 Chapter No. 8 

Question

When defining a method you must include a ___________ to declare any exception that might be thrown but is not caught in the method.

  1. try block
  2. finally block
  3. catch block
  4. throws-clause

Answer: 4 Chapter No. 7 

Question

Aside from the Scanner class, which of the following classes can be used for text-file input?

  1. ObjectInputStream
  2. BufferedReader
  3. StringTokenizer
  4. None of the given

Answer: 2 Chapter No. 7 

Question

HahMap takes key as a/an _________

  1. Object
  2. Array
  3. Primitive value
  4. Function

Answer: 1 Chapter No. 6 

Question

A collection can store _________

  1. Homogenous objects
  2. Heterogeneous objects
  3. Objects as well as primitive values
  4. At most 100 objects

Answer: 2 Chapter No. 6 

Question

If a super class method is protected then overriding method _________

  1. must be protected
  2. must be public
  3. must be private
  4. may be either protected or public

Answer: 4 Chapter No. 5 

Question

A variable declared as static in a class is a/an _________

  1. Instance variable
  2. Class variable
  3. Const variable
  4. Global variable

Answer: 2 Chapter No. 4 

Question

The toString () method returns a _________ representation of _______

  1. int, string
  2. string, int
  3. string, object
  4. object, string

Answer: 3 Chapter No. 4 

Question

What will happen if static modifier is removed from the signature of main method?

  1. The program does not compile
  2. The program compiles and runs successfully
  3. The program compiles but does not run
  4. None of the given

Answer: 3 Chapter No. 2 

Question

What will happen if main method is declared as private?

  1. The program does not compile
  2. The program throws an exception at run time
  3. The program compiles and runs successfully
  4. None of the given

Answer: 2 Chapter No. 2 

Question

If we remove static from main then program _______

  1. Program cannot compile
  2. Program will compile and work properly
  3. Run time errors
  4. Exception throws in main

Answer: 4 Chapter No. 2 

Question

If we remove String array from main then program_______

  1. Program cannot compile
  2. Program will compile and work properly
  3. Run time errors
  4. Exception throws in main

Answer: 4 Chapter No. 2 

Question

Java developed in ________

  1. 1990
  2. 1995
  3. 1997
  4. 2000

Answer: 2 Chapter No. 1