Docsity

[Zend_Framework] Zend Framework Certification Exam Preparation, Exams of Technology

Toggle sidebar
bg1
[Zend_Framework] Zend Framework
Certification Exam Preparation
**Question 1.** Which Zend component is specifically designed to mitigate
Cross-Site Scripting (XSS) attacks by escaping output?
A) Zend\Filter\StripTags
B) Zend\Validator\StringLength
C) Zend\Escaper\Escaper
D) Zend\Crypt\Password\Bcrypt
Answer: C
Explanation: Zend\Escaper provides methods such as `escapeHtml` and `escapeJs`
that safely encode output, preventing XSS.
**Question 2.** In Zend\Db, which class represents a parameterized SELECT query
without writing raw SQL?
A) Zend\Db\Sql\Select
B) Zend\Db\TableGateway\TableGateway
C) Zend\Db\Adapter\Adapter
D) Zend\Db\ResultSet\ResultSet
Answer: A
Explanation: `Zend\Db\Sql\Select` builds SELECT statements using an
object-oriented API and automatically parameterizes values.
**Question 3.** Which Service Manager configuration key is used to map a class
name directly to an invokable factory without custom logic?
A) factories
B) invokables
C) abstract_factories
D) aliases
Answer: B
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a

Partial preview of the text

Download [Zend_Framework] Zend Framework Certification Exam Preparation and more Exams Technology in PDF only on Docsity!

Certification Exam Preparation

Question 1. Which Zend component is specifically designed to mitigate Cross-Site Scripting (XSS) attacks by escaping output? A) Zend\Filter\StripTags B) Zend\Validator\StringLength C) Zend\Escaper\Escaper D) Zend\Crypt\Password\Bcrypt Answer: C Explanation: Zend\Escaper provides methods such as escapeHtml and escapeJs that safely encode output, preventing XSS. Question 2. In Zend\Db, which class represents a parameterized SELECT query without writing raw SQL? A) Zend\Db\Sql\Select B) Zend\Db\TableGateway\TableGateway C) Zend\Db\Adapter\Adapter D) Zend\Db\ResultSet\ResultSet Answer: A Explanation: Zend\Db\Sql\Select builds SELECT statements using an object-oriented API and automatically parameterizes values. Question 3. Which Service Manager configuration key is used to map a class name directly to an invokable factory without custom logic? A) factories B) invokables C) abstract_factories D) aliases Answer: B

Certification Exam Preparation

Explanation: The invokables key registers a class that can be instantiated via new with no constructor arguments. Question 4. In the MVC lifecycle, which event is dispatched immediately after routing has resolved the controller and action? A) MvcEvent::EVENT_DISPATCH B) MvcEvent::EVENT_ROUTE C) MvcEvent::EVENT_RENDER D) MvcEvent::EVENT_FINISH Answer: A Explanation: After routing (EVENT_ROUTE), the framework triggers EVENT_DISPATCH to call the controller. Question 5. Which route type should be used when you need to capture optional parameters using a regular expression? A) Literal B) Segment C) Regex D) Scheme Answer: C Explanation: Regex routes allow full regular-expression patterns, ideal for complex optional segments. Question 6. What is the primary purpose of a Zend\Form’s InputFilterProviderInterface? A) To render form elements automatically B) To provide default validation rules within the form class

Certification Exam Preparation

Question 9. In Zend\Authentication, which adapter would you use to authenticate a user against a database table named users? A) HttpAdapter B) LdapAdapter C) DbTableAdapter D) DigestAdapter Answer: C Explanation: Zend\Authentication\Adapter\DbTable validates credentials using a database table. Question 10. Which validator checks that a string contains only digits? A) Digits B) Regex C) Alnum D) StringLength Answer: A Explanation: The Digits validator ensures the input consists solely of numeric characters. Question 11. What does the Zend\Hydrator\ClassMethods hydrator do? A) Converts an object to an associative array using public properties B) Populates an object using its setter methods C) Serializes an object to JSON D) Maps database rows to PDO statements Answer: B

