×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

Transact-SQL (T-SQL) Multiple-Choice Questions (MCQs)

Transact-SQL is Microsoft's and Sybase's proprietary extension to the SQL used to interact with relational databases.

Transact-SQL (T-SQL) MCQs: This section contains multiple-choice questions and answers on the various topics of Transact-SQL (T-SQL). Practice these MCQs to test and enhance your skills on Transact-SQL (T-SQL).

List of Transact-SQL (T-SQL) MCQs

1. What is the full form of T-SQL?

  1. Transact Structured Query Language
  2. Transaction Structure Query Language
  3. Transcript Structure Query Language

Answer: A) Transact Structured Query Language

Explanation:

T-SQL stands for Transact Structured Query Language.

Discuss this Question


2. Which company owns T-SQL?

  1. IBM
  2. Microsoft
  3. Oracle
  4. SAP

Answer: B) Microsoft

Explanation:

T-SQL is owned by Microsoft.

Discuss this Question


3. What is T-SQL?

  1. T-SQL is a language that is commonly used as an object mapper.
  2. T-SQL is a language that is greatly used in the analysis and search engine sector.
  3. T-SQL is a language that is the extension of normal extension.

Answer: B) T-SQL is a language that is the extension of normal extension.

Explanation:

T-SQL is a language that is the extension of normal extension.

Discuss this Question


4. Is T-SQL a nonprocedural language?

  1. Yes
  2. No

Answer: B) NO

Explanation:

No, T-SQL is a procedural language.

Discuss this Question


5. How many types of functions are there in T-SQL?

  1. 2
  2. 3
  3. 4
  4. 5

Answer: C) 4

Explanation:

There are four types of functions in T-SQL: Aggregate functions, Ranking functions, Row set functions, Scalar functions

Discuss this Question


6. How many data types and categories are available in T-SQL?

  1. 8
  2. 9
  3. 4
  4. 7

Answer: D) 7

Explanation:

There are seven categories of data types in T-SQL: Exact Numeric Types, Numeric Type, Date and Time types, Unicode Character String, Binary Strings, and Character Strings.

Discuss this Question


7. Which of the following commands is used if you want to see the column definition of a particular table?

  1. Show _column table name
  2. Column table name
  3. Exec sp_column table name
  4. Sp_column table name

Answer: C) Exec sp_column table name

Explanation:

Exec sp_column table name is the command we use when we want to see the columns definition of a particular table.

Discuss this Question


8. Which of the following commands is used if you want to delete the table?

  1. DROP TABLE
  2. DROP TABLE table_name
  3. DELETE TABLE
  4. DELETE TABLE table_name

Answer: B) DROP TABLE table_name

Explanation:

DROP TABLE table_name is the command we use if you want to delete the table.

Discuss this Question


9. Which of the following commands is used if you want to delete the row from a table?

  1. DROP FROM table_name where condition
  2. DROP FROM TABLE table_name
  3. DELETE FROM TABLE table_name
  4. DELETE FROM table_name where condition

Answer: D) DELETE FROM table_name where condition

Explanation:

DELETE FROM table_name where condition command is used if you want to delete the row from a table.

Discuss this Question


10. What will be the output of the below LIKE query?

WHERE SALARY LIKE '9000%'
  1. It will find any value that starts with 9000
  2. It will find any value that ends with 9000
  3. It will find any value whose range is between 9000
  4. It will find the value where salary is less than 9000

Answer: A) It will find any value that starts with 9000

Explanation:

It will find any value that starts with 9000.

Discuss this Question


11. What will be the output of the below LIKE query?

WHERE SALARY LIKE '%9000%'
  1. It will find any value that starts with 9000
  2. It will find any value that ends with 9000
  3. It will find any value that has 9000 at any position.
  4. It will find the value where salary is less than 9000

Answer: C) It will find any value that has 9000 at any position.

Explanation:

It will find any value that has 9000 at any position.

Discuss this Question


12. What will be the output of the below LIKE query?

WHERE SALARY LIKE '8_%_%.'
  1. It will find any value that starts with 8 and has more than 3 characters in length
  2. It will find any value that starts with 8 and has only 2 characters in length
  3. It will find any value that starts with 8 and have at least 1 character in length
  4. It will find any value that starts with 8 and has at least 3 characters in length.

Answer: D) It will find any value that starts with 8 and has at least 3 characters in length.

Explanation:

It finds any value that starts with 8 and has at least 3 characters in length.

Discuss this Question


13. What will be the output of the below LIKE query?

