0% found this document useful (0 votes)
25 views8 pages

PLSQL Multiple Choice Questions

Uploaded by

vivek reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views8 pages

PLSQL Multiple Choice Questions

Uploaded by

vivek reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

PLSQL Test Paper

Candidate Name: G VIVEKANANDA REDDY


Section 1: Multiple Choice Questions (20 Marks) 45mins
Instructions:
 Try to answer All questions
 Tick [] only ONE Answer.

Question 1: What will be the output of below select statement?

TBL_ACCOUNT

TBL_LOAN

A CONTRACT_TYPE TYPE GUARANTOR


CB0010001.A-6204258.TYPE.1 6204258 1000085

B ✘ CONTRACT_TYPE TYPE GUARANTOR


CB0010001.A-6204258.TYPE.1 CB0010001.A-6204258.TYPE.1 1000085.1

C CONTRACT_TYPE TYPE GUARANTOR


CB0010001.A-6204258.TYPE.1 A-6204258.TYPE.1 BK.1000085

D CONTRACT_TYPE TYPE GUARANTOR


CB0010001.A-6204258.TYPE.1 A-6204258.TYPE.1 BK.1000085
E None of the above

1
Question 2: Observe the following code and fill in the blanks.

A ✘ %notfound, %found, %rowcount.


B %found, %notfound, %rowcount.
C sql%found, sql%notfound, sql%rowcount.
D sql%notfound, sql%found, sql%rowcount.

Question 3: What is the correct order for steps of initializing the cursor?
A. FETCH - B.OPEN - C. DECLARE - D.CLOSE
A A, C, D, B
B ✘ C, B, A, D
C B, D, A, C
D C, A, D, B

2
Question 4: The following code tries to fetch some information from all the rows in a table named
tbl_customers for use in a PL/SQL block. What is wrong in the following code?

A It needs not use a cursor.


B It will not print information from all the rows.
C ✘ The cursor is not open.
D There is nothing wrong in the code.

Question 5: Match the expression examples with their description.

A Nested IF-THEN-ELSE 1 Column name.


IF-THEN-ELSIF Can use one IF-THEN or IF-THEN-ELSIF statement inside another IF-THEN
B 2
statement or IF-THEN-ELSIF statement(s).
Automatically created by Oracle whenever an SQL statement is executed,
C VARRAY 3
when there is no explicit cursor for the statement.
Repeats a statement or group of statements while a given condition is
D Employee.FirstName 4
true. It tests the condition before executing the loop body.
Associates a condition with a sequence of statements enclosed by the
keywords THEN and END IF. If condition is true, the statements get
E Implicit cursors 5
executed and if the condition is false or NULL then the IF statement does
nothing.
Execute a sequence of statements multiple times and abbreviates the
F IF-THEN statement 6
code that manages the loop variable.
G WHILE Loop 7 Must specify the maximum size and the type of elements stored in it.
H FOR Loop 8 Can use to choose between several alternatives

A A = 8, B = 2, C = 7, D = 5, E = 1, F = 3, G = 6, H = 4
B A = 2, B = 8, C = 7, D = 1, E = 3, F = 5, G = 4, H = 6
C A = 5, B = 2, C = 1, D = 7, E = 6, F = 8, G = 4, H = 3
D ✘ A = 2, B = 5, C = 7, D = 1, E = 3, F = 8, G = 4, H = 6
Question 6: What will be the value of variable result after execution of this block of code?

int result =0;


3
for (int i = 0; 1<20; i++){
if (i <10){
continue;
}else if (i >= 10 && i < 15){
result = i;
}else{
break;
}
}

A 0
B 3
C ✘ 14
D 17
E 19

Question 7: What will the content of array updatedArray after execution the following program? (Array
first position start at 0)

char testArray[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'};
char [] updatedArray = new char[10];

int counter =0;


int arrayEndPos = (testArray.length -1);
while (counter < arrayEndPos){
updatedArray[counter+1] = testArray[arrayEndPos-counter];
counter++;
}

A [‘A’ , ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’]
B ✘ [‘D’, ‘C’, ‘B’, ‘A’, ‘J’, ‘I’, ‘H’, ‘G’, ‘E’, ‘F’]
C [‘J’, ‘I’, ‘H’, ‘G’, ‘F’, ‘E’, ‘A’, ‘B’, ‘C’, ‘D’]
D [‘J’, ‘I’, ‘H’, ‘G’, ‘F’, ‘E’, ‘D’, ‘C’, ‘B’, ‘A’]
E [‘J’, ‘I’, ‘H’, ‘G’, ‘F’, ‘E’, ‘D’, ‘C’, ‘A’, ‘B’,]

4
Question 8: What is the value of result after execution of this block of code?

integer i = 0, k = 0, result = 1;
for (i = 0; i < 5; i++) {
if (i < 3) {
k = i;
} else {
k = i + 1;
}
while (k > 0){
result = result + k;
k--;
}
}
Print result

A 5
B 27
C ✘ 30
D 42
E Run time error

Question 9: What is the value printed after the execution of this block of code?

int[][] multiArray = new int[5][10]; /* Two Dimensional array of Integers*/


int i=0,j=0,k=0;

for (i=0; i<5 ; i++){


for (j=0; j<10; j++){
multiArray[i][j] = (i+1) * (j+1);
}
}

Print (multiArray[2][2] + multiArray[3][8]); /*Sum of the two values in the array*/

A 0
B ✘ 45
C 54
D 95
E Run time error
Question 10: What will be printed upon running this block of code?

5
Main Program

int checkVal;

for (int i = 1 ; i< 10 ; i++){

checkVal = computeVal(i);

if (checkVal > 0){

print checkVal

Function

computeVal(int i)

int returnVal;

int countValue = 0;

int counter = value;

do{

if ((value != 1) AND (mod(value,counter) = 0)){

++countValue;

counter--;

}while (counter > 1);

if (countValue == 1){

returnVal= value;

}else{

returnVal = -1;

return returnVal;

6
NB : Suppose

- mod is an in-built function that return the remainder when argument 1 divided by
argument 2
- print command will add an extra blank space after each character

A Division by zero Error


B 2 3 4 5 6 7 8 9 10
C 2468
D ✘ 2357
E 12357

You might also like