McqMate
These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) , Bachelor of Science in Computer Science FY (BSc CS) , Bachelor of Science in Computer Science SY (BSc CS) , Bachelor of Science in Information Technology SY (BSc IT) , Bachelor of Computer Applications (BCA) .
Chapters
1. |
Which SQL function is used to count the number of rows in a SQL query? |
A. | COUNT() |
B. | NUMBER() |
C. | SUM() |
D. | COUNT(*) |
Answer» D. COUNT(*) |
2. |
Which SQL keyword is used to retrieve a maximum value? |
A. | MOST |
B. | TOP |
C. | MAX |
D. | UPPER |
Answer» C. MAX |
3. |
Which of the following SQL clauses is used to DELETE tuples from a database table? |
A. | DELETE |
B. | REMOVE |
C. | DROP |
D. | CLEAR |
Answer» A. DELETE |
4. |
___________removes all rows from a table without logging the individual row deletions. |
A. | DELETE |
B. | REMOVE |
C. | DROP |
D. | TRUNCATE |
Answer» D. TRUNCATE |
5. |
Which of the following is not a DDL command? |
A. | UPDATE |
B. | TRUNCATE |
C. | ALTER |
D. | None of the Mentioned |
Answer» A. UPDATE |
6. |
Which of the following are TCL commands? |
A. | UPDATE and TRUNCATE |
B. | SELECT and INSERT |
C. | GRANT and REVOKE |
D. | ROLLBACK and SAVEPOINT |
Answer» D. ROLLBACK and SAVEPOINT |
7. |
________________ is not a category of SQL command. |
A. | TCL |
B. | SCL |
C. | DCL |
D. | DDL |
Answer» B. SCL |
8. |
If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default ______________ |
A. | ASC |
B. | DESC |
C. | There is no default value |
D. | None of the mentioned |
Answer» A. ASC |
9. |
Which of the following statement is true? |
A. | DELETE does not free the space containing the table and TRUNCATE free the space containing the table |
B. | Both DELETE and TRUNCATE free the space containing the table |
C. | Both DELETE and TRUNCATE does not free the space containing the table |
D. | DELETE free the space containing the table and TRUNCATE does not free the space containing the table |
Answer» A. DELETE does not free the space containing the table and TRUNCATE free the space containing the table |
10. |
What is the purpose of the SQL AS clause? |
A. | The AS SQL clause is used to change the name of a column in the result set or to assign a name to a derived column |
B. | The AS clause is used with the JOIN clause only |
C. | The AS clause defines a search condition |
D. | All of the mentioned |
Answer» A. The AS SQL clause is used to change the name of a column in the result set or to assign a name to a derived column |
11. |
What does DML stand for? |
A. | Different Mode Level |
B. | Data Model Language |
C. | Data Mode Lane |
D. | Data Manipulation language |
Answer» D. Data Manipulation language |
12. |
With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”? |
A. | SELECT * FROM Persons WHERE FirstName=’a’ |
B. | SELECT * FROM Persons WHERE FirstName LIKE ‘a%’ |
C. | SELECT * FROM Persons WHERE FirstName LIKE ‘%a’ |
D. | SELECT * FROM Persons WHERE FirstName=’%a%’ |
Answer» C. SELECT * FROM Persons WHERE FirstName LIKE ‘%a’ |
13. |
With SQL, how can you return all the records from a table named “Persons” sorted descending by “FirstName”? |
A. | SELECT * FROM Persons SORT BY ‘FirstName’ DESC |
B. | SELECT * FROM Persons ORDER FirstName DESC |
C. | SELECT * FROM Persons SORT ‘FirstName’ DESC |
D. | SELECT * FROM Persons ORDER BY FirstName DESC |
Answer» D. SELECT * FROM Persons ORDER BY FirstName DESC |
14. |
With SQL, how can you return the number of not null records in the “Persons” table? |
A. | SELECT COUNT() FROM Persons |
B. | SELECT COLUMNS() FROM Persons |
C. | SELECT COLUMNS(*) FROM Persons |
D. | SELECT COUNT(*) FROM Persons |
Answer» D. SELECT COUNT(*) FROM Persons |
15. |
What does the ALTER TABLE clause do? |
A. | The SQL ALTER TABLE clause modifies a table definition by altering, adding, or deleting table columns and/or constraints |
B. | The SQL ALTER TABLE clause is used to insert data into database table |
C. | THE SQL ALTER TABLE deletes data from database table |
D. | The SQL ALTER TABLE clause is used to delete a database table |
Answer» A. The SQL ALTER TABLE clause modifies a table definition by altering, adding, or deleting table columns and/or constraints |
16. |
The UPDATE SQL clause can _____________ |
A. | update only one row at a time |
B. | update more than one row at a time |
C. | delete more than one row at a time |
D. | delete only one row at a time |
Answer» B. update more than one row at a time |
17. |
The UNION SQL clause can be used with _____________ |
A. | SELECT clause only |
B. | DELETE and UPDATE clauses |
C. | UPDATE clause only |
D. | All of the mentioned |
Answer» A. SELECT clause only |
18. |
Which SQL statement is used to return only different values? |
A. | SELECT DIFFERENT |
B. | SELECT UNIQUE |
C. | SELECT DISTINCT |
D. | SELECT ALL |
Answer» C. SELECT DISTINCT |
19. |
Which SQL keyword is used to sort the result-set? |
A. | ORDER BY |
B. | SORT |
C. | ORDER |
D. | SORT BY |
Answer» A. ORDER BY |
20. |
How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table? |
A. | UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’ |
B. | MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’ |
C. | MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’ |
D. | UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’ |
Answer» D. UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’ |
21. |
Which of the following command makes the updates performed by the transaction permanent in the database? |
A. | ROLLBACK |
B. | COMMIT |
C. | TRUNCATE |
D. | DELETE |
Answer» B. COMMIT |
22. |
Which TCL command undo all the updates performed by the SQL in the transaction? |
A. | ROLLBACK |
B. | COMMIT |
C. | TRUNCATE |
D. | DELETE |
Answer» A. ROLLBACK |
23. |
SQL query to find all the cities whose humidity is 95. |
A. | SELECT city WHERE humidity = 95 |
B. | SELECT city FROM weather WHERE humidity = 95 |
C. | SELECT humidity = 89 FROM weather |
D. | SELECT city FROM weather |
Answer» B. SELECT city FROM weather WHERE humidity = 95 |
24. |
SQL query to find the temperature in increasing order of all cities. |
A. | SELECT city FROM weather ORDER BY temperature |
B. | SELECT city, temperature FROM weather |
C. | SELECT city, temperature FROM weather ORDER BY temperature |
D. | SELECT city, temperature FROM weather ORDER BY city |
Answer» D. SELECT city, temperature FROM weather ORDER BY city |
25. |
What is the meaning of LIKE ‘%0%0%’? |
A. | Feature begins with two 0’s |
B. | Feature ends with two 0’s |
C. | Feature has more than two 0’s |
D. | Feature has two 0’s in it, at any position |
Answer» D. Feature has two 0’s in it, at any position |
26. |
Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy. |
A. | SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’) |
B. | SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’) |
C. | SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’) |
D. | SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’); |
Answer» A. SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’) |
27. |
Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70. |
A. | SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70 |
B. | SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70 |
C. | SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70 |
D. | SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70 |
Answer» C. SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70 |
28. |
Find all the tuples having a temperature greater than ‘Paris’. |
A. | SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = ‘Paris’ |
B. | SELECT * FROM weather WHERE temperature > (SELECT * FROM weather WHERE city = ‘Paris’) |
C. | SELECT * FROM weather WHERE temperature > (SELECT city FROM weather WHERE city = ‘Paris’) |
D. | SELECT * FROM weather WHERE temperature > ‘Paris’ temperature |
Answer» A. SELECT * FROM weather WHERE temperature > (SELECT temperature FROM weather WHERE city = ‘Paris’ |
29. |
Find all the cities with temperature, condition and humidity whose humidity is in the range of 63 to 79. |
A. | SELECT * FROM weather WHERE humidity IN (63 to 79) |
B. | SELECT * FROM weather WHERE humidity NOT IN (63 AND 79) |
C. | SELECT * FROM weather WHERE humidity BETWEEN 63 AND 79 |
D. | SELECT * FROM weather WHERE humidity NOT BETWEEN 63 AND 79 |
Answer» C. SELECT * FROM weather WHERE humidity BETWEEN 63 AND 79 |
30. |
The command to remove rows from a table ‘CUSTOMER’ is __________________ |
A. | DROP FROM CUSTOMER |
B. | UPDATE FROM CUSTOMER |
C. | REMOVE FROM CUSTOMER |
D. | DELETE FROM CUSTOMER WHERE |
Answer» D. DELETE FROM CUSTOMER WHERE |
31. |
What type of join is needed when you wish to include rows that do not have matching values? |
A. | Equi-join |
B. | Natural join |
C. | Outer join |
D. | All of the Mentioned |
Answer» C. Outer join |
32. |
What type of join is needed when you wish to return rows that do have matching values? |
A. | Equi-join |
B. | Natural join |
C. | Outer join |
D. | All of the Mentioned |
Answer» D. All of the Mentioned |
33. |
Which of the following is one of the basic approaches for joining tables? |
A. | Subqueries |
B. | Union Join |
C. | Natural join |
D. | All of the Mentioned |
Answer» D. All of the Mentioned |
34. |
The following SQL is which type of join: SELECT CUSTOMER_T. CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,ORDER_T WHERE CUSTOMER_T. CUSTOMER_ID = ORDER_T. CUSTOMER_ID? |
A. | Equi-join |
B. | Natural join |
C. | Outer join |
D. | Cartesian join |
Answer» A. Equi-join |
35. |
A UNION query is which of the following? |
A. | Combines the output from no more than two queries and must include the same number of columns |
B. | Combines the output from no more than two queries and does not include the same number of columns |
C. | Combines the output from multiple queries and must include the same number of columns |
D. | Combines the output from multiple queries and does not include the same number of columns |
Answer» C. Combines the output from multiple queries and must include the same number of columns |
36. |
Which of the following statements is true concerning subqueries? |
A. | Involves the use of an inner and outer query |
B. | Cannot return the same result as a query that is not a subquery |
C. | Does not start with the word SELECT |
D. | All of the mentioned |
Answer» A. Involves the use of an inner and outer query |
37. |
Which of the following is a correlated subquery? |
A. | Uses the result of an inner query to determine the processing of an outer query |
B. | Uses the result of an outer query to determine the processing of an inner query |
C. | Uses the result of an inner query to determine the processing of an inner query |
D. | Uses the result of an outer query to determine the processing of an outer query |
Answer» A. Uses the result of an inner query to determine the processing of an outer query |
38. |
The following SQL is which type of join: SELECT CUSTOMER_T. CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,ORDER_T? |
A. | Equi-join |
B. | Natural join |
C. | Outer join |
D. | Cartesian join |
Answer» D. Cartesian join |
39. |
Which is not a type of join in T-SQL? |
A. | Equi-join |
B. | Natural join |
C. | Outer join |
D. | Cartesian join |
Answer» B. Natural join |
40. |
What is a view? |
A. | A view is a special stored procedure executed when certain event occurs |
B. | A view is a virtual table which results of executing a pre-compiled query |
C. | A view is a database diagram |
D. | None of the Mentioned |
Answer» B. A view is a virtual table which results of executing a pre-compiled query |
41. |
Which of the following is not a limitation of view? |
A. | ORDER BY Does Not Work |
B. | Index Created on View Used Often |
C. | Cross Database Queries Not Allowed in Indexed View |
D. | Adding Column is Expensive by Joining Table Outside View |
Answer» B. Index Created on View Used Often |
42. |
Which of the following statement is true? |
A. | Views could be looked as an additional layer on the table which enables us to protect intricate or sensitive data based upon our needs |
B. | Views are virtual tables that are compiled at run time |
C. | Creating views can improve query response time |
D. | All of the Mentioned |
Answer» D. All of the Mentioned |
43. |
SQL Server has mainly how many types of views? |
A. | one |
B. | two |
C. | three |
D. | four |
Answer» B. two |
44. |
Dynamic Management View is a type of ___________ |
A. | System Defined Views |
B. | User Defined View |
C. | Simple View |
D. | Complex View |
Answer» A. System Defined Views |
45. |
Syntax for creating views is __________ |
A. | CREATE VIEW AS SELECT |
B. | CREATE VIEW AS UPDATE |
C. | DROP VIEW AS SELECT |
D. | CREATE VIEW AS UPDATE |
Answer» A. CREATE VIEW AS SELECT |
46. |
You can delete a view with ___________ command. |
A. | DROP VIEW |
B. | DELETE VIEW |
C. | REMOVE VIEW |
D. | TRUNCATE VIEW |
Answer» A. DROP VIEW |
47. |
What is SCHEMABINDING a VIEW? |
A. | Schema binding binds your views to the dependent physical columns of the accessed tables specified in the contents of the view |
B. | These are stored only in the Master database |
C. | These types of view are defined by users on a specified schema |
D. | These are used to show database self describing information |
Answer» B. These are stored only in the Master database |
48. |
Which of the following is not a SQL Server INFORMATION_SCHEMA view? |
A. | INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE |
B. | INFORMATION_SCHEMA.DOMAIN_CONSTRAINTS |
C. | INFORMATION_SCHEMA.KEY_COLUMN_USAGE |
D. | sys.dm_exec_connections |
Answer» D. sys.dm_exec_connections |
49. |
___________ is stored only in the Master database. |
A. | Database-scoped Dynamic Management View |
B. | Complex View |
C. | Catalog View |
D. | None of the mentioned |
Answer» D. None of the mentioned |
Done Studing? Take A Test.
Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.