This set of PL/SQL Multiple Choice Questions & Answers (MCQs) focuses on “PL/SQL Data Types”.
1. Which of the following is not a category of datatype in PL/SQL?
a) Scalar
b) Vector
c) Composite
d) Reference
View Answer
Explanation: In PL/SQL, there are four main categories of datatypes – Scalar, LOB, Composite, Reference.
2. The Numeric datatype comes under the category of Scalar datatypes in PL/SQL.
a) True
b) False
View Answer
Explanation: The Numeric category of datatypes contains subcategories like Numeric, Character, Boolean and Datetime. These subcategories also have various subcategories inside them. For ex – Integer inside Numeric.
3. Which of the following datatype is not within the subcategory of Character datatypes?
a) VARCHAR2
b) NCHAR
c) NVARCHAR2
d) NCAHR2
View Answer
Explanation: The NCHAR2 datatype does not belong in the Character datatype category. The VARCHAR2 datatype is used for Variable-length character string with maximum size of 32,767 bytes. The NCHAR datatype is used for Fixed-length national character string with maximum size of 32,767 bytes. The NVARCAHR2 datatype is used for Variable-length national character string with maximum size of 32,767 bytes.
4. In PL/SQL, the logical values are the Boolean values 0 and 1 and the value NULL.
a) True
b) False
View Answer
Explanation: The BOOLEAN data type stores logical values that are used in logical operations. The logical values are the Boolean values TRUE and FALSE and the value NULL.
5. Which of the following is the correct date range for the DATETIME datatype in PL/SQL?
a) January 1, 4712 BC to December 31, 4712 AD
b) January 1, 9999 BC to December 31, 9999 AD
c) January 1, 4712 BC to December 31, 9999 AD
d) -Infinity to +Infinity
View Answer
Explanation: The DATE datatype is used to store fixed-length datetimes, which include the time of day in seconds since midnight. Valid dates range from January 1, 4712 BC to December 31, 9999 AD.
6. Which of the following is the correct full-form for the LOB datatype category in PL/SQL?
a) Long Objects
b) Large Objects
c) Lexical Objects
d) Lengthy Objects
View Answer
Explanation: LOB stands for large objects. Large Object (LOB) data types refer to large data items such as text, graphic images, video clips etc.
7. In PL/SQL, which of the following datatype is used to store large blocks of character data in the database?
a) NCLOB
b) BFILE
c) BLOB
d) CLOB
View Answer
Explanation: The CLOB datatype is used to store large blocks of character data in the database. The NCLOB, BFILE and BLOB datatypes are used to store large blocks of NCHAR data in the database, store large binary objects in operating system files outside the database and store large binary objects in the database respectively.
8. The NULL in PL/SQL is represented by which of the following symbol?
a) NULL
b) /0
c) \0
d) 0
View Answer
Explanation: PL/SQL NULL values represent missing or unknown data and they are not an integer, a character, or any other specific data type. The NULL value cannot be equated with anything or any value.
9. Which of the following statement can be used to define a user defined datatype in PL/SQL?
a) SUBTYPE userdefined_datatype_name (value) IS datatype
b) SUBTYPE datatype (value) IS userdefined_datatype_name
c) SUBTYPE userdefined_datatype_name IS datatype (value)
d) SUBTYPE userdefined_datatype_name datatype (value)
View Answer
Explanation: The statement that can be used to define a user defined a user defined datatype in PL/SQL is –
SUBTYPE userdefined_datatype_name IS datatype (VALUE)
Here SUBTYPE and IS are keywords. userdefined_datatype_name is the name of datatype that the user wants to keep.
10. In PL/SQL, how many bytes does each character in the AL16UTF16 encoding takes?
a) 1
b) 2
c) 3
d)4
View Answer
Explanation: In PL/SQL, the AL16UTF16 encoding comes with a fixed size that is 2 bytes. They are used when the storage requirement is high otherwise the bytes get wasted.
Sanfoundry Global Education & Learning Series – PL/SQL.
To practice all areas of PL/SQL, here is complete set of 1000+ Multiple Choice Questions and Answers.