SQL Questions and Answers – SQL Null Values

This set of SQL Multiple Choice Questions & Answers (MCQs) focuses on “SQL Null Values”.

1. NULL value is different from a zero value.
a) True
b) False
View Answer

Answer: a
Explanation: NULL value is different from a zero value or a space character. NULL signifies an unknown value or a value which doesn’t exist during the creation of the record. Field with NULL value is left blank during record creation.

2. NULL signifies _________
a) A known value
b) A random value
c) An unknown value
d) A specific value
View Answer

Answer: c
Explanation: SQL NULL is the term used to represent a missing value during the creation of tuple. A field with a NULL value is similar to a field with no value. NULL signifies an unknown value or a value which doesn’t exist during the creation of the record.

3. Which of the following is not correct about an SQL NULL value?
a) Unknown value
b) Value that is not available
c) Value that is undefined for a tuple
d) Zero value
View Answer

Answer: d
Explanation: NULL value is different from a zero value or a field which contains space characters. A NULL value is used to represent a value that is unknown or unavailable at the time of record creation or undefined for a tuple.
advertisement
advertisement

4. Is it possible to test for NULL values using comparison operators?
a) Yes
b) No
View Answer

Answer: b
Explanation: It is not possible to test for NULL values using the comparison operators, such as =, <, or <>. A special keyword IS NULL and IS NOT NULL operators are used to test for NULL values instead of using comparison operators.

5. Which keyword is used to look for NULL values?
a) Isnull
b) Is Null
c) Null
d) Not Null
View Answer

Answer: b
Explanation: IS NULL and IS NOT NULL are comparison operators which are used to check for a NULL value. When IS NULL is used, only those tuples are selected whose specified attribute(s) is NULL. When IS NOT NULL is used, only those tuples are selected whose specified attribute(s) is NOT NULL.

6. NULL value can be assigned to which type of fields?
a) Only character fields
b) Only Numeric fields
c) Only date fields
d) Character, numeric and date fields
View Answer

Answer: d
Explanation: When a field value is NULL it means that its value doesn’t exist during the creation of the tuple. A field with NULL is not considered as a zero value or a blank. It represents an unknown or undefined value. NULL value can be assigned to character, numeric and date type of fields.

7. IS NULL and IS NOT NULL operators are used with which of the following?
a) Select
b) From
c) Where
d) Insert
View Answer

Answer: c
Explanation: Comparison operators are used with Where clause. Syntax for using IS NULL and IS NOT NULL is as follows:

advertisement
SELECT column_list FROM TABLE_NAME
WHERE column_name IS NULL/IS NOT NULL;

8. Any comparison with NULL returns ______
a) NULL
b) A known value
c) Unknown
d) Zero
View Answer

Answer: c
Explanation: A NULL value is considered to be different value from every other NULL value in the database. When a NULL value is involved in a comparison operation, the result will be UNKNOWN.
advertisement

9. Which of the following keyword when used with a column name while creating the table signifies that it should always accept an explicit value of the given column data type?
a) Is not null
b) Null
c) Not null
d) Is null
View Answer

Answer: c
Explanation: NOT NULL signifies that a column should always accept a value of the given data type. Is not null and Is null are used as comparison operators. They are not used while creating a table. NULL is used to assign an unknown value to a field.

10. When a known value is added to a NULL value, the result is _______
a) Null
b) Known value
c) Zero
d) Infinity
View Answer

Answer: a
Explanation: A field with a NULL value is same as a field with no value. So a NULL value can be considered as an unknown value. Adding anything to a NULL value will give a null value as result. So, when a known value is added to a NULL value, the result will be NULL.

Sanfoundry Global Education & Learning Series – SQL.

To practice all areas of SQL, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.