0% found this document useful (0 votes)
125 views23 pages

Python For Ds Evaluation Quiz

The document is an evaluation quiz for Python in Data Science, consisting of multiple questions related to NumPy and Pandas operations. Each question includes a marked answer, the correct answer, total marks, and marks obtained, with all answers being correct. The total marks obtained by the participant are 0.25 out of a possible 10.

Uploaded by

sheikh2100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
125 views23 pages

Python For Ds Evaluation Quiz

The document is an evaluation quiz for Python in Data Science, consisting of multiple questions related to NumPy and Pandas operations. Each question includes a marked answer, the correct answer, total marks, and marks obtained, with all answers being correct. The total marks obtained by the participant are 0.25 out of a possible 10.

Uploaded by

sheikh2100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

PYTHON FOR DS EVALUATION QUIZ

​ For a given 3×3 numpy array, How will you calculate the determinant of the
same?

x = [[11,21,13],[14,15,16],[27,18,29]]

A = np.array(x)

print(A)

output:

[[11 21 13]

[14 15 16]

[27 18 29]]

​ Marked Answer :

​ np.linalg.det(A)

​ Correct Answer :

​ np.linalg.det(A)

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For a given NumPy array, how will you calculate the variance of the same?

x = [[11,21,13],[14,15,16],[27,18,29]]

A = np.array(x)

print(A)
output:

[[11 21 13]

[14 15 16]

[27 18 29]]

​ Marked Answer :

​ np.var(A)

​ Correct Answer :

​ np.var(A)

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For a given array, how will you do element wise traversal for the same?

x = np.ones(shape=(3,3), dtype=’int’)

for i in x:

print(i)

​ Marked Answer :

​ Add x.flat or x.flatten() in the for loop condition

​ Correct Answer :

​ Add x.flat or x.flatten() in the for loop condition


​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For a given NumPy array, how will you do row-wise traversal of the same?

x = np.zeros((3,2), dtype=’int’)

for i in ___:

print(i)

​ Marked Answer :

​ Add x or x[ : ] in the blank

​ Correct Answer :

​ Add x or x[ : ] in the blank

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ What is the output of the following code?

x = [4,2,1,6,3,6,8,0,5,2,1,7,0,2]

np.var(x, ddof=1)

​ Marked Answer :

​ 7.01

​ Correct Answer :

​ 7.01
​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For the given numpy arrays, what will be the cross product of the same?

A = np.array([[3,2],[4,1],[2,5]])

B = np.array([[6,11],[4,12],[2,15]])

np.cross(A,B)

​ Marked Answer :

​ array([21, 44, 20])

​ Correct Answer :

​ array([21, 44, 20])

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ What is the output of the following code?

A = np.array([4,5,6])

B = np.array([1,2,3])

np.hstack((B,A))

​ Marked Answer :

​ array([1, 2, 3, 4, 5, 6])

​ Correct Answer :
​ array([1, 2, 3, 4, 5, 6])

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ What will be the output of the following code?

A = np.array([[4],[5],[6]])

B = np.array([[1],[2],[3]])

np.column_stack((A,B))

​ Marked Answer :

​ array([[4, 1],[5, 2],[6, 3]])

​ Correct Answer :

​ array([[4, 1],[5, 2],[6, 3]])

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For the given numpy array, how will you convert the 1-d array to a 2-d array.

A = np.array([1,2,3,4,5])

​ Marked Answer :

​ A.reshape((5,1))

​ Correct Answer :

​ A.reshape((5,1))
​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Answer the following based on the given NumPy Array.

A = np.array([1,3,4,5,6,7,8,9,10,11])

1. How will you update 11 to 12 and delete 12 from the array

​ Marked Answer :

​ A[-1:] = 12 np.delete(A, len(A)-1)

​ Correct Answer :

​ A[-1:] = 12 np.delete(A, len(A)-1)

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Given a sample list, how will you convert the same to a pandas series?

sample_list = [1,2,3,4,5]

Use pd as the alias for imported pandas library.

​ Marked Answer :

​ pd.Series(sample_list)

​ Correct Answer :

​ pd.Series(sample_list)
​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Given a sample Pandas series, how will you update the index values as [‘A’, ‘B’,
‘C’, ‘D’, ‘E’]?

sample = pd.Series([1,4,9,16,25])

​ Marked Answer :

​ sample.index = {‘A’, ‘B’, ‘C’, ‘D’, ‘E’}

​ Correct Answer :

​ sample.index = {‘A’, ‘B’, ‘C’, ‘D’, ‘E’}

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For a given pandas Series, how will you update the values to the square of each
value in the series?

sample = pd.Series([1,4,9,16,25])

​ Marked Answer :

​ All options are correct

​ Correct Answer :

​ All options are correct

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25


​ For a given sample series, how will you add new values to the series?

sample = pd.Series([1,4,9,16,25])

​ Marked Answer :

​ sample.append(pd.Series([36]), ignore_index=True)

​ Correct Answer :

​ sample.append(pd.Series([36]), ignore_index=True)

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For a given Pandas series, how will you remove the existing element 46 from the
series?

