RSS Feed

Multiple Choice Questions - SQL NULL

Multiple Choice Questions - SQL NULL

1. Comparisons between two null values, or between a NULL and any other value, returns .............

A) NULL
B) 0
C) UNKNOWN
D) NONE OF ABOVE

2. Null values can be inserted into a column by ...........

A) explicitly stating NULL in an INSERT
B) when adding a new column to an existing table by using the ALTER TABLE statement
C) by leaving a column out of an INSERT statement
D) All of above

3. What will be the result of following query:
DECLARE @X VARCHAR(5) 
SET @X = NULL 
SELECT ISNULL(@X, 'ABCDEFGHI') 
A) ABCDEFGHI
B) NULL
C) ABCDE
D) ABC

4. What will be the result of following query:
DECLARE @X VARCHAR(5)
SET @X = NULL  
SELECT COALESCE(@X, 'ABCDEFGHI') 
A) ABCDEFGHI
B) ABCDE
C) NULL
D) NONE OF ABOVE

5. NULLIF returns NULL if its comparison is successful, ISNULL returns NOT NULL if its comparison is successful.

A) True
B) False

6. The data type of an ISNULL expression is the data type of the first input. If the first input is an untyped NULL literal, the data type of the result is the type of the second input. If both inputs are the untyped literal, the type of the output is .....

A) INT
B) nCHAR
C) VARCHAR
D) BOOL

7. Result of the below query is:

select ('Potato ' + NULL + 'Chips')

A) Potato Chips
B) Potato
C) NULL
D) NONE OF ABOVE

8. select * from TABLE_X

Result:
1
a
b
NULL

For the above table the result of below query will be:
select * from TABLE_X
where ID = NULL
A) NULL
B) UNKNOWN
C) NONE OF ABOVE

9. All native SQL SERVER data types are nullable i.e. they can either hold a valid value or an unknown (Null) value.

A) True
B) False

10. The data type of a COALESCE expression is the data type of the input argument with the highest data type precedence. If all inputs are the untyped NULL literal, the data type is:

A) NULL
B) UNKNOWN
C) there is an error
D) NONE OF ABOVE

Answers