Class 12

Information Technology (802)

351 questions available

Refine

All questions

351 results
241

Which method of the Statement object is used to execute a SELECT query and returns a ResultSet?

MCQ Medium
a. executeUpdate()
b. executeQuery()
c. runQuery()
d. fetch()
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
executeQuery()
Explanation: The executeQuery(query) method executes a SELECT SQL statement and returns a ResultSet object containing the results.
242

What is a key limitation of using the DBMS approach?

MCQ Medium
a. It cannot store large volumes of data
b. High cost of implementation and security/recovery overheads
c. It does not allow multiple users
d. It cannot be used for small databases
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
High cost of implementation and security/recovery overheads
Explanation: The DBMS approach has a high implementation cost and involves security/recovery overheads (e.g., regular backups), making it less preferred for small, simple databases.
243

A ResultSet object represents:

MCQ Medium
a. A single row of data
b. A table of data returned by an SQL query
c. The database connection itself
d. An exception object
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
A table of data returned by an SQL query
Explanation: A ResultSet is a table of data (rows and columns) returned by executing an SQL query via executeQuery().
244

The relational database model was developed by:

MCQ Medium
a. Charles Babbage
b. E.F. Codd
c. Dennis Ritchie
d. James Gosling
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
E.F. Codd
Explanation: The relational database model was developed by E.F. Codd at IBM in 1970.
245

Which method of the ResultSet object is used to move to the next row and returns false when there are no more rows?

MCQ Medium
a. hasNext()
b. next()
c. getNext()
d. moveNext()
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
next()
Explanation: The next() method of ResultSet moves the cursor to the next row and returns false when there are no more rows left.
246

In the relational model, a row of a table is called a:

MCQ Easy
a. Domain
b. Attribute
c. Tuple
d. Relation
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Tuple
Explanation: In relational model terminology, a row is called a Tuple, a column is an Attribute, and a table is a Relation.
247

Which type of exception is typically thrown by database connectivity operations, requiring a try-catch block?

MCQ Medium
a. ArithmeticException
b. SQLException
c. NullPointerException
d. ArrayIndexOutOfBoundsException
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
SQLException
Explanation: Database connectivity operations can throw an SQLException, so they should be enclosed in a try-catch block.
248

In the relational model, the number of attributes in a relation is called its:

MCQ Easy
a. Cardinality
b. Degree
c. Domain
d. Schema
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Degree
Explanation: The Degree of a relation is the number of attributes (columns) it has; Cardinality is the number of tuples (rows).
249

If the try block does not throw any exception, the catch clauses following it are still executed.

TRUE FALSE Medium
a. TRUE
b. FALSE
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
FALSE
Explanation: If no exception is thrown, the catch clauses are NOT executed; program execution continues after the last catch clause.
250

In the relational model, the number of tuples in a relation is called its:

MCQ Easy
a. Degree
b. Domain
c. Cardinality
d. Attribute
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Cardinality
Explanation: Cardinality of a relation is the number of rows (tuples) it contains.
251

The finally block is optional in a try-catch structure.

TRUE FALSE Medium
a. TRUE
b. FALSE
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
TRUE
Explanation: The finally block is optional; it is commonly used for cleanup code that should run regardless of whether an exception occurred.
252

The set of all possible values that an attribute may contain is called its:

MCQ Easy
a. Degree
b. Cardinality
c. Domain
d. Tuple
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Domain
Explanation: The Domain of an attribute is the set of all atomic (indivisible) values that attribute may take.
253

How are exceptions handled in Java? Name the key keywords involved.

SHORT Medium
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: Exceptions in Java are handled using try, catch, and (optionally) finally blocks. The try block surrounds code that might throw an exception; the catch block(s) handle specific exception types; the optional finally block always executes when the try block exits.
254

Which of the following is a characteristic of relations in the relational model?

MCQ Medium
a. Ordering of tuples is significant
b. No two tuples in a relation can be identical
c. Attribute values can be non-atomic (divisible)
d. Ordering of attributes must be maintained
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
No two tuples in a relation can be identical
Explanation: No two tuples of a relation should be identical; ordering of tuples and attributes is not significant, and attribute values must be atomic.
255

Write a Java code fragment demonstrating exception handling for a division by zero, using a divide() method that takes two integer parameters.

LONG Medium
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Explanation: int divide(int dividend, int divisor) { return dividend/divisor; } ... try { int quotient = divide(10,0); System.out.println(quotient); } catch (Exception e) { System.out.println(e.getMessage()); }
256

A special value used to represent an attribute value that is unknown, not applicable, or unavailable is called:

MCQ Easy
a. Zero
b. Blank
c. NULL
d. Undefined
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
NULL
Explanation: NULL is used to represent an attribute value that is unknown, not applicable, or unavailable.
257

An assertion in Java is used to:

MCQ Medium
a. Improve runtime performance
b. Identify/detect and correct logical errors by checking that a condition is true at a certain point
c. Handle file input/output
d. Establish database connections
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Identify/detect and correct logical errors by checking that a condition is true at a certain point
Explanation: An assertion is a mechanism to detect logical errors by checking that a stated condition should be true at a particular point during execution.
258

A Relational DBMS (RDBMS) is a DBMS that is:

MCQ Easy
a. Based on hierarchical data structures
b. Based on the relational model
c. Only used for spreadsheets
d. Not capable of storing numeric data
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Based on the relational model
Explanation: An RDBMS is a DBMS based on the relational model, e.g., Oracle, MySQL, IBM DB2.
259

Which type of error is thrown when an assertion's expression evaluates to false?

MCQ Medium
a. ArithmeticException
b. AssertionError
c. SQLException
d. NullPointerException
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
AssertionError
Explanation: If the asserted expression is false, an AssertionError is thrown (with an optional custom error message).
260

A set of attributes in a relation for which no two tuples have the same combination of values is called a:

MCQ Medium
a. Candidate key
b. Primary key
c. Superkey
d. Foreign key
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Superkey
Explanation: A Superkey is a set of attributes for which no two tuples in a relation state have the same combination of values; every relation has at least one (the set of all attributes).