Databricks Data Engineer Associate exam dumps

Databricks Data Engineer Associate practice question 58 of 532

Databricks Certified Data Engineer Associate. Associate level, Databricks. Free question with the correct answer and a full explanation.

Databricks Data Engineer Associate Question 58

Single answer

You are working on a Databricks notebook that processes data and want to reuse a function written in another notebook called 'utilities'. How can you run this 'utilities' notebook from your current notebook to access its functionality?

  1. A

    Use the %run magic command followed by the relative path to the 'utilities' notebook.

  2. B

    Use the %sql magic command followed by the relative path to the 'utilities' notebook.

  3. C

    Use the dbutils.notebook.run() function to call the 'utilities' notebook.

  4. D

    Use the import keyword in Python to directly import the 'utilities' notebook as a module.

Show answer and explanation

Correct answer: A

Explanation

To run one notebook from within another notebook in Databricks and access its functions or variables in the current context, the %run magic command should be used. This allows the current notebook to execute the code from the specified notebook and inherit its scope. Other methods like dbutils.notebook.run() are used for separate execution flows or job workflows, not inline execution.

  • A. Correct.

    Correct. The %run magic command is used to execute another notebook within the current notebook. You must specify the relative path to the notebook, ensuring proper access to its variables and functions.

  • B. Incorrect.

    Incorrect. The %sql magic command is used for running SQL queries directly in a Databricks notebook, not for executing other notebooks.

  • C. Incorrect.

    Incorrect. The dbutils.notebook.run() function is used to trigger a notebook as a separate job with arguments and captures its return value, but it does not directly execute the notebook in the current context.

  • D. Incorrect.

    Incorrect. The import keyword in Python cannot directly import a Databricks notebook as a module, as Databricks notebooks are not treated as standard Python modules.

Timed practice exam

Take a Databricks Data Engineer Associate practice test under exam conditions

45 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam