Section 2 Quiz

Section 2 Quiz (Answer all questions in this section) 1. Which statements about lexical units are true? (Choose two.) M

Views 1,714 Downloads 16 File size 469KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

Section 2 Quiz (Answer all questions in this section) 1. Which statements about lexical units are true? (Choose two.)

Mark for Review (1) Points

(Choose all correct answers) They are sequences of characters including letters, digits, tabs, returns and symbols (*) They are optional but can make a PL/SQL block execute faster They are the building blocks of every PL/SQL program (*) They are named objects stored in the database Correct 2. What is a lexical unit?

Mark for Review (1) Points

A data type for a column A building block of a PL/SQL block (*) A type of variable Correct 3. What will be displayed when the following code is executed? DECLARE x VARCHAR2(6) := 'Chang'; BEGIN DECLARE x VARCHAR2(12) := 'Susan'; BEGIN x := x || x; END; DBMS_OUTPUT.PUT_LINE(x); END; Susan Chang (*) The code will fail with an error ChangChang SusanChang Correct

Mark for Review (1) Points

4. A variable defined in an outer block is global to the outer block and local to the inner block. True or False?

Mark for Review (1) Points

True False (*) Correct 5. Is the following variable declaration correct or not?

Mark for Review (1) Points

DECLARE maxsalary NUMBER(7) = 5000; Correct. Not correct. (*) Incorrect. Refer to Section 2 Lesson 1. 6. Examine the following variable declarations:

Mark for Review (1) Points

DECLARE v_number NUMBER := 10; v_result NUMBER; Which of the following correctly assigns the value 50 to V_RESULT? All of these are correct (*) v_result := 100 / 2; v_result := ROUND(49.77); v_result := v_number * 5; Incorrect. Refer to Section 2 Lesson 1. 7. The implicit data type conversion at Point A may not work correctly. Why not? DECLARE v_mydate DATE;

Mark for Review (1) Points

BEGIN V_MYDATE := '29-Feb-2004'; -- Point A END; V_MYDATE has been entered in uppercase Oracle cannot implicitly convert a character string to a date, even if the string contains a valid date value (*) There are only 28 days in February If the database language is not English, 'Feb' has no meaning. Incorrect. Refer to Section 2 Lesson 5. 8. Which of the following are valid PL/SQL operators? (Choose three.)

Mark for Review (1) Points

(Choose all correct answers) Exponential (*) Arithmetic (*) Concatenation (*) Exception Correct 9. Examine the following block. What should be coded at Line A? DECLARE v_char VARCHAR2(8) := '24-Sep-2007'; v_date DATE; BEGIN v_date := ....... Line A END;

Mark for Review (1) Points

v_date := TO_DATE(v_char,'dd-Mon-YYYY'); (*) v_date := v_char; v_date := FROM_CHAR(v_char,'dd-Mon-YYYY'); Correct 10. Which of the following is a composite data type?

Mark for Review (1) Points

DATE VARCHAR2 CLOB

RECORD (*) Correct 11. Which statement most closely describes "data type"?

Mark for Review (1) Points

It allows different kinds of data to be stored in a single variable. It is the value of a variable. It specifies a storage format, constraints, and a valid range of values for a variable. (*) It is used to test if errors have occurred. Correct 12. Which of the following makes PL/SQL code easier to read and maintain?

Mark for Review (1) Points

Type everything in lowercase. Place multiple statements on the same line. Use suitable comments in the code. (*) Incorrect. Refer to Section 2 Lesson 7. 13. Which of the following are examples of good programming practice? (Choose three.)

Mark for Review (1) Points

(Choose all correct answers) Develop naming conventions for identifiers and other objects. (*) Indent code so that it can be read more easily. (*) Document code with comments. (*) Use implicit data type conversions. Use table column names as the names of variables. Incorrect. Refer to Section 2 Lesson 7. 14. You need to declare a variable to hold a value which has been read from the SALARY column of the EMPLOYEES table. Which of the following is an advantage of declaring the variable as: employees.salary%TYPE ?

Mark for Review (1) Points

If the SALARY column is ALTERed later, the PL/SQL code need not be changed. (*) It is shorter than coding NUMBER(8,2) It executes much faster than using NUMBER(8,2) It allows the software to perform implicit data type conversions. Correct 15. Which of the following is NOT a character data type?

Mark for Review (1) Points

LONG BOOLEAN (*) CHAR VARCHAR2 Correct