Exam AD0-E103 All QuestionsBrowse all questions from this exam
Question 64

A developer is working on an HTL script for a custom component. The script has the following requirements:

✑ This script must list the title of every child page of the current page.

✑ If a child page does not have any children, then its title should link directly to that page.

✑ If a child page has children, then the title of every one of its children should be listed beneath its title.

✑ The title of every grandchild page should link directly to that page.

Which HTL script should the developer use to meet these requirements?

A.

B.

C.

D.

    Correct Answer:

    The HTL script that meets the requirements should be able to list the title of every child page and handle grandchildren appropriately by checking if children exist and then listing the titles accordingly. Additionally, the children's titles should link directly to their pages if they don't have children, and grandchildren's titles should link directly to their pages. Therefore, the correct answer should handle these conditions accurately. Given that option D checks if the child has children using ${child.listChildren} and uses the extension '.html' in the link, as well as handling all the specified requirements, it should be the correct choice.

Discussion
pkg82

Correct answer is D.

rakayaD

B is wrong as extension is not there. A and D both are working as expected. Only question is whether is it a best practice to use local variable ${grandChildren} for testing or ${child.listChildren}? IMO, A is promoting code reuse as we are using a variable.

Batya

D is correct, because when we can not get listchildren from the child, we will not know about grandChildren variable.