1. ______________ function returns current date and time.
a) SET DATEFIRST
b) SYSDATETIME
c) Cert_ID
d) GETDATE
Answer: d
2. Which of the following function checks whether the expression is a valid date or not?
a) ISDATE
b) ISDAY
c) ISVALID
d) ISYEAR
Answer: a
3. Which of the following is not a mathematical function?
a) ATN2
b) POWER
c) PI
d) CEIL
Answer: d
4. @@NESTLEVEL function falls under which of the following category?
a) Configuration functions
b) Cursor functions
c) Mathematical functions
d) Date and Time Data Functions
Answer: a
5. __________ are used for supporting encryption, decryption, digital signing and their validation.
a) Cryptographic functions
b) Cursor functions
c) Configuration functions
d) None of the mentioned
Answer: a
6. DecryptByKeyAutoCert is ________________ type function.
a) Symmetric Encryption and decryption
b) Encryption Hashing
c) Asymmetric Encryption and decryption
d) Symmetric decryption with Automatic key handling
Answer: d
7. Text and Image Functions are ___________
a) nondeterministic
b) deterministic
c) table valued
d) all of the mentioned
Answer: a
8. Which of the following is not a conversion function?
a) CAST and CONVERT
b) PARSE
c) TRY_CAST
d) TRY_CASE
Answer: d
9. ______________ returns the rank of rows within the partition of a result set, without any gaps in the ranking.
a) RANK
b) NTILE
c) DENSE_RANK
d) ROW_NUMBER
Answer: c
10. Built in Functions in SQL Server is categorized into how many categories?
a) 4
b) 5
c) 6
d) 7
Answer: a
11. . 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
12. Which SQL keyword is used to retrieve a maximum value?
a) MOST
b) TOP
c) MAX
d) UPPER
Answer: c
13. 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
14. ___________removes all rows from a table without logging the individual row deletions.
a) DELETE
b) REMOVE
c) DROP
d) TRUNCATE
Answer: d
15. Which of the following is not a DDL command?
a) UPDATE
b) TRUNCATE
c) ALTER
d) None of the Mentioned
Answer: a
16. 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
17. ________________ is not a category of SQL command.
a) TCL
b) SCL
c) DCL
d) DDL
Answer: b
18. 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
19. 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
20. 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
21. ____ value is returned by the SQL Aggregate functions?
A. Single
B. Twice
C. NULL
D. Infinite
Answer: A) Single
22. In how many parts are the SQL functions are divided into?
A. 1
B. 2
C. 3
D. 4
Answer: B) 2
23. Select the Aggregate function(s) among the following.
A. AVG()
B. FIRST()
C. LAST()
D. All of the above
Answer: D) All of the above
24. What does AVG() function returns?
A. First value of the column
B. Last value of the column
C. Sum of rows of the table
D. Average value of the column
Answer: D) Average value of the column
25. Which function returns the largest value of the column?
A. MIN()
B. MAX()
C. LARGE()
D. AVG()
Answer: B) MAX()
26. What does COUNT() function returns?
A. Average value
B. Largest value
C. Smallest value
D. Number of rows
Answer: D) Number of rows
27. Select the function which is not the Scalar Function(s)?
A. UCASE()
B. LEN()
C. SUM()
D. NOW()
Answer: C) SUM()
28. What does UCASE() function do?
A. Converts database field to uppercase
B. Converts database field to lowercase
C. Returns the length of the text field
D. Returns the current date and time
Answer: A) Converts database field to uppercase
29. ____ function extract characters from the text field.
A. LEN()
B. NOW()
C. MID()
D. FORMAT()
Answer: C) MID()
30. Which function returns the correct date and time?
A. DATE()
B. NOW()
C. TIME()
D. DATETIME()
Answer: B) NOW()
31. In order to merge two or more strings, which string function is used?
A. CHAR
B. ALTER
C. CONCAT
D. MERGE
Answer: C) CONCAT
32. We can use literal in the CONCAT function. What does literal refer to?
A. Number
B. Character
C. Date
D. All of the above
Answer: D) All of the above
33. What is the symbol of Concatenation Operator?
A. |
B. ||
C. //
D. \\
Answer: B) ||
34. What is the full form of CTE in SQL?
A. Character Table Expressions
B. Character Table Evaluator
C. Common Table Evaluator
D. Common Table Expressions
Answer: D) Common Table Expressions
35. Which clause is needed in CTE SQL syntax?
A. FOR
B. AS
C. WITH
D. TO
Answer: C) WITH
36. In case of ____ data, recursive CTE is used?
A. Round
B. Hierarchal
C. Linear
D. None of the above
Answer: B) Hierarchal
37. In case the CTE is wrong, it goes into –
A. Infinite Loop
B. Null State
C. False State
D. True State
A) Infinite Loop
38. From the set of results, in order to remove the duplicate columns, ____ Clause is
used.
A. DUPLICATE
B. DISTINCT
C. REMOVE
D. DROP
Answer: B) DISTINCT
39. Which of the following statement is TRUE about DISTINCT Clause?
A. Returns only Distinct values.
B. Only on the single column, it operates.
C. It can be used with the aggregates such as COUNT, AVG, etc.
D. All of the above
Answer: D) All of the above
40. ____ are the columns for the retrieval purpose.
A. Tables
B. WHERE Conditions
C. Expressions
D. None of the above
Answer: C) Expressions
41. Which of the following statement is TRUE about DISTINCT Clause?
A. It cannot ignore the NULL values
B. It can ignore the NULL values
C. Its query can return multiple values
D. None of the above
Answer: A) It cannot ignore the NULL values
42. In order to join N tables, minimum number of join statements required is –
A. N
B. N-1
C. N-2
D. N+1
Answer: B) N-1
43. ____ Clause is used in Parent-child relationship in order to join two or more
tables.
A. FROM
B. TO
C. WHERE
D. IN
Answer: C) WHERE
44. Transaction is able to control the following –
A. Transaction
B. Commit
C. Rollback
D. All of the above
Answer: D) All of the above
45. GROUP BY clause is placed before which clause in SQL?
A. HAVING
B. WHERE
C. ORDER BY
D. FROM
Answer: C) ORDER BY
46. Which one if these is used to put the same value in all the rows?
A. Group by unique column
B. Group by single column
C. Group by one column
D. Group by same value
Answer: B) Group by single column
47. In order to convert the expression from one to another data type, which SQL
Function is used?
A. CONVERT
B. CHANGE
C. CAST
D. TRANSIT
Answer: C) CAST
48. What is the syntax of SQL CAST Function?
A. CAST (expression AS [data type])
B. CAST (expression IN [data type])
C. CAST (expression TO [data type])
D. CAST (expression FOR [data type])
Answer: A) CAST (expression AS [data type])
49. Select the correct type(s) of SQL Comments.
A. Inline Comments
B. Single Line Comments
C. Multi-line Comments
D. All of the above
Answer: D) All of the above
50. What will be the output of the below SQL statement?
SELECT CAST('2021-10-06' AS datetime);
A. 2021-10-06 00:00:00.000
B. 2021-10-06
C. 2021 OCT 06
D. 06-10-2021
Answer: A) 2021-10-06 00:00:00.000