Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Chapter: 7
Q101:
In a PL/SQL block, how is the salary updated if more than 5 employees have worked for over 5 years?
A. By 15%
B. By 5%
C. By 10%
D. No update
Correct Answer:
C
Chapter: 7
Q102:
What variable is used to store the count of employees working for more than 5 years in the given solution?
A. total_emp
B. total
C. max_id
D. count
Correct Answer:
A
Chapter: 7
Q103:
Which PL/SQL user is being checked for in the IF-THEN-ELSE statement example?
A. HR_PUBLIC_USER
B. APEX_PUBLIC_USER
C. SYSTEM_USER
D. ANALYST_USER
Correct Answer:
B
Chapter: 7
Q104:
What is the maximum salary allowed for the designation 'ANALYST' in the given solution?
A. 4000
B. 4500
C. 5000
D. 5500
Correct Answer:
C
Chapter: 7
Q105:
What message is displayed when salary is between 3000 and 6000, and designation is 'MANAGER'?
A. Not part of management
B. Executive management
C. Senior management
D. Junior management
Correct Answer:
C
Chapter: 7
Q106:
What day is considered the 'start of the week' in the PL/SQL date block?
A. Wednesday
B. Saturday
C. Monday
D. Thursday
Correct Answer:
C
Chapter: 7
Q107:
In the nested IF statement, what happens if the parent IF condition is TRUE?
A. Child IF will also be evaluated
B. Program ends
C. Parent IF executes but not child
D. No output
Correct Answer:
A
Chapter: 7
Q108:
What is the output if both a is between 0 and 100 and b is between 101 and 200?
A. Value of a is 100, Value of b is 200
B. No output
C. Invalid values
D. Only a is true
Correct Answer:
A
Chapter: 7
Q109:
In the IF-THEN-ELSIF example, what message is displayed for salary between 6000 and 9000 with the designation 'PRESIDENT'?
A. Senior Management
B. Executive Management
C. Not eligible
D. No output
Correct Answer:
B
Chapter: 7
Q110:
Write a PL/SQL block to check if the number of employees is odd or even.
A. Employees are odd
B. Employees are even
C. .
D. .
Correct Answer:
B
Chapter: 8
Q111:
What is the alternate to IF-Then statements in PL/SQL?
A. LOOP
B. CASE
C. WHILE
D. GOTO
Correct Answer:
B
Chapter: 8
Q112:
The CASE statement in PL/SQL selects how many sequences of statements to execute?
A. Multiple
B. None
C. Only one
D. All
Correct Answer:
C
Chapter: 8
Q113:
What is raised when ELSE part is not written and no matching case is found?
A. Warning
B. Error
C. Exception
D. NULL
Correct Answer:
C
Chapter: 8
Q114:
In a CASE statement, what happens when no case is matched?
A. The first case is executed
B. The last case is executed
C. The ELSE part is executed
D. Program terminates
Correct Answer:
C
Chapter: 8
Q115:
What message is printed when the grade is 'B' in the given PL/SQL block?
A. Excellent
B. Very good
C. Good
D. You Fail
Correct Answer:
B
Chapter: 8
Q116:
In the second scenario of the CASE statement, what is the output for the user 'DBA'?
A. Test User
B. Owner of Schema
C. Invalid User
D. Admin User
Correct Answer:
D
Chapter: 8
Q117:
In a Searched CASE Statement, conditions are mentioned in which clause?
A. THEN
B. ELSE
C. CASE
D. WHEN
Correct Answer:
D
Chapter: 8
Q118:
What action is taken when the salary is between 4000 and 6999 in the searched CASE statement?
A. No action
B. Insert row with the status 'Good'
C. Insert row with the status 'Very Good'
D. Insert row with the status 'Excellent'
Correct Answer:
B
Chapter: 8
Q119:
What does the searched CASE statement do if the salary is greater than 7000 and less than 10000?
A. Status: Good
B. Status: Excellent
C. Status: Very Good
D. No such salary
Correct Answer:
C
Chapter: 8
Q120:
What happens in the ELSE part if no case is matched in the searched CASE statement?
A. An exception is raised
B. A row is inserted
C. The program terminates
D. The program continues without any action
Correct Answer:
B