フリー問題

Oracle Database Program with PL/SQL のフリー問題 2 / 20 問目

問題文

An outer block declares a variable and an inner block declares another variable with the same name. The inner block needs to read the value that the outer one holds. Which approach makes that reference possible?

選択肢

  1. Label the outer block and qualify the name with that label, because a label gives the outer block a name that the inner block can place in front of the identifier it wants to reach.
  2. Move the inner declaration into the exception handling part, because the handlers are outside the scope of the declarative part and the outer name is visible again inside them.
  3. Reference the identifier with the name of the table in front of it, because the table name resolves the ambiguity between two variables that were declared with one and the same name.
  4. Declare the inner variable as a constant, because a constant and a variable of the same name can coexist in nested blocks and the compiler then reads the outer one for every reference.

解答・解説を確認するには

正解と解説の確認、回答の記録には無料登録が必要です。登録すると演習モードでフリー問題に回答し、正誤と解説をその場で確認できます。