Important python question
Q.
No Question CO PO BTL
.
Consider the following Python dictionary:
Dict={“A”:1,”B”:”2″,”C”:[3,3,3],”D”:(4,4,4),’E’:5,’F’:6}
1. What is the result of the following operation: Dict[“D”]? 1 1 2
A) 4 B) 3 C) [3,3,3] D) (4, 4, 4)
What is an important difference between lists and tuples?
A) Lists can’t contain a string. B) Tuples can only have integers.
2. 1 1 2
C) Lists and tuples are the same. D) Lists are mutable, tuples are not.
What do the following lines of code do?
with open(“[Link]”,”w”) as writefile:
[Link](“This is line A\n”)
3. [Link](“This is line B\n”) 2 1 1,2
A) Read the file “[Link]”. B) Write to the file “[Link]”.
C) Append the file “[Link]”. D) Write to the console
What will be the output of the following code?
def outer():
x = 10
def inner():
nonlocal x
x += 5
4. 2 1 2
return x
return inner
closure = outer()
print(closure())
print(closure())
A)15 ,20 B) 15, 15 C) 10, 15 D) 5, 5
What is the primary goal of the Data Science Process?
5. A) Data RetrievalB) Building ModelsC) Presenting Findings 3 1 1
D) Data Preparation
What is the purpose of Data Mining?
6. A) Building ModelsB) Extracting patterns and insights from large datasets 3 1 1
C) Retrieving DataD) Describing Data with Tables
3. The slope of the regression line of Y on X is also referred to as the:
A) Regression coefficient of X on Y
7. B) The correlation coefficient of X on Y 4 1 2
C) Regression coefficient of Y on X
D) Correlation coefficient of Y on X.
2. Choose the correct option concerning the correlation analysis between 2 sets of
data.
A) Multiple correlations is a correlational analysis comparing two sets of data.
8. B) A partial correlation is a correlational analysis comparing two sets of data. 4 1 2
C) A simple correlation is a correlational analysis comparing two sets of data.
D) None of the preceding.
What is a correct syntax to return the first row in a Pandas DataFrame?
9. 5 1 2
a) df[0] b) [Link][0] c) [Link][0] d) df[1]
Which Seaborn function is used to create a scatter plot?
10. 6 1 1
a) sns.plot_scatter() b) [Link]() c)sns.draw_scatter() d)[Link]()
Answer ALL Questions
PART B-(10X3=30 marks)
Q.
No Question CO PO BTL
.
11 What is tuple? How literals of type tuple are en give example. 1 1 2
12. Write a python code to find the minimum among the list of 10 numbers. 1 1 2
13. Write a Python program to read and display first two lines of the text file. 2 1 2
14. What is command line argument? 2 1 1
15. Define Data Science. 3 1 1
16. What is the purpose of EDA? 3 1 1
17. Define ‘r’. List out the key properties of ‘r’ 4 1 1
18. Can we find inverse of a matrix using Python library? If yes,how? 5 1 2
19. Differentiate between loc and iloc function? 5 1 2
20. What is the use of Matplotlib? 6 1 2
Answer ALL Questions
PART C-(5X12=60Marks)
21 (a) Define tuple. Explain how data are
i)created in the tuple
1 1 1
ii)deleted from the tuple
iii)Updated in the tuple
(Or)
(b) Define operator and explain the different types of operators used in python
1 1 1
with example
22 (a) Explain file handling in python. Write a program to read from file and
2 1 2
write data into console
(Or)
(b) Define function and briefly explain the following
2 1 1
i)passing arguments ii) return values iii) passing a list
23 (a) 3 1 1
Define Data mining and its process and techniques with neat diagram
(Or)
(b)
3 1 1
Define data science process and explain its steps with neat diagram
24 (a) Calculate ‘r’ for the following
Couple X Y
A 1 2
B 3 4
4 1 3
C 2 3
D 3 2
E 1 0
F 2 3
(Or)
(b) Explain the facets of data in data science
4 1 1
25 (a) Briefly explain the following
5 1 1
i)Reshape ii)eye function iii)flatten iv)identity
(Or)
(b) How to visualize a three dimensional function in Python? Illustrate with a
6 1 1
code