Question bank

Class 12

1 subject · 351 questions

Refine

All questions

351 results
21

In the LIKE clause, which wildcard character replaces zero or more characters?

MCQ Easy
a. _ (underscore)
b. % (percent)
c. * (asterisk)
d. ? (question mark)
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
% (percent)
Explanation: The % wildcard replaces zero or more random characters in a LIKE pattern; _ replaces exactly one character.
22

Evaluate the Java logical expression: !(2 > 6)

MCQ Medium
a. TRUE
b. FALSE
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
TRUE
Explanation: Using && (both true), || (either true), and ! (negation) rules, !(2 > 6) evaluates to true.
23

Which pattern matches first names having exactly 6 characters and starting with 'S'?

MCQ Hard
a. S%
b. S______
c. S_____
d. %S%
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
S_____
Explanation: 'S' followed by exactly five underscores (5 more characters) matches a 6-character name starting with 'S' — 'S_____' (S + 5 underscores = 6 chars total).
24

Evaluate the Java logical expression: (4 == 4) && (5 != 5)

MCQ Medium
a. TRUE
b. FALSE
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
FALSE
Explanation: Using && (both true), || (either true), and ! (negation) rules, (4 == 4) && (5 != 5) evaluates to false.
25

Which clause is used to sort the result of a SELECT query?

MCQ Easy
a. GROUP BY
b. ORDER BY
c. SORT BY
d. HAVING
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
ORDER BY
Explanation: ORDER BY <attribute(s)> sorts the result; ascending (ASC) by default, or descending with DESC.
26

Evaluate the Java logical expression: (4 == 4) || (5 != 5)

MCQ Medium
a. TRUE
b. FALSE
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
TRUE
Explanation: Using && (both true), || (either true), and ! (negation) rules, (4 == 4) || (5 != 5) evaluates to true.
27

Which keywords are used to test for NULL values in SQL?

MCQ Medium
a. = NULL and != NULL
b. IS NULL and IS NOT NULL
c. EQUALS NULL
d. HAS NULL
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
IS NULL and IS NOT NULL
Explanation: IS NULL and IS NOT NULL are used to test whether a column's value is NULL, since = NULL is not valid in SQL.
28

How many times does the loop body execute? for(int count=1; count<=5; count++)

MCQ Medium
a. 5
b. 6
c. 4
d. 7
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
5
Explanation: The loop runs from count=1 while count<=5, stepping by 1 each time, giving 5 iterations.
29

A query written inside another query's WHERE clause is called a:

MCQ Medium
a. Join query
b. Nested query (subquery)
c. Aggregate query
d. Cartesian query
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Nested query (subquery)
Explanation: A nested query (or subquery) is a query within another query; the outer query uses the result of the inner query.
30

How many times does the loop body execute? for(int count=1; count<10; count++)

MCQ Medium
a. 9
b. 10
c. 8
d. 11
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
9
Explanation: The loop runs from count=1 while count<10, stepping by 1 each time, giving 9 iterations.
31

Which of the following is NOT one of the standard SQL aggregate functions?

MCQ Easy
a. COUNT
b. SUM
c. SORT
d. AVG
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
SORT
Explanation: The standard aggregate functions are COUNT, SUM, MAX, MIN, and AVG. SORT is not an aggregate function.
32

How many times does the loop body execute? for(int count=0; count<5; count++)

MCQ Medium
a. 5
b. 6
c. 4
d. 7
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
5
Explanation: The loop runs from count=0 while count<5, stepping by 1 each time, giving 5 iterations.
33

Which aggregate function returns the number of tuples in the result of a query?

MCQ Easy
a. SUM
b. COUNT
c. AVG
d. MAX
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
COUNT
Explanation: COUNT counts the number of tuples (rows) in the result of a query; COUNT(*) counts all rows.
34

How many times does the loop body execute? for(int count=2; count<=20; count = count + 2)

MCQ Medium
a. 10
b. 11
c. 9
d. 12
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
10
Explanation: The loop runs from count=2 while count<=20, stepping by 2 each time, giving 10 iterations.
35

What is the difference between COUNT(Salary) and COUNT(*)?

MCQ Hard
a. They are identical in every case
b. COUNT(Salary) ignores NULL salary values while COUNT(*) counts all rows regardless of NULLs
c. COUNT(*) is invalid syntax
d. COUNT(Salary) always returns 0
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
COUNT(Salary) ignores NULL salary values while COUNT(*) counts all rows regardless of NULLs
Explanation: COUNT(column) counts only non-NULL values in that column, while COUNT(*) counts all rows in the result, regardless of NULL values.
36

How many times does the loop body execute? for(int count=5; count>=1; count--)

MCQ Medium
a. 5
b. 6
c. 4
d. 7
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
5
Explanation: The loop runs from count=5 while count>=1, stepping by -1 each time, giving 5 iterations.
37

Which clause is used to group rows sharing a common value in one or more columns, typically with an aggregate function?

MCQ Easy
a. ORDER BY
b. GROUP BY
c. HAVING
d. WHERE
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
GROUP BY
Explanation: The GROUP BY clause groups rows based on an attribute (e.g., Dept_No) so aggregate functions can be applied per group.
38

How many times does the loop body execute? for(int count=10; count>1; count--)

MCQ Medium
a. 9
b. 10
c. 8
d. 11
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
9
Explanation: The loop runs from count=10 while count>1, stepping by -1 each time, giving 9 iterations.
39

Which clause is used to filter groups AFTER a GROUP BY has been applied (as opposed to filtering individual rows)?

MCQ Medium
a. WHERE
b. HAVING
c. ORDER BY
d. DISTINCT
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
HAVING
Explanation: HAVING is used to filter groups after GROUP BY, e.g., HAVING COUNT(*) > 1; WHERE cannot be used to filter on aggregate results.
40

How many times does the loop body execute? for(int count=1; count<=7; count++)

MCQ Medium
a. 7
b. 8
c. 6
d. 9
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
7
Explanation: The loop runs from count=1 while count<=7, stepping by 1 each time, giving 7 iterations.