WHERE SALARY LIKE '_10%8'
  1. It will find any value that has a 10 at the starting position and ends with 8.
  2. It will find any value that has a 10 in the second position and ends with 8.
  3. It will find any value that has a 10 in the third position and also has 8.
  4. It will find any value that has a 10 in the second position and starts with 8.

Answer: B) It will find any value that has a 10 in the second position and ends with 8.

Explanation:

It will find any value that has a 10 in the second position and ends with 8.

Discuss this Question


14. In T-SQL if we use order-by clause then by default in which order the value is sorted?

  1. Ascending order
  2. Descending order

Answer: A) Ascending order

Explanation:

ORDER BY sorts the data in ascending order by default.

Discuss this Question


15. In T-SQL which keyword is used to sort the data in descending order?

  1. DES
  2. DEC
  3. DESC
  4. DESCORDER

Answer: C) DESC

Explanation:

DESC is the keyword used in T-SQL to sort the data in descending order.

Discuss this Question


16. In T-SQL which keyword is used to sort the data in ascending order?

  1. AES
  2. AEC
  3. AESC
  4. ASC

Answer: D) ASC

Explanation:

ASC is the keyword used in T-SQL to sort the data in ascending order.

Discuss this Question


17. In T-SQL Pivot and Unpivot are the ____.

  1. Arithmetic Operators.
  2. Relational Operators.
  3. Logical Operators.

Answer: B) Relational Operators.

Explanation:

In T-SQL Pivot and Unpivot are the relational operators.

Discuss this Question


18. Among PIVOT operators and UNPIVOT operators, which type of operator in T-SQL converts the row data into column data?

  1. PIVOT Operators.
  2. UNPIVOT Operators.

Answer: A) PIVOT Operators.

Explanation:

PIVOT operator is the type of operator in T-SQL which converts the row data into column data.

Discuss this Question


19. Among PIVOT operators and UNPIVOT operators, which type of operator in T-SQL converts the column-based data into row-based data and vice versa?

  1. PIVOT Operators.
  2. UNPIVOT Operators.

Answer: B) UNPIVOT Operators.

Explanation:

UNPIVOT operators are the type of operator in T-SQL which Converts column-based data into row-based data and vice versa.

Discuss this Question


20. Which of the following keywords in T-SQL eliminate duplicate records?

  1. UNIQUE
  2. DISTINCT
  3. DISCRETE

Answer: B) DISTINCT

Explanation:

DISTINCT keyword in T-SQL is used to eliminate duplicate records from the table.

Discuss this Question


21. Which of the following is the correct syntax to use the DISTINCT keyword?

  1. SELECT DISTINCT column N FROM table_name WHERE [condition]
  2. SELECT column N FROM table_name WHERE [condition]=DISTINCT
  3. SELECT column N DISTINCT FROM table_name WHERE [condition]

Answer: A) SELECT DISTINCT column N FROM table_name WHERE [condition]

Explanation:

SELECT DISTINCT column N FROM table_name WHERE [condition], is the correct syntax to use DISTINCT keyword in T-SQL.

Discuss this Question


22. Which of the following joins returns rows when there is a match in the tables?

  1. INNER JOIN
  2. LEFT JOIN
  3. RIGHT JOIN
  4. FULL JOIN
  5. SELF JOIN
  6. CARTESIAN JOIN

Answer: A) INNER JOIN

Explanation:

INNER JOIN is a type of join that returns the rows as a result when there is a match in the tables.

Discuss this Question


23. Which of the following types of joins selects all the rows from the right table if there are no matches found in the left table?

  1. INNER JOIN
  2. LEFT JOIN
  3. RIGHT JOIN
  4. FULL JOIN
  5. SELF JOIN
  6. CARTESIAN JOIN

Answer: C) RIGHT JOIN

Explanation:

RIGHT JOIN is a type of join which selects all the rows from the right table if there are no matches found in the left table.

Discuss this Question


24. Which of the following types of joins involves joining every row from one table to every row from another table?

  1. INNER JOIN
  2. LEFT JOIN
  3. RIGHT JOIN
  4. FULL JOIN
  5. SELF JOIN
  6. CARTESIAN JOIN

Answer: F) CARTESIAN JOIN

Explanation:

CARTESIAN JOIN involves joining every row from one table to every row from another table.

Discuss this Question


25. Which of the following types of joins is an intersection of two copies of the same table?

  1. INNER JOIN
  2. LEFT JOIN
  3. RIGHT JOIN
  4. FULL JOIN
  5. SELF JOIN
  6. CARTESIAN JOIN

Answer: E) SELF JOIN

Explanation:

SELF JOIN is an intersection of two copies of the same table.

Discuss this Question


