Upwork Test Answers: Get all the correct answers of most recent and possible Upwork Tests A to Z (Updated on Jan, 2016)
Cover Letter Templates: These cover letter samples are not only for Upwork job, but also you will have some idea about your real life job
Freelance Profile Overviews: Different Profile samples and overviews of experts, advanced and intermediate level freelancers
For Newbie of Upwork: Upwork Help - How to apply for a job in Upwork with 10 most important articles about Upwork

A to Z View - All Upwork Test Answers

Drupal Test Answers (new)

Hello Web Developer, are you Drupal expert ?

If you really know about Drupal and you do have a profile in Upwork then this post is for you, Do't get late to take the Drupal Test. In this post you will find current Upwork Drupal Test questions with correct answers for Web Development category.

Search your desired answers of the Upwork Drupa test question by pressing Ctrl + F button.

1. Which of the following is the correct way to get the current theme path in Drupal?
 • drupal_get_path()

 2. Which of the following are best practices for scaling Drupal for a high traffic site?
 Answers: • Using a PHP opcode cache

 3. Which of the following is not a desired way to create a custom page with custom layout in Drupal?
 Answers: • Build page with exact HTML structure you want

 4. Which function can be used to invoke a hook in all enabled modules in Drupal?
 Answers: • module_invoke_all()

 5. The following are advantages of using Drupal Views vs. custom module development EXCEPT:
 Answers: • Maintenance - Views is a Drupal standard, as opposed to using custom modules, which gives your site's maintenance an unnecessary learning curve

 6. Which software architectural pattern is Drupal most closely associated with?
 Answers: • PAC: Presentation-Abstraction-Control

 7. Which function can be used to attach images to a particular node at runtime?
 Answers: • node_save()

 8. Which of the following is the correct way to remove core CSS files and add custom CSS files to a theme?
 Answers: • By using the drupal_get_css() & drupal_add_css() function

 9. Which of following will have a negative effect on the performance of a Drupal website?
 Answers: • using cache

 10. Which of the following is the correct way to display recent nodes/posts created by a user on their profile page?
 Answers: • By using views module to create a block, and configuring a view to take an argument as user ID and set that block to show only on profile pages

 11. By using the auto-complete field for a CCK nodereference, nodereference gives node id as [nid: node id]; which Drupal hook can be used to remove the bracket from the auto-complete list?
 Answers: • menu_alter()

 12. Which of the following is the correct way to customize the template for a view thas has been created using CCK and the Views 2 module?
 Answers: • By creating views-view-field--viewname--field-name-value.tpl.php

 13. Which of the following is the correct way to make a partial or substring search in Drupal?
 Answers: • By using the Apache Solr module

 14. How can all the input filters that have been created in the code be applied?
 Answers: • Using check_markup()

 15. Which of the following statements are true?
 Answers: • Can insert a block to a template programmatically using module_invoke() and block_invoke().

 16. How can the taxonomy term pages be themed?
 Answers: • Creating two files named node-taxonomy.tpl.php and page-taxonomy-term.tpl.php for theming the taxonomy pages

 17. Which of the following is the correct way to resolve the array_flip() error in Drupal which flips string and integer values?
 Answers: • It should use array for the ID which are passed

 18. What is the best way to display the plain HTML content of view's node using only one .tpl.php file for all views?
 Answers: • By implementing both hook_preprocess_page and hook_preprocess_html

 19. How can the theme be changed in Drupal using a Drush command?
 Answers: • drush -l http://yoursitename.com/ pm-enable theme_name
 • drush -l http://yoursitename.com/ vset theme_default theme_name

 20. How can a Drupal site be taken offline or in maintenance mode using Drush?
 Answers: • drush vset site_offline 1

 21. Which of the following is the correct function to get the current theme of a Drupal site?
 Answers: • All of above

 22. How can a module's data be exposed to the Views 2 module using its API?
 • by using hook_views_data() & hook_views_api()

 23. With the faceted search module it is possible to?
 Answers: • All of above

 24. What is the naming convention for a preprocessor function for the CCK fields in Drupal if the template called content-field-field_transmission_make_model.tpl?
 Answers: • yourThemeName_preprocess_content_field_field_tramission_make_model(&$variables)

 25. Which of the following is the correct way to include CSS and JavaScript files to a particular node in Drupal 6?
 Answers: • By using the node preprocess function and adding the CSS and JavaScript files in the function

 26. Which of the following is the correct way to get the page URL of a page in Drupal?
 Answers: • $link = url($path, array('absolute' => TRUE));

 27. Drupal.behaviors should be used instead of jQuery.ready. Which of the following statements are not a good reason for this recommendation?
 Answers: • Drupal.behaviors increase jQuery performence.

 28. How can a Drupal user's password be reset using Drush from the command line in Drupal 6.x?
 Answers: • drush user-password someuser --password="new_password_here"

 29. What is the best way to set up development for Drupal-based websites so that many developers can work on their own copy and before updating the master/central copy?
 Answers: • By using the Features and Strongarm Module

 30. How can an absolute date (as opposed to a relative date, or the current date) be set as the default value for a CCK datetime field in Drupal?
 Answers: • There is no option to set an absolute date as the default value in a CCK date field

 31. Drupal.behaviors should be used instead of jQuery.ready. Which of the following statements are not good reason for this recommendation?
 Answers: • Drupal.behaviors increase jQuery performence.

 32. What is the best way to create multiple blocks from a single module?
 Answers: • Using module_hook_block hook with $delta

 33. Which of the following statements are not best practices for implementing page handler include files in Drupal?
 Answers: • Consolidating page handlers in to a single file, to decrease overhead

 34. $node_type_A = node_load($some_nid);
 $current_delta = get_current_delta($node_type_A->vid);
 $node_type_A->field_type_B_node_ref += array($current_delta + 1 => array('nid' => $node_type_B_nid));
 $node_type_A = node_submit($node_type_A);

 Which of following statements are true about code above?
 Answers: • Appending a node reference

 35. Which of the following is the correct way to change the execution order of Drupal modules?
 Answers: • Updating the module's weight in the system table

 36. Which of the following statements are true for the code below?
 function custom_module_menu_alter(&$items) {
 $items['xyx/abc']['page callback'] = 'custom_module_showcontent';
 Answers: • The code adds a function which will be called with function callback queue upon requesting xyx/abc.

 37. Which one of following makes use of the Features module in Drupal?
 Answers: • Exporting modules' functionality in a single feature module

 38. How can a Drupal site be brought out of maintenance mode?
 Answers: • By changing the "Site status" configuration in admin settings to "online".

 39. What is the best practice when adding a div with some text at the end of a page?
 Answers: • Modify your theme's page.tpl file

 40. Which of the following condition(s) is/are not suited for using custom Drupal nodes?
 Answers: • When high data integrity is needed

 41. "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.

 42. function phptemplate_breadcrumb($breadcrumb) {
 if (!empty($breadcrumb)) {
 return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';

 Which of the statement(s) about the code above is/are true?
 Answers: • The code will remove the home item from the breadcrumbs

 43. Which of the following is the correct way to enable special characters in Drupal user's URL?
 Answers: • Install Path auto module and configure the special characters that you want to allow in the URL.

 44. Which of the following is the correct way to get the node ID of the page being currently executed?
 Answers: • Using the arg() function

 45. Which of the following is the correct way to combine the values of two fields in one field display in Drupal views, when using a field display style?
 Answers: • Selecting "rewrite output" and placing the field token values together in the desired display form

 46. How can custom CSS rules be added to a Drupal page (content) without using themes?
 Answers: • By using the drupal_add_css() function

 47. Which of the following are ways to display SQL queries executed by a Drupal view?
 Answers: • By using $view->build_info['query']

 48. Which of the following is the best way to pass arguments to the drupal_get_form() function?
 Answers: • drupal_get_form(‘custom1_default_form’,$arg1,$arg2)

 49. 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.

 50. Each menu item has a key corresponding to a Drupal path being registered in hook_menu. Which of following is
 not a key used to register a path in hook_menu()?
 Answers: • rule

 51. function special_registration_form_alter(&$form, $form_state, $form_id) {

 if ($form_id == 'user_register' && 'user' == arg(0) && 'register' == arg(1)) {
 // snipped alteration code

 Which of the following statements about code above are true?
 Answers: • The code will alter the registration form, but only when the user_register form appears on the 'user/register' page.

 52. What is the order in which template files (.tpl) will be displayed in a "view"?
 Answers: • Display output, Style output, Row style output, Fields

 53. How can a new element that was created be validated, if hook_form_alter was used, and a new field was added to an existing form?
 Answers: • Adding $form['#validate'][] and writing the validation function

 54. When sending email from Drupal, how can the default "From" address be changed?
 Answers: • By changing the Drupal admin settings' Site Information page

 55. Having a taxonomy associated with a node type. Using which function would it be possible to load/get the vocabulary information in the code?
 Answers: • taxonomy_vocabulary_load

 56. require './includes/bootstrap.inc';
 $db_result = db_query('SELECT * FROM {users}');
 while($user_object = db_fetch_object($db_result)){
 // .. code here

 Which of the following statement(s) about the above code is/are true?
 Answers: • The code can be used in an external PHP file to fetch all users

 57. 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?

 • 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.

 58. 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 implementing the hook_node_info hook in a custom module.

 59. Which of the following is the correct method to fire another process when a new node is created in Drupal?
 Answers: • Use hook_nodeapi and inside the insert handler add the code that you want to run after node creation. Code below: function mymodule_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { switch ($op) { case 'insert': // Add you code here break; } }

 60. Which of the following is the correct way to control the maximum character length in views, while displaying field content?
 Answers: • Select "Trim this field to a maximum length" and put the number of characters

 61. Suppose there is a new version for a module that is installed on a Drupal 6 site. This new version contains some database updates. Do those database updates need to be applied manually? If so, how can those updates be applied?
 Answers: • Run the update.php script as soon as the previous version is replaced with the new version.

 62. 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

 63. By default, does Drupal Filefield allow uploading of javascript files?
 Answers: • No, it would be a security risk if it is allowed, what is does is change the type of the file to .txt

 64. Is it possible to call Drupal functions in external PHP files?
 Answers: • Yes. Bootstrap Drupal functions in your external PHP file.

 65. Suppose the user is on the folllowing URL:

 The above URL path is an alias of the following URL path:

 What would be the output of the following code? (Assume it's placed in the node.tpl.php file)

 $arg_0 = arg(0);
 Answers: • 'node'