Database Multiple Choice Questions 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
Answer: c
Clarification: 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
Answer: c
Clarification: 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
Answer: d
Clarification: None.
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
Answer: b
Clarification: Not null constraint removes the tpules of null values.
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
Answer: b
Clarification: Not null constraint removes the tuples of null values.
6. Using the ______ clause retains only one copy of such identical tuples.
a) Null
b) Unique
c) Not null
d) Distinct
Answer: d
Clarification: Unique is a constraint.
7.
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
Answer: c
Clarification: 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
Answer: c
Clarification: 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
Answer: a
Clarification: 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
Answer: d
Clarification: Since unknown does not hold any value the value cannot have a reverse value.