Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Chapter: 8
Q121:
Which job type receives a salary raise of 0.09 in the provided PL/SQL block?
A. MANAGER
B. ANALYST
C. CLERK
D. DBA
Correct Answer:
C
Chapter: 8
Q122:
In the PL/SQL block, what happens if the job ID does not match CLERK, MANAGER, or ANALYST?
A. Raise by 0.09
B. Raise by 0.07
C. No raise
D. Raise by 0.08
Correct Answer:
C
Chapter: 8
Q123:
What discount is given if the order amount is between 20000 and 30000?
A. 0.05
B. 0.08
C. 0.1
D. No discount
Correct Answer:
B
Chapter: 8
Q124:
In the CASE statement, how is flexibility achieved in a searched CASE expression?
A. By using more operators
B. By reducing comparisons
C. By removing ELSE condition
D. By writing complete conditions in each comparison
Correct Answer:
D
Chapter: 8
Q125:
In the first PL/SQL block for the user scenario, what message is printed if the user is 'APEX_PUBLIC_USER'?
A. Test User
B. Admin User
C. Owner of Schema
D. Invalid User
Correct Answer:
A
Chapter: 8
Q126:
The syntax of the CASE statement includes which keyword?
A. SELECT
B. INSERT
C. THEN
D. DELETE
Correct Answer:
C
Chapter: 8
Q127:
What happens if ELSE part is not provided in a CASE statement and no condition is true?
A. Execution continues
B. An exception is raised
C. Program halts
D. Control goes to the next statement
Correct Answer:
B
Chapter: 9
Q128:
What is the purpose of a simple loop in PL/SQL?
A. To execute statements only once
B. To repeatedly execute a set of statements
C. To terminate a loop before it starts
D. To skip execution based on condition
Correct Answer:
B
Chapter: 9
Q129:
Which statement is true about a simple loop without an exit condition?
A. It runs once and terminates
B. It's an invalid syntax
C. It runs indefinitely
D. It terminates on its own
Correct Answer:
C
Chapter: 9
Q130:
In a simple loop, when does the loop terminate?
A. When exit condition is TRUE
B. When exit condition is FALSE
C. After one iteration
D. When the program ends
Correct Answer:
A
Chapter: 9
Q131:
Which of the following causes abnormal termination of a simple loop in PL/SQL?
A. Missing EXIT condition
B. Incorrect syntax
C. Declaring variables after the loop
D. Not printing results
Correct Answer:
A
Chapter: 9
Q132:
What will the following code output after the loop completes: `if rep >=5 then EXIT; end if; rep:=rep+1;`?
A. Value of Rep: 5
B. ORA-10260 Error
C. Program runs indefinitely
D. The program doesn't terminate
Correct Answer:
A
Chapter: 9
Q133:
What is the output of a loop that inserts rows into the EMP table when the value of rep is less than 11?
A. No rows inserted
B. Only 1 row inserted
C. 10 rows inserted
D. Loop terminates early
Correct Answer:
C
Chapter: 9
Q134:
In a simple loop with an exit condition, what happens when the exit condition is FALSE?
A. The loop continues executing
B. The loop terminates
C. The program crashes
D. The loop skips execution
Correct Answer:
A
Chapter: 9
Q135:
What is the reverse value of the maximum salary, given the following code? (Output of the program is 117564)
A. 461571
B. 456711
C. 465711
D. 567141
Correct Answer:
C
Chapter: 9
Q136:
How does the reverse operation work in a loop with MOD and TRUNC functions?
A. It calculates the square
B. It extracts the last digit
C. It finds the even number
D. It reverses the string
Correct Answer:
B
Chapter: 9
Q137:
Which loop structure is used to display the reverse of a number in PL/SQL?
A. FOR loop
B. WHILE loop
C. Simple loop
D. IF loop
Correct Answer:
C
Chapter: 9
Q138:
What will the following code print: `WHILE done LOOP DBMS_OUTPUT.PUT_LINE ('Printed once'); done := FALSE; END LOOP;`?
A. Printed twice
B. Printed once
C. Printed indefinitely
D. Nothing
Correct Answer:
B
Chapter: 9
Q139:
Which of the following can cause a WHILE loop to terminate prematurely?
A. Exit condition becomes TRUE
B. Exit condition is missing
C. Syntax error
D. The loop counter reaches 10
Correct Answer:
A
Chapter: 9
Q140:
What is the output of the following code with a WHILE loop that inserts 10 rows into EMP table?
A. Rows inserted successfully
B. Transaction failed
C. Only 5 rows inserted
D. Loop terminated prematurely
Correct Answer:
A