A Java Quiz

32 Questions | Total Attempts: 997

SettingsSettingsSettings
Please wait...
Java Quizzes & Trivia

A Java Quiz


Questions and Answers
  • 1. 
    JTable has which of the following functions?
    • A. 

      It stores data

    • B. 

      It renders data

    • C. 

      Both of the above

    • D. 

      None of the above

  • 2. 
    Statement.executeUpdate(); method is used for fetching the data from the database from netbeans?
    • A. 

      True

    • B. 

      False

  • 3. 
    Statement.executeUpdate(); method is used for fetching the data from the database from netbeans?
    • A. 

      True

    • B. 

      False

  • 4. 
    JOptionPane.showInputDialog() will return?
    • A. 

      Int

    • B. 

      String

    • C. 

      Double

    • D. 

      Object

  • 5. 
    Which of the following needs to be imported for java jdbc connectivity JFrame project from netbeans?
    • A. 

      Javax.sql.*;

    • B. 

      Java.sql.*;

    • C. 

      Javac.sql.*;

    • D. 

      Java.sql;

  • 6. 
    You want to take the input of Hobbies from the user, ie Sports, Movies , Traveling etc which of the following controls would be the most suitable?
    • A. 

      Radio Button

    • B. 

      Check Box

    • C. 

      Text Field

    • D. 

      Combo box

  • 7. 
    Which of the following SQL objects will store the data retrieved through a Query?
    • A. 

      Connection

    • B. 

      Driver

    • C. 

      Statement

    • D. 

      ResultSet

  • 8. 
    Which of the following needs to be imported for java jdbc connectivity JFrame project from netbeans?
    • A. 

      Javax.sql.*;

    • B. 

      Java.sql.*;

    • C. 

      Javac.sql.*;

    • D. 

      Java.sql;

  • 9. 
    Class.forName() method is used for?
    • A. 

      Firing the query

    • B. 

      Getting the connection

    • C. 

      Registering the Driver

    • D. 

      None of the above

  • 10. 
    round and pow  are methods of?
    • A. 

      Util package

    • B. 

      Math package

    • C. 

      Lang package

    • D. 

      Net package

  • 11. 
    Which keyword is used for implementing inheritance in java?
    • A. 

      Implements

    • B. 

      Extends

    • C. 

      Inherits

    • D. 

      Derives

  • 12. 
    Combination of two or more different kinds of inheritances is called?
    • A. 

      Combination Inheritance

    • B. 

      Hybrid Inheritance

    • C. 

      Hierarchical Inheritance

    • D. 

      Multiple Inheritance

  • 13. 
    Calender is a static class?
    • A. 

      True

    • B. 

      False

  • 14. 
    Java is object oriented language because it supports classes and encapsulation?
    • A. 

      True

    • B. 

      False

  • 15. 
    Which of the following is used to add or delete from a JList?
    • A. 

      DefaultListModel

    • B. 

      ListModel

    • C. 

      AddElement()

    • D. 

      RemoveElement()

  • 16. 
    for using date and calender which package should be imported?
    • A. 

      Math

    • B. 

      Util

    • C. 

      Net

    • D. 

      Applet

  • 17. 
    The overloaded methods are distinguished by both the return type and signature of the method?
    • A. 

      True

    • B. 

      False

  • 18. 
    How many types of dialogs are supported by jOptionPane?
    • A. 

      1

    • B. 

      2

    • C. 

      3

    • D. 

      4

  • 19. 
    Each row of a JTable in java is added using?
    • A. 

      String

    • B. 

      Object

    • C. 

      Component

    • D. 

      Panel

  • 20. 
    Which of the following methods is used by DefaultTableModel class to add rows to table.
    • A. 

      AddElement()

    • B. 

      AddRow()

    • C. 

      AddRow(Object newrow)

    • D. 

      AddRows()

  • 21. 
    Arrange the events in the order they need to be carried out 1. Extract data from result set 2. import the sql package 3. Execute Query 4.Open a connection
    • A. 

      1,3,2,4

    • B. 

      4,3,2,1

    • C. 

      3,2,4,1

    • D. 

      2,4,3,1

  • 22. 
    The MySql service is available by default at which of the following ports?
    • A. 

      6303

    • B. 

      3606

    • C. 

      3303

    • D. 

      3306

  • 23. 
    The Statement.executeQuery() will return?
    • A. 

      Int

    • B. 

      String

    • C. 

      Object

    • D. 

      ResultSet

  • 24. 
    Super keyword is used for which of the two purposes?
    • A. 

      Refer to base class members with same name as in derived class in the derived class

    • B. 

      Calling the base class destructors

    • C. 

      To create new objects of the base class

    • D. 

      Passing parameters to base class constructor

  • 25. 
    The Statement.executeUpdate() will return?
    • A. 

      Int

    • B. 

      String

    • C. 

      Object

    • D. 

      ResultSet