0

Java Databases (GATE - CS)

Description: Database Connectivity questions
Number of Questions: 15
Created by:
Tags: Database Connectivity questions Java Basics
Attempted 0/15 Correct 0 Score 0

Which of the following methods is not defined in 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 DatabaseMetaData interface?

  1. allProceduresAreCallable()

  2. allTablesAreSelectable()

  3. autoCommitFailureClosesAllResultSets()

  4. dataDefinitionCausesTransactionCommit()

  5. allTablesSelected()


Correct Option: E
Explanation:

This is the correct option 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 or not.

Which of the following methods is defined in DatabseMetaData 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 the database allows for a character literal.

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 option because there is no method named deleteColumn() defined in ResultSet interface.

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 option 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 in 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 the JDBC driver's major version number.

How many methods are defined in Date class in Java?

  1. 10

  2. 9

  3. 8

  4. 7

  5. 6


Correct Option: B
Explanation:

This is the correct answer because there are 9 methods defined in the Date class. These are: 1) getHours() 2) getMinutes() 3) getSeconds() 4) setHours(int i) 5) setMinutes(int i) 6) setSeconds(int i) 7) setTime(long date) 8) toString():  9) valueOf(String s)

Which of the following methods is present in DatabaseMetaData 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 option because isReadOnly() method is defined in DatabaseMetaData. It retrieves whether this database is in read-only mode or not.

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 option 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 interface 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 option 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 allowed in a table by Java Database?

  1. getMaxColumns()

  2. getMaxColumnsInTable()

  3. getMaxColsInTable()

  4. getMaxCols()

  5. None of these


Correct Option: B
Explanation:

This is the correct option 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 DatabaseMetaData interface retrieves the maximum number of characters the database allows for a column name?

  1. getMaxColumnLength()

  2. getMaxColumnNameLength()

  3. getMaxColNameLength()

  4. getMaxColLength()

  5. getColumnNameLength()


Correct Option: B
Explanation:

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

Which of the following methods in 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 ParameterMetaData interface and it retrieves the designated parameter's database-specific type name.

Which of the following methods is present in 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 option because isWritable(int column) is defined in ResultSetMetaData interface and it indicates whether it is possible for a write on the designated column to succeed or not.

- Hide questions