A question bank for every class and subject

Practice questions, with answers and explanations included

794 questions available

Refine

All questions

794 results
401

If int number = 6; and the loop is: do{...}while(number<=5);, how many times does the loop body execute?

MCQ Medium
a. Zero times
b. At least once (exactly once here)
c. Five times
d. It causes a compile error
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
At least once (exactly once here)
Explanation: Since a do-while loop tests AFTER executing, the body executes once (printing for number=6) before the condition (6<=5, false) exits the loop.
402

Which command is used to see the structure of a table, including its columns, types, and keys?

MCQ Easy
a. SHOW TABLES
b. DESCRIBE <table>
c. SELECT * FROM <table>
d. USE <table>
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
DESCRIBE <table>
Explanation: The DESCRIBE (or DESC) statement displays the structure of a table, including column names, data types, and keys.
403

Expand the abbreviation: CU

SHORT Easy
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: Control Unit
404

A loop that never terminates because its test condition is always true is called:

MCQ Easy
a. A nested loop
b. An infinite loop
c. A finite loop
d. A dead loop
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
An infinite loop
Explanation: An infinite loop occurs when the test condition is always true, so the loop body executes forever.
405

Which constraint ensures that NULL and duplicate values are NOT accepted in a column?

MCQ Medium
a. NOT NULL
b. UNIQUE
c. PRIMARY KEY
d. FOREIGN KEY
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
PRIMARY KEY
Explanation: PRIMARY KEY constraint ensures a column has no NULLs and no duplicate values, uniquely identifying each row.
406

Expand the abbreviation: RAM

SHORT Easy
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: Random Access Memory
407

What is the error in this code: int x = 1; while (x <= 5); { x = x + 1; }

MCQ Hard
a. Missing semicolon after while condition
b. A semicolon placed after the while condition, making the loop body an empty (null) statement, causing an infinite loop
c. x is not declared
d. The condition uses the wrong operator
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
A semicolon placed after the while condition, making the loop body an empty (null) statement, causing an infinite loop
Explanation: Placing a semicolon right after the while(condition) makes the loop body a null (empty) statement; since x never changes inside the actual while, this results in an infinite loop.
408

Which statement correctly creates a new database named 'School'?

MCQ Easy
a. CREATE TABLE School;
b. CREATE DATABASE School;
c. USE School;
d. NEW DATABASE School;
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
CREATE DATABASE School;
Explanation: CREATE DATABASE <name>; is the correct syntax to create a new database.
409

Expand the abbreviation: EEPROM

SHORT Easy
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: Electrically Erasable Programmable Read Only Memory
410

How many parts of a for loop are separated by semicolons?

MCQ Easy
a. Two
b. Three
c. Four
d. One
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Three
Explanation: A for loop has three parts separated by semicolons: initialization, test condition, and the update/step, e.g., for(int i=0; i<5; i++).
411

Which command is used to add a new column to an existing table?

MCQ Medium
a. UPDATE TABLE ... ADD
b. ALTER TABLE ... ADD
c. MODIFY TABLE ... ADD
d. INSERT TABLE ... ADD
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
ALTER TABLE ... ADD
Explanation: ALTER TABLE <table_name> ADD <column_name> [datatype]; is used to add a new column to an existing table.
412

Expand the abbreviation: ROM

SHORT Easy
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: Read Only Memory
413

How many times does this loop execute: for(int count=1; count<5; count++) { ... }

MCQ Medium
a. 3
b. 4
c. 5
d. 6
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
4
Explanation: The loop runs for count = 1,2,3,4 — a total of 4 times (it exits when count becomes 5, since 5<5 is false). This is an example of an 'off by one' consideration.
414

Which command permanently removes a table's structure and data from the database?

MCQ Easy
a. DELETE TABLE
b. TRUNCATE
c. DROP TABLE
d. REMOVE TABLE
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
DROP TABLE
Explanation: DROP TABLE <tablename>; deletes the table's structure as well as its data from the database.
415

Expand the abbreviation: DRAM

SHORT Easy
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: Dynamic Random Access Memory
416

What is wrong with the loop: for(int count=5; count<=1; count++) { ... }

MCQ Medium
a. It runs infinitely
b. The body never executes, since the initial value (5) already exceeds the limit (1) with a positive increment
c. It causes a syntax error
d. It runs exactly once
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
The body never executes, since the initial value (5) already exceeds the limit (1) with a positive increment
Explanation: Since the initial value 5 is already greater than the limit 1, and the increment is positive, the test condition (5<=1) is false from the start, so the loop body never executes.
417

Table names and column names in MySQL are case sensitive.

TRUE FALSE Medium
a. TRUE
b. FALSE
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
FALSE
Explanation: Table names and column names are NOT case sensitive in MySQL; e.g., STUDENT and student are treated the same.
418

Define the term: Computer

SHORT Easy
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
Explanation: An electronic device that takes input from the user, processes it according to a set of instructions, and displays/gives the output.
419

What is the scope of a loop counter declared within a for loop statement, e.g., for(int count=1; ...)?

MCQ Medium
a. Available throughout the entire program
b. Available only within the body of the for loop
c. Available only in the main method
d. Available globally after the loop ends
Information Technology (802) · Class 12 · Sep 26, 2026
Show answer
Available only within the body of the for loop
Explanation: A variable declared within a for loop's initialization is scoped only to the loop body and is NOT visible outside the loop.
420

A MySQL table can have more than one primary key defined using two separate PRIMARY KEY clauses.

TRUE FALSE Hard
a. TRUE
b. FALSE
Information Technology (802) · Class 11 · Sep 26, 2026
Show answer
FALSE
Explanation: A table can have at most one primary key; attempting to define two separate PRIMARY KEY clauses results in an error (Multiple primary key defined).