0% found this document useful (0 votes)
285 views5 pages

Quiz 2

This document contains 15 multiple choice questions about PL/SQL concepts such as data types, identifiers, anonymous blocks, and assignment statements. Key points covered include: - BOOLEAN variables can be assigned True, False, 0 or NULL - Implicit data type conversion is when PL/SQL converts data types automatically - Labeling blocks makes code easier to follow - Assignment statements can span multiple lines in PL/SQL - The CONSTANT keyword prevents a variable's value from changing - RECORD is a composite data type - Data types can specify a valid range of values

Uploaded by

Andriy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
285 views5 pages

Quiz 2

This document contains 15 multiple choice questions about PL/SQL concepts such as data types, identifiers, anonymous blocks, and assignment statements. Key points covered include: - BOOLEAN variables can be assigned True, False, 0 or NULL - Implicit data type conversion is when PL/SQL converts data types automatically - Labeling blocks makes code easier to follow - Assignment statements can span multiple lines in PL/SQL - The CONSTANT keyword prevents a variable's value from changing - RECORD is a composite data type - Data types can specify a valid range of values

Uploaded by

Andriy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

 Which of the following can be assigned to a BOOLEAN variable?


1. Null
2. False
3. True
4. 0
Mark for Review

(1) Points
2, 3 and 4
2 and 3
1, 2 and 3 (*)
1, 2, 3 and 4
Correct

2. Code is easier to read if you declare one identifier per line. True or False?
Mark for Review

(1) Points
True (*)
False
Correct

3. Single row character functions are valid SQL functions in PL/SQL. True or
False?
Mark for Review

(1) Points
True (*)
False
Correct

4. When PL/SQL converts data automatically from one data type to another,
it is called _______ conversion.
Mark for Review

(1) Points
Explicit
Implicit (*)
TO_CHAR
Correct
5. What will happen when the following code is executed?
DECLARE v_new_date DATE;
BEGIN
v_new_date := 'Today';
DBMS_OUTPUT.PUT_LINE(v_new_date);
END;

Mark for Review

(1) Points
The block will fail because the character value "Today" cannot be implicitly
converted to a date. (*)
The block will execute and display today's date.
The block will execute and display the word "Today".
Correct
6. Reserved words can be used as identifiers. True or False?
Mark for Review

(1) Points
True
False (*)
Correct

7. The name of a variable is an example of an identifier. True or False?


Mark for Review

(1) Points
True (*)
False
Correct

8. To comment a single line of code, use two dashes after the comment.
True or False?
Mark for Review

(1) Points
True
False (*)
Correct
9. What good programming practice would make this code easier to follow?
DECLARE
   v_myvar VARCHAR2(20);
BEGIN
   DECLARE
     v_myvar VARCHAR2(15);
   BEGIN
   ...
   END;
END;

Mark for Review

(1) Points
Using a consistent naming convention for variables
Developing a case convention for the code
Labeling the blocks (*)
Avoid using column names as identifiers
Correct

10. What values will be displayed when the following code is executed?


DECLARE
    v_mynum NUMBER;
BEGIN
    v_mynum := 7;
    DECLARE
       v_mynum NUMBER;
    BEGIN
       DBMS_OUTPUT.PUT_LINE(v_mynum);
       v_mynum := 3;
    END;
    DBMS_OUTPUT.PUT_LINE(v_mynum);
END;

Mark for Review

(1) Points
3,7
3,3
Null, 3
Null, 7 (*)
Correct
11. For the anonymous block below, what is the correct reference to the
father's date of birth in the inner block?
<< outer>>
DECLARE
   v_father_name VARCHAR2(20):='Patrick';
   v_date_of_birth DATE:='20-Apr-1972';
BEGIN
   DECLARE
     v_child_name VARCHAR2(20):='Mike';
     v_date_of_birth DATE:='12-Dec-2002';
...

Mark for Review

(1) Points
v_date_of_birth.outer
  << outer.v_date_of_birth >>

<< outer>>v_date_of_birth
outer.v_date_of_birth (*)
Correct

12. Assignment statements can continue over several lines in PL/SQL. True


or False?
Mark for Review

(1) Points
True (*)
False
Correct

13. When a variable is defined using the CONSTANT keyword, the value of


the variable cannot change. True or False?
Mark for Review

(1) Points
True (*)
False
Correct
14. Which of the following is a composite data type?
Mark for Review

(1) Points
CLOB
RECORD (*)
VARCHAR2
DATE
Correct

15. A datatype may specify a valid range of values. True or False?


Mark for Review

(1) Points
True (*)
False
Correct
Previous

You might also like