Databricks Certified Data Engineer Associate · Free Practice Question Easy
Question 21
- A By installing a special library that allows cross-language execution.
- B By writing all code in Python and using API calls to execute SQL queries.
- C By configuring the notebook settings to enable multi-language support before execution.
-
D
By using the
%pythonand%sqlmagic commands at the beginning of each cell to specify the language.
Reveal correct answer
Correct answer: D
Explanation
Databricks notebooks natively support multiple programming languages. You can use magic commands like %python and %sql to write Python and SQL code in the same notebook, allowing for smooth collaboration between data science and engineering teams and leveraging the strengths of each language. This flexibility improves productivity and simplifies code management.
A. Installing a special library is not necessary to execute Python and SQL code within the same Databricks notebook. There are built-in magic commands that allow you to specify the language for each cell.
B. Writing all code in Python and using API calls to execute SQL queries is not the recommended approach for executing Python and SQL code within the same Databricks notebook. Using the %python and %sql magic commands is the more efficient and straightforward method for language specification.
C. Configuring the notebook settings to enable multi-language support is not required to execute Python and SQL code within the same Databricks notebook. The %python and %sql magic commands are sufficient for specifying the language in each cell.
D.
Using the %python and %sql magic commands at the beginning of each cell is the correct way to specify the language for executing Python and SQL code within the same Databricks notebook. This method allows you to switch between Python and SQL seamlessly within the notebook.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
