May 10, 2020
Estimated Post Reading Time ~

AEM Interview Questions

Q 1. What is the difference between Simple Versioning and Full Versioning?
A. Simple Versioning requires mix:simpleVersionable node type and Full Versioning requires mix:versionable node type.
B. Simple Versioning only versions some system-specific properties. With Full Versioning, all properties are versioned.
C. Both are the same and there is no difference other than the name of the mixin type.
D. Under Simple Versioning, versions are added as direct successors of the previous version. Under Full Versioning, a new version can be added as a direct successor of a version that already has another direct successor.
Correct Answer: D
Explanation: In Simple Versioning at most one node is created for versioning and in Full Versioning more the one node is created for versioning.

Q 2. You want to run a script as a workflow step. Which workflow step should you select?
A. Participant step.
B. Process step.
C. Container step.
D. Split step.
Correct Answer: B

Q 3. You want to switch to preview mode by modifying the URL. What should you do?
A. Add the parameter wcmmode=preview to the URL.
B. Add the parameter request=preview to the URL.
C. Add the selector preview as the fist selector in the URL.
D. Add the suffix preview to the URL.
Correct Answer: A
Explanation: Available mode in CQ is edit, preview, design, and disabled.

Q 4. Given the following selector: print.a4 and the URL extension is html, which script will Sling render?
A. print.html.jsp
B. a4.html.jsp
C. print.a4.jsp
D. a4.jsp
Correct Answer: A
Explanation: Extension takes priority than a selector.

Q 5. Which should you use to get the root node of a JCR workspace?
A. jcrSession.getRootNode();
B. node.getRootNode();
C. slingRequest.getPath(“/”);
D. com.day.cq.commons.jcr.JcrUtil.getNode (“/”);
Correct Answer: A

Q 6. Which tab in the Apache Felix Web OSGi Console is used to install OSGi bundles?
A. OSGi Installer tab.
B. Bundles tab.
C. Services tab.
D. Components tab.
Correct Answer: B

7. How can you use the Apache Felix Web OSGi console to check if an OSGi bundle is running?
A. Select the Bundles tab > check that your bundle is listed > check that the status is Active.
B. Select the Configuration Status tab > then Bundles tab > check that your OSGi component is
listed.
C. Select the Components tab > check that your bundle is listed > check that the status is Active.
D. Select the Services tab > check that your OSGi component is listed > check that the status is Active.
Correct Answer: A

QUESTION: 8 Which is the correct way to get the ValueMap of a resource?
A. resourceResolver.adaptTo(ValueMap.class)
B. resource.adaptTo(ValueMap.class)
C. currentNode.getValueMap()
D. currentPage.getValueMap()
Answer: B

QUESTION: 9 Which option do you need to add to the Java-based crx-quickstart command to specify that you will be using an LDAP authentication?
A. Dcom.day.crx.core.CRXUserManagerImpl=crxquickstart/
server/etc/ldap_login.conf
B. Djava.security.auth.login.config=crx-quickstart/server/etc/ldap_login.conf
C. Dcom.day.crx.security.ldap.LDAPLoginModule=required
D. Dcom.day.crx.security.ldap.principals.LDAPPrincipalProvider=crxquickstart/
server/etc/ldap_login.conf
Answer: B

QUESTION: 10 How do you create a configuration for an OSGi bundle within CRX that is specific to only the author instance?
A. Add a property called "run_mode" to the node sling:OsgiConfig and assign it the
value "author".
B. Use the CRX browser to create a folder in /apps/myproject called "author" and
then create a new node and select "nt:unstructured" as the node type.
C. Use the CRX browser to create a folder in /apps/myproject called "author" and
then create a new node and select "sling:OsgiConfig" as the node type.
D. Use the CRX browser to create a folder in /apps/myproject called "config.author"
and then create a new node and select "sling:OsgiConfig" as the node type
Answer: D

QUESTION: 11 During a workflow step a comment is added requiring an update of a paragraph on a Web page. Where does the workflow author make the change
?
A. In the content page within the workflow step.
B. In the Workflow Model.
C. In the Workflow Instance.
D. In the design page.
Answer: A

QUESTION: 12 Which method of the ResourceResolver Interface uses resources mapping to retrieve property values?
A. resolve().
B. getResource().
C. map().
D. getSearchPath().
Answer: A

QUESTION: 13 How does the OSGi installer manage a bundle if a bundle with the same symbolic name is already installed?
A. It uses the new bundle only if it has a higher version.
B. Stops the current bundle and allows the user to select which one to start.
C. Keep the old one and write an error to the log file.
D. The previous bundle is replaced by the last provided bundle.
Answer: A

