24CS5308 - Data Science Fundamentals Laboratory
Pre & Post Lab Questions
EX NO 1
1. Which of the following is a core feature of NumPy?
A) Data visualization
B) Machine learning models
C) Multi-dimensional array operations
D) Web development
2. What does the Pandas DataFrame structure represent?
A) A single numeric array
B) A 2D labeled data structure
C) A statistical model
D) An HTML page
3. What is the primary purpose of Statsmodels?
A) Deep learning
B) Data visualization
C) Statistical modeling and hypothesis testing
D) Image processing
4. Which module in SciPy is used for optimization?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
5. Which function in NumPy creates an array with values from 0 to 9?
A) [Link](10)
B) [Link](0, 10)
C) [Link](10)
D) [Link](0, 10)
6. Which of the following libraries is best suited for interactive code execution and data visualization?
A) NumPy
B) Jupyter Notebook
C) SciPy
D) Statsmodels
7. How do you check for missing values in a Pandas DataFrame?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
8. What function in NumPy is used to compute the mean of an array?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
9. Which SciPy sub-package is used for statistical computations?
A) [Link]
B) [Link]
C) [Link]
D) [Link]
10. What is the default axis for the sum() method in a Pandas DataFrame?
A) 0 (columns)
B) 1 (rows)
C) Both
D) None
11. Which of the following can be used to fit a linear regression model in Statsmodels?
A) OLS()
B) LinearRegression()
C) fit_model()
D) regress()
12. Which of the following is not a feature of Pandas?
A) Time series handling
B) Matrix multiplication
C) Data cleaning
D) Data filtering
13. In Jupyter Notebook, what symbol is used to write shell commands?
A) %
B) @
C) !
D) #
14. Which Pandas method is used to combine DataFrames horizontally (column-wise)?
A) append()
B) merge()
C) concat()
D) join()
15. Which function in NumPy helps generate random numbers?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
16. Which of the following is a characteristic of NumPy arrays?
A) Heterogeneous data types
B) Dynamic size
C) Fixed size and homogeneous types
D) Only 2D support
17. In Jupyter Notebook, how do you run a code cell?
A) Ctrl + Enter
B) Ctrl + R
C) Shift + Enter
D) Alt + Enter
18. Which Pandas method is used to read a CSV file?
A) pandas.load_csv()
B) [Link]()
C) pandas.read_csv()
D) pandas.open_csv()
19. What kind of plot is commonly used for visualizing data distributions?
A) Line plot
B) Bar plot
C) Histogram
D) Scatter plot
20. Which library provides descriptive statistics like mean, median, and mode?
A) Jupyter
B) Statsmodels
C) Pandas
D) Both B and C
EX NO 2
1. Which of the following is used to select rows by label in a DataFrame?
A) .iloc[]
B) .filter()
C) .loc[]
D) .slice[]
2. What function is used to merge two DataFrames in Pandas?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
3. How do you check for missing values in a DataFrame?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
4. Which Pandas method allows grouping of data for aggregation?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
5. What is used to generate pivot tables in Pandas?
A) df.cross_tab()
B) [Link]()
C) df.pivot_table()
D) [Link]()
6. Which method is used to compute the average of values in a column?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
7. What function drops all missing values in a DataFrame?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
8. How do you access a row at position 2 using integer-based indexing?
A) [Link][2]
B) [Link][2]
C) [Link][2]
D) [Link](2)
9. Which method is used to fill missing values with a specific value?
A) df.fillna_with()
B) [Link]()
C) [Link]()
D) df.replace_na()
10. Which method returns basic summary statistics for a DataFrame?
A) [Link]()
B) [Link]()
C) [Link]()
D) [Link]()
11. What function allows conditional filtering in a DataFrame?
A) [Link]()
B) [Link]()
C) Boolean indexing using df[df['column'] > value]
D) [Link]()
12. What method is used to reset the index of a DataFrame?
A) [Link]()
B) df.drop_index()
C) df.reset_index()
D) df.clear_index()
13. Which method concatenates multiple DataFrames vertically or horizontally?
A) df.merge_all()
B) df.join_all()
C) [Link]()
D) [Link]()
14. Which method is used to sort a DataFrame by column values?
A) [Link]()
B) [Link]()
C) df.sort_values()
D) [Link]()
15. How do you get unique values from a column in Pandas?
A) df.unique_values()
B) [Link]()
C) df['column'].unique()
D) df['column'].different()
16. Which method in Pandas is used to rename columns or index labels?
A) df.set_labels()
B) df.modify_names()
C) [Link]()
D) df.label_columns()
17. What does [Link]() return in Pandas?
A) The entire DataFrame
B) The last 5 rows
C) The first 5 rows
D) Only the index values
18. What type of join is performed by default in [Link]()?
A) Outer join
B) Left join
C) Inner join
D) Right join
19. Which method is used to transpose a Pandas DataFrame?
A) [Link]()
B) [Link]()
C) df.T
D) [Link]()
20. What is the default behavior of dropna() in Pandas?
A) Drop only columns with missing values
B) Drop only rows with missing values
C) Drop rows with any missing values
D) Drop all null and zero values
EX NO 3
1. Which of the following is NOT a measure of central tendency?
A. Mean
B. Median
C. Mode
D. Variance
2. What does the standard deviation represent?
A. The average value
B. The most frequent value
C. The spread of the data around the mean
D. The midpoint of the dataset
3. Which of the following variables from the Pima Indians dataset is likely to be binary?
A. Age
B. Glucose
C. Outcome
D. BMI
4. Skewness indicates:
A. The central point of data
B. The number of peaks
C. The asymmetry of data distribution
D. The standard deviation of the mean
5. A variable with high kurtosis is likely to have:
A. Very flat distribution
B. Fewer outliers
C. Heavy tails or outliers
D. Symmetrical distribution
6. If the mean of Glucose is significantly higher than the median, the distribution is likely:
A. Symmetrical
B. Left-skewed
C. Right-skewed
D. Uniform
7. What is the mode of a dataset?
A. Value at 50th percentile
B. Value that appears most frequently
C. Average of all values
D. Difference between max and min
8. Which of the following is used to identify the "flatness" or "peakedness" of a distribution?
A. Mean
B. Skewness
C. Kurtosis
D. Variance
9. Which Python function would you use to calculate standard deviation in pandas?
A. mean()
B. std()
C. var()
D. describe()
10. The variable Pregnancies is most likely a:
A. Categorical variable
B. Continuous variable
C. Discrete variable
D. Binary variable
11. If the kurtosis of a variable is less than 3, the distribution is considered:
A. Leptokurtic
B. Platykurtic
C. Mesokurtic
D. Hyperkurtic
12. Which of the following variables would you expect to have the highest variance in the Pima
dataset?
A. Age
B. Outcome
C. Diabetes Pedigree Function
D. BMI
13. The .value_counts() function in pandas is used to compute:
A. Mean of a variable
B. Frequency distribution
C. Standard deviation
D. Kurtosis
14. Which of the following variables is continuous?
A. Outcome
B. BloodPressure
C. Pregnancies
D. None of the above
15. A normal distribution has skewness and kurtosis equal to:
A. 0 and 3 respectively
B. 0 and 0 respectively
C. 1 and 1 respectively
D. 1 and 3 respectively
16. Which of the following statistics is most affected by outliers?
A. Median
B. Mode
C. Mean
D. Frequency
17. If a variable has a skewness of -1.5, it is considered:
A. Symmetrical
B. Positively skewed
C. Normally distributed
D. Negatively skewed
18. The purpose of computing variance is to:
A. Find the most common value
B. Show the middle value
C. Measure the spread of data
D. Identify data types
19. A variable has a standard deviation of 0. This means:
A. Data is normally distributed
B. Data has heavy tails
C. All data points are identical
D. Mean is zero
20. What would be the best measure of central tendency for a highly skewed variable?
A. Mean
B. Mode
C. Median
D. Variance
EX NO 4
1. Which of the following is best suited for predicting a binary outcome (e.g., diabetes or not)?
A. Linear Regression
B. Logistic Regression
C. Decision Tree Regression
D. K-Means Clustering
2. In linear regression, the goal is to:
A. Classify data points
B. Minimize log loss
C. Maximize R² score
D. Minimize the difference between predicted and actual values
3. The coefficient of determination (R²) indicates:
A. The number of predictors used
B. The strength of correlation between two variables
C. How much variance in the dependent variable is explained by the model
D. The log-likelihood of a logistic model
4. Which of the following is an appropriate error metric for evaluating a logistic regression model?
A. Mean Squared Error (MSE)
B. R² Score
C. Accuracy or ROC-AUC
D. Mean Absolute Error (MAE)
5. Multivariate regression differs from bivariate regression because:
A. It uses multiple target variables
B. It uses multiple independent variables
C. It only works for classification
D. It requires standardized data
6. Which library in Python is most commonly used for linear and logistic regression modeling?
A. matplotlib
B. pandas
C. scikit-learn
D. seaborn
7. In a logistic regression model for the Pima dataset, which variable is typically the target?
A. Age
B. Glucose
C. Outcome
D. Insulin
8. A high R² value close to 1 in linear regression indicates:
A. Overfitting
B. Poor model performance
C. Strong explanatory power
D. Incorrect variable types
9. Which of the following metrics is NOT used to evaluate linear regression models?
A. Mean Absolute Error (MAE)
B. Root Mean Squared Error (RMSE)
C. Log Loss
D. R² Score
10. Which type of regression is used when the dependent variable is continuous and the predictors
are multiple?
A. Simple Logistic Regression
B. Multiple Linear Regression
C. Polynomial Classification
D. Binary Logistic Regression
11. Which metric would you use to compare classification models for diabetes prediction?
A. R²
B. Accuracy, Precision, Recall
C. RMSE
D. Variance
12. An ROC curve is used to evaluate the performance of:
A. Linear Regression models
B. Clustering algorithms
C. Logistic Regression classifiers
D. Time series forecasting
13. If the R² value of a regression model is 0.0, it means:
A. The model fits the data perfectly
B. The model explains none of the variance in the target
C. The target variable is binary
D. The model is a classification model
14. Which variable from the Pima dataset is likely to be the best predictor in both linear and logistic
models?
A. Pregnancies
B. DiabetesPedigreeFunction
C. Glucose
D. SkinThickness
15. What does the logistic function output in a logistic regression model?
A. A class label (0 or 1)
B. A linear score
C. A probability between 0 and 1
D. A categorical variable
16. Which assumption is essential for applying linear regression models?
A. Binary target variable
B. Multicollinearity among predictors
C. Linear relationship between predictors and target
D. Independent variable must be categorical
17. Which of the following would indicate overfitting in a multivariate regression model?
A. Low R² on training and testing sets
B. High training R² and low test R²
C. High R² for both training and test sets
D. Low variance inflation factor (VIF)
18. What is the main purpose of using train_test_split in model building?
A. To increase training data
B. To normalize the dataset
C. To test model performance on unseen data
D. To remove outliers
19. Which of the following metrics is best suited to evaluate imbalanced classification in logistic
regression?
A. Accuracy
B. Confusion Matrix
C. ROC-AUC
D. R² Score
20. Which feature selection technique can help improve multivariate regression performance?
A. One-hot encoding
B. Normalization
C. Recursive Feature Elimination (RFE)
D. Label encoding