Deck 4: Introduction to PlSQL
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/100
Play
Full screen (f)
Deck 4: Introduction to PlSQL
1
A data structure is a data object made up of multiple individual data elements.
True
2
The default buffer size in SQL*Plus is 2,000 characters.
True
3
A string literal is enclosed in "" (double quotes).
False
4
To parse a character string it is best to use the LENGTH and RTRIM functions.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
5
A PL/SQL program usually begins with the keyword DECLARE.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
6
If NUMBER variable x has a value of NULL,and y has a value of 1,then the result of x * y is 1.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
7
The end of each PL/SQL command is marked with a .(period).
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
8
There are variable data types called INTEGER and REAL.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
9
To execute a PL/SQL program in SQL*Plus use the @ character after the last line of the program.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
10
Any text between the characters /* and */ is considered a comment.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
11
The result of the expression 'Jane' || 'Doe' in PL/SQL would be 'Jane Doe'.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
12
When a program has a syntax error,it will not execute.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
13
Every PL/SQL variable must be declared with a data type before it is used.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
14
In programming,decision control structures alter the order in which statements execute,based on the values of certain variables.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
15
An IF statement is always followed by an ELSE statement.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
16
To capitalize the first letter only of a character string,use the INITCAP function.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
17
To assign a value to a variable use the = operator.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
18
In a PL/SQL program,2 ** 3 = 6.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
19
To create a reference variable to a database field,use the %FIELD data type.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
20
The VARCHAR2 variable data type is exactly the same as the field data type.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
21
When using logical operators,AND is always evaluated before OR.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
22
What designates a one-line comment in PL/SQL?
A)^
B) $$
C)--
D)!
A)^
B) $$
C)--
D)!
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
23
The LOOP...EXIT Loop can be a pretest or posttest loop.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
24
The error message "ORA-01422: exact fetch returns more than requested number of rows" indicates that the implicit cursor query tried to retrieve multiple records.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
25
An explicit cursor must be opened before it can be processed.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
26
DDL queries may be used in PL/SQL programs.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
27
In an IF/THEN/ELSE statement,the logic that comes after the ELSE is only executed if the condition is true.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
28
The numeric FOR loop executes a predetermined number of times.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
29
An undefined exception must be declared before it can be handled.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
30
When you declare a variable with data type NUMBER,what is the value before you assign a value?
A)0
B)-1
C)1
D)NULL
A)0
B)-1
C)1
D)NULL
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
31
When you execute a SELECT statement in a PL/SQL program that returns exactly one row,you must use an explicit cursor.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
32
When declaring a variable that has the same data type as a field,use the ____ type.
A)%FIELD
B)%COLUMN
C)%TYPE
D)%ROWTYPE
A)%FIELD
B)%COLUMN
C)%TYPE
D)%ROWTYPE
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
33
Choose the scalar variable.
A)TABLE
B)RECORD
C)BOOLEAN
D)VARRAY
A)TABLE
B)RECORD
C)BOOLEAN
D)VARRAY
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
34
If the value of a conditional statement is NULL,it is evaluated as if it were false in a conditional statement.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
35
Choose the composite variable.
A)VARRAY
B)BINARY_INTEGER
C)VARCHAR2
D)DATE
A)VARRAY
B)BINARY_INTEGER
C)VARCHAR2
D)DATE
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
36
What operator represents exponentiation in PL/SQL?
A)^
B)#
C)**
D)@
A)^
B)#
C)**
D)@
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
37
To assign a value to a variable,use the ____ operator.
A)=
B):=
C)=:
D)= =
A)=
B):=
C)=:
D)= =
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
38
You must include a ____ at the end of a PL/SQL command.
A) ,
B):
C) ;
D).
A) ,
B):
C) ;
D).
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
39
What keyword comes first in a PL/SQL program?
A)END
B)BEGIN
C)DECLARE
D)EXCEPTION
A)END
B)BEGIN
C)DECLARE
D)EXCEPTION
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
40
____ are typically written in lower-case letters according to the PL/SQL command capitalization style.
A)Database objects
B)Built-in functions
C)Reserved words
D)Predefined data types
A)Database objects
B)Built-in functions
C)Reserved words
D)Predefined data types
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
41
To concatenate two strings,use the ____ operator.
A)&
B)&&
C)||
D)+
A)&
B)&&
C)||
D)+
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
42
What would be the value of variable str_length after executing the following: str_length := LENGTH('123345');
A)2
B)3
C)6
D)8
A)2
B)3
C)6
D)8
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
43
What is a pointer to the context area?
A)explicit cursor
B)implicit cursor
C)declared cursor
D)context cursor
A)explicit cursor
B)implicit cursor
C)declared cursor
D)context cursor
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
44
What keyword is not used in a PL/SQL program?
A)UPDATE
B)COMMIT
C)ROLLBACK
D)ALTER
A)UPDATE
B)COMMIT
C)ROLLBACK
D)ALTER
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
45
What is the prefix for error codes generated by PL/SQL?
A)ORA
B)PLS
C)PLA
D)OSL
A)ORA
B)PLS
C)PLA
D)OSL
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
46
Given the character string 'I am a yellow dog" in variable c_str,what would be the expected value of the c_substr variable after the following commands are executed: yellow_pos := instr(c_str,'yellow');
C_substr := substr(c_str,1,yellow_pos);
A)'I'
B)'I am a y'
C)'I am a'
D)'I am a '
C_substr := substr(c_str,1,yellow_pos);
A)'I'
B)'I am a y'
C)'I am a'
D)'I am a '
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
47
What is the default size,in characters,for the SQL*Plus buffer?
A)1,000
B)2,000
C)3,000
D)4,000
A)1,000
B)2,000
C)3,000
D)4,000
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
48
What SQL statement could not be part of a PL/SQL program?
A)INSERT INTO my_table ('abc');
B)SELECT * from my_table;
C)CREATE TABLE my_table (col1 CHAR(10));
D)DELETE my_table;
A)INSERT INTO my_table ('abc');
B)SELECT * from my_table;
C)CREATE TABLE my_table (col1 CHAR(10));
D)DELETE my_table;
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
49
What happens if a condition in an IF statement evaluates to NULL?
A)A syntax error
B)A logic error
C)Treated as TRUE
D)Treated as FALSE
A)A syntax error
B)A logic error
C)Treated as TRUE
D)Treated as FALSE
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
50
What command is used differently in PL/SQL from the way it is used when interacting directly with the database?
A)COMMIT
B)INSERT
C)DELETE
D)SELECT
A)COMMIT
B)INSERT
C)DELETE
D)SELECT
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
51
What is the best way to debug a logic error in a PL/SQL program?
A)Use the built-in debugger
B)Use output statements to display variable values.
C)Comment-out every line then un-comment one at a time
D)Execute each query on the database.
A)Use the built-in debugger
B)Use output statements to display variable values.
C)Comment-out every line then un-comment one at a time
D)Execute each query on the database.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
52
To remove trailing spaces,use the ____ function.
A)RTRIM
B)LTRIM
C)RPAD
D)LTRAIL
A)RTRIM
B)LTRIM
C)RPAD
D)LTRAIL
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
53
In a PL/SQL decision control structure the program code following the ____ statement executes when the condition is true.
A)DONE
B)IF
C)ELSE
D)END IF
A)DONE
B)IF
C)ELSE
D)END IF
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
54
In a PL/SQL decision control structure the program code following the ____ statement executes when the condition is false.
A)DONE
B)IF
C)ELSE
D)END IF
A)DONE
B)IF
C)ELSE
D)END IF
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
55
What loop is a pretest only loop?
A)Numeric FOR
B)WHILE ...LOOP
C)LOOP ...EXIT
D)LOOP ...EXIT WHEN
A)Numeric FOR
B)WHILE ...LOOP
C)LOOP ...EXIT
D)LOOP ...EXIT WHEN
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
56
What type of program is helpful in finding logic errors?
A)interpreter
B)sequential processor
C)debugger
D)executor
A)interpreter
B)sequential processor
C)debugger
D)executor
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
57
Which string function is used to capitalize only the initial letter of a word?
A)CAP
B)INCAP
C)INITCAP
D)CAPINIT
A)CAP
B)INCAP
C)INITCAP
D)CAPINIT
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
58
If a = TRUE and b = FALSE,which of the following statements is TRUE?
A)a AND b
B)a OR b
C)NOT a
D)All of the above
A)a AND b
B)a OR b
C)NOT a
D)All of the above
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
59
What does the expression 1 <> 5 evaluate to?
A)TRUE
B)FALSE
C)NULL
D)Undefined
A)TRUE
B)FALSE
C)NULL
D)Undefined
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
60
What loop control structure uses an automatically incremented numeric counter?
A)Numeric FOR
B)WHILE ...LOOP
C)LOOP ...EXIT
D)LOOP ...EXIT WHEN
A)Numeric FOR
B)WHILE ...LOOP
C)LOOP ...EXIT
D)LOOP ...EXIT WHEN
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
61
A(n)____________________ variable references a single value,such as a number,date,or character string.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
62
What command is used to create a user-defined exception when an error condition occurs?
A)THROW
B)HANDLE
C)RAISE
D)CREATE EXCEPTION
A)THROW
B)HANDLE
C)RAISE
D)CREATE EXCEPTION
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
63
Oracle10g stores ____________________ data values internally in a binary format,which takes slightly less storage space than the NUMBER data type,so the system can perform calculations more quickly.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
64
What section of an exception handler handles unanticipated errors?
A)ELSE
B)OTHER
C)WHEN OTHERS
D)ELSE OTHERS
A)ELSE
B)OTHER
C)WHEN OTHERS
D)ELSE OTHERS
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
65
What predefined error indicates that a primary key constraint was violated?
A)DUP_VAL_ON_INDEX
B)NO_DATA_FOUND
C)INVALID_NUMBER
D)VALUE_ERROR
A)DUP_VAL_ON_INDEX
B)NO_DATA_FOUND
C)INVALID_NUMBER
D)VALUE_ERROR
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
66
____________________ statements are lines of text that explain or document a program step or series of steps.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
67
A(n)____________________ variable references a data structure that contains multiple scalar variables.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
68
The ____________________ data type assumes the data type of a database record.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
69
Why is it important to close an explicit cursor?
A)So that other users can access it
B)The server will crash if you don't
C)So that its memory area is available to the system
D)So that an error is avoided when you try to create another cursor
A)So that other users can access it
B)The server will crash if you don't
C)So that its memory area is available to the system
D)So that an error is avoided when you try to create another cursor
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
70
PL/SQL is a(n)____________________ typed language,which means that you must write a command that explicitly declares each variable and specifies its data type before you use the variable.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
71
The ____________________ of a PL/SQL block starts with the BEGIN reserved word and consists of program statements,such as assignment statements,conditional structures,and looping structures.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
72
In PL/SQL,the assignment operator is ____________________.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
73
If a cursor is named location_cursor,and you are using a LOOP ...EXIT WHEN loop to process the cursor,what is the exit condition for the loop?
A)location_cursor.DONE
B)location_cursor%DONE
C)location_cursor.NOTFOUND
D)location_cursor%NOTFOUND
A)location_cursor.DONE
B)location_cursor%DONE
C)location_cursor.NOTFOUND
D)location_cursor%NOTFOUND
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
74
A(n)____________________ variable directly references a specific database column or row and assumes the data type of the associated column or row.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
75
What is the active set?
A)Set of data retrieved by a SELECT command
B)Set of data inserted by an INSERT command
C)Set of data deleted by a DELETE command
D)Set of data updated by an UPDATE command
A)Set of data retrieved by a SELECT command
B)Set of data inserted by an INSERT command
C)Set of data deleted by a DELETE command
D)Set of data updated by an UPDATE command
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
76
What section of a PL/SQL program is used for exception handling?
A)BEGIN
B)DECLARE
C)EXCEPTION
D)ERROR
A)BEGIN
B)DECLARE
C)EXCEPTION
D)ERROR
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
77
What command is used to associate an exception variable with an undefined Oracle error code?
A)EXCEPTION DECLARE
B)PRAGMA EXCEPTION_INIT
C)PRAGMA ERROR
D)PRAGMA EX_INIT
A)EXCEPTION DECLARE
B)PRAGMA EXCEPTION_INIT
C)PRAGMA ERROR
D)PRAGMA EX_INIT
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
78
What is a disadvantage of using a Cursor FOR loop over processing a cursor with a LOOP ...EXIT WHEN loop?
A)It is slower
B)It is more error-prone
C)Cursor variables can not be used outside loop
D)It is not supported in previous versions of Oracle
A)It is slower
B)It is more error-prone
C)Cursor variables can not be used outside loop
D)It is not supported in previous versions of Oracle
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
79
When you declare a variable in PL/SQL,the variable's default value is always ____________________.
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck
80
What clause is added to the SELECT to retrieve values from an implicit cursor?
A)FOR
B)INTO
C)ON
D)AT
A)FOR
B)INTO
C)ON
D)AT
Unlock Deck
Unlock for access to all 100 flashcards in this deck.
Unlock Deck
k this deck