dump
dump
def display(sentence):
words = sentence.split(' ')
reverse_sentence = ' '.join(reversed(words))
return reverse_sentence
a. easy is Python
b. [‘easy’, ‘is’, ‘Python’]
c. Python is easy
d. None of the options
2. For a machine learning project, Sara has given the client dataset named 'mydata.csv' having
millions of records with 50 columns to Allen, and asked him to work with the specific column
names l.e. "coulmn23", "column33", "column37", "column 12" in a given dataset.
Select the correct option that will help Allen to import the data with the specific column
names mentioned above.
4. # Initialize A and B
A = {1,2,3,4,5}
B = {4,5,6,7,8}
Print(A^B)
c.
import pandas as pd
a_list=[11, 5, 17, 18, 23, 50]
a_series = pd.Series(a_list)
accessed_series = a_series[[0,5]]
accessed_list = list(accessed_series)
print(accessed_list)
d.
import numpy as np
a_list = [11, 5, 17, 18, 23, 50]
n_array = np.array(a_list)
a_array = n_array[[0,5]]
a_list = list(a_array)
print(a_list)
6. Dave has been newly assigned as a manager in a large retail store. The first thing he wants to
store perform is to identify interesting association rules. He has identified itemsets above his
minimum support. He comes to you and enquires about how to choose minimum
confidence. Which of the following would be your correct response?
1.Depending on the question and distribution of confidence values for a sample decision is made
by the analyst
3.Depending on the question and distribution of support values for itemsets made by the
analyst.
4.Depending on the question and distribution of values for a set of rules made by the analyst.
(not sure)
7. Does the decision boundary change with the addition/deletion of data points in SVM?
Yes
No
8.
No First Last Email Age
1. Sam Schafer [email protected] 33
2. Jane Doe [email protected] 55
3. Ben Doe [email protected] 63
4. Chris Morris None 36
5. NaN NaN NaN None
6. None NaN [email protected] None
7. NA Missing NA Missing
Sara wants to delete the rows where both the last name and email are missing. Select the
correct option that will help Sara to do that.
df.dropna(axis='index',how='all',subset=['last','email'])
df.dropna(axis='index',how='any',subset=['last','email'))
df.dropna(axis='index', subset=['last','email'])
John wants to flatten the 2D array in such a way that he should be able to change the 3rd
element value to 52. Select the right option for him.
A. arr1_flatten = arr1.flatten();arr1_flatten[2]=52
B. arr1_flatten = arr1.ravel();arr1_ravel[2]=52
D.arr1_flatten=arr1.flatten();arr1_flatten[1]=52
10.
A.grouped = club_data.groupby("Year')
B.grouped = club_data.groupby("Year')
C. grouped = club_data.groupby('Year')
11.
df.reset_index(inplace=True)
df.set_index(inplace=True)
df.reset(inplace=True)
df.reset_index(('student_city', 'default'), inplace=True)
12. John wants to do data visualization for the dataset given by his client. Select the python
libraries that are used for data visualization.
A. Matplotlib
B. Seaborn.
C. Plotly
D. ggplot
Select the correct option that will help john to reverse the array as shown in the output
array ([[10,9,8,7,6],
[5,4,3,2,1]])
A. a[::-1, :: -1]
B. a.reversed()
C. a[:: :-1]
D. np.flip(a,axis=0)
17. Create a new dictionary only with the students who have earned a passing grade greater
than or equal to 60:
grades = {"Nora": 78, "Gino": 100, "Talina": 56, "Elizabeth": 45, "Lulu": 67}
def outer():
x = "local"
def inner():
nonlocal x
x ="nonlocal"
print("inner:", x)
inner()
print("outer:", x)
outer()
A. Inner: nonlocal
outer nonlocal
B. SyntaxError: invalid syntax, nonlocal
C. inner: nonlocal
outer: local
D. inner: local
outer: local
print(x)
foo()
print(x)
A. global
UnboundLocalError
B. global
globalglobal
globalglobal
C. global
globalglobal
global
D. None of the options
20. Naomi has been informed that the confidence for the association A=>B is 0.5 and that the
itemsets A and B together occur in 30% of the transactions. She is interested in finding support for A.
What value should she ger?
a. 0.6
b. 0.15
c. 1.67
d. 0.5
21. In ML and statistics, the learning rate is a hyperparameter for algorithm tuning that determines
the step size at each iteration while moving towards a minimum of a loss function. Which
among the following algorithms, the learning rate is not used as one of its hyperparameter?
a. Random forest
b. Decision tree
c. Gradient Learning
22. Which of the following statements is/are true regarding the bagging-based algorithms say a
random forest used in modal building?
23. What needed for constructing a confidence interval for a regression coefficient besides you
define the appropriate t statistics and regression coefficient.
24. for two itemsets A and B Lift(A=>B)<1, which of the following is the most correct inference?
A. If itemset A occurs, the probability of the occurrence of itemset B is less than what is
expected by chance store
list1 = [{'Sam': 70, 'Joe': 80}, {'Sam': 60, 'Joe': 50}, {'Sam': 80, 'Joe': 50}]
s_total = sum(p['Sam'] for p in list1)
total = len(list1)
a = s_total / total
print(a)
a. 70 b. 60 c. 180 d. 210
test_dict = {'you': [7, 6, 3], 'are': [2, 10, 3], 'best': [19, 4]}
res = dict()
for key in sorted(test_dict):
res[key] = sorted(test_dict[key])
print(res)