Friday, July 8, 2022

Durpal Test 2022-23

1. The following are advantages of using Drupal Views vs. custom module development EXCEPT:

Answers:

• Development speed — creating a View will be faster than creating a custom module most of the time
• Performance — Views offer increased performance over custom modules
• Maintenance — Views is a Drupal standard, as opposed to using custom modules, which gives your site’s maintenance an unnecessary learning curve
• Upgrading — Views provide an upgrade path to future versions of Drupal, which custom modules don’t provide out-of-the-box

2. Which of the following is the correct way to restrict users, with an email address ending in example.org (user@example.org, test@example.org, etc), from registering an account?

Answers:

• By adding «%@example.org» as an email restriction in the Access Rules administration settings
• By installing a Captcha module and its required modules
• By creating a custom module and implementing the hook_user_restrictions hook
• By installing the Domain Access module and its dependencies

3. How can a Drupal site be taken offline or in maintenance mode using Drush?

Answers:

• drush vset site_offline 1
• drush vdel site_offline
• drush vset maintenance_mode 0
• drush setoffline 1

4. Which of the following is the correct way to add a user’s first and last name in Drupal?

Answers:

• By enabling Profile module. This module allows for fields to be added to users like first-name and last-name.
• Must enable the User Details module.
• Can not do this for Drupal users.
• A and B

5. Suppose the user is on the folllowing URL:
http://example.com/blog/odesk-skills-test?page=1#comment-123
The above URL path is an alias of the following URL path:
http://example.com/node/8
What would be the output of the following code? (Assume it’s placed in the node.tpl.php file)
$arg_0 = arg(0);
var_export($arg_0);

Answers:

• ‘1’
• ‘node’
• ‘blog’
• ‘blog/odesk-skills-test’

6. Which of the following is the correct way to install another Drupal that shares the same modules, themes, libraries and core code of an existing site, while using a new database?

Answers:

• By creating a new folder in the ‘sites’ folder with the new domain name as folder name. Then, copy the sites/default/default.settings.php file to the new folder. Run the install.php script from the browser afterwards.
• By installing the Subdomain module and its required modules.
• By adding the new site domain name as a key in the ‘$db_url’ associative array in the settings.php file.
• A single Drupal code base cannot be used to host multiple sites.

7. Which of the following will not change the value of a CCK field automatically as soon as the user creates a new node?

Answers:

• By using the Rules module and adding and configuring a new Triggered Rule.
• By installing the Computed Field module and creating a Computed Field as the changing field.
• By implementing the hook_nodeapi hook in a custom module.
• By implementing the hook_node_info hook in a custom module.

8. Which of the following is not a desired way to create a custom page with custom layout in Drupal?

Answers:

• Using panels
• Using a .tpl.php file specificially for that page
• Build page with exact HTML structure you want
• None of above

9. «hook_js_alter» overrides JavaSript in Drupal. Which of the following statements are true?

Answers:

• It performs the necessary alterations to the JavaScript code before it is presented on the page.
• It performs the necessary alterations to the JavaScript code after it is presented on the page.
• It performs the necessary alterations to the JavaScript code before the page is loaded by browser.
• It performs the necessary alterations to the JavaScript code after the page is loaded by browser.

10. Which of the following is the correct way to control the maximum character length in views, while displaying field content?

Answers:

• Select «exclude from display» and use token values to display fields
• Select «Trim this field to a maximum length» and put the number of characters
• Select «rewrite output» and write a PHP function for the maximum length
• Use the maximum field formatter to restrict the character length

11. function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
array_shift($breadcrumb);
return ‘<div class=»breadcrumb»>’. implode(‘ › ‘, $breadcrumb) .'</div>’;
}
}
Which of the statement(s) about the code above is/are true?

Answers:

• The code will add one item to the breadcrumbs
• The code will remove the home item from the breadcrumbs
• The code will add one item at the end of the breadcrumbs
• The code will add a separator to the breadcrumbs

12. How can a Drupal site be brought out of maintenance mode?

Answers:

• By changing the $maintance_mode variable in the settings.php file to FALSE.
• By changing the «Site status» configuration in admin settings to «online».
• By removing the maintenance-lock.php file from the root of the Drupal installation folder.
• By granting «access site» permissions to anonymous users.

