SA2 DBS - Sheet1 Flashcards

1
Q

In anonymous block, DECLARE states “this is the start of a block”. In Procedure, ____________ states “this is the start of a subprogram”.

A

CREATE PROCEDURE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which keyword is omitted in the declaration section of the procedure? _____

A

DECLARE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Subprograms are named PL/SQL blocks that are compiled and stored in the _______.

A

DATABASE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The IN parameters can only be read within the procedure and cannot be modified.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The positional parameter passing uses the associate operator.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The symbol&raquo_space; is used for association operator?

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The code below is a correct example of passing parameters by combination notation.
add_dept (p_loc=>1400, ‘EDUCATION’ );

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The Positional parameter passing is the common method of passing parameters.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The type of parameter that is declared in procedure heading is called ________.

A

FORMAL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which can be used to assign a default value to IN parameters?

A

All the options

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The ____ parameters can be literal values, variables, or expressions that are sent to the parameter list of a called subprogram.

A

ACTUAL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which parameter mode can be assigned a default value?
IN
OUT
IN OUT

A

IN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How many value is returned by a function?_____

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A stored function must return exactly ____ value.

A

one

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The functions used in SQL statements cannot use ____ or IN OUT modes.

A

IN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is missing in the code below?

create or replace function sample

return number

is

begin

return 5+5;

end;

Group of answer choices

Formal parameter

Nothing is missing

Expression evaluation

Variable

A

Nothing is missing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Which of the statement below is valid? Assuming that get_sal procedure exists with one OUT parameter.

Group of answer choices

x:=100; DBMS_OUTPUT.PUT_LINE(get_sal(x));

All the options

x:= 200; DBMS_OUTPUT.PUT_LINE(get_sal(100+x));

PUT_LINE(get_sal(100));

A

x:=100; DBMS_OUTPUT.PUT_LINE(get_sal(x));

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The purpose of the OR REPLACE clause is to ______ an existing procedure.

A

OVERWRITE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

The _____ are named PL/SQL blocks that are compiled and stored in the database.

A

SUBPROGRAMS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

The DECLARE keyword is not used in a subprogram.
Group of answer choices

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

In Procedure, all parameter modes must be specified.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The formal parameters can be literal values, variables, or expressions that are sent to the parameter list of a called subprogram.
Group of answer choices

True

False

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

The Named parameter passing is the common method of passing parameters.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The DEFAULT keyword is used to assign a default value for formal parameters.
Group of answer choices

True

False

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is the symbol used for association operator?

Group of answer choices

=

> >

=>

> =

A

=>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Assuming add_dept procedure has two parameters: p_name and p_id, what is the error in the given procedure call?

add_dept (‘ADVERTISING’, p_loc => 1400);

Group of answer choices

No error

The value of the positional parameter

The named parameter

Positional parameter must come before named parameter

A

The named parameter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

If Combination notation is used, the _______ parameters must come first.

Group of answer choices

POSITIONAL

NAMED

A

POSITIONAL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What keyword is missing in the given function construct?

CREATE [OR REPLACE] function_name

[(parameter1 [mode1] datatype1, …)]

RETURN datatype IS|AS

[local_variable_declarations; …]

BEGIN

        actions;

RETURN expression;

END [function_name];

A

FUNCTION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Functions return only a single value, and the value is returned through a ______ statement.

A

RETURN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

A function must have a _______ clause in the header and at least one RETURN statement in the executable section.

Group of answer choices

PARAMETER

DECLARATION

RETURN

EXIT

A

RETURN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What follows the RETURN keyword at the function header?

Group of answer choices

IS

PARAMETER

VARIABLE

DATA TYPE

A

DATA TYPE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

The _______ is added to CREATE PROCEDURE clause to overwrite an existing procedure.

A

OR REPLACE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Subprograms become the building blocks of packages and triggers.
Group of answer choices

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

If Combination notation is used, the positional parameters must come first before the named parameters.
Group of answer choices

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

To invoke a procedure from another procedure, use a direct call inside an executable section of the block.
Group of answer choices

True

False

A

t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

Given the procedure below, what is the correct way of invoking the procedure?

