PLSQL Multiple Choice Questions
PLSQL Multiple Choice Questions
TBL_ACCOUNT
TBL_LOAN
1
Question 2: Observe the following code and fill in the blanks.
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 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?
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];
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?
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;
checkVal = computeVal(i);
print checkVal
Function
computeVal(int i)
int returnVal;
int countValue = 0;
do{
++countValue;
counter--;
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