Python fundamentals for data analysis (NumPy, pandas, Jupyter): Practice Questions — Foundations of Accelerated Data Science (NVIDIA-Certified Associate: Accelerated Data Science)
Practice Questions: Python Fundamentals for Data Analysis These multiple-choice questions focus on key Python libraries and tools essential for data...
Practice Questions: Python Fundamentals for Data Analysis
These multiple-choice questions focus on key Python libraries and tools essential for data analysis in the NVIDIA-Certified Associate: Accelerated Data Science exam, specifically covering NumPy, pandas, and Jupyter.
Which of the following libraries is primarily used for numerical computing and supports multi-dimensional arrays?
- A. pandas
- B. NumPy
- C. Matplotlib
- D. Seaborn
Correct Answer: B. NumPy
Explanation: NumPy provides support for large, multi-dimensional arrays and matrices along with a collection of mathematical functions to operate on these arrays, making it fundamental for numerical computing.
In pandas, which data structure is best suited for representing tabular data with labeled rows and columns?
- A. Series
- B. DataFrame
- C. Panel
- D. Array
Correct Answer: B. DataFrame
Explanation: A DataFrame is a two-dimensional labeled data structure with columns of potentially different types, ideal for tabular data analysis.
What is the primary purpose of Jupyter notebooks in data science workflows?
- A. Compiling Python code into executables
- B. Interactive development and visualization of code, data, and results
- C. Managing database connections
- D. Automating deployment of machine learning models
Correct Answer: B. Interactive development and visualization of code, data, and results
Explanation: Jupyter notebooks provide an interactive environment combining code execution, rich text, visualizations, and other media, facilitating exploratory data analysis.
Which NumPy function would you use to create an array of evenly spaced values between 0 and 10, inclusive?
- A. numpy.linspace(0, 10, num=50)
- B. numpy.arange(0, 10)
- C. numpy.zeros(10)
- D. numpy.ones(10)
Correct Answer: A. numpy.linspace(0, 10, num=50)
Explanation: linspace generates a specified number of evenly spaced values over a defined interval, including the endpoint.
In pandas, which method is used to read data from a CSV file into a DataFrame?
- A. pandas.read_csv()
- B. pandas.load_csv()
- C. pandas.open_csv()
- D. pandas.import_csv()
Correct Answer: A. pandas.read_csv()
Explanation: The read_csv() function is the standard method to load CSV data into a pandas DataFrame.
How can you display the first 5 rows of a DataFrame named df in pandas?
- A. df.head()
- B. df.tail()
- C. df.show()
- D. df.first()
Correct Answer: A. df.head()
Explanation: The head() method returns the first n rows (default 5) of the DataFrame, useful for quick inspection.
Which command in a Jupyter notebook cell will display the output of the last expression without explicitly using a print statement?
- A. print()
- B. return
- C. Simply place the expression as the last line
- D. display()
Correct Answer: C. Simply place the expression as the last line
Explanation: In Jupyter notebooks, the output of the last expression in a cell is automatically displayed without needing print().
What is the result of executing numpy.array([1, 2, 3]) + numpy.array([4, 5, 6])?
- A. An error due to incompatible types
- B. Element-wise addition resulting in array([5, 7, 9])
- C. Concatenation resulting in array([1, 2, 3, 4, 5, 6])
- D. Multiplication resulting in array([4, 10, 18])
Correct Answer: B. Element-wise addition resulting in array([5, 7, 9])
Explanation: NumPy arrays support element-wise operations; adding two arrays adds corresponding elements.
More in this topic
Ready to test your knowledge?
Put what you've learned into practice with a quick quiz and track your progress.
Test your knowledge →