RSS Feed

Multiple Choice Questions on SQL Server - Inbuilt Functions - Set 2

Multiple Choice Questions on SQL Server - Inbuilt Functions - Set 2

1. SELECT CHOOSE ( 4, 'TRUE', 'FALSE', 'I Dont Know' ) AS Answer;

Result of the above query is:

A) True
B) False
C) NULL
D) I Dont Know

2. We are running below query on 4-Apr-2014 at 9:25 am.

SELECT CONCAT('Date & Time: ', GETDATE() + 7-6)

It will return:

A) Date & Time: Apr 4 2014 9:25AM
B) Date & Time: Mar 5 2014 9:25AM
C) Date & Time: Mar 4 2014 9:25AM
D) Date & Time: Apr 5 2014 9:25AM

3. SOUNDEX function

A) returns a four-character code to evaluate the similarity of two strings.
B) inserts a string into another string.
C) returns the integer value, as defined by the Unicode standard, for the first character of the input expression.
D) None of Above.

4. Declare @v1 varchar(21) = '2'
SELECT CHOOSE((CAST(@v1 as int)) , 'TRUE', 'FALSE', 'I Dont Know' ) AS Answer;

Result of the above query is:

A) FALSE
B) TRUE
C) I Dont Know
D) NULL

5. IF todays date is 4-Apr-2014, what will the below query return:

SELECT EOMONTH(GETDATE()-5,00.000)

A) 2014-03-31
B) 2014-04-30
C) 2014-06-30
D) 2014-04-31

6. SELECT IIF ( (select count(0))=1, NULL, 'UNKNOWN' ) AS Result

what will the above query return:

A) UNKNOWN
B) 0
C) NULL
D) 1

7. SELECT IIF ( 2 < 1, IIF ( 1=1, IIF ( 2>1, 'Good', 'Bad' ), 'worse' ), IIF ( 1<2, 'Good', 'Bad' ) ) AS Solution;

what will the above query return:

A) Bad
B) Good
C) Worse
D) Null

8. Result of the below query is:

SELECT TRY_CONVERT(INT, 9999999999.3) AS ValueInt;

A) NULL
B) EMPTY
C) ERROR
D) None of Above

9.
Number Name
1 One
2 Two
3 Three
4 Four
5 Five
1 One
NULL NULL
0

Above is an Example_Table:
Select Count(*) from Example_Table as COUNT
Select COUNT_BIG(*) from Example_Table as COUNT_BIG

Result of the above two queries is:

A) 6, 6
B) 7, 7
C) 8, 8
D) None of Above

10. SELECT TIMEFROMPARTS (23,59,59,00, 00) AS New_Time;

Result of the above query is:

A) 23:59:59
B) 23:59:59:0:0
C) 23:59:59:00:00

Answers