Database Questions and Answers – Null Values Operations

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

1. A _____ indicates an absent value that may exist but be unknown or that may not exist at all.
a) Empty tuple
b) New value
c) Null value
d) Old value
View Answer

Answer: c
Explanation: None.

2. If the attribute phone number is included in the relation all the values need not be entered into the phone number column. This type of entry is given as
a) 0
b) –
c) Null
d) Empty space
View Answer

Answer: c
Explanation: Null is used to represent the absence of a value.

3. The predicate in a where clause can involve Boolean operations such as and. The result of true and unknown is_______ false and unknown is _____ while unknown and unknown is _____
a) Unknown, unknown, false
b) True, false, unknown
c) True, unknown, unknown
d) Unknown, false, unknown
View Answer

Answer: d
Explanation: None.
advertisement
advertisement

4.

 SELECT name
FROM instructor
WHERE salary IS NOT NULL;
Selects

a) Tuples with null value
b) Tuples with no null values
c) Tuples with any salary
d) All of the mentioned
View Answer

Answer: b
Explanation: Not null constraint removes the tpules of null values.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

5. In an employee table to include the attributes whose value always have some value which of the following constraint must be used?
a) Null
b) Not null
c) Unique
d) Distinct
View Answer

Answer: b
Explanation: Not null constraint removes the tuples of null values.
advertisement

6. Using the ______ clause retains only one copy of such identical tuples.
a) Null
b) Unique
c) Not null
d) Distinct
View Answer

Answer: d
Explanation: Unique is a constraint.

7.

advertisement
CREATE TABLE employee (id INTEGER,name VARCHAR(20),salary NOT NULL);
INSERT INTO employee VALUES (1005,Rach,0);
INSERT INTO employee VALUES (1007,Ross, );
INSERT INTO employee VALUES (1002,Joey,335);

Some of these insert statements will produce an error. Identify the statement.
a) Insert into employee values (1005,Rach,0);
b) Insert into employee values (1002,Joey,335);
c) Insert into employee values (1007,Ross, );
d) None of the mentioned
View Answer

Answer: c
Explanation: Not null constraint is specified which means sone value (can include 0 also) should be given.

8. The primary key must be
a) Unique
b) Not null
c) Both Unique and Not null
d) Either Unique or Not null
View Answer

Answer: c
Explanation: Primary key must satisfy unique and not null condition for sure.

9. You attempt to query the database with this command:

 SELECT nvl (100 / quantity, NONE)
     FROM inventory;

Why does this statement cause an error when QUANTITY values are null?
a) The expression attempts to divide by a null value
b) The data types in the conversion function are incompatible
c) The character string none should be enclosed in single quotes (‘ ‘)
d) A null value used in an expression cannot be converted to an actual value
View Answer

Answer: a
Explanation: The expression attempts to divide by a null value is erroneous in sql.

10. The result of _____unknown is unknown.
a) Xor
b) Or
c) And
d) Not
View Answer

Answer: d
Explanation: Since unknown does not hold any value the value cannot have a reverse value.

Sanfoundry Global Education & Learning Series – Database Management System.

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.