First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.
Continue in the practice tool above to load more questions, 50 at a time.
Question 1AEM Sites architecture and component development
In AEM, which file in a component's folder defines the component's dialog for authoring?
- cq:dialog
- cq:htmlTag
- _cq_dialog Correct answer.
- cq:editConfig
Explanation
Dialogs are stored as a node named _cq_dialog (with sling:resourceType cq/gui/components/authoring/dialog) directly under the component node. The underscore prefix marks it as an authoring-time resource that is not rendered on the page. cq:editConfig controls editing behavior, not the dialog fields.
Question 2AEM Sites architecture and component development
Which Sling script resolution order applies when a resource of type myproject/components/text is rendered?
- Scripts in /apps are ignored in favor of /libs
- The script with the shortest filename is selected first
- The most specific resource type path is searched first, then super types Correct answer.
- Only scripts named exactly after the resource type are considered
Explanation
Sling builds a list of resource types starting with the exact type and walking up the sling:resourceSuperType chain, searching each for a matching script. The first match wins. This lets projects override or extend library components via super types.
Question 3AEM Sites architecture and component development
What is the primary purpose of the HTL (Sightly) data-sly-use block element?
- To declare client-side JavaScript libraries for the page
- To include a static HTML fragment from the file system
- To define a new editable dialog field
- To instantiate a Java or JavaScript Use-API object and expose it to the template Correct answer.
Explanation
data-sly-use binds a server-side logic object, resolved through the Use-API, to a variable usable in the template. It separates business logic from markup. It does not load client libraries or dialogs.
Question 4AEM Sites architecture and component development
A developer needs to add a new field to an existing dialog inherited through sling:resourceSuperType. What is the recommended AEM approach?
- Edit the dialog in /libs directly
- Delete the super type and rebuild the component
- Copy the entire dialog into the project component
- Use a resource merger with sling:resourceSuperType and override only the needed node Correct answer.
Explanation
Sling resource merging lets a component inherit a dialog from its super type while overriding or adding only specific nodes. This avoids duplicating the whole dialog and keeps library upgrades safe. Editing /libs is discouraged because changes can be overwritten.
Question 5AEM Sites architecture and component development
Which annotation exposes a Java class as an HTL model through the Use-API?
- @SlingServlet
- @Model Correct answer.
- @Reference
- @Component
Explanation
The @Model annotation from the Sling Models framework registers a class as an adaptable model, which HTL can consume via data-sly-use. @Component is OSGi, @Reference injects services, and @SlingServlet registers servlets.
Question 6AEM Sites architecture and component development
How does a Sling Model declare which resource types it can adapt from?
- With a properties file in /etc
- With resourceType and optionally resourceSuperType in @Model Correct answer.
- With the adaptables attribute only
- With the @Inject annotation alone
Explanation
The @Model annotation accepts resourceType (and resourceSuperType) to register the model for those types. adaptables declares the adaptable classes such as Resource or SlingHttpServletRequest. Registration by resource type lets HTL resolve the model automatically.
Question 7AEM Sites architecture and component development
Which statement best describes the role of the sling:resourceSuperType property?
- It points to a parent component whose scripts and dialog can be inherited Correct answer.
- It sets the client library category for the component
- It specifies the servlet path used to render the component
- It defines the JCR primary node type of the component
Explanation
sling:resourceSuperType establishes an inheritance link so Sling can fall back to the parent's scripts and merge its dialog. It enables reuse and extension of existing components. It does not set node types, clientlibs, or servlet paths.
Question 8AEM Sites architecture and component development
A component must render different markup for touch and classic authoring UI without duplicating business logic. Which mechanism is designed for this?
- A single dialog with hidden fields per editor
- Two separate components with different resource types
- Editor-specific HTL scripts selected by the editor's resource type Correct answer.
- Client-side JavaScript that rewrites the DOM
Explanation
AEM supports editor-specific rendering by resolving scripts based on the editor's resource type, such as cq.authoring.editor.hook. This keeps one component while allowing tailored markup for each authoring UI.
Question 9AEM Sites architecture and component development
What does the data-sly-resource block element do in HTL?
- It loads a Java class as a model
- It renders another resource, optionally with resource type and selectors Correct answer.
- It declares a reusable template fragment
- It includes the current component's dialog definition
Explanation
data-sly-resource delegates rendering to another resource, allowing developers to embed components and pass options such as resourceType, selectors, and request attributes. It is commonly used for container-style components.
Question 10AEM Sites architecture and component development
Which HTL statement correctly iterates a list and exposes the loop status?
- data-sly-use.item="${list}"
- data-sly-include.item="${list}"
- data-sly-repeat.item="${list}"
- data-sly-list.item="${list}" with itemList exposed Correct answer.
Explanation
data-sly-list iterates a collection and provides a status variable (by default itemList) with index, count, first, last, and other properties. data-sly-repeat repeats an element but does not provide the same list status object.
Question 11AEM Sites architecture and component development
How should a component expose authorable text so that it is safely escaped in HTL output?
- Output ${properties.text} without context
- Concatenate strings in a Java model and print raw
- Use ${properties.text @ context='unsafe'}
- Use ${properties.text @ context='html'} for rich text Correct answer.
Explanation
HTL applies contextual escaping automatically; specifying context='html' allows intended HTML from rich text while still protecting against scripts. Choosing the correct context balances formatting with security.
Question 12AEM Sites architecture and component development
Which node under a component enables in-place editing and defines listeners?
- cq:actions
- cq:template
- sling:resourceType
- cq:editConfig Correct answer.
Explanation
cq:editConfig holds editing configuration such as cq:actions, cq:listeners, and in-place editing settings. It governs how the component behaves in the authoring UI.
Question 13AEM Sites architecture and component development
A developer wants a component to appear in the component browser only for certain page templates. Which mechanism controls this?
- The jcr:title of the component
- The sling:resourceSuperType property
- The allowedComponents setting in the template's policy Correct answer.
- The component group name only
Explanation
Editable templates use policies that can restrict which components are allowed in a container or on a template. This governs availability in the component browser per template context.
Question 14AEM Sites architecture and component development
What is the function of a proxy component in AEM?
- It caches rendered HTML for performance
- It duplicates the library component's scripts into the project
- It points to a library component via sling:resourceSuperType to allow safe customization Correct answer.
- It proxies requests to an external server
Explanation
A proxy component has no scripts of its own but sets sling:resourceSuperType to a library component. Projects customize by adding scripts or dialogs to the proxy, keeping the library intact.
Question 15AEM Sites architecture and component development
Which client library technique ensures a component's CSS and JS are included only once per page even if the component appears multiple times?
- Embedding the category in every HTL script
- Relying on the dispatcher to deduplicate
- Using the page component to include the category once Correct answer.
- Adding the clientlib category to each component instance
Explanation
Client library categories are aggregated at the page level, so including the category once in the page template ensures assets load once regardless of instance count. Per-instance inclusion risks duplicate references.
Question 16AEM Sites architecture and component development
Which HTTP method and selector combination is commonly used to render a component's JSON representation for a Sling Model exporter?
- DELETE with the .json extension
- GET with the .model.json extension Correct answer.
- POST with the .html extension
- PUT with the .xml extension
Explanation
Sling Model Exporter exposes models as JSON through the model selector and json extension, requested with GET. This enables headless consumption of component data. Other methods and extensions do not map to the exporter.
Question 17AEM Sites architecture and component development
A component's HTL references ${model.title}, but the page renders nothing. The model is registered with resourceType matching the component. What is the most likely cause?
- The component is missing a cq:editConfig node
- The model class lacks a public getter for title Correct answer.
- The page template has no clientlib category
- The model uses @Model without adaptables
Explanation
HTL accesses model properties through public getter methods (getTitle for title). A missing getter means the expression resolves to nothing. Registration and resource type are already correct per the scenario.
Question 18AEM Sites architecture and component development
Which statement about HTL expressions and Java method calls is accurate?
- HTL requires JSP tag libraries for logic
- HTL executes inline Java code blocks
- HTL can access getters and permitted methods without parentheses Correct answer.
- HTL can call arbitrary Java methods with parameters
Explanation
HTL is intentionally limited: it accesses properties via getters and a restricted set of allowed methods, without arbitrary parameterized calls. Logic belongs in Use-API classes. This restriction keeps templates safe and maintainable.
Question 19AEM Sites architecture and component development
What does the cq:isContainer property on a component indicate?
- The component renders a parsys or layout container for child components Correct answer.
- The component inherits from a proxy
- The component is read-only in the editor
- The component is hidden from the component browser
Explanation
cq:isContainer marks a component as a container that can host child components, typically used with layout containers and parsys. It signals drop-target behavior in the editor.
Question 20AEM Sites architecture and component development
A developer needs to read a request parameter inside an HTL template. Which approach follows AEM best practice?
- Embed a JSP include to read the parameter
- Use a scriptlet block in the HTL file
- Call request.getParameter directly in HTL
- Expose the value through a model or Use-API object Correct answer.
Explanation
HTL should not contain business logic; parameters are read in a model or Use-API class and exposed as properties. This keeps templates declarative and testable. Direct request access or scriptlets violates the separation.
Question 21AEM Sites architecture and component development
Which combination correctly describes how a page component and its template relate in editable templates?
- The page component stores content; the template defines rendering
- Both are identical and interchangeable
- The template is only used for static templates
- The template stores content structure; the page component defines rendering Correct answer.
Explanation
With editable templates, the template holds the initial content structure and policies, while the page component provides the rendering scripts and resource type. Content authored by users lives in page instances.
Question 22AEM Sites architecture and component development
What is the effect of the sling:resourceType property on a content node?
- It determines which component renders the node Correct answer.
- It defines the node's workflow status
- It specifies the node's version history
- It sets the node's access control list
Explanation
sling:resourceType tells Sling which component to use to render the resource, driving script resolution. It has no bearing on permissions, workflow, or versioning.
Question 23AEM Sites architecture and component development
Which HTL attribute correctly includes a reusable template fragment defined with data-sly-template?
- data-sly-call Correct answer.
- data-sly-test
- data-sly-resource
- data-sly-use
Explanation
A fragment declared with data-sly-template is invoked with data-sly-call, optionally passing parameters. This promotes reuse of markup within and across templates.
Question 24AEM Sites architecture and component development
A component must render a list of child pages with their titles and links. Which approach is most appropriate?
- Use client-side JavaScript to fetch page titles
- Use a Sling Model that queries child pages and expose them to HTL Correct answer.
- Hard-code links in the HTL template
- Add each page manually through the dialog
Explanation
Querying child pages belongs in server-side logic such as a Sling Model, which exposes results to HTL for rendering. This keeps templates clean and supports dynamic content. Hard-coding or manual entry does not scale.
Question 25AEM Sites architecture and component development
Which statement about the HTL data-sly-test attribute is correct?
- It removes the element and its children when the expression is false Correct answer.
- It throws an exception when the expression is false
- It hides the element with CSS when false
- It repeats the element for each item in a list
Explanation
data-sly-test conditionally renders the host element and its children; when the expression evaluates false, the whole block is omitted from output. It is the standard conditional construct in HTL.
Question 26AEM Sites architecture and component development
In an AEM project, what is the primary purpose of the ui.apps package?
- It stores the compiled OSGi bundles for the project
- It provides the JCR repository configuration for the instance
- It contains the /apps content such as components, templates, and client libraries Correct answer.
- It holds immutable content packages that can never be modified
Explanation
The ui.apps package deploys code-like content under /apps, including component definitions, editable template definitions, and client libraries. OSGi bundles are built by the core bundle module, not ui.apps.
Question 27AEM Sites architecture and component development
Which file extension identifies an HTL script inside an AEM component?
- .js
- .jsp
- .html Correct answer.
- .xml
Explanation
HTL scripts use the .html extension and are interpreted by the HTL/Sightly engine. JSP scripts use .jsp and are handled by a different script engine.
Question 28AEM Sites architecture and component development
What does an HTL block element such as <div data-sly-unwrap> accomplish when rendered?
- It defers rendering of the element to the client side
- It renders the element but hides it with a CSS display rule
- It removes the element itself from the output while keeping its content Correct answer.
- It escapes the element's content as plain text
Explanation
data-sly-unwrap strips the host element from the generated markup while still processing its children, which is useful when a wrapper tag is not wanted. The content is still rendered normally.
Question 29AEM Sites architecture and component development
Which AEM construct lets an author change a component's dialog field values on a page without a code deployment?
- The component's HTL script
- The component's dialog definition Correct answer.
- The component's sling:resourceType
- The component's client library
Explanation
The dialog defines the authorable fields whose values are stored as properties on the component's content node. Authors edit those values through the dialog, and the HTL reads them at render time.
Question 30AEM Sites architecture and component development
A developer wants a Sling Model to be available only for a specific component resource type and to be injectable into HTL via ${model}. Which annotation attribute achieves the resource type binding?
- @Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
- @Model(adaptables = Resource.class, adapters = Component.class)
- @Model(adaptables = SlingHttpServletRequest.class, cache = true)
- @Model(adaptables = Resource.class, resourceType = "myproject/components/text") Correct answer.
Explanation
The resourceType attribute on @Model registers the model for that specific resource type so it can be resolved through the model factory. The adaptables attribute alone registers the model for any adaptable of that type.
Question 31AEM Sites architecture and component development
Which HTL expression safely outputs an author-provided string inside an HTML attribute value context?
- ${properties.title @ context='html'}
- ${properties.title @ context='text'}
- ${properties.title @ context='uri'}
- ${properties.title @ context='attribute'} Correct answer.
Explanation
HTL applies context-aware escaping based on where the expression appears. For an HTML attribute value, the attribute context escapes characters that could break out of the attribute.
Question 32AEM Sites architecture and component development
A page component uses editable templates. Where are the structural policies and allowed components for a given template stored?
- In the page's cq:Page node under jcr:content
- In the component's cq:dialog definition
- In the template's /conf structure alongside the template definition Correct answer.
- In the /etc/designs node for the site
Explanation
Editable templates and their associated policies live under /conf, separate from page content. Policies constrain what authors can place and configure within the template's structure.
Question 33AEM Sites architecture and component development
Which statement correctly describes how a component inherits a dialog from its supertype?
- The child must copy the parent dialog file to reuse its fields
- The child cannot inherit dialog fields at all
- The dialog is merged automatically so the child shows both inherited and own fields Correct answer.
- The child inherits only the parent's HTL, not its dialog
Explanation
When a component declares a sling:resourceSuperType, its dialog is merged with the supertype's dialog, so inherited fields appear alongside the component's own fields. This enables reuse without duplicating dialog definitions.
Question 34AEM Sites architecture and component development
A developer needs to make a component's dialog field required so authors cannot leave it empty. Which Granite UI construct enforces this?
- Setting the field's name property to a non-empty value
- Adding the field to the component's HTL template
- Adding a validation property such as required to the field's Granite UI definition Correct answer.
- Setting cq:isContainer to true on the component
Explanation
Granite UI fields support validation properties, such as required, that the authoring UI enforces client-side before saving. The name property only determines the JCR property the value is stored under.
Question 35AEM Sites architecture and component development
Which approach correctly passes a parameter into an HTL template fragment defined with data-sly-template?
- Use data-sly-use to inject the parameter into the template
- Use data-sly-resource with a selector equal to the parameter name
- Use data-sly-call with an object argument matching the template's declared parameter name Correct answer.
- Use data-sly-repeat to iterate the parameter into the template
Explanation
A template fragment declares named parameters, and data-sly-call supplies an object whose keys match those parameter names. This is the supported mechanism for parameterizing reusable fragments.
Question 36AEM Sites architecture and component development
A developer must expose a component's data as JSON for a Sling Model Exporter. Which combination is required?
- Add a data-sly-resource call in the component's HTL
- Set sling:resourceType to the exporter class name
- Annotate the model with @Model and set cache to true
- Annotate the model with @Exporter and provide a Jackson exporter configuration Correct answer.
Explanation
Sling Model Exporter requires the model to be annotated with @Exporter, naming an exporter such as the Jackson exporter. This registers a servlet that serializes the model when the appropriate selector and extension are requested.
Question 37AEM Sites architecture and component development
A component must render a value that may be null and should show a fallback only when it is present. Which HTL construct expresses this cleanly?
- data-sly-unwrap on the value
- data-sly-include on the value
- data-sly-test with the value, wrapping the fallback markup Correct answer.
- data-sly-list on the value
Explanation
data-sly-test evaluates a condition and renders its host element and children only when the expression is truthy. Using it to guard the fallback markup avoids rendering when the value is null.
Question 38AEM Sites architecture and component development
A developer wants a component's client library to load only on pages where that component is actually used. Which approach best achieves this?
- Declare the client library as a dependency of the component's own client library category and include that category from the component Correct answer.
- Add the client library script tag directly in the component's HTL
- Embed the client library in the page's global clientlib
- Put all component CSS in a single site-wide client library
Explanation
Scoping a client library to the component's category and including it from the component means it is requested only when the component renders. Embedding into a global library loads assets on every page.
Question 39AEM Sites architecture and component development
A page renders through the editable template's structure, but a developer adds a component directly to the template structure node. What is the effect on pages that use the template?
- The component is copied into each page's content on creation
- The component is hidden from authors and never rendered
- The component appears on all pages using the template and is not authorable per page Correct answer.
- The component replaces the page's parsys entirely
Explanation
Components placed in the template structure are rendered on every page that uses that template and are locked from per-page authoring. Authors add their own components in the page's editable layout container instead.
Question 40AEM Sites architecture and component development
A Sling Model uses @ChildResource to inject a child node, but the injection is null at runtime. Which cause best explains this?
- The child node's name does not match the name given in @ChildResource and no default is set Correct answer.
- The model's adaptable is SlingHttpServletRequest and the child is not a request attribute
- The component's HTL does not declare data-sly-use
- The model is registered for a different adaptable than Resource
Explanation
@ChildResource resolves a child node by name relative to the adaptable resource; if the name does not match and no fallback is provided, the injection yields null. The injection strategy may also need to be optional to avoid failing the model.
Question 41Templates, policies, and editable templates
Which node type must a template's root node use for the template to be recognized as an editable template?
- cq:Page
- nt:unstructured
- cq:Template Correct answer.
- sling:Folder
Explanation
Editable templates store their configuration under a node of type cq:Template, which is what distinguishes them from content pages and makes them available to the template editor. A cq:Page is a content page, not a template definition.
Question 42Templates, policies, and editable templates
In an editable template, which node holds the template's structural content such as the initial layout and components?
- jcr:content/root
- jcr:content/structure Correct answer.
- jcr:content/policies
- jcr:content/initial
Explanation
The structure node stores the template's structural content, including the responsive grid and any components that appear on every page. Policies and initial content live in separate sibling nodes.
Question 43Templates, policies, and editable templates
Which node in an editable template stores the mapping of components to policies that control their allowed behavior?
- jcr:content/structure
- jcr:content/initial
- jcr:content/policies Correct answer.
- jcr:content/settings
Explanation
The policies node maps component resource types to policy nodes, determining which design properties apply to each component in the template. Structure and initial content are stored in their own dedicated nodes.
Question 44Templates, policies, and editable templates
What is the primary purpose of the 'initial' node in an editable template?
- To define the template's editable layout grid
- To hold the policy mappings for components
- To store default content that is copied to new pages Correct answer.
- To list which components are locked for authors
Explanation
The initial node holds default content (such as placeholder text or preconfigured components) that is copied into a page when it is created from the template. It is distinct from structure and policies.
Question 45Templates, policies, and editable templates
Which statement best describes the relationship between an editable template and a static template?
- Static templates require a policy node, while editable templates do not.
- Editable templates are defined in code, while static templates are authored in the template editor.
- Editable templates are authored in the template editor and stored in the repository, while static templates are defined in code under the app. Correct answer.
- Both are authored in the template editor and stored in /conf.
Explanation
Editable templates are content-based: authors create and edit them in the template editor, and they are stored in the repository. Static templates are developer-defined in the codebase under the application folder.
Question 46Templates, policies, and editable templates
Where are editable templates typically stored in the repository?
- /content/dam/templates
- /conf/<project>/settings/wcm/templates Correct answer.
- /etc/designs
- /apps/<project>/templates
Explanation
Editable templates are stored under the project's configuration branch, conventionally /conf/<project>/settings/wcm/templates. This makes them part of the editable, content-based configuration.
Question 47Templates, policies, and editable templates
Which tool is used to create and modify editable templates?
- The page editor
- The Sites console
- The workflow console
- The template editor Correct answer.
Explanation
The template editor is the dedicated UI for authoring editable templates, including their structure, policies, and initial content. The Sites and page consoles are for managing and editing content pages.
Question 48Templates, policies, and editable templates
What is the purpose of the 'locked' setting on a component inside an editable template's structure?
- It prevents authors from editing or deleting that component on pages created from the template. Correct answer.
- It prevents the component from being rendered on the page.
- It restricts the component to administrators only.
- It hides the component from the component browser.
Explanation
Locking a component in the template structure prevents authors from modifying or removing it on pages based on that template, enforcing a fixed layout. It does not affect rendering or visibility in the component browser.
Question 49Templates, policies, and editable templates
A developer needs a component's allowed components to be restricted on pages created from a template. Where is this best configured?
- In the page's jcr:content node
- In the component's cq:dialog
- In the template's structure node
- In a policy assigned to the layout container in the template Correct answer.
Explanation
The allowed components for a layout container are governed by a policy, which is mapped in the template's policies node and applied to the container. This centralizes the restriction at the template level.
Question 50Templates, policies, and editable templates
Which node type is used for a policy node that configures a component's design properties in an editable template?
- sling:OsgiConfig
- cq:Page
- cq:Component
- nt:unstructured Correct answer.
Explanation
Policy nodes are typically stored as nt:unstructured nodes under the policies branch, holding properties that map to the component's design dialog. They are not pages, components, or OSGi configurations.