QUESTION: 14 How do you create a design dialog for a CQ component?
QUESTION 15: You are working with two components: Component A and Component B. Component B has a slightly different behavior than component A. What is the best way to reuse the default script of component A in component B?

A. Set a property in component B called sling:resourceSuperType with the path to component A and omit the default script in component B
B. Set a property in component B called sling:resourceSuperType with the path to component A and create an empty default script in component B
C. Set a property in component B called sling:resourceSuperType with the path to component A and include the default script of component A in the default script in component B
D. Copy the default script from component A into component B
Answer: A

QUESTION 16: What does an Item represent in a JCR repository hierarchical content model diagram?
A. The value to be stored
B. A Node or a Property
C. The UUID of Node
D. The path to a Node
Answer: B
Explanation: Item is super of Node.

QUESTION 17 Which access control policies does the JCR Session define to manage nodes?
A. Privileges to access the JCR workspace.
B. Permissions to access the JCR repository.
C. Capabilities to traverse the JCR repository.
D. A list of node locks in the JCR workspace.
Answer: A

QUESTION 18 :How do you delete a property inside a Node object?
A. node.removeProperty("propertyName");
B. String propertyA = ""; node.setProperty("propertyName", propertyA);
C. String propertyA = null; node.setProperty("propertyName", propertyA);
D. node.delete("propertyName");
Answer: C
Explanation: Delete a property using node.getProperty("propertyName").remove();

QUESTION 19:You are creating a repository-based OSGi configuration. Which name should the factory configuration node have?
A. Append "-factory" to the configuration node name.
B. Start the node name with "config-" and end it with "-".
C. Append "-" to the name, where identifier can be any unique name.
D. Start the node name with "factory-".
Answer: C

QUESTION 20: How are the resources called that are passed through a workflow?
A. WorkItem.
B. Transaction.
C. Lifecycle.
D. Payload.
Answer: D

QUESTION 21:You want to prompt a workflow user for information during the processing of a workflow step. Where is the content that the workflow user-entered stored?
A. As part of the page.
B. As part of the workflow model.
C. As part of the workflow instance.
D. As part of the design.
Answer: A
Explanation :
Implementing a Process Step with a Java Class
To define a process step as an OSGI service component (Java bundle):
Create the bundle and deploy it into the OSGI container. Refer to the documentation about creating a bundle with CRXDE Lite, CRXDE or Eclipse.
Note 1: the OSGI component needs to implement the WorkflowProcess interface with its execute() method. See the example code below.
Note 2: The package name needs to be added to the section of the maven-bundle-plugin configuration.
Add the SCR property "process.label" and set the value as you please. This will be the name which your process step is listed as when using the generic Process Step component. See the example below.
In the CQ Workflow console, add the process step to the workflow using the generic Process Step component.
In the edit dialog, go to the Process tab and select your process implementation.
If you use arguments in your code, set the Process Arguments . For example: false.
Save the changes.

/**
Sample workflow process that sets an approve property to the payload based on the process argument value.
*/
@Component
@Service
public class MyProcess implements WorkflowProcess {
@Property(value = "An example workflow process implementation.")
static final String DESCRIPTION = Constants.SERVICE_DESCRIPTION;
@Property(value = "Adobe")
static final String VENDOR = Constants.SERVICE_VENDOR;
@Property(value = "My Sample Workflow Process")
static final String LABEL="process.label";

private static final String TYPE_JCR_PATH = "JCR_PATH";

public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {
WorkflowData workflowData = item.getWorkflowData();
if (workflowData.getPayloadType().equals(TYPE_JCR_PATH)) {
String path = workflowData.getPayload().toString() + "/jcr:content";
try {
Session jcrSession = session.adaptTo(Session.class);
Node node = (Node) jcrSession.getItem(path);
if (node != null) {
node.setProperty("approved", readArgument(args));
jcrSession.save();
}
} catch (RepositoryException e) {
throw new WorkflowException(e.getMessage(), e);
}
}
}

private boolean readArgument(MetaDataMap args) {
String argument = args.get("PROCESS_ARGS", "false");
return argument.equalsIgnoreCase("true");
}
}


