Free Introduction to Python for Data Science Questions and Answers — Questions and Answers
Question 1: What command will enable you to obtain a stack trace while using the interactive Python debugger?
- Where (Correct answer)
- Step
- Whatis
- P
Correct answer: Where
Explanation: <br> The command at the interactive Python debugger prompt that helps you in getting a stack trace while debugging a Python program is where or w.
Question 2: Choosing the incorrect command to create and reshape a 60-integer array when the NumPy package has been imported as an object with the name np
- myArray=np.arrange(60).reshape(8,7) (Correct answer)
- myArray=np.arrange(60).reshape(12,5)
- myarray=np.linspace(0,60,60).reshape(3,20)
- myArray=np.arrange(60).reshape(10,6)
Correct answer: myArray=np.arrange(60).reshape(8,7)
Explanation: <br> The command myArray = np.arrange(60).reshape(8,7) is not a valid command for creating and reshaping a 60-integer array using NumPy.
Question 3: Which activity does not fall under the data science lifecycle's Dissemination phase?
- Creating and managing analysis scripts (Correct answer)
- Deploying findings and reports to a production environment
- Publishing and sharing result findings
- Writing reports of the results from each iteration
Correct answer: Creating and managing analysis scripts
Explanation: <br> Creating and managing analysis scripts is not typically included in the Dissemination phase of the data science lifecycle.
Question 4: What kind of data can be used to satisfy the needs of an application that has datasets that are not suited for an RDBMS yet require order and hierarchy
- Unstructured
- Semi-structured (Correct answer)
- Structured
- Complex
Correct answer: Semi-structured
Explanation: <br> Semi-structured data is suitable to address the requirement for an application having datasets that are not suitable for a Relational Database Management System (RDBMS) but still require order and hierarchy.
Question 5: What does Python's "capture" cell magic command not support?
- It cannot be used to capture graphical cell output (Correct answer)
- It can be used to capture the standard error stream of a cell
- It can capture textual cell output into variable in the current namespace
- It can be used to capture the standard output stream of a cell
Correct answer: It cannot be used to capture graphical cell output
Explanation: <br> The statement "It cannot be used to capture graphical cell output" is invalid regarding the "capture" cell magic command in Python.
Question 6: What does the Jupyter Notebook application not apply to?
- A notebook server must be running in order to create and interact with notebook documents
- It is web-based, interactive computing environment
- Cell may only be run one at a time (Correct answer)
- Code may be stored and run one at a time
- Code may be stored and run along with its output in each notebook document
Correct answer: Cell may only be run one at a time
Explanation: <br> The statement "Cell may only be run one at a time" is not applicable to the Jupyter Notebook application.
Question 7: What qualifies as not a property of an ndarray object?
- shape
- dtype
- length (Correct answer)
- ndim
Correct answer: length
A NumPy ndarray exposes attributes like shape, dtype, ndim, and size, but there is no 'length' attribute. To get the number of elements you use .size, and len() returns only the first-axis length — neither is a property called 'length'. So 'length' is the one that is not a valid ndarray attribute.
What command will enable you to obtain a stack trace while using the interactive Python debugger?