sample = pd.Series([1,4,9,16,25,46])

​ Marked Answer :

​ sample.pop(len(sample) – 1)

​ Correct Answer :

​ sample.pop(len(sample) – 1)

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For the given dictionary, how will you convert the same into a dataframe?

x = {“A”:[1,4,9,16,25], “B”:[2,6,11,18,27]}
​ Marked Answer :

​ All options are correct

​ Correct Answer :

​ All options are correct

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For the given pandas dataframe, how will you remove the duplicate rows?

​ Marked Answer :

​ df.drop_duplicates()

​ Correct Answer :

​ df.drop_duplicates()

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25


​ For the given Pandas DataFrame, how will you add a new row in the dataframe?

​ Marked Answer :

​ df.loc[len(df.index)] = {‘A’:7, ‘B’:8, ‘C’:9}

​ Correct Answer :

​ df.loc[len(df.index)] = {‘A’:7, ‘B’:8, ‘C’:9}

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For the given Pandas DataFrame, how will you calculate the cumulative sum of
each of the rows.

df = pd.DataFrame({‘A’:[1,4,9], ‘B’:[2,5,10], ‘C’:[3,6,11]})

​ Marked Answer :

​ df.cumsum(axis=1)

​ Correct Answer :

​ df.cumsum(axis=1)
​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ For the given Pandas Dataframe, How will you apply a function to each of the
cells in the dataframe?

​ Marked Answer :

​ apply()

​ Correct Answer :

​ apply()

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ What is the correct inference for the bar graph shown below?

​ Marked Answer :
​ Healthcare sector has more than 200 sp500 companies

​ Correct Answer :

​ Healthcare sector has more than 200 sp500 companies

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ What is the correct inference for the boxplot shown below?

​ Marked Answer :

​ All options are correct

​ Correct Answer :

​ All options are correct

​ TOTAL MARKS : 0.25


​ MARKS OBTAINED 0.25

​ What is the correct inference for the distribution plot shown below?

​ Marked Answer :

​ Distribution is right skewed

​ Correct Answer :

​ Distribution is right skewed

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25


​ What is the correct inference for the heatmap shown below?

​ Marked Answer :

​ All options are correct

​ Correct Answer :

​ All options are correct

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25


​ What is the correct inference for the pie chart shown below?

​ Marked Answer :

​ Industrials sector has the most number of companies

​ Correct Answer :

​ Industrials sector has the most number of companies

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25


​ What is the correct inference for the area chart shown below?

​ Marked Answer :

​ All options are correct

​ Correct Answer :

​ All options are correct

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25


​ What is the correct inference for the scatter plot shown below?

​ Marked Answer :

​ Revenuegrowth is the highest for consumer cyclical sector

​ Correct Answer :

​ Revenuegrowth is the highest for consumer cyclical sector

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ What is the correct inference for the count plot shown below?

​ Marked Answer :

​ Communication Services has the least companies in the United States


​ Correct Answer :

​ Communication Services has the least companies in the United States

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ What is the correct inference for the regression plot shown below?

​ Marked Answer :

​ Ebitda Shows a linear relationship with MarketCap

​ Correct Answer :

​ Ebitda Shows a linear relationship with MarketCap

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25


​ What is the correct inference for the graph shown below?

​ Marked Answer :

​ Communication Services has more than 20 companies

​ Correct Answer :

​ Communication Services has more than 20 companies

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ How many null values are present in the dataset?

​ Marked Answer :

​ 79

​ Correct Answer :

​ 79

​ TOTAL MARKS : 0.25


​ MARKS OBTAINED 0.25

​ How many sectors are there in the dataset?

​ Marked Answer :

​ 11

​ Correct Answer :

​ 11

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Which company has the highest marketcap?

​ Marked Answer :

​ Apple Inc

​ Correct Answer :

​ Apple Inc

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Which company has the highest currentprice?

​ Marked Answer :

​ NVR, Inc

​ Correct Answer :
​ NVR, Inc

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Which company has fulltimeemployees more than 2000000?

​ Marked Answer :

​ Walmart Inc

​ Correct Answer :

​ Walmart Inc

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ What is the range of revenuegrowth for all the companies in the dataset?

​ Marked Answer :

​ 271.235

​ Correct Answer :

​ 271.235

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Which state has the most number of sp500 companies?

​ Marked Answer :
​ California

​ Correct Answer :

​ California

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Which company’s current price is the lowest where the revenue growth is more
than 0.1?

​ Marked Answer :

​ Carnival Corporation

​ Correct Answer :

​ Carnival Corporation

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

​ Which sector has the most number of companies in the state of california?

​ Marked Answer :

​ Technology

​ Correct Answer :

​ Technology

​ TOTAL MARKS : 0.25


​ MARKS OBTAINED 0.25

​ Which feature is highly correlated with marketcap?

​ Marked Answer :

​ Ebitda

​ Correct Answer :

​ Ebitda

​ TOTAL MARKS : 0.25

​ MARKS OBTAINED 0.25

Total Marks
0 / 10

You might also like