Certification Exam Preparation

Explanation: ClassMethods hydrator calls setters (setX) for each key in the data array. Question 12. Which Service Manager pattern is considered an anti-pattern when overused because it hides dependencies? A) Factory B) Service Locator C) Abstract Factory D) Invokable Answer: B Explanation: The Service Locator pattern can obscure required dependencies, making code harder to test. Question 13. In a Zend\Mvc controller, which method should you return to render a view template with variables? A) new JsonModel() B) new ViewModel($variables) C) $this->redirect()->toRoute() D) $this->forward()->dispatch() Answer: B Explanation: Returning a ViewModel passes data to the view script for rendering. Question 14. Which filter removes all HTML tags from a string? A) StringTrim B) StripTags C) HtmlEntities

Certification Exam Preparation

C) EVENT_DISPATCH_ERROR

D) EVENT_ROUTE_ERROR

Answer: B Explanation: EVENT_FINISH occurs after rendering, allowing post-processing before sending the HTTP response. Question 18. In Zend\Db\TableGateway, which method is used to retrieve a single row by primary key? A) select() B) insert() C) update() D) find() Answer: A Explanation: select(['id' => $id]) returns a ResultSet; you then fetch the first row. Question 19. Which validator would you use to ensure a submitted email address is syntactically correct? A) EmailAddress B) Regex C) Hostname D) Uri Answer: A Explanation: EmailAddress validates format and optionally checks DNS records. Question 20. What does the Zend\Mvc\Router\Http\Literal route match? A) Any URL that starts with a given prefix

Certification Exam Preparation

B) An exact URL string without parameters C) URLs based on regular expressions D) Scheme-specific URLs (http/https) Answer: B Explanation: Literal routes match a fixed path exactly, e.g., /login. Question 21. Which class in Zend\Permissions\Acl represents a collection of roles? A) RoleInterface B) Role\GenericRole C) Role\Registry D) Role\Aggregate Answer: B Explanation: Zend\Permissions\Acl\Role\GenericRole is the standard implementation for roles. Question 22. In Zend\View, which method is used to render a partial view script from within another view? A) $this->url() B) $this->partial() C) $this->headScript() D) $this->layout() Answer: B Explanation: The partial helper renders a separate template and returns its content.

Certification Exam Preparation

Explanation: The get() method resolves aliases automatically, returning the underlying service. Question 26. Which configuration key would you use to register a factory that receives the Service Manager as an argument? A) factories B) invokables C) abstract_factories D) delegators Answer: A Explanation: factories map a service name to a callable that receives the Service Manager. Question 27. In a RESTful controller extending AbstractRestfulController, which method handles HTTP PATCH requests? A) patchAction() B) patch() C) updatePartial() D) notSupported() Answer: B Explanation: AbstractRestfulController defines patch($id, $data) for PATCH semantics. Question 28. Which validator would you use to ensure a password field contains at least one digit, one letter, and is between 8-20 characters? A) Regex B) StringLength

Certification Exam Preparation

C) Alnum D) Callback Answer: A Explanation: A regular expression can enforce all three constraints in a single validator. Question 29. Which component of Zend\Mvc is responsible for translating a request into a controller name? A) Router B) DispatchListener C) ViewManager D) ServiceManager Answer: A Explanation: The router matches the request URI to a route, which defines the controller and action. Question 30. Which Zend\Cache storage adapter is best suited for distributed caching across multiple servers? A) Filesystem B) Memory C) Redis D) WinCache Answer: C Explanation: Redis can be accessed by many application servers, providing a shared cache.

Certification Exam Preparation

Question 34. What does the module_map_cache configuration improve in production? A) Automatic class loading speed B) Database query performance C) View rendering time D) Session handling Answer: A Explanation: module_map_cache caches the mapping of module classes to file paths, speeding up autoloading. Question 35. Which Zend\Form element automatically generates a CSRF token and validates it? A) Hidden B) Token C) Csrf D) Security Answer: C Explanation: Zend\Form\Element\Csrf handles token creation and validation. Question 36. Which event is triggered when an exception occurs during dispatch? A) EVENT_DISPATCH_ERROR B) EVENT_ROUTE_ERROR C) EVENT_RENDER_ERROR D) EVENT_FINISH

