1. What does SQL stand for?
• Structured Query Language
• Simple Query Language
• Structured Question Language
• Sequential Query Language
Correct Answer: Structured Query Language
2. Which SQL statement is used to retrieve data from a database?
• SELECT
• GET
• FETCH
• RETRIEVE
Correct Answer: SELECT
3. What is the primary key in a SQL table?
• A column that uniquely identifies each row
• A column that stores foreign keys
• A column that allows duplicate values
• A column used for sorting
Correct Answer: A column that uniquely identifies each row
4. Which command is used to add new rows to a table?
• INSERT INTO
• ADD
• UPDATE
• CREATE
Correct Answer: INSERT INTO
5. What is a foreign key?
• A column that uniquely identifies a row in its own table
• A column that refers to the primary key of another table
• A key used to index data
• A key used for encryption
Correct Answer: A column that refers to the primary key of another table
6. Which SQL command is used to delete data from a table?
• DELETE
• REMOVE
• DROP
• CLEAR
Correct Answer: DELETE
7. What is the function of the WHERE clause?
• Filters rows returned by a query
• Sorts the result set
• Joins two tables
• Groups rows
Correct Answer: Filters rows returned by a query
8. Which of the following is NOT a SQL data type?
• VARCHAR
• INTEGER
• BOOLEAN
• NUMERIC
Correct Answer: BOOLEAN
9. What command is used to change data in a table?
• UPDATE
• MODIFY
• CHANGE
• SET
Correct Answer: UPDATE
10. Which of these SQL commands deletes a table and its data?
• DROP TABLE
• DELETE TABLE
• REMOVE TABLE
• ERASE TABLE
Correct Answer: DROP TABLE
11. What is a stored procedure?
• A precompiled set of SQL statements
• A table that stores procedures
• A user-defined function
• A temporary table
Correct Answer: A precompiled set of SQL statements
12. Which SQL clause is used to sort results?
• ORDER BY
• GROUP BY
• SORT BY
• FILTER BY
Correct Answer: ORDER BY
13. Which join returns all rows when there is a match in one of the tables?
• INNER JOIN
• LEFT JOIN
• RIGHT JOIN
• FULL OUTER JOIN
Correct Answer: FULL OUTER JOIN
14. In ADO.NET, which class represents a connection to a SQL Server database?
• SqlConnection
• SqlCommand
• SqlDataReader
• SqlAdapter
Correct Answer: SqlConnection
15. What is the role of SqlCommand in ADO.NET?
• Executes SQL queries
• Reads data
• Manages database connections
• Stores query results
Correct Answer: Executes SQL queries
16. Which ADO.NET object is used to retrieve data in a read-only, forward-only manner?
• SqlDataReader
• SqlDataAdapter
• SqlCommand
• DataSet
Correct Answer: SqlDataReader
17. What does DataSet in ADO.NET represent?
• An in-memory cache of data
• A database connection
• A command to execute SQL
• A data reader
Correct Answer: An in-memory cache of data
18. How do you begin a transaction in ADO.NET?
• SqlTransaction.Begin()
• SqlConnection.BeginTransaction()
• SqlCommand.Begin()
• DataSet.Begin()
Correct Answer: SqlConnection.BeginTransaction()
19. Which method executes a SQL query that returns a single value?
• ExecuteScalar()
• ExecuteNonQuery()
• ExecuteReader()
• ExecuteXmlReader()
Correct Answer: ExecuteScalar()
20. Which method is used to execute INSERT, UPDATE, or DELETE commands?
• ExecuteNonQuery()
• ExecuteReader()
• ExecuteScalar()
• ExecuteXmlReader()
Correct Answer: ExecuteNonQuery()
21. What does the SqlDataAdapter do?
• Fills a DataSet and updates the data source
• Executes SQL commands
• Opens a database connection
• Reads data forward-only
Correct Answer: Fills a DataSet and updates the data source
22. What is a parameterized query used for?
• To prevent SQL injection
• To improve performance only
• To join multiple tables
• To create tables dynamically
Correct Answer: To prevent SQL injection
23. Which namespace contains the core ADO.NET classes for SQL Server?
• System.Data.SqlClient
• System.Data
• System.Sql
• System.Data.Sql
Correct Answer: System.Data.SqlClient
24. How do you close a database connection in ADO.NET?
• connection.Close()
• connection.Dispose()
• connection.End()
• connection.Terminate()
Correct Answer: connection.Close()
25. What is the result of ExecuteNonQuery()?
• Number of rows affected
• First column of the first row
• DataReader object
• Boolean status
Correct Answer: Number of rows affected
26. What does the DataReader require to be open?
• Open connection
• Closed connection
• Transaction
• DataSet
Correct Answer: Open connection
27. Which ADO.NET class is used for disconnected data manipulation?
• DataSet
• SqlConnection
• SqlCommand
• SqlDataReader
Correct Answer: DataSet
28. What is a DataTable in ADO.NET?
• A representation of a table in memory
• A SQL table
• A class to connect to SQL Server
• An SQL command
Correct Answer: A representation of a table in memory
29. How do you begin a transaction using SqlConnection?
• SqlConnection.BeginTransaction()
• SqlCommand.BeginTransaction()
• SqlDataAdapter.BeginTransaction()
• SqlTransaction.Start()
Correct Answer: SqlConnection.BeginTransaction()
30. Which method rolls back a transaction?
• Rollback()
• Cancel()
• Undo()
• Abort()
Correct Answer: Rollback()
31. Which SQL statement is used to modify the structure of a table?
• ALTER TABLE
• MODIFY TABLE
• CHANGE TABLE
• UPDATE TABLE
Correct Answer: ALTER TABLE
32. What keyword is used to select only unique values?
• DISTINCT
• UNIQUE
• UNION
• EXCLUSIVE
Correct Answer: DISTINCT
33. Which of these is a transaction property in SQL Server?
• Atomicity
• Durability
• Consistency
• All of the above
Correct Answer: All of the above
34. What type of join returns only matching rows from both tables?
• INNER JOIN
• LEFT JOIN
• RIGHT JOIN
• FULL JOIN
Correct Answer: INNER JOIN
35. What is the default isolation level in SQL Server?
• Read Committed
• Serializable
• Read Uncommitted
• Repeatable Read
Correct Answer: Read Committed
36. Which method of SqlDataAdapter is used to send changes from a DataSet to the database?
• Update()
• Fill()
• Execute()
• Submit()
Correct Answer: Update()
37. Which command is used to create a new database?
• CREATE DATABASE
• NEW DATABASE
• MAKE DATABASE
• BUILD DATABASE
Correct Answer: CREATE DATABASE
38. What does the SqlBulkCopy class do?
• Efficiently copies large amounts of data to SQL Server
• Copies database schema
• Copies stored procedures
• Backs up the database
Correct Answer: Efficiently copies large amounts of data to SQL Server
39. How can you prevent SQL Injection in ADO.NET?
• Using parameterized queries
• Using string concatenation
• Using dynamic SQL
• Using stored procedures only
Correct Answer: Using parameterized queries
40. Which SQL clause groups rows sharing a property?
• GROUP BY
• ORDER BY
• WHERE
• HAVING
Correct Answer: GROUP BY
41. What is the use of the HAVING clause?
• Filters groups
• Filters rows
• Sorts results
• Joins tables
Correct Answer: Filters groups
42. Which method of SqlDataReader advances to the next record?
• Read()
• Next()
• MoveNext()
• Advance()
Correct Answer: Read()
43. What is the maximum size of a VARCHAR(MAX) field in SQL Server?
• 2^31-1 bytes
• 8000 bytes
• 4000 bytes
• Unlimited
Correct Answer: 2^31-1 bytes
44. Which ADO.NET object manages a set of SQL commands and connections?
• SqlCommand
• SqlConnection
• SqlDataAdapter
• SqlTransaction
Correct Answer: SqlDataAdapter
45. Which method is used to begin reading XML data from a SQL Server in ADO.NET?
• ExecuteXmlReader()
• ExecuteReader()
• ExecuteScalar()
• ExecuteNonQuery()
Correct Answer: ExecuteXmlReader()
46. What does the term "disconnected architecture" in ADO.NET mean?
• Data can be accessed without an open connection
• Connection is always open
• Connection is shared between apps
• Data is fetched real-time only
Correct Answer: Data can be accessed without an open connection
47. Which isolation level allows dirty reads?
• Read Uncommitted
• Read Committed
• Repeatable Read
• Serializable
Correct Answer: Read Uncommitted
48. Which SQL Server tool is used for database management?
• SQL Server Management Studio (SSMS)
• SQL Server Profiler
• Visual Studio
• Azure Data Studio
Correct Answer: SQL Server Management Studio (SSMS)
49. Which command is used to give permissions on a table?
• GRANT
• PERMIT
• ALLOW
• ACCESS
Correct Answer: GRANT
50. How do you create a new SQL Server login?
• CREATE LOGIN
• NEW LOGIN
• ADD LOGIN
• MAKE LOGIN
Correct Answer: CREATE LOGIN