CREATE OR REPLACE PROCEDURE show_emps

(p_emp_id IN NUMBER, p_department_id IN number,

p_hiredate IN DATE) IS

begin

  . . . . . .

End;

Group of answer choices

show_emps(101, p_hiredate => ’01-dec-2007’, p_department_id = 10)

Show_emps(101, 10, ’01-dec-2006’);

show_emps(p_department_id => 10, p_hiredate => ’01-dec-1007’, p_emp_id => 101)

All the options

A

show_emps(p_department_id => 10, p_hiredate => ’01-dec-1007’, p_emp_id => 101)

37
Q

The operator => is called _______.

Group of answer choices

Associate operator

Association operator

Referencing operator

Reference operator

A

Association operator

38
Q

Using an _______ parameter mode, you can pass a value into a procedure that can be updated within the procedure.

Group of answer choices

OUT

IN

All the options

IN OUT

A

IN OUT

39
Q

Which type of parameter passing uses an association operator?

Group of answer choices

Positional

IN OUT

Combination

Named

A

Named

40
Q

The functions used in SQL statements cannot use OUT or _____ modes.

A

IN OUT

41
Q

Which of the statement below is valid? Assuming that get_sal function exists with no parameter.

Group of answer choices

v_salary := get_sal() + 50;

get_sal + 50;

v_salary := get_sal + 50;

get_sal() + 50;

A

v_salary := get_sal() + 50;

42
Q

What is missing in the code below?

create or replace function sample

is num number(2);

begin

num := 5+5;

return num;

end;

Group of answer choices

Formal parameter

Not in the options

Size of the returning value

No return value

A

No return value

43
Q

The functions used in SQL statements cannot use OUT or _____ modes.
Group of answer choices

IN

IN OUT

A

IN OUT

44
Q

In the given Procedure header, the ________clause is optional.

CREATE OR REPLACE PROCEDURE name [parameters] IS|AS

A

OR REPLACE

45
Q

The block structure of the subprograms is similar to the structure of anonymous blocks.
Group of answer choices

True

False

A

True

46
Q

The IN mode parameters may or may not be specified.
Group of answer choices

True

False

A

True

47
Q

The actual is a special form of a variable, whose input values are initialized by the calling environment when the subprogram is called, and whose output values are returned to the calling environment when the subprogram returns control to the caller.
Group of answer choices

True

False

A

False

48
Q

What is missing in the given code below?

CREATE or replace procedure raise_sal

       empid my_employees.employee_id%TYPE := 1234, emp_raise number IS

