tag in HTML is used specifically to define a row within a table. Question 2. Which CSS selector has the highest specificity? A) Element selector B) Class selector C) ID selector D) Universal selector Answer: C Explanation: ID selectors have higher specificity than class and element selectors, meaning their rules override others. Question 3. What does the "responsive design" principle ensure in front-end development? A) Faster page loads B) Consistent look across devices and screen sizes C) Accessibility for search engines D) Better server-side performance Answer: B Explanation: Responsive design ensures layouts adapt and look consistent across different devices and screen sizes. Question 4. Which jQuery method is used to select elements by class name? A) $('#classname') B) $('.classname') C) $('classname') D) $('#.classname') Answer: B Explanation: In jQuery, classes are selected using a dot, so $('.classname') selects all elements with that class. Question 5. What is the primary use of Git in development workflows? A) Compiling code B) Designing layouts C) Version control D) Database management Answer: C Explanation: Git is a version control system used to track changes in code and enable collaborative development. Question 6. What differentiates Drupal 7 theming from Drupal 8+ theming? A) Use of CSS frameworks B) Use of PHP-based theming vs. Twig-based theming C) Use of JavaScript libraries D) Use of XML templates Answer: B Explanation: Drupal 7 uses PHP for theming, while Drupal 8 and above use Twig templating.
A) name B) core C) regions D) description Answer: C Explanation: 'regions' is optional in the .info file; 'name', 'core', and 'description' are required. Question 11. How do you declare a custom region in a Drupal 7 theme’s .info file? A) regions[] B) regions: C) regions[region_name] = Region Label D) region: name Answer: C Explanation: Custom regions are declared using the syntax regions[region_name] = Region Label in the .info file. Question 12. What does the theme() function do in Drupal 7? A) Registers a new theme B) Renders themed output using theme hooks C) Loads a CSS file D) Runs a database query Answer: B Explanation: theme() renders output based on theme hooks and templates. Question 13. Which template file is used to override the default rendering of nodes in Drupal 7?
A) block.tpl.php B) node.tpl.php C) page.tpl.php D) comment.tpl.php Answer: B Explanation: node.tpl.php is responsible for theming individual nodes. Question 14. How can you target the front page specifically with a template override in Drupal 7? A) page-front.tpl.php B) page--front.tpl.php C) front-page.tpl.php D) front.tpl.php Answer: B Explanation: page--front.tpl.php is the correct naming convention for front page overrides. Question 15. What is the purpose of a preprocess function in Drupal theming? A) To add logic to CSS files B) To modify variables before rendering templates C) To load external JavaScript files D) To connect to the database Answer: B Explanation: Preprocess functions adjust variables before they are sent to template files for rendering. Question 16. Which function in template.php would preprocess variables for nodes? A) template_preprocess_page()
C) escape_html() D) sanitize_string() Answer: A Explanation: check_plain() escapes output to prevent cross-site scripting attacks. Question 20. Where do you define and group CSS files for a Drupal 7 theme? A) template.php B) .info file C) style.css D) theme.js Answer: B Explanation: CSS files are grouped and defined inside the .info file for the theme. Question 21. What is the effect of enabling CSS aggregation in Drupal 7? A) Slower page load times B) Combining CSS files to reduce HTTP requests C) Disabling all custom CSS D) Removing inline styles Answer: B Explanation: CSS aggregation combines multiple files into one to improve performance by reducing HTTP requests. Question 22. Which hook would you use to alter or remove CSS files added by a module in Drupal 7? A) hook_js_alter() B) hook_css_alter()
C) hook_preprocess_css() D) hook_theme_css() Answer: B Explanation: hook_css_alter() allows you to modify or remove CSS files added by modules or core. Question 23. How do you include a JavaScript file in a Drupal 7 theme through the .info file? A) js[] = path/to/file.js B) javascript[] = path/to/file.js C) scripts[] = path/to/file.js D) add_js[] = path/to/file.js Answer: A Explanation: JavaScript files are added using the js[] = path/to/file.js syntax in the .info file. Question 24. What is the benefit of loading JavaScript in the footer instead of the header? A) Makes scripts load before content B) Improves perceived page load time C) Prevents JavaScript from running D) Increases CSS specificity Answer: B Explanation: Loading JS in the footer allows the page content to load first, improving user experience. Question 25. Which function is used to add JavaScript files conditionally in Drupal 7? A) drupal_add_js() B) js_add() C) add_script()
D) theme and region Answer: B Explanation: The attach function receives 'context' (element to attach to) and 'settings' (JavaScript settings). Question 29. What is the primary use of jQuery within Drupal behaviors? A) To manipulate the DOM and add dynamic effects B) To store theme settings C) To connect to the database D) To compile CSS files Answer: A Explanation: jQuery is used to select and manipulate DOM elements, especially after AJAX content loads. Question 30. What is a common use-case for Drupal's AJAX framework in Drupal 7? A) Exporting database tables B) Dynamically updating forms without page reloads C) Aggregating CSS files D) Creating custom blocks Answer: B Explanation: The AJAX framework is used to update parts of the UI, like forms, without full page reloads. Question 31. Which function is used to add an AJAX callback to a form element in Drupal 7? A) ajax_add() B) drupal_set_ajax() C) #ajax property in form array
D) theme_ajax() Answer: C Explanation: The #ajax property is used in form arrays to attach AJAX callbacks to elements. Question 32. What is the effect of using the "Full HTML" text format in a Drupal text field? A) No HTML is allowed B) Allows all HTML tags and attributes C) Only plain text is allowed D) All scripts are blocked Answer: B Explanation: Full HTML allows all tags and attributes, so it should be restricted to trusted users. Question 33. Which module is commonly used for rich text editing in Drupal 7? A) Views B) CKEditor C) Devel D) Pathauto Answer: B Explanation: CKEditor provides a WYSIWYG editor for text fields in Drupal. Question 34. What is the purpose of the administrative overlay in Drupal 7? A) To provide a modal interface for admin pages B) To increase site speed C) To add custom blocks D) To manage user roles
Explanation: Naming the template block--[block-id].tpl.php allows overriding for a particular block. Question 38. What is the default directory for theme files in Drupal 7? A) /themes B) /modules C) /sites/default/themes D) /themes/custom Answer: A Explanation: By default, themes are placed in the /themes directory. Question 39. What is a sub-theme in Drupal 7? A) A theme that is not visible to users B) A theme that inherits styles and templates from a base theme C) A theme that only contains JavaScript files D) A theme created by the Views module Answer: B Explanation: Sub-themes inherit everything from a base theme and can override as needed. Question 40. How do you specify a base theme in a sub-theme’s .info file? A) base_theme[] = themename B) base-theme: themename C) base theme = themename D) base theme = "themename" Answer: A Explanation: base_theme[] = themename is the correct syntax in the .info file.
Question 41. Where are preprocess functions typically placed in a Drupal 7 theme? A) .info file B) template.php C) style.css D) theme.js Answer: B Explanation: Preprocess functions are written in template.php. Question 42. Which of the following is NOT a default template file provided by Drupal 7 core? A) comment.tpl.php B) region.tpl.php C) field.tpl.php D) form.tpl.php Answer: D Explanation: form.tpl.php is not a default template; forms are rendered via the Form API. Question 43. Which variable in page.tpl.php provides the main HTML content for the page? A) $main B) $body C) $content D) $page Answer: C Explanation: $content contains the main rendered content of the page.
A) theme settings B) Performance settings C) User permissions D) Block settings Answer: B Explanation: Aggregation is configured under Configuration > Development > Performance. Question 48. What is the effect of JS aggregation in Drupal 7? A) Removes all JavaScript B) Combines multiple JS files into one for performance C) Converts JS to CSS D) Disables inline scripts Answer: B Explanation: Aggregation combines JS files to reduce HTTP requests and improve load times. Question 49. Which Drupal function is used to add inline JavaScript from PHP? A) drupal_add_inline_js() B) drupal_add_js($script, 'inline') C) add_inline_script() D) js_add_inline() Answer: B Explanation: drupal_add_js($script, 'inline') adds inline JavaScript code. Question 50. What is the standard way to attach behaviors to AJAX-loaded content in Drupal 7? A) Using document.ready
B) Using Drupal.behaviors C) Using setTimeout D) Using window.onload Answer: B Explanation: Drupal.behaviors ensures code runs on AJAX-loaded content as well as initial page load. Question 51. Which Drupal 7 function is used to discover available template suggestions? A) theme_suggestions() B) theme_registry() C) Theme Registry D) theme_get_suggestions() Answer: C Explanation: The Theme Registry provides a list of available template suggestions and theme hooks. Question 52. What does the $classes variable provide in a .tpl.php file? A) The page title B) A string of CSS classes to apply to the HTML element C) The main content D) The theme's name Answer: B Explanation: $classes contains a string of CSS classes used for styling elements. Question 53. Which hook is used to provide new theme hooks in a custom module or theme? A) hook_theme() B) hook_template()
D) echo htmlspecialchars($variable); Answer: C Explanation: check_plain() escapes output, preventing XSS attacks. Question 57. Which of the following statements about preprocess functions is TRUE? A) They run after the template is rendered B) They allow you to modify variables before templates use them C) They are only available in modules D) They are written in JavaScript Answer: B Explanation: Preprocess functions modify variables before they are used in templates. Question 58. What is the default theme provided with Drupal 7? A) Bartik B) Zen C) Garland D) Omega Answer: A Explanation: Bartik is the default front-end theme in Drupal 7 core. Question 59. How is the theme registry rebuilt in Drupal 7? A) By clearing the cache B) By saving the theme settings C) By updating the .info file D) By enabling a new module
Answer: A Explanation: Clearing the cache rebuilds the theme registry so new templates and preprocess functions are recognized. Question 60. What does the $is_front variable indicate in Drupal 7 templates? A) If the user is an admin B) If the page is the site's front page C) If the block is visible D) If the theme is enabled Answer: B Explanation: $is_front is TRUE when rendering the site's front page, allowing conditional logic in templates. Question 61. Which function is used to render a block programmatically in Drupal 7? A) render_block() B) drupal_render_block() C) block_render() D) block_get_renderable_array() Answer: D Explanation: block_get_renderable_array() returns the renderable structure for a block. Question 62. Which key in the .info file defines the Drupal core version for the theme? A) version B) core C) drupal_version D) d