You are on page 1of 3

MCQ (1Mark each) 31-01-2018

1. Which of the following thing can be data in Pandas?


a) a python dict
b) an ndarray
c) a scalar value
d) all of the Mentioned
2. Which of the following input can be accepted by DataFrame?
a) Structured ndarray
b) Series
c) DataFrame
d) All of the Mentioned
3. Which of the following indexing capabilities is used as a concise means of selecting data
from a pandas object?
a) In
b) ix
c) ipy
d) none of the Mentioned
4. All pandas data structures are ___-mutable but not always _______-mutable.
a) size, value
b) semantic, size
c) value, size
d) none of the Mentioned
5. Which of the following function is used for fixing character vectors?
a) tolower
b) toUPPER
c) toLOWER
d) all of the Mentioned
6. Which of the following graph can be used for simple summarization of data?
a) Scatterplot
b) Overlaying
c) Barplot
d) All of the Mentioned
7. Write the list comprehension to pick out only negative integers from a given list ‘l’.
a) [x<0 in l]
b) [x for x<0 in l]
c) [x in l for x<0]
d) [x for x in l if x<0]
8. What is the output of the code shown below?
import math
[str(round(math.pi)) for i in range (1, 6)]
a) [‘3’, ‘3’, ‘3’, ‘3’, ‘3’, ‘3’]
b) [‘3.1’, ‘3.14’, ‘3.142’, ‘3.1416’, ‘3.14159’, ‘3.141582’]
c) [‘3’, ‘3’, ‘3’, ‘3’, ‘3’]
d) [‘3.1’, ‘3.14’, ‘3.142’, ‘3.1416’, ‘3.14159’]

9. What is the output of the following snippet of code?


>>> a={i: i*i for i in range(6)}
>>> a
a) Dictionary comprehension doesn’t exist
b) {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6:36}
c) {0: 0, 1: 1, 4: 4, 9: 9, 16: 16, 25: 25}
d) {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}

10. What is the output of the following snippet of code?


test = {1:'A', 2:'B', 3:'C'}
test = {}
print(len(test))
a) 0
b) None
c) 3
d) An exception is thrown

11. What is the output of the following?


print('abcefd'.replace('cd', '12'))
a) ab1ef2
b) abcefd
c) ab1efd
d) ab12ed2

12. Is the following piece of code valid?


>>> a=(1,2,3)
>>> b=a.update(4,)
a) Yes, a=(1,2,3,4) and b=(1,2,3,4)
b) Yes, a=(1,2,3) and b=(1,2,3,4)
c) No because tuples are immutable
d) No because wrong syntax for update() method

13. What is the output of the following?


d = {0: 'a', 1: 'b', 2: 'c'}
for x, y in d.items():
print(x, y)
a) 0 1 2
b) a b c
c) 0 a 1 b 2 c
d) none of the mentioned
14. Pick the write explanation if Confusion Matrix of some classifier is as follows
[[14 0 0]
[ 1 17 0]
[ 0 0 22]]
a) three classes, only one wrong classification
b) three classes, 14 correct numbers classified as class-1
c) Accuracy is about 98%
d) All of the above

Short Answer questions (2 Mark each)

1. What is a pandas DataFrame and Panel?


2. Explain zip() function.
3. Differentiate between append() and extend() methods.
4. How do you handle missing or corrupted data in a dataset?
5. How can you generate random numbers in Python?
6. Draw a pie chart with any one portion exploded out. (take your own data).
7. Create a scatter plot on lists (x,y) of numbers, having marker of shape ‘+’, color be ‘red’. Also
add labels, title and legend.
8. Using cut(), convert a column of data frame into five categories. (create column of 100 rows
beforehand)

Code (10 Marks each)

1. Evaluate the performance of any two classifiers of your choice on provided wine_dataset.

2. Extract raw data from gutenbergs and demonstrate NLP.

You might also like