nerdexam
Zend

200-710 · Question #107

200-710 Question #107: Real Exam Question with Answer & Explanation

Sign in or unlock 200-710 to reveal the answer and full explanation for question #107. The question stem and answer options stay visible for context.

Question

Given the following code, what will the output be: trait MyTrait { private $abc = 1; public function increment() { $this->abc++; } public function getValue() { return $this->abc; } } class MyClass { use MyTrait; public function incrementBy2() { $this->increment(); $this->increment(); } } $c = new MyClass(); $c->incrementBy2(); var_dump($c->getValue());

Options

  • AFatal error: Access to private variable MyTrait::$abc from context MyClass
  • BNotice: Undefined property MyClass::$abc
  • Cint(2)
  • Dint(3)
  • ENULL

Unlock 200-710 to see the answer

You've previewed enough free 200-710 questions. Unlock 200-710 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 200-710 Practice