QUESTION 22:What is the main purpose of the CQ HTML client library property that is called categories?
A. To easily find client libraries when the user searches categories in the author environment.
B. To uniquely name a group of client libraries to be included in templates or components and to reference dependencies to other client libraries.
C. To link the categories name with the component name, so that the client library can be included automatically into the component.
D. To define the type of files that the client library contains, e.g. JavaScript and/or CSS.
Answer: B
Explanation: The "clientlib" functionality will manage all your Javascript and CSS resources in your application. It takes cares of dependency management, merging files and minifying content.
The following application scenario will be explained :
multiple components with their own Javascript and CSS files
global Javascript and CSS files
/apps folder is not available via the dispatcher (recommended)
CSS resources have to go in the , Javascript resources at the end of the page
Resources need to be minified
Some resources need to be merged
Create a node of type cq:clientLibraryFolder named it as clientlib.
Add a property to every clientlib-node called "categories" of type String[] with the single value of "myproject.components". (To get a String[] type click the Multi button ).

For accessing this through design
clientlib(categories ,embed, dependency)

QUESTION 23:What is the purpose of the Impersonators tab within the User settings?
A. Add one or more users that are allowed to take over all permissions from the current user.
B. Add one or more users that are inheriting the permissions from the current user.
C. Add one or more users that can act on the behalf of the current user.
D. Add one or more users that the current user can act on their behalf.
Answer: C
Explanation:
Authentication information is extracted from the request. In Adobe Experience Manager (AEM), this is done by an authentication handler.
The authentication information is then checked to determine whether it is sufficient and/or correct. In AEM, this is performed by the login modules.
The appropriate response is initiated.

QUESTION 24:Which OSGi configuration settings take over precedence on start-up?
A. Any .config files from /crx-quickstart/launchpad/config/* on the local file system.
B. Repository nodes with type sling:OsgiConfig under /libs/*/install.
C. Repository nodes with type sling:OsgiConfig under /apps/*/config.
D. Repository nodes with type sling:OsgiConfig under /libs/*/config.
Answer: C

QUESTION 25:Which tab in the Apache Felix Web Console displays the list of all the users that are logged in to the repository?
A. Authenticator tab.
B. CRX Login Tokens tab.
C. Recent Request tab.
D. System Information tab.
Answer: B

QUESTION 26: How do you define the error message that should be displayed when the regex widget validation results in an error?
A. After the regular expression property in the cq:Widget element, add a new property, name it regex and enter the error message in quotes.
B. Add a property to the cq:Widget element, name it regexText and enter the error message.
C. Create a node under the cq:Widget element, name it options, then create a property called error Message and enter the error message.
D. Create a node under the cqWidget element and name it errorMessage. Create a property called text and enter the error message.
Answer:
Explanation:
regexText="Please enter a valid email address"
regex="/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/"
xtype="textfield"
fieldLabel="Email"
name="./email"
allowBlank="false"/>

Q: How to install CQ5 using command line:
java -XX:MaxPermSize=256m -Xmx1024M -jar cq5-author-p4502.jar

Q: What is the difference between node and resource in CQ5?
Ans: While on pure JCR you only work with raw repository structures (nodes and properties), the Sling resource abstraction offers you easier handling (no need to deal with the repository exceptions any more)

and many more options to interact with your business objects and services.

As an example let’s assume, that we need to read the title of CQ page /content/geometrixx/en/services. Using the JCR API it would look like this:
String readTitle (Session session) {
Node page =session.getNode("/content/geometrixx/en/services"); Node jcrcontent = page.getChild("jcr:content");
String title = titleProp.getValue().getString(); Property titleProp= jcrcontent.getProperty ("title"): return title;
}

This is a very small example, but it shows 3 problems:

We need to know, that all CQ page properties are stored on the jcr:content node below the page
the title of the page is encoded in the property “title”.
Properties are not available immediately as basic types and need to be converted from Properties to a Value to our expected type (String)

The same example with Sling:
String readTitle (ResourceResolver resolver) {
Resource r = resolver.getResource("/content/geometrixx/en/services"); Page page = r.adaptTo(Page.class); String title = page.getTitle(); return title;
}

We don't need to deal with the low-level information (like the jcr:content node) and properties, but we use the appropriate business object (a CQ page object), which is available out of the box and offers a better level of abstraction.

On a Sling resource level we also a bunch of helpers available, which offer some great benefits over the use of plain nodes and properties:
* the adaptTo() mechanism allows converting a resource into appropriate objects representing a certain aspect of this resource, for example:
  • LiveCopyStatus lcs = resource.adaptTo (LiveCopyStatus.class);
  • PageManager pm = resource.adaptTo (PageManager.class);
see http://host:port/system/console/adapters for an (incomplete?) list.
The ValueMap is abstracting away the Property type, type conversions are then done implicitly.

And likely many many more.
And if you ever need to deal with JCR directly, just use Node node = resource.adaptTo(Node.class);
So, there are many reasons to use Sling instead of the JCR API.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.