Certification Exam Preparation

Answer: A Explanation: EVENT_DISPATCH_ERROR is fired when the dispatcher cannot execute the controller/action. Question 37. Which Zend\Db component implements the Table Data Gateway pattern? A) Zend\Db\Sql\Select B) Zend\Db\TableGateway\TableGateway C) Zend\Db\Adapter\Adapter D) Zend\Db\ResultSet\ResultSet Answer: B Explanation: TableGateway provides CRUD operations for a single database table. Question 38. In Zend\Mvc, which class is responsible for assembling the final HTTP response? A) Http\PhpEnvironment\Response B) Http\Response\Stream C) Http\Response D) Http\Response\Headers Answer: C Explanation: Zend\Diactoros\Response (or the PSR-7 Response) is used; in ZF3 it is Laminas\Diactoros\Response. Question 39. Which validator checks that a value is not empty after filters have been applied? A) NotEmpty B) PresenceOf

Certification Exam Preparation

A) ttl B) lifetime c) expire d) cache_time Answer: A Explanation: ttl (time-to-live) defines the lifetime of cached entries in seconds. Question 43. In Zend\Form, which interface allows an object to provide its own InputFilter via getInputFilterSpecification()? A) InputFilterAwareInterface B) InputFilterProviderInterface C) FormInterface D) HydratorAwareInterface Answer: B Explanation: Implementing InputFilterProviderInterface returns the filter specification. Question 44. Which Zend\Mvc component is primarily responsible for translating a controller’s ViewModel into HTML? A) ViewRenderer B) PhpRenderer C) TemplateResolver D) ViewManager Answer: B Explanation: PhpRenderer processes the PHP view scripts using the ViewModel data.

Certification Exam Preparation

Question 45. Which Zend\Db adapter driver is used for PostgreSQL connections? A) Pdo_Mysql b) Pdo_Pgsql c) Mysqli d) Sqlsrv Answer: B Explanation: Pdo_Pgsql uses PDO with the PostgreSQL driver. Question 46. Which validator would you use to ensure a string length is between 5 and 15 characters inclusive? A) StringLength b) Length c) Between d) Size Answer: A Explanation: StringLength accepts min and max options to enforce length constraints. Question 47. Which event name is used for attaching listeners that should run after routing but before dispatch? A) EVENT_ROUTE B) EVENT_DISPATCH C) EVENT_ROUTE_POST D) EVENT_DISPATCH_ERROR Answer: A

Certification Exam Preparation

d) LowerCase Answer: A Explanation: StringToLower transforms the input to lower case. Question 51. In a Zend\Mvc application, where is the entry point that creates the Application object? A) public/index.php b) config/application.config.php c) module/Application/Module.php d) src/Bootstrap.php Answer: A Explanation: public/index.php bootstraps the application and calls Application::init(). Question 52. Which Zend\Permissions\Acl component represents a set of resources? A) Resource\GenericResource b) Resource\Registry c) Resource\Aggregate d) Resource\Chain Answer: A Explanation: GenericResource is used to define individual resources in ACL. Question 53. Which method of Zend\View\Renderer\PhpRenderer renders a view script and returns the output as a string? A) render()

Certification Exam Preparation

b) capture() c) execute() d) display() Answer: A Explanation: render($name, $variables) processes the script and returns the generated content. Question 54. Which Zend\Db class is used to build an INSERT statement? A) Insert b) Update c) Delete d) Sql Answer: A Explanation: Zend\Db\Sql\Insert represents an INSERT query with column/value pairs. Question 55. Which validator checks that a given value matches a predefined set of allowed values? A) InArray b) Identical c) Callback d) Explode Answer: A Explanation: InArray validates that the input exists in the provided haystack.