BEGIN

    update employees

    set salary = salary + (salary * (emp_raise/100) where employee_id =  emp;

END;

Group of answer choices

Procedure name after END keyword

Not in the options

Nothing is missing

Incomplete declaration of emp_raise parameter

IN

A

Procedure name after END keyword

49
Q

What is the error of the given code?

BEGIN

add_dept(name =>’new dept’, ‘new location’);

END;

Group of answer choices

Positional parameter must come before named parameter

Invoking the procedure

Actual parameter values

Do not enclose parameter values with single quote

A

Positional parameter must come before named parameter

50
Q

How many private variables are there in the given code?

CREATE or replace procedure raise_sal

       (empid my_employees.employee_id%TYPE := 1234, emp_raise number) IS

BEGIN

    update employees

    set salary = salary + (salary * (emp_raise/100) where employee_id =  emp;

END;

Group of answer choices

2

3

1

0

A

2

51
Q

What is missing in the code below?

create or replace function sample

return number

is num number(2);

begin

num := 5+5;

end;

Group of answer choices

Size of the returning value

No return value

Formal parameter

Incomplete expression

A

No return value

52
Q

The block structure of the subprograms is similar to the structure of _____ blocks.

A

ANONYMOUS

53
Q

The executable section of the procedure body requires a minimum of _____ statement.

A

ONE

54
Q

In the given Procedure header, the underlined clause/keyword is optional.

CREATE OR REPLACE PROCEDURE name [parameters] IS|AS

Group of answer choices

True

False

A

False

55
Q

A procedure is a PL/SQL block containing local variables, a BEGIN, and an END. The procedure_name after the END keyword is mandatory.
Group of answer choices

True

False

A

False

56
Q

Three ways of passing parameters from the calling environment:

Group of answer choices

POSITIONAL, NAMED, COMBINATION

POSITION, NAME, COMBINATION

POSITIONAL, NAMED, COMBINATIONAL

d. POSITION, NAMED, COMBINATION

A

POSITIONAL, NAMED, COMBINATION

57
Q

A ______ is a named PL/SQL block that returns exactly one value.

A

FUNCTION

58
Q

The functions used in SQL statements cannot use _____ or IN OUT modes.

A

IN

59
Q

Which of the statement below is valid? Assuming that get_sal function exists with parameter.

Group of answer choices

get_sal + 50;

get_sal() + 50;

v_salary := get_sal() + 50;

Not in the options

A

get_sal() + 50;

60
Q

You cannot invoke a procedure from inside an SQL statement.
Group of answer choices

True

False

A

True

61
Q

A procedure can be invoked in another procedure.
Group of answer choices

True

False

A

True

62
Q

How many parameters are there in the given code?

CREATE or replace procedure raise_sal

       (empid my_employees.employee_id%TYPE := 1234, emp_raise number) IS

BEGIN

    update employees

    set salary = salary + (salary * (emp_raise/100) where employee_id =  emp;

END;

Group of answer choices

1

2

3

0

A

2

63
Q

In stored function, the parameter mode should only be ______ .

A

IN

64
Q

In Procedure, the default parameter mode is IN.
Group of answer choices

True

False

A

True

65
Q

Procedures may have an exception section.
Group of answer choices

True

False

A

True

66
Q

The parameter modes are specified in:

Group of answer choices

ACTUAL PARAMETER

FORMAL PARAMETER

A

FORMAL PARAMETER

67
Q

In stored function, the RETURN clause is used instead of ____ mode.

A

OUT

68
Q

A function must have a RETURN clause in the _____ and at least one RETURN statement in the executable section.

A

HEADER

69
Q

In Procedure, the default parameter mode is _______.

A

IN

70
Q

Parameters in subprograms are optional.
Group of answer choices

True

False

A

t

71
Q

Another way of initializing a default value for parameter is by using assignment operator.
Group of answer choices

True

False

A

True

72
Q

The OUT parameter mode supplies an input value, which can be returned (output) as a modified value.
Group of answer choices

True

False

A

False

73
Q

The _____ are containers that enable you to group together related PL/SQL subprograms, variables, cursors, and exceptions.

A

PACKAGES

74
Q

What is missing in the given construct in order to remove an entire package?

DROP ________ PACKAGE_NAME;

A

PACKAGES

75
Q

The ____ option drops and re-creates the package specification.

A

OR REPLACE

76
Q

The OR REPLACE option deletes an existing package bod

A
77
Q

The OR REPLACE option overwrite an existing package body.

A

t

78
Q

What is missing in the given package body construct?

CREATE [OR REPLACE] PACKAGE package_name

IS|AS

private type and variable declarations subprogram bodies

[BEGIN initialization statements]

END [package_name];

A

BODY

79
Q

The package specification should contain the subprogram ________ and associated parameters terminated by a semicolon.

A

NAME

80
Q

The package body contains the executable code of the _________ which were declared in the package specification. It may also contain its own variable declarations.

A

SUBPROGRAMS

81
Q

Variables declared in the package body are considered private.

A

t

82
Q

You need to recompile the package specification whenever the body of the subprograms that are in the package body changes.

A
83
Q

Package construct (variable, procedure, function, and so on) that can be seen and executed from _____ the package are considered public.

A

OUTSIDE

84
Q

The OR REPLACE options _______ and re-creates the package specification.

A

DROPS

85
Q

Using the package name after the END keyword is mandatory.

A
86
Q

One of the reason for using packages is encapsulation wherein related programs and variables are grouped together.

A

t

87
Q

The implementation (i.e., the detailed code) of a procedure or function that is declared in a ________ is done in the package body.

A

PACKAGE SPECIFICATION

88
Q

Package body contains only subprograms that are declared in the package specification.

A
89
Q

The OR REPLACE option overwrite an existing package body.

A

t