Computer Science - IT MCQs
Topic Notes: Computer Science - IT
<p>MCQs and preparation resources for competitive exams, covering important concepts, past papers, and detailed explanations.</p>
Plato
- Biography: Ancient Greek philosopher (427–347 BCE), student of Socrates and teacher of Aristotle, founder of the Academy in Athens.
- Important Ideas:
- Theory of Forms
- Philosopher-King
- Ideal State
481
The `BETWEEN` operator is used to:
Answer:
Select values within a given range.
The `BETWEEN` operator selects values within a given range. The values can be numbers, text, or dates. The range is inclusive, meaning the begin and end values are included.
482
Which DDL command is used to add a new column to a table?
Answer:
`ALTER TABLE table_name ADD COLUMN ...`
The `ALTER TABLE` statement is used to modify an existing table's structure. The `ADD COLUMN` clause is used with `ALTER TABLE` to add a new column.
483
Which constraint is a combination of `NOT NULL` and `UNIQUE`?
Answer:
PRIMARY KEY
A PRIMARY KEY constraint is essentially a UNIQUE constraint and a NOT NULL constraint combined. It enforces that the values in the column(s) are both unique and not null.
484
What is a transitive dependency?
Answer:
A dependency where a non-key attribute depends on another non-key attribute.
A transitive dependency occurs in a relation when a non-prime attribute is functionally dependent on another non-prime attribute. This indirect dependency (e.g., A → B and B → C, where A is the key) is what 3NF aims to eliminate.
485
In which data model is data organized in a tree-like structure, where each record has one parent and can have many children?
Answer:
Hierarchical Model
The hierarchical model organizes data into a tree structure with a single root, to which all other data is linked. The hierarchy starts from the root data, and expands like a tree, adding child nodes to the parent nodes.
486
For a database table to be in Second Normal Form (2NF), it must first satisfy the requirements of:
Answer:
First Normal Form (1NF)
The normal forms are progressive. A table must be in 1NF before it can be considered for 2NF. Likewise, it must be in 2NF before it can be considered for 3NF, and so on.
487
What does the 'Durability' property of ACID ensure?
Answer:
The effects of a committed transaction are permanent.
Durability guarantees that once a transaction has been committed, it will remain so, even in the event of power loss, crashes, or errors. The changes are permanently stored on non-volatile memory.
488
What is the purpose of an index on a table?
Answer:
To speed up data retrieval operations.
An index is a special lookup table that the database search engine can use to speed up data retrieval. It works like an index in a book; instead of searching the entire table, the database can use the index to find the location of the rows that match the query criteria.
489
What is the difference between DELETE and TRUNCATE?
Answer:
TRUNCATE removes all rows from a table, while DELETE can remove one or more rows.
The DELETE command is a DML command that can remove specific rows based on a WHERE clause (or all rows if no clause is used). TRUNCATE is a DDL command that quickly removes all rows from a table and typically cannot be rolled back.
490
What is a primary key?
Answer:
A key that uniquely identifies each record in a table.
A primary key is a constraint that uniquely identifies each record in a database table. It must contain unique values for each row of data and cannot contain NULL values. A table can have only one primary key.