MySQL Multiple Choice Questions on “Null: the Four Letter Word”.
1. What is the meaning of “NULL” in Mysql?
a) Not applicable
b) Value not yet known
c) Value undefined
d) All of the mentioned
Answer: d
Clarification: None.
2. Is the following statement is true/false?
“An expression can be NULL, but can never equal to NULL”
a) True
b) False
Answer: a
Clarification: None.
3. Is the following statement is true/false?
“Two NULL values are equal to each other”
a) True
b) False
Answer: b
Clarification: None.
4. Which operator is used to check whether the expression is “NULL”?
a) IS NULL
b) NOT NULL
c) ON
d) None of the mentioned
Answer: a
Clarification: None.
5. Which operator is used to check the expression is not “NULL”?
a) IS NULL
b) NOT NULL
c) ON
d) None of the mentioned
Answer: b
Clarification: None.
6. What will be the output of the following MySQL command?
SELECT * FROM person WHERE emp_id IS NULL;
a) Only those columns whose emp_id is NULL
b) Only those columns whose emp_id is not NULL
c) No output
d) None of the mentioned
Answer: a
Clarification: None.
7. What will be the output of the following MySQL command?
SELECT * FROM person WHERE emp_id IS NULL;
a) Only those columns whose emp_id is NULL
b) Only those columns whose emp_id is not NULL
c) No output
d) None of the mentioned
Answer: b
Clarification: None.
8. What will be the output of the following MySQL command?
SELECT * FROM person WHERE emp_id = NULL;
a) Only those columns whose emp_id is NULL
b) Only those columns whose emp_id is not NULL
c) No output
d) None of the mentioned
Answer: c
Clarification: An expression can never be equated to NULL that is why there will be no output.
9. What will be the output of the following MySQL command?
SELECT fname FROM person WHERE emp_id != 6;
a) Only those names whose emp_id is not equal to 6
b) Only those names whose emp_id is equal to 6
c) No output
d) None of the mentioned
Answer: a
Clarification: None.
10. What will be the output of the following MySQL command?
SELECT fname FROM person WHERE emp_id != 6 OR emp_id IS NULL;
a) Only those names whose emp_id is not equal to 6 or emp_id with NULL values
b) Only those names whose emp_id is not equal to 6
c) Only those names whose emp_id is equal to 6
d) None of the mentioned
Answer: a
