Data_Science_Sample_Paper_Deewan[1]
Data_Science_Sample_Paper_Deewan[1]
python
for i in range(3):
- a) 1 2 3
- b) 0 1 2
- c) 0 1 2 3
- d) 1 2
3. *How can you display the first five rows of a DataFrame named df?*
- a) df.show()
- b) df.first()
- c) df.head()
- d) df.top(5)
- a) df.mean('salary')
- b) df.salary.mean()
- c) df['mean'].salary()
- d) df['salary'].average()
- a) readlines()
- b) readline()
- c) read()
- d) iterlines()
6. *What happens if you try to open a file that doesn’t exist in 'r' mode?*
- b) It raises a FileNotFoundError.
- a) To reduce overfitting
- d) To avoid underfitting
- d) Loss Function
9. *What does the False Negative (FN) value represent in a confusion
matrix?*
- a) Entropy
- b) Gini Index
- c) Both a and b
- d) Gradient Boosting
- a) Bagging
- b) Boosting
- c) Stacking
- d) Averaging
- a) Random Forest
- b) AdaBoost
- c) K-Means
- d) KNN
- a) n is assigned to 2
- a) abcdefg
- b) abcabc
- c) abcdefghij
- d) abchij
- a) 0xA0xB0xC
- b) Error
- c) 0x22
- d) 33
17. What is the output of the below program?
logfile = open('test.log', 'w')
logfile.write('test succeeded')
logfile.close()
print file('test.log').read()
- a) File error
- b) test succeeded
- c) open error
- d) unknown result
def writer():
title = 'Sir'
name = (lambda x:title + ' ' + x)
return name
who = writer()
who('Arthur')
- a) Arthur Sir
- b) Arthur
- c) Sir Arthur
def foo(x):
x[0] = ['def']
x[1] = ['abc']
return id(x)
q = ['abc', 'def']
print(id(q) == foo(q))
- a) True
- b) False
- c) None
- d) Error
- a) A
- b) Daman
- c) Error
- d) n
>>>t = (1, 2, 4, 3, 8, 9)
>>>[t[i] for i in range(0, len(t), 2)]
- a) [2, 3, 9]
- b) [1, 2, 4, 3, 8, 9]
- c) [1, 4, 8]
- d) (1, 4, 8)
a=[1,2,3,4,5,6,7,8,9]
a[::2]
- a) [1,3,5,7,9]
- b) Syntax Error
- c) [1,2]
- d) [1,3]
a = "bay"
b = a[0]
- a) chr
- b) list
- c) odr
- d) str