26. In Transact SQL, ____are used to save time by avoiding writing the code repeatedly.

  1. Query
  2. Objects
  3. Stored procedures
  4. Processes

Answer: C) Stored procedures

Explanation:

In Transact SQL, stored procedures are used to save time by avoiding writing the code repeatedly.

Discuss this Question


27. How many types of parameters are there in the stored procedure?

  1. 3
  2. 2
  3. 4
  4. 5

Answer: A) 3

Explanation:

There are three types of parameters in the stored procedure: IN, OUT, IN OUT.

Discuss this Question


28. In the declaration_section of the procedure is where we declare ____?

  1. Global variable
  2. Local variable

Answer: B) Local variable

Explanation:

In the declaration_section of the procedure is where we declare the LOCAL variable.

Discuss this Question


29. In which section of the procedure, do we enter the code for the procedure?

  1. Executable section
  2. Declaration section

Answer: A) Executable section

Explanation:

In the executable section of the procedure, we enter the code for the procedure.

Discuss this Question


30. Is enclosing the query with parenthesis important while writing the subquery inside a query?

  1. Yes
  2. No

Answer: B) NO

Explanation:

While writing a subquery inside a query then a subquery must be enclosed in parenthesis.

Discuss this Question


31. In contrast to the database, the ____ represents a unit of work.

  1. Pipeline
  2. Stored procedure
  3. Transactions

Answer: C) Transactions

Explanation:

In contrast to the database, the Transaction represents a unit of work.

Discuss this Question


32. How many properties of transactions are there?

  1. 2
  2. 3
  3. 5
  4. 4

Answer: D) 4

Explanation:

The transaction has four properties, which are referred to as ACID properties-
Atomicity, consistency, Isolation, Durability.

Discuss this Question


33. In which of the following ACID properties, successful completion of the work unit's operations is ensured and also focuses on the principle where either all operations are successful or none?

  1. Atomicity
  2. Consistency
  3. Isolation
  4. Durability.

Answer: A) Atomicity

Explanation:

In the atomicity property, successful completion of the work unit's operations is ensured and it also focuses on the principle where either all operations are successful or none.

Discuss this Question


34. Which of the following ACID properties ensures that every transaction is unique and every operation works transparently?

  1. Atomicity
  2. Consistency
  3. Isolation
  4. Durability.

Answer: C) Isolation

Explanation:

The isolation property ensures that every transaction is unique and every operation works transparently.

Discuss this Question


35. Which of the following ACID properties states that upon committing a transaction, the database will change state properly?

  1. Atomicity
  2. Consistency
  3. Isolation
  4. Durability.

Answer: B) Consistency

Explanation:

The consistency property states that upon committing a transaction, the database will change state properly.

Discuss this Question


36. Which of the following ACID properties ensures that committed transactions will be properly executed if the system fails?

  1. Atomicity
  2. Consistency
  3. Isolation
  4. Durability.

Answer: D) Durability

Explanation:

The durability property ensures that committed transactions will be properly executed if the system fails.

Discuss this Question


37. Which of the following commands is used to save the changes in the transaction?

  1. COMMIT
  2. ROLLBACK
  3. SAVEPOINT
  4. Set Transport

Answer: A) COMMIT

Explanation:

Commit command in the transaction is used to save the changes in the transaction.

Discuss this Question


38. Which of the following commands is used to return a name on the transaction?

  1. COMMIT
  2. ROLLBACK
  3. SAVEPOINT
  4. Set Transport

Answer: D) Set Transport

Explanation:

Set transport command is used to return a name on the transaction.

Discuss this Question


39. Which of the following commands is used to retrieve the changes?

  1. COMMIT
  2. ROLLBACK
  3. SAVEPOINT
  4. Set Transport

Answer: B) ROLLBACK

Explanation:

The ROLLBACK command is used to retrieve the changes in the transaction.

Discuss this Question


40. Which of the following commands helps you to generate the collection of transactions with the help of the ROLLBACK command?

  1. COMMIT
  2. ROLLBACK
  3. SAVEPOINT
  4. Set Transport

Answer: C) SAVEPOINT

Explanation:

Savepoint command helps you to generate the collection of transactions with the help of the ROLLBACK command.

Discuss this Question


41. Can you use transactional commands with DDL commands?

  1. Yes
  2. No

Answer: B) NO

Explanation:

DDL commands are commonly known as data definition commands which include commands like create, drop or alter, and transactions commands cannot be used with these types of commands but can be used with the help of DML commands i.e. data manipulation language.

Discuss this Question


42. Which of the following keywords is used to initiate the transaction?

  1. BEGIN
  2. START
  3. INITIATE
  4. ACTIVATE

Answer: A) BEGIN

