1Z0-829 Static method Practice Question
Exhibit
Refer to the exhibit.
```
-- Creating a PL/SQL function
CREATE OR REPLACE FUNCTION get_emp_name (p_emp_id NUMBER) RETURN VARCHAR2 IS
v_name employees.last_name%TYPE;
BEGIN
SELECT last_name INTO v_name FROM employees WHERE employee_id = p_emp_id;
RETURN v_name;
END;
```Given the exhibit, which statement about calling this method is true?
⚠ Common exam trap
Java often tests the misconception that any method that performs I/O or database operations cannot be called directly, but the restriction is about modifying state (side effects) in contexts like lambdas, not about reading data. Here, the key is that the method is static, not that it contains a SELECT statement.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
It can be called as `ClassName.getEmpName(101)`.
A static method can be called directly on the class without creating an instance. The method `getEmpName` is static and returns a value, so it can be invoked as `ClassName.getEmpName(101)`. Instance methods require an object reference, and non-static methods cannot be called in a static context without an instance.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
It must be called using the `new` keyword.
Why it's wrong here
Incorrect. The `new` keyword is used to instantiate objects, not to call static methods.
- ✗
It can only be called from a static context, not from an instance.
Why it's wrong here
Incorrect. Static methods can be called from both static and instance contexts (though from instance context, it's discouraged via object reference).
- ✓
It can be called as `ClassName.getEmpName(101)`.
Why this is correct
Correct. Static methods are called on the class, e.g., `ClassName.methodName()`.
- ✗
It cannot be used because it contains a loop.
Why it's wrong here
Incorrect. The presence of a loop does not affect the ability to call a method; only if the method is not static would instance creation be necessary.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 1Z0-829 question from scratch — 513 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.