13. Which one of the following is correct way to list all routes?

Answers:

• drupal router:debug
• drupal router:all
• drupal router:list-all
• drupal route:all

14. Which of the following formats are supported by default in Views?
Note: There may be more than one right answer.

Answers:

• Grid
• HTML List
• Table
• Slideshow

15. Use the CCK module to add fields to your ____.

Answers:

• Nodes
• Pages
• Files
• Modulars

16. Default location of the configuration sync directory is?

Answers:

• DRUPALROOT/sites/all/config/config_LONG_HASH
• DRUPALROOT/sites/default/config_LONG_HASH
• DRUPALROOT/sites/default/files/private/config_LONG_HASH
• DRUPALROOT/sites/default/files/config_LONG_HASH

17. Which of the following statements is valid for Field SQL Storage?
Note: There may be more than one right answer.

Answers:

• Field UI—allow you to create fields and attach them to content types, comments
• Fields can be stored in different formats and formatted in different ways
• Fields can not be stored in different formats and formatted in different pages
• None of the above

18. To create our own Controller we need to extend it from the following Controller Class:

Answers:

• BaseController
• ControllerBase
• Controller
• ControlController

19. Which of the following is correct way to translate string in Twig?

Answers:

• {{ ‘String to translate’ | translate() }}
• {{ ‘String to translate’ | t() }}
• {{ ‘String to translate’ | t }}
• {{ t(‘String to translate’) }}

20. In Drupal 8, CacheCollector has the same internal logic as CacheArray but uses public methods for get and set instead of __.

Answers:

• ArrayAccess
• CacheArray
• RenderArray
• 2DArray

21. Which of the following APIs are provided by Drupal?
Note: There may be more than one right answer.

Answers:

• Authentication API
• Block API
• RESTful Web Services API
• Tour API

22. Which one of the following is true with respect to JQuery loading in Drupal?

Answers:

• jQuery loads on every page
• jQuery only loads where required
• jQuery does not load on any page
• jQuery is not bundled with Drupal Core

23. Which of the following code you can use and can change date_popup date format in form?

Answers:

• $form[‘mymodule_end_date’] = array(
‘#type’ => ‘date_popup’,
‘#title’ => t(‘Start date’),
‘#date_format’ => ‘d-m-Y’,
‘#datepicker_options’ => array(
‘maxDate’ => 0,
‘dateFormat’ => date_popup_format_to_popup(‘d-m-Y’),
),
‘#date_year_range’ => ‘-3:+0’,
‘#date_label_position’ => ‘above’,
‘#theme_wrappers’ => array(‘date_popup’),
‘#required’ => TRUE,
);
• $form[‘mymodule_start_date’] = array(
‘#type’ => ‘date_popup’,
‘#title’ => t(‘Start date’),
‘#date_format’ => ‘d-m-Y’,
‘#datepicker_options’ => array(
‘maxDate’ => 0,
‘dateFormat’ => date_popup_format_to_popup(‘d-m-Y’),
),
‘#date_year_range’ => ‘-3:+0’,
‘#date_label_position’ => ‘above’,
‘#theme_wrappers’ => array(‘date_popup’),
‘#required’ => TRUE,
);
• $form[‘mymodule_start_date’] = array(
‘#type’ => ‘date_popup’,
‘#title’ => t(‘Start date’),
‘#date_format’ => ‘d-m-Y’,
‘#datepicker_options’ => array(
‘maxDate’ => ‘0’,
‘dateFormat’ => date_popup_format_to_popup(‘d-m-Y’),
),
‘#date_year_range’ => ‘-3:+0’,
‘#date_label_position’ => ‘above’,
‘#theme_wrappers’ => array(‘date_popup’),
‘#required’ => TRUE,
);

24. Drupal has over _____ plug-ins to boost your website?

Answers:

• 1000
• 2000
• 4000
• 5000
• 7000

25. In module.routing.yml file ‘requirements’ can have following properties defined?
Note: There may be more than one right answer.

Answers:

• _permission
• _role
• _csrf_token
• _form

No comments:

Post a Comment