Data Science · Matplotlib In plt.plot(x, y, 'r--'), what does the format string 'r--' specify? A A round marker only B A red dotted line C A reversed x-axis D A red dashed line Correct answer MCQSEXAM Show answer Read explanation
Data Science · Matplotlib Long category names overlap on the x-axis. Which call rotates the tick labels by 45 degrees? A plt.xlim(45) B plt.xlabel(rotate=45) C plt.rotate_x(45) D plt.xticks(rotation=45) Correct answer MCQSEXAM Show answer Read explanation
Data Science · Matplotlib How do you add background grid lines to a Matplotlib plot? A plt.mesh(True) B plt.grid(True) Correct answer C plt.lines(True) D plt.axis('grid') MCQSEXAM Show answer Read explanation
Data Science · Matplotlib Which Matplotlib function plots data points with error bars? A plt.errorbar() Correct answer B plt.stem() C plt.boxplot() D plt.step() MCQSEXAM Show answer Read explanation
Data Science · Matplotlib In plt.figure(figsize=(10, 4)), the numbers specify: A Rows and columns of subplots B Font size and line width C Width and height in pixels D Width and height in inches Correct answer MCQSEXAM Show answer Read explanation
Data Science · Matplotlib Which call makes the y-axis of the current plot logarithmic? A plt.ylabel('log') B plt.ylog(True) C plt.yscale('log') Correct answer D plt.yaxis('log') MCQSEXAM Show answer Read explanation
Data Science · NumPy What is the dtype of np.array([1, 2]) + 0.5? A int64 B float64 Correct answer C int32 D object MCQSEXAM Show answer Read explanation
Data Science · NumPy What does (scores >= 50).sum() return for a NumPy array of exam scores? A The total of all scores at or above 50 B The average of every score in the array C The number of scores that are at least 50 Correct answer D The index of the first score above 50 MCQSEXAM Show answer Read explanation
Data Science · NumPy Array a has shape (3, 4). What is the shape of a.mean(axis=1)? A (3,) Correct answer B (4,) C (3, 4) D (1,) MCQSEXAM Show answer Read explanation
Data Science · NumPy For a = np.array([10, 20, 30, 40]), what does a[[0, 2]] return? A array([10, 20, 30]) B array([10, 30]) Correct answer C array([10, 20]) D array([20, 40]) MCQSEXAM Show answer Read explanation
Data Science · NumPy What does the ndim attribute of a NumPy array return? A The total number of elements B The number of dimensions Correct answer C The data type of the array D The size of each element in bytes MCQSEXAM Show answer Read explanation
Data Science · NumPy If x has shape (5,), what is the shape of x[:, np.newaxis]? A (1, 5) B (5, 1) Correct answer C (5, 5) D (5,) MCQSEXAM Show answer Read explanation
Data Science · NumPy For 2-D NumPy arrays A and B, what does A @ B compute? A Matrix transpose B Element-wise multiplication C Element-wise addition D Matrix multiplication Correct answer MCQSEXAM Show answer Read explanation
Data Science · NumPy Why is np.isclose(0.1 + 0.2, 0.3) preferred over (0.1 + 0.2) == 0.3? A It is the only way to compare NumPy arrays B It converts both values into integers first C It allows for tiny floating-point rounding errors Correct answer D It ignores the sign of negative numbers MCQSEXAM Show answer Read explanation
Data Science · NumPy a = np.arange(5); b = a[1:3]; b[0] = 99. What is a now? A array([99, 1, 2, 3, 4]) B array([0, 99, 99, 3, 4]) C array([0, 1, 2, 3, 4]) D array([0, 99, 2, 3, 4]) Correct answer MCQSEXAM Show answer Read explanation
Data Science · NumPy For a = np.array([3, 8, 1, 9]), what does a[a > 5] return? A array([3, 1]) B array([8, 9]) Correct answer C array([1, 3]) D array([False, True, False, True]) MCQSEXAM Show answer Read explanation
Data Science · Python For nums = [10, 20, 30, 40], what is nums[-1]? A 10 B An IndexError C 40 Correct answer D 30 MCQSEXAM Show answer Read explanation
Data Science · Python According to PEP 8, how many spaces should be used for each indentation level? A 8 B 2 C 1 D 4 Correct answer MCQSEXAM Show answer Read explanation
Data Science · Python What does the 'walrus operator' (:=), added in Python 3.8, do? A Assigns a value inside an expression Correct answer B Compares two values for identity C Swaps the values of two variables D Declares a constant that cannot change MCQSEXAM Show answer Read explanation
Data Science · Python Why use copy.deepcopy() instead of copy.copy() for a list of lists? A To copy the list faster using less memory B To remove duplicate items while copying C To convert the list into an immutable tuple D To copy the inner lists as well Correct answer MCQSEXAM Show answer Read explanation
Data Science · Python What is the result of list(zip([1, 2, 3], ['a', 'b']))? A [1, 'a', 2, 'b', 3] B An error because the lengths differ C [(1, 'a'), (2, 'b')] Correct answer D [(1, 'a'), (2, 'b'), (3, None)] MCQSEXAM Show answer Read explanation
Data Science · Python What does enumerate(['a', 'b'], start=1) yield? A (0, 'a') and (1, 'b') B (1, 'a') and (2, 'b') Correct answer C (1, 'b') and (2, 'a') D ('a', 1) and ('b', 2) MCQSEXAM Show answer Read explanation
Data Science · Python What does sorted(['kiwi', 'fig', 'banana'], key=len) return? A ['banana', 'kiwi', 'fig'] B ['fig', 'kiwi', 'banana'] Correct answer C ['banana', 'fig', 'kiwi'] D ['fig', 'banana', 'kiwi'] MCQSEXAM Show answer Read explanation
Data Science · Python What is the value of 'python'[1:4]? A 'ytho' B 'yth' Correct answer C 'pyt' D 'pyth' MCQSEXAM Show answer Read explanation
Data Science · Python In standard CPython, what is the main effect of the Global Interpreter Lock (GIL)? A Global variables cannot be read by any function B Each thread receives its own private memory heap C Only one thread executes Python bytecode at a time Correct answer D Python code always runs on all CPU cores at once MCQSEXAM Show answer Read explanation