Cyber Olympiad Class 10 - Sample question paper 13
Posted by Olympiad Tester on
Q1. Which type of join in SQL returns all records when there is a match in either the left or right table?
a) INNER JOIN
b) LEFT JOIN
c) RIGHT JOIN
d) FULL OUTER JOIN
Answer: d) FULL OUTER JOIN
Explanation: A FULL OUTER JOIN returns all records when there is a match in either the left or right table, filling in NULL values for non-matching records.
Q2. In database terminology, what is the purpose of the term "ACID" properties?
a) A set of rules for data modeling
b) A type of indexing method
c) Ensuring reliable processing of database transactions
d) A data type for numerical values
Answer: c) Ensuring reliable processing of database transactions
Explanation: ACID properties (Atomicity, Consistency, Isolation, Durability) ensure reliable processing of database transactions.
Q3. Which SQL command is used to remove all records from a table without removing the table itself?
a) DELETE
b) TRUNCATE
c) DROP
d) REMOVE
Answer: b) TRUNCATE
Explanation: The TRUNCATE command is used to remove all records from a table without removing the table itself.
Q4. What is the purpose of the SQL aggregate function MAX()?
a) Find the average value of a column
b) Retrieve the maximum value from a column
c) Count the number of records in a table
d) Concatenate values from multiple rows
Answer: b) Retrieve the maximum value from a column
Explanation: The MAX() function is used to retrieve the maximum value from a column in SQL.
Q5. In a relational database, what is a foreign key?
a) A key used for encryption
b) A key that uniquely identifies each record in a table
c) A key that references the primary key in another table
d) A key used for sorting records
Answer: c) A key that references the primary key in another table
Explanation: A foreign key in a relational database references the primary key in another table, establishing a relationship between the two tables.
Q6. What is the purpose of the SQL command GROUP BY?
a) Arrange records in ascending order
b) Combine multiple columns into one
c) Filter records based on a condition
d) Group rows that have the same values in specified columns
Answer: d) Group rows that have the same values in specified columns
Explanation: The GROUP BY clause is used to group rows that have the same values in specified columns in SQL.
Q7. What is the purpose of the SQL command HAVING?
a) Specify conditions for filtering rows
b) Join multiple tables
c) Sort records in descending order
d) Specify conditions for filtering groups
Answer: d) Specify conditions for filtering groups
Explanation: The HAVING clause is used to specify conditions for filtering groups in SQL.
Q8. Which type of relationship exists when one record in Table A can have only one related record in Table B, and each record in Table B can have only one related record in Table A?
a) One-to-One (1:1)
b) One-to-Many (1:N)
c) Many-to-One (N:1)
d) Many-to-Many (N:N)
Answer: a) One-to-One (1:1)
Explanation: In a One-to-One relationship, each record in Table A can have only one related record in Table B, and vice versa.
Q9. What is the purpose of the SQL command UNION?
a) Combine rows from two or more tables
b) Remove duplicate rows from a result set
c) Sort records in descending order
d) Rename a table
Answer: a) Combine rows from two or more tables
Explanation: The UNION operator is used to combine rows from two or more tables in SQL.
Q10. What is the purpose of the SQL command COMMIT?
a) Add a new record to a table
b) Delete a record from a table
c) Save all changes made during the current transaction
d) Roll back changes made during the current transaction
Answer: c) Save all changes made during the current transaction
Explanation: The COMMIT command is used to save all changes made during the current transaction in SQL.
Q11. What is the purpose of the SQL command ROLLBACK?
a) Add a new record to a table
b) Delete a record from a table
c) Save all changes made during the current transaction
d) Undo changes made during the current transaction
Answer: d) Undo changes made during the current transaction
Explanation: The ROLLBACK command is used to undo changes made during the current transaction in SQL.
Q12. In a relational database, what is the purpose of the UNIQUE constraint?
a) Ensure data integrity and uniqueness in a column
b) Create a relationship between tables
c) Sort records in ascending order
d) Combine multiple columns into one
Answer: a) Ensure data integrity and uniqueness in a column
Explanation: The UNIQUE constraint ensures data integrity and uniqueness in a column by preventing duplicate values.
Q13. What is the purpose of the SQL command ALTER TABLE?
a) Add a new record to a table
b) Delete a record from a table
c) Modify the structure of a table
d) Sort records based on a condition
Answer: c) Modify the structure of a table
Explanation: The ALTER TABLE command is used to modify the structure of a table in SQL, such as adding or deleting columns.
Q14. What is the purpose of the SQL command CASCADE?
a) Sort records in ascending order
b) Delete all records from a table
c) Perform multiple operations in a single transaction
d) Propagate changes made to the parent table to its related tables
Answer: d) Propagate changes made to the parent table to its related tables
Explanation: The CASCADE option in SQL is used to propagate changes made to the parent table to its related tables.
Q15. In a database, what is the purpose of the CHECK constraint?
a) Enforce data integrity constraints
b) Combine multiple columns into one
c) Specify conditions for filtering rows
d) Create a relationship between tables
Answer: a) Enforce data integrity constraints
Explanation: The CHECK constraint in a database is used to enforce data integrity constraints by specifying conditions that values in a column must meet.
Q16. What is the purpose of the SQL command GRANT?
a) Add a new record to a table
b) Modify the structure of a table
c) Assign privileges to users or roles
d) Delete a record from a table
Answer: c) Assign privileges to users or roles
Explanation: The GRANT command in SQL is used to assign privileges (permissions) to users or roles.
Q17. In Microsoft Access, what is the purpose of the "Relationships" window?
a) Design queries
b) Create forms
c) Define relationships between tables
d) Design printable layouts for presenting data
Answer: c) Define relationships between tables
Explanation: The "Relationships" window in Microsoft Access is used to define relationships between tables in a database.
Q18. What is the purpose of the SQL command INDEX?
a) Sort records in ascending order
b) Improve search and retrieval performance
c) Combine multiple columns into one
d) Create a backup of a table
Answer: b) Improve search and retrieval performance
Explanation: The INDEX command in SQL is used to improve search and retrieval performance by creating an index on one or more columns.
Q19. What is the purpose of the SQL command DELETE?
a) Remove a table from the database
b) Remove all records from a table
c) Modify the structure of a table
d) Add a new record to a table
Answer: b) Remove all records from a table
Explanation: The DELETE command in SQL is used to remove all records from a table.
Q20. What is the purpose of the SQL command UPDATE?
a) Add a new record to a table
b) Delete a record from a table
c) Modify existing records in a table
d) Create a relationship between tables
Answer: c) Modify existing records in a table
Explanation: The UPDATE command in SQL is used to modify existing records in a table.
Q21. What is the purpose of the SQL command SELECT DISTINCT?
a) Select all records from a table
b) Select unique values from a column
c) Rename a column in a result set
d) Add a new record to a table
Answer: b) Select unique values from a column
Explanation: The SELECT DISTINCT command in SQL is used to retrieve unique values from a specified column in a result set.
Q22. In a relational database, what is the purpose of the term "Normalization"?
a) Sorting records in ascending order
b) Designing user interfaces
c) Organizing data to minimize redundancy and dependency
d) Creating relationships between tables
Answer: c) Organizing data to minimize redundancy and dependency
Explanation: Normalization in a relational database is the process of organizing data to minimize redundancy and dependency by dividing tables into smaller, related tables.
Q23. What is the purpose of the SQL command INNER JOIN?
a) Combine records from both tables, including non-matching ones
b) Combine only matching records from both tables
c) Sort records in descending order
d) Create a new table with combined records
Answer: b) Combine only matching records from both tables
Explanation: The INNER JOIN command in SQL is used to combine only matching records from both tables based on a specified condition.
Q24. What is the purpose of the SQL command COMMIT?
a) Add a new record to a table
b) Delete a record from a table
c) Save all changes made during the current transaction
d) Roll back changes made during the current transaction
Answer: c) Save all changes made during the current transaction
Explanation: The COMMIT command is used to save all changes made during the current transaction in SQL.
Q25. In a relational database, what is the purpose of the term "Data Integrity"?
a) Ensuring accurate and consistent data
b) Sorting records in ascending order
c) Creating relationships between tables
d) Designing user interfaces
Answer: a) Ensuring accurate and consistent data
Explanation: Data Integrity in a relational database involves ensuring accurate and consistent data by enforcing rules and constraints.
Q26. What is the purpose of the SQL command DESC?
a) Add a new record to a table
b) Delete a record from a table
c) Sort records in descending order
d) Perform a complex calculation
Answer: c) Sort records in descending order
Explanation: The DESC keyword in SQL is used to sort records in descending order based on a specified column.
Q27. In Microsoft Access, what is the purpose of the "Lookup" data type?
a) Store large text data
b) Display a list of values for user selection
c) Calculate values based on specified criteria
d) Sort records in ascending order
Answer: b) Display a list of values for user selection
Explanation: The "Lookup" data type in Microsoft Access is used to display a list of values for user selection in a field.
Q28. What is the purpose of the SQL command GROUP BY?
a) Arrange records in ascending order
b) Combine multiple columns into one
c) Filter records based on a condition
d) Group rows that have the same values in specified columns
Answer: d) Group rows that have the same values in specified columns
Explanation: The GROUP BY clause is used to group rows that have the same values in specified columns in SQL.
Q29. What is the purpose of the SQL command DELETE?
a) Remove a table from the database
b) Remove all records from a table
c) Modify the structure of a table
d) Add a new record to a table
Answer: b) Remove all records from a table
Explanation: The DELETE command in SQL is used to remove all records from a table.
Q30. In Microsoft Access, what is the purpose of the "Parameter Query"?
a) Sort records in ascending order
b) Prompt the user to enter a parameter value during query execution
c) Calculate values based on specified criteria
d) Design printable layouts for presenting data
Answer: b) Prompt the user to enter a parameter value during query execution
Explanation: A "Parameter Query" in Microsoft Access prompts the user to enter a parameter value during query execution.
Q31. Consider a scenario where you have a database with two tables: "Customers" and "Orders." The "Customers" table has a primary key called "CustomerID," and the "Orders" table has a foreign key referencing "CustomerID" in the "Customers" table. What type of relationship is this?
a) One-to-One (1:1)
b) One-to-Many (1:N)
c) Many-to-One (N:1)
d) Many-to-Many (N:N)
Answer: b) One-to-Many (1:N)
Explanation: In this scenario, each customer in the "Customers" table can have multiple orders in the "Orders" table, indicating a one-to-many relationship.
Q32. Suppose you want to ensure that the "Email" column in the "Customers" table only contains unique values. Which SQL constraint would you apply?
a) PRIMARY KEY
b) UNIQUE
c) CHECK
d) FOREIGN KEY
Answer: b) UNIQUE
Explanation: The UNIQUE constraint is used to ensure that all values in a column are unique, preventing duplicates.
Q33. In a database system, explain the significance of the term "Normalization." How does it contribute to efficient data storage and retrieval?
a) It involves sorting data in ascending order for faster retrieval.
b) It organizes data to minimize redundancy and dependency, improving efficiency.
c) It creates complex relationships between tables for better data integrity.
d) It focuses on adding more columns to tables to store diverse data types.
Answer: b) It organizes data to minimize redundancy and dependency, improving efficiency.
Explanation: Normalization involves organizing data to minimize redundancy and dependency, which contributes to efficient storage and retrieval by reducing data duplication.
Q34. You are designing a database for an online bookstore. Explain how you would use indexes to enhance the performance of queries related to book titles.
a) Create an index on the "Author" column.
b) Create an index on the "Publication Year" column.
c) Create an index on the "ISBN" column.
d) Create an index on the "Title" column.
Answer: d) Create an index on the "Title" column.
Explanation: Creating an index on the "Title" column would enhance the performance of queries related to book titles by speeding up the search and retrieval process.
Q35. Imagine you are tasked with designing a database for a university that stores student information, course details, and grades. How would you establish a relationship between the "Students" and "Courses" tables?
a) Use a foreign key in the "Students" table referencing the "Courses" table.
b) Use a primary key in the "Students" table referencing the "Courses" table.
c) Create a new table to represent the relationship between students and courses.
d) Use a common column in both tables to establish the relationship.
Answer: a) Use a foreign key in the "Students" table referencing the "Courses" table.
Explanation: Using a foreign key in the "Students" table referencing the "Courses" table establishes a relationship between the two tables.
Q36. Consider a database scenario where you have a table named "Employees" with columns such as "EmployeeID," "FirstName," and "LastName." How would you structure an SQL query to retrieve unique combinations of first and last names?
a) SELECT DISTINCT FirstName, LastName FROM Employees;
b) SELECT FirstName, LastName FROM Employees GROUP BY FirstName, LastName;
c) SELECT UNIQUE FirstName, LastName FROM Employees;
d) SELECT FirstName, LastName FROM Employees WHERE UNIQUE;
Answer: a) SELECT DISTINCT FirstName, LastName FROM Employees;
Explanation: The DISTINCT keyword is used to retrieve unique combinations of values in specified columns.
Q37. You are tasked with designing a database for a library. How would you structure a query to retrieve books published after the year 2000?
a) SELECT * FROM Books WHERE PublicationYear > 2000;
b) SELECT * FROM Books HAVING PublicationYear > 2000;
c) SELECT * FROM Books ORDER BY PublicationYear DESC;
d) SELECT * FROM Books GROUP BY PublicationYear HAVING PublicationYear > 2000;
Answer: a) SELECT * FROM Books WHERE PublicationYear > 2000;
Explanation: The WHERE clause is used to filter records based on specified conditions, such as retrieving books published after the year 2000.
Q38. In a database, you have a table named "Products" with columns "ProductID," "ProductName," and "Price." How would you retrieve the top 5 most expensive products?
a) SELECT TOP 5 * FROM Products ORDER BY Price DESC;
b) SELECT * FROM Products ORDER BY Price DESC LIMIT 5;
c) SELECT * FROM Products WHERE ROWNUM <= 5 ORDER BY Price DESC;
d) SELECT * FROM Products LIMIT 5 WHERE ORDER BY Price DESC;
Answer: a) SELECT TOP 5 * FROM Products ORDER BY Price DESC;
Explanation: The TOP keyword is used in SQL Server to limit the number of rows returned, and it is followed by the number of rows to retrieve.
Q39. You are working with a database that stores information about students and their enrolled courses. How would you design a query to find students who have not enrolled in any courses?
a) SELECT * FROM Students INNER JOIN Enrollments ON Students.StudentID = Enrollments.StudentID WHERE Enrollments.CourseID IS NULL;
b) SELECT * FROM Students LEFT JOIN Enrollments ON Students.StudentID = Enrollments.StudentID WHERE Enrollments.CourseID IS NULL;
c) SELECT * FROM Students WHERE NOT EXISTS (SELECT * FROM Enrollments WHERE Students.StudentID = Enrollments.StudentID);
d) SELECT * FROM Students EXCEPT SELECT * FROM Enrollments;
Answer: c) SELECT * FROM Students WHERE NOT EXISTS (SELECT * FROM Enrollments WHERE Students.StudentID = Enrollments.StudentID);
Explanation: The NOT EXISTS clause is used to find rows where a specified condition is not true.
Q40. Explain the concept of an SQL subquery and provide an example of how it could be used in a database scenario.
a) A subquery is a query that retrieves data from multiple tables.
b) A subquery is a query nested inside another query and is enclosed in parentheses. It can be used to retrieve data to be used by the main query as a condition.
c) A subquery is a query that contains an aggregate function, such as COUNT or SUM.
d) A subquery is a query that involves sorting data in ascending or descending order.
Answer: b) A subquery is a query nested inside another query and is enclosed in parentheses. It can be used to retrieve data to be used by the main query as a condition.
Explanation: A subquery is a query that is embedded inside another query, and it is enclosed in parentheses. It can be used to retrieve data that will be used by the main query as a condition to further filter or restrict the results.