## Python for Data Science Quiz 1

What is the output of the following code?

a = 3

b = “12”

print(a*b)

a = 3

b = “12”

print(a*b)

121212

What is the output of the following code?

a = -9//7

print(a)

a = -9//7

print(a)

-2

Consider a following code snippet. What is a data type of y ?

x = 15

y = str(float(x))

x = 15

y = str(float(x))

str

Which of the following variable names are INVALID in Python?

a) 1_variable

b) variable_1

c) variable1

d) variable#

a) 1_variable

b) variable_1

c) variable1

d) variable#

1_variable & variable#

While naming the variable, use of any special character other than underscore(_) ill throw which type of error?

Syntax error

Let x = “Mayur”. Which of the following commands converts the ‘x’ to float datatype?

a) str(float,x)

b) x.float()

c) float(x)

d) Cannot convert a string to float data type

a) str(float,x)

b) x.float()

c) float(x)

d) Cannot convert a string to float data type

Cannot convert a string to float data type

Which Python library is commonly used for data wrangling and manipulation?

Pandas

Predict the output of the following code.

x = 10

y = 5

z = 3

ans = x + y % z

print(ans)

x = 10

y = 5

z = 3

ans = x + y % z

print(ans)

12

Given two variables, j = 6 and g = 3.3. If both normal division and floor division operators were used to divide j by g, what would be the data type of the value obtained from the operations?

float, float

Let a = 5 (101 in binary) and b = 3 (011 in binary). What is the result of the following operation?

a = 5

b = 3

print(a & b)

a = 5

b = 3

print(a & b)

1

Which of the following object does not support indexing?

a) tuple

b) list

c) dictionary

d) set

a) tuple

b) list

c) dictionary

d) set

set

Given a NumPy array, arr = np.array([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]), what is the output of the command, print(arr[0][1])?

[4 5 6]

Which of the following data type is immutable?

a) list

b) set

c) tuple

d) dictionary

a) list

b) set

c) tuple

d) dictionary

tuple

Which of the following is the correct approach to fill missing values in case of categorical variable?

a) Mean

b) Median

c) Mode

a) Mean

b) Median

c) Mode

Mode

Which pandas function is used to stack the dataframes vertically?

a) pd.merge()

b) pd.concat()

c) join()

a) pd.merge()

b) pd.concat()

c) join()

pd.concat()

Which of the following are libraries in Python?

a) Pandas

b) Matplotlib

c) NumPy

a) Pandas

b) Matplotlib

c) NumPy

Pandas, Matplotlib, and NumPy all are libraries in Python.

Which of the following are regression problems? Assume that appropriate data is given.

a) Predicting the house price.

b) Predicting whether it will rain or not on a given day.

c) Predicting the maximum temperature on a given day.

d) Predicting the sales of the ice-creams.

a) Predicting the house price.

b) Predicting whether it will rain or not on a given day.

c) Predicting the maximum temperature on a given day.

d) Predicting the sales of the ice-creams.

a) Predicting the house price.

c) Predicting the maximum temperature on a given day.

d) Predicting the sales of the ice-creams.

c) Predicting the maximum temperature on a given day.

d) Predicting the sales of the ice-creams.

Which of the followings are binary classification problems?

a) Predicting whether a patient is diagnosed with cancer or not.

b) Predicting whether a team will win a tournament or not.

c) Predicting the price of a second-hand car.

a) Predicting whether a patient is diagnosed with cancer or not.

b) Predicting whether a team will win a tournament or not.

c) Predicting the price of a second-hand car.

a) Predicting whether a patient is diagnosed with cancer or not.

b) Predicting whether a team will win a tournament or not.

b) Predicting whether a team will win a tournament or not.

If a linear regression model achieves zero training error, can we say that all the data points lie on a hyperplane in the (d+1)-dimensional space? Here, d is the number of features.

Yes

A regression model with the following function y=60+5.2x was built to understand the impact of humidity (x ) on rainfall (y ). The humidity this week is 30 more than the previous week. What is the predicted difference in rainfall?

156 mm

X and Y are two variables that have a strong linear relationship. Which of the following statements are incorrect?

a) There cannot be a negative relationship between the two variables.

b) The relationship between the two variables is purely causal.

c) One variable may or may not cause a change in the other variable.

a) There cannot be a negative relationship between the two variables.

b) The relationship between the two variables is purely causal.

c) One variable may or may not cause a change in the other variable.

a) There cannot be a negative relationship between the two variables.

b) The relationship between the two variables is purely causal.

b) The relationship between the two variables is purely causal.

## Leave a comment