nerdexam
Python_Institute

PCEP-30-02 · Question #140

PCEP-30-02 Question #140: Real Exam Question with Answer & Explanation

Sign in or unlock PCEP-30-02 to reveal the answer and full explanation for question #140. The question stem and answer options stay visible for context.

Question

You create a function to calculate the power of a number by using Python. You need to ensure that the function is documented with comments. You create the following code. Line numbers are included for reference only. 01 # The calc_power function calculates exponents\n02 # x is the base\n03 # y is the exponent\n04 # The value of x raised to the y power is returned\n05 def calc_power(x, y):\n06 comment = "# Return the value"\n07 return x ** y # raise x to the y power\nWhich of the following statements are true? (Choose two.)

Options

  • AThe string in Line 06 will be interpreted as a comment.
  • BThe pound sign (#) is optional for lines 02 and 03.
  • CLine 07 contains an inline comment.
  • DLines 01 through 04 will be ignored for syntax checking.

Unlock PCEP-30-02 to see the answer

You've previewed enough free PCEP-30-02 questions. Unlock PCEP-30-02 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full PCEP-30-02 Practice