Explanation:

BEGIN keyword is used before every transaction.

Discuss this Question


43. Which of the following commands is known as Transactional Command?

  1. COMMIT
  2. ROLLBACK
  3. SAVEPOINT
  4. Set Transport

Answer: A) COMMIT

Explanation:

COMMIT command is known as Transactional Command.

Discuss this Question


44. Which of the following is the correct syntax to create an index?

  1. CREATE INDEX index_name ON table_name
  2. CREATE index_name ON table_name
  3. CREATE INDEX table_name
  4. Create INDEX on table name/ index name

Answer: A) CREATE INDEX index_name ON table_name

Explanation:

CREATE INDEX index_name ON table_name, is the correct syntax to create an index.

Discuss this Question


45. How many types of indexes does SQL provide?

  1. 3
  2. 4
  3. 2
  4. 5

Answer: C) 2

Explanation:

Two types of indexing are there in SQL: Clustered and Non-clustered.

Discuss this Question


46. Which type of indexing creates a physical sorting order of rows?

  1. Clustered
  2. Non-clustered.

Answer: A) Clustered

Explanation:

Clustered type of indexing creates a physical sorting order of rows.

Discuss this Question


47. Which type of index is kept in one place and table data is stored in another place?

  1. Clustered
  2. Non-clustered.

Answer: B) Non-clustered.

Explanation:

Non-Clustered type of index is kept in one place and table data is stored in another place.

Discuss this Question


48. Do indexes increase the database performance?

  1. Yes
  2. No

Answer: A) yes

Explanation:

In general, indexes help us to increase database performance.

Discuss this Question


49. Will it be efficient to use indexing on small tables?

  1. Yes
  2. No

Answer: B) NO

Explanation:

It is suggested to use indexing only for long tables.

Discuss this Question


50. Which of the following functions is used to generate the square root of the number?

  1. SQT
  2. SQRT
  3. SQUT
  4. SQR

Answer: B) SQRT

Explanation:

SQRT function is used to generate the square root of the number.

Discuss this Question


51. Which of the following functions is used to generate the random number?

  1. RANDOM
  2. RANDOM_NUMBER
  3. RAND
  4. RANDN

Answer: C) RAND

Explanation:

RAND function is used to generate the random number.

Discuss this Question


52. Select LEFT('HELLO', 3)
What will be the output of the above code?

  1. HELL
  2. ELL
  3. OLL
  4. LLO

Answer: A) HELL

Explanation:

LEFT function returns us the left part of the string, according to the specified number of characters, so the output would be HELL

Discuss this Question


53. Select RIGHT('HELLO', 3)
What will be the output of the above code?

  1. HELL
  2. ELL
  3. OLL
  4. LLO

Answer: D) LLO

Explanation:

RIGHT function returns us the RIGHT part of the string, according to the specified number of characters, so the output would be LLO.

Discuss this Question


54. Which of the following functions eliminate the leading blanks?

  1. TRIM
  2. LTRIM
  3. ETRIM
  4. RTRIM

Answer: B) LTRIM

Explanation:

LTRIM function removes the leading blanks from the given string.

Discuss this Question


55. Which of the following functions eliminate the blanks which are there after the given string?

  1. TRIM
  2. LTRIM
  3. ETRIM
  4. RTRIM

Answer: D) RTRIM

Explanation:

RTRIM function eliminates the blanks which are there after the given string.

Discuss this Question


56. Which of the following functions will help you to repeat the string multiple times?

  1. REPEAT
  2. REPLACE
  3. REPLICATE
  4. DUPLICATE

Answer: C) REPLICATE

Explanation:

The REPLICATE function will help you to repeat the string multiple times.

Discuss this Question


57. What is the full form of PL/SQL?

  1. Process language extension SQL
  2. Procedural language extension SQL
  3. Practical language extension SQL
  4. Progression language extension SQL

Answer: B) Procedural language extension SQL

Explanation:

PL/SQL stands for Procedural language extension SQL.

Discuss this Question


58. PL/SQL is used to ____?

  1. Create applications
  2. Manipulate the data

Answer: A) Create applications

Explanation:

PL/SQL is used to create applications.

Discuss this Question


59. Which company owns PL/SQL?

  1. IBM
  2. Microsoft
  3. Oracle
  4. SAP

Answer: C) Oracle

Explanation:

PL/SQL is owned by Oracle.

Discuss this Question


60. Does PL/SQL use the concept of OOPS?

  1. Yes
  2. No

Answer: A) YES

Explanation:

PL/SQL uses the OPPs concepts like data encapsulation, information hiding, and function overloading.

Discuss this Question




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.