PL/I and PL/SQL Programming Quiz
Test your knowledge of PL/I programming language constructs and PL/SQL database programming including procedures, cursors, and triggers.
Questions
What does the cursor attribute ‘%rowcount’ do?
- Check whether cursor has fetched any row
- Check whether cursor has not fetched any row.
- Check the number of rows returned by the cursor
- Both A and C
The data type returned by a ‘%FOUND’ cursor attribute is
- NUMBER
- BOOLEAN
- CHARACTER
- STRING
True of False :A package specification can exist without a body
- True
- False
In which property does a NUMBER datatype differs from a PLS_INTEGER datatype
- Padding
- Length
- Storage
- All of the above
How many types of triggers are there?
- 4
- 8
- 12
- 16
A database storage is stored in the database as
- In compiled form
- As source code
- Both A and B
- None of the above
What are the modes of parameters that can be passes to a procedure?
- IN
- IN, OUT
- IN, OUT,INOUT
- IN, OUT, INOUT , OUTIN
The default mode of parameters that can be passes to a procedure?
- IN
- OUT
- OUTIN
- INOUT
What are the types of cursors available in plsql?
- user defined
- implied
- implicit and explicit
- Implied and user defined
Which of the following statements about PL/I arrays is TRUE ?
- multidimensional arrays are allowed. The maximum number of dimensions is 15.
- the elements in an array can only be of the numeric datatype
- a reference towards an element in an array is done by means of a subscript. The first occurrence of an element in an array has subscript 0.
- arrays are used to read in DB2 tables
Which of the following statements about PL/I programs are TRUE?
- a program must always begin with a PROCEDURE statement and end with an END statement
- PL/I instructions can be coded between positions 1 and 72
- you have to declare each variable that you are going to use
- a program can be composed out of different procedures
A PL/I programmer wants to display a number in his/her program. Which of the following variables is suited for doing this ? +123.45 (we assume the decimal sign is ‘.’)
- PIC ‘(5)9’
- PIC ‘S(3)9V.99’
- PIC ‘S999.99’
- PIC ‘999V99’
A PL/I programmer wants to repeat an instruction 5 times. How can he/she code this ?
- REPEAT 5 TIMES; instruction; END;
- DO J=1 TO 5; instruction; END;
- COUNTER = 1; DO WHILE COUNTER < 5; COUNTER = COUNTER + 1; instruction; END;
- REPEAT VARYING COUNTER FROM 1 BY 1 UNTIL COUNTER = 5; instruction; END;
Take a look at the following PL/I program. Assume A, B, C, ... being PL/I instructions. In which order will they be executed? MYPROG : PROCEDURE OPTIONS (MAIN); CALL INIT; Z; CALL TERM; Z; END MYPROG; INIT : PROCEDURE; A; B; CALL READ-X; LOOP : PROCEDURE; E; F; TERM : PROCEDURE; G; H; READ-X : PROCEDURE. X;
- A B Z E F Z X
- A B X Z E F G H Z X
- A B X Z E F Z G H Z
- A B X Z G H Z
Take a look at the following PL/I variables. Which of the given conditions is NOT correct? DCL INFILE FILE RECORD INPUT; DCL EOF BIT(1) INIT (‘0’B); ON ENDFILE (INFILE) EOF = ‘1’B; (1) DO WHILE (NOT EOF); (2) DO WHILE (^EOF); (3) DO WHILE (EOF = ‘0’B); (4) DO WHILE (EOF ^= ‘1’B);
- 1
- 2
- 3
- 4
Assume a PL/I program that wants to execute a call to an external procedure. This procedure expects 1 parameter and returns 1 parameter. Which instructions do you have to provide in the main program ? (1) DCL MYSUB ENTRY (CHAR(5)) EXTERNAL; (2) DCL MYSUB ENTRY (CHAR(5)) RETURNS (CHAR(5)) EXTERNAL; (3) DCL MYPARAMETER,MYRESULT CHAR(5); (4) CALL MYSUB (MYPARAMETER); (5) MYRESULT = MYSUB; (6) MYRESULT = MYSUB(MYPARAMETER);
- 1, 3 and 4
- 2, 3 and 4
- 2, 3 and 6
- 1, 3 and 5
If you have the following declarations, what will be the content of RESULT at the end of the given instructions? DCL 1 VAR1 CHAR(5) INIT (‘PL/I’); DCL 1 VAR2 CHAR(10); DCL 1 VAR3 CHAR (2); DCL 1 RESULT CHAR (5); RESULT = ‘COBOL’; VAR2 = VAR1; VAR3 = VAR2; RESULT = VAR3;
- PLbbb (bbb = 3 blanco’s)
- COBOL
- COBPL
- PLBOL
Which of the following PL/I SELECT statements is correct ?
- SELECT (A); WHEN (A=0) PUT LIST(‘A = 0‘); WHEN (A=5) PUT LIST (‘A = 5‘); OTHERWISE PUT LIST (‘A IS NOT 0 NOR 5’); END;
- SELECT (A); WHEN (0) PUT LIST(‘A = 0‘); WHEN (5) PUT LIST (‘A = 5‘); OTHERWISE PUT LIST (‘A IS NOT 0 NOR 5’); END;
- SELECT; WHEN (A=0) PUT LIST(‘A = 0‘); WHEN (5) PUT LIST (‘A = 5‘); OTHERWISE PUT LIST (‘A IS NOT 0 NOR 5’); END;
- All of the above
Which of the following array declarations is NOT correct ? (1) DCL ARRAY_1 DEC FIXED (3)(5,2); (2) DCL ARRAY_1 (5,2) DEC FIXED (3); (3) DCL ARRAY_1 (5) DEC FIXED (3), (2) DEC FIXED (3); (4) DCL (5,2) ARRAY_1 DEC FIXED (3);
- 1
- 2
- 3
- 4
The following are only recognized in white space programming
- Space, tabs, hashes
- Space & tabs
- Hashes & spaces
- Special characters
- None of the above