Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Exam (elaborations)

PLSQL feedbak of midterm exam semister 1 part1 ( LATEST UPDATE )

Rating
-
Sold
-
Pages
378
Grade
A+
Uploaded on
14-02-2022
Written in
2021/2022

PLSQL feedbak of midterm exam semister 1 part1 ( LATEST UPDATE )

Institution
Course

Content preview

PlSQL feedback midterm semister 1 part2
Test: Mid Term Exam Semester 1 - Part II


Review your answers, feedback, and question scores below. An asterisk (*) indicates
a correct answer.
The Mid Term Exam for Semester 1 is presented to you as two exams. This is Part II
of the Mid Term Exam for Semester 1.


Section 4
1. Examine the following code:
DECLARE
a BOOLEAN := TRUE;
b BOOLEAN := FALSE;
c BOOLEAN := TRUE;
d BOOLEAN := FALSE;
game char(4) := 'lost';
BEGIN
IF ((a AND b) AND (c OR d))
THEN game := 'won';
END IF;
What is the value of GAME at the end of this block?
Mark for Review
(1) Points
NULL
won'
lost' (*)
False

Incorrect. Refer to Section 4.

2. What is the correct form of a compound IF statement? Mark for Review
(1) Points
IF condition
THEN statement1
ELSE statement 2;

IF condition
THEN statement1
ELSE statement 2;
END IF;

IF condition;
THEN statement1;
ELSE statement2;
END IF;

IF condition THEN statement1;
ELSE statement2;
END IF;
Page 1

, PlSQL feedback midterm semister 1 part2
(*)


Incorrect. Refer to Section 4.

3. How many ELSIF statements are you allowed to have in a compound IF statement?
Mark for Review
(1) Points
Only one
As many as you want (*)
They must match the same number as the number of ELSE statements.
None; the command is ELSE IF;

Incorrect. Refer to Section 4.

4. Examine the following code:
DECLARE
a VARCHAR2(6) := NULL;
b VARCHAR2(6) := NULL;
BEGIN
IF a = b THEN
DBMS_OUTPUT.PUT_LINE('EQUAL');
ELSIF a != b THEN
DBMS_OUTPUT.PUT_LINE('UNEQUAL');
ELSE
DBMS_OUTPUT.PUT_LINE('OTHER');
END IF;
END;

Which word will be displayed?
Mark for Review
(1) Points
UNEQUAL
EQUAL
Nothing will be displayed
OTHER (*)

Incorrect. Refer to Section 4.

5. You need to execute a set of statements 10 times, increasing a counter by 1
each time. Which of the following PL/SQL constructs can do this? (Choose three)
Mark for Review
(1) Points
(Choose all correct answers)
IF ... THEN ... ELSE
A WHILE loop (*)
Page 2

, PlSQL feedback midterm semister 1 part2
CASE ... WHEN ... THEN
A FOR loop (*)
A basic loop (*)

Incorrect. Refer to Section 4.

6. In the following code fragment, you want to exit from the outer loop at Line A
if v_number = 6. Which statement would you write on Line A?
<<big_loop>>
WHILE condition_1 LOOP
<<small_loop>>
FOR i IN 1..10 LOOP
DBMS_OUTPUT.PUT_LINE(i);
-- Line A
END LOOP;
END LOOP;
Mark for Review
(1) Points
IF v_number = 6 THEN EXIT;
EXIT outer_loop WHEN v_number = 6;
EXIT big_loop WHEN v_number = 6; (*)
EXIT small_loop WHEN v_number = 6;

Incorrect. Refer to Section 4.

7. You want to display multiplication tables for numbers up to 12. The display
should look like this:
1 x 1 = 1
1 x 2 = 2
.....
1 x 12 = 12
2 x 1 = 2
2 x 2 = 4
.....
2 x 12 = 24
3 x 1 = 3
.....
.....
12 x 12 = 144
Which of the following is an efficient way to do this in PL/SQL? Mark for Review
(1) Points
Use two nested FOR loops. (*)
Store all the numbers from 1 to 144 in a table, then fetch and display them
using a cursor.
Create a function which accepts two numbers as IN parameters and returns their
product. Invoke the function 144 times.
Write an anonymous block which contains 144 calls to DBMS_OUTPUT, each looking
Page 3

, PlSQL feedback midterm semister 1 part2
like: DBMS_OUTPUT.PUT_LINE('7 x 9 = 63');

Incorrect. Refer to Section 4.

8. Examine the following code:
DECLARE
v_outer_count NUMBER := 1;
v_inner_count NUMBER := 1;
BEGIN
LOOP
LOOP
v_inner_count := v_inner_count + 1;
EXIT WHEN v_inner_count > 5; -- Line A
END LOOP;
v_outer_count := v_outer_count + 1;
EXIT WHEN v_outer_count > 3;
END LOOP;
END;

What happens at Line A when the value of V_INNER_COUNT equals 6?
Mark for Review
(1) Points
Both loops are exited and the block's execution is terminated.
The inner loop is exited but the outer loop continues execution. (*)

The outer loop is exited but the inner loop continues execution.
An error condition is returned.

Incorrect. Refer to Section 4.

9. Examine the following code:
BEGIN
FOR i IN 1..5 LOOP
FOR j IN 1..8 LOOP
EXIT WHEN j = 7;
DBMS_OUTPUT.PUT_LINE(i || j);
END LOOP;
END LOOP;
END;
How many lines of output will be displayed when this code is executed? Mark for
Review
(1) Points
35
6
30 (*)
40

Incorrect. Refer to Section 4.

10. The EXIT statement can be located anywhere inside a basic loop. True or
Page 4

Written for

Course

Document information

Uploaded on
February 14, 2022
Number of pages
378
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$7.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
gersro

Also available in package deal

Get to know the seller

Seller avatar
gersro Arizona Medical Training Institute
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
4 year
Number of followers
0
Documents
13
Last sold
-
MEDLUXT IMPEX

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions