0

Java Database

Description: Concept Based Questions
Number of Questions: 15
Created by:
Tags: Concept Based Questions Java Basics
Attempted 0/15 Correct 0 Score 0

Which of the following methods is defined in the DatabaseMetaData interface in Java database programming?

  1. getMaxTableLength()

  2. getMaxTables()

  3. getMaxCharLiteralLength()

  4. getMaxUserLength()

  5. getSchema()


Correct Option: C
Explanation:

This is the correct answer because getMaxCharLiteralLength() is defined in the DatabaseMetaData interface and it retrieves the maximum number of characters. This database allows for a character literal.

Which of the following methods is not defined in the ResultSetMetaData interface?

  1. getColumnClassName(int column)

  2. getScale(int column)

  3. isCaseSensitive(int column)

  4. getColumnSize(int column)

  5. isSearchable(int column)


Correct Option: D
Explanation:

This is the correct answer because there is no method named getColumnSize(int column) in ResultSetMetaData interface. The correct method name is getColumnDisplaySize(int column) which indicates the designated column's normal maximum width in characters.

Which of the following methods is not defined in the DriverManager class in Java database programming?

  1. getConnection(String url, String user, String password)

  2. deregisterDriver(Driver driver)

  3. getLoginTimeout()

  4. registerDriver(Driver driver)

  5. getLog()


Correct Option: E
Explanation:

This is the correct answer because there is no method named getLog() in DriverManager class. The correct method is getLogWriter() which retrieves the log writer.

Which of the following methods is not defined in ParameterMetaData in Java database programming?

  1. isSigned(int param)

  2. isNullable(int param)

  3. getParameterCount()

  4. getParameterName(int param)

  5. getParameterType(int param)


Correct Option: D
Explanation:

This is the correct choice because there is no method named getParameterName(int param) in ParameterMetaData interface. The correct method is getParameterTypeName(int param) which retrieves the designated parameter's database-specific type name.

Which of the following methods in DatabaseMetaData retrieves the maximum number of columns this database allows in a table?

  1. getMaxColumns()

  2. getMaxColumnsInTable()

  3. getMaxColsInTable()

  4. getMaxCols()

  5. None of these


Correct Option: B
Explanation:

This is the correct answer because getMaxColumnsInTable() method is defined in the DatabaseMetaData interface and it retrieves the maximum number of columns this database allows in a table.

Which of the following methods in Timestamp Class returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Timestamp object?

  1. getTime()

  2. Time()

  3. getMilliseconds()

  4. getTimeInMilliseconds()

  5. Milliseconds()


Correct Option: A
Explanation:

This is the correct answer because getTime() method is defined in the TimeStamp class in Java and it returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Timestamp object.

Which of the following methods is not defined in the DatabaseMetaData interface?

  1. allProceduresAreCallable()

  2. allTablesAreSelectable()

  3. autoCommitFailureClosesAllResultSets()

  4. dataDefinitionCausesTransactionCommit()

  5. allTablesSelected()


Correct Option: E
Explanation:

This is the correct choice because there is no method named allTablesSelected() in DatabaseMetaData. The correct method is allTablesAreSelectable() and it retrieves whether the current user can call all the procedures returned by the method getProcedures.

Which of the following methods is not defined in the ResultSet interface in Java?

  1. cancelRowUpdates()

  2. deleteRow()

  3. clearWarnings()

  4. deleteColumn()

  5. absolute(int row)


Correct Option: D
Explanation:

This is the correct answer because there is no method named deleteColumn() defined in the ResultSet interface.

Which of the following methods is present in the ResultSet interface in Java database programming?

  1. moveToCurrentRow()

  2. moveToNextRow()

  3. moveToPreviosRow()

  4. moveToFirstRow()

  5. moveToLastRow()


Correct Option: A
Explanation:

This is the correct choice because moveToCurrentRow() method is present in the ResultSet interface. This method moves the cursor to the remembered cursor position, usually the current row.

Which of the following methods in the DatabaseMetaData retrieves the maximum number of characters this database allows for a column name?

  1. getMaxColumnLength()

  2. getMaxColumnNameLength()

  3. getMaxColNameLength()

  4. getMaxColLength()

  5. getColumnNameLength()


Correct Option: B
Explanation:

This is the correct choice because getMaxColumnNameLength() method is defined in the DatabaseMetaData interface and it retrieves the maximum number of characters this database allows for a column name.

Which of the following methods in the ResultSet interface refreshes the current row with its most recent value in the database?

  1. rowRefresh()

  2. refreshRow()

  3. refreshIt()

  4. refreshAll()

  5. refreshCurrentRow()


Correct Option: B
Explanation:

This is the correct answer because refreshRow() method is defined in the ResultSet interface and it refreshes the current row with its most recent value in the database.

Which of the following methods in DatabaseMetaData interface retrieves the JDBC driver's major version number?

  1. getMajorDriverVersion()

  2. getMajorVersion()

  3. getDriverVersion()

  4. getDriverMajorVersion()

  5. getDriversMajorVersion()


Correct Option: D
Explanation:

This is the correct answer because getDriverMajorVersion() method is defined in the DatabaseMetaData interface and it retrieves this JDBC driver's major version number.

Which of the following methods is present in the DatabseMetaData interface in Java database programming?

  1. isReadOnly()

  2. isCurrency(int column)

  3. isDefinitelyWritable(int column)

  4. isWritable(int column)

  5. isReadOnly(int Column)


Correct Option: A
Explanation:

This is the correct choice as isReadOnly() method id defined in the DatabaseMetaData. It retrieves whether this database is in read-only mode.

Which of the following methods is present in the ResultSetMetaData interface in Java database programming?

  1. isWritable(int column)

  2. isReadable(int column)

  3. getColumnsName(int column)

  4. getColumnsCount()

  5. getSchema(int column)


Correct Option: A
Explanation:

This is the correct choice because isWritable(int column) is defined in the ResultSetMetaData interface and it indicates whether it is possible for a write on the designated column to succeed.

Which of the following methods in the ParameterMetaData interface retrieves the designated parameter's database-specific type name?

  1. getParameterName(int param)

  2. getParameterType(int param)

  3. getParameterTypeName(int param)

  4. getParameterNameType(int param)

  5. getTypeOfParameter(int param)


Correct Option: C
Explanation:

This is the correct answer because getParameterTypeName(int param) method is defined in the ParameterMetaData interface and it retrieves the designated parameter's database-specific type name.

- Hide questions