Nothing Special   »   [go: up one dir, main page]

Section A Consists of 25 Questions, Attempt Any 20 Questions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

SECTION –A

Section A consists of 25 questions, attempt any 20 questions.

1. Which of the following is module in python?


(a) pandas (b) matplotlib (c) numpy (d) All of these
2. Python Pandas is used for
(a) Graphic Designing (b) Animaion
(c) Data Manipulation and Analysis (d) All of these
3. Series can be created by using
(a) List (b) Tuple (c) Numpy (d) All of these
4. Series represents a
(a) Single column in memory (b) Double columns in memory
(c) Three columns in memory (d) Multi columns in memory
5. Given a Pandas series called “S”, the command which will display the last 4 rows is
__________________.
(a) print(S.tail(4)) (b) print(S.Tail(4)) (c) print(S.tails(4)) (d) print(S.Tails(4))
6. Size and values of data of Series is
(a) Mutable,Immutable (b) Immutable,Mutable (c) Mutable,Mutable (d)
Immutable,Immutable

7. The command used to draw a line graph is


(a) plt.line(x,y) (b) plt.linegraph(x,y) (c) plt. lineplot(x,y) (d) plt. plot(x,y)
8. Which command is correct to set upper left position of legend in line graph?
(a) pos=2 (b) position=2 (c) loc=2 (d) location =2
9. Method or function to add a new column in a data frame is:
(a) iloc() (b) insert() (c) join() (d) add()
10. What is the minimum number of arguments required for bar() function in matplotlib?
(a) 1 (b) 2 (c) 3 (d) 4

11.---------------------------is made when information is collected from the user without the person
knowing this is happening.
(a) active footprint (b) passive footprint (c) pass footprint (d) known footprint
12. Repeated posting of rumours online is the violation of
(a) Copyright (b) Cybercrime (c) plagiarism (d) None of these
13. ‘O’ in ODF stands for:
(a) Original (b) Open (c) Operating (d) Operator

14. Which of the following statement is correct to create series?


( a) s=Series.pd (b) s=Series(pd) (c) s=pd.Series() (d) pd.Series()=s
15. __________includes sending, posting, or sharing negative, harmful, false, or mean content
about someone else.
(a) Cyberbullying. (b) Spamming (c) Phishing (d) Plagiarism
16. A website is a collection of ___________
(a) Web Servers (b) Web pages (c) Browsers (d) Hyperlinks
17. If you are deleting a column in dataframe using drop() function but same column name in not
there, which type of error it will raise?
(a) Key Error (b) Syntax Error (c) Name Error (d) Value Error
18. Which of the following is suggested while on social media?
(a) Don’t save password on other computers/phone (b) Don’t share personal information
(c) Don’t use abusing language. (d) All of these
19. In a DataFrame, Axis= 0 represents the_____________ elements.
(a) row (b) column (c) true (d) false

20. Which of the following method can be used to change the name of column in dataframe?
(a) colname (b) newname (c) rename (d) reindex

21. Which of the following statement is correct to set the value True to ignore_index?
(a) ignore.index:true (b) ignore_index:True (c) ignore_index=True (d) ignore_index=true

22. Which of the following is incorrect statement to create DataFrame using list?
(a) df=pd.DataFrame(data=[‘red’,’green’,’blue’,’yellow’])
(b) df=pd.DataFrame(list=[‘red’,’green’,’blue’,’yellow’])
(c) df=pd.DataFrame([‘red’,’green’,’blue’,’yellow’])
(d) all of these
23. Which of the following command is used to display all records having rollno>3?
(a) print(df[df[‘Roll’]>3]) (b) print(df[‘Roll’]>3) (c) print(df.Roll>3]) (d)
print(df(‘Roll’)>3)
24. Which function will be used to write data into dataframe from CSV file?
(a) readcsv() (b) to_csv() (c) read_csv() (d) csv_read()
25. Which of the following code will display the total number of rows?
(a) print(len(stud.axes[0]) (b) print(stud.len(0))

(c) print(stud.len[axes=0]) (d) print(len(stud.axes[row])

SECTION -B
Section B consists of 24 Questions (26 to 49). Attempt any 20 questions.

26. What will be the output of the given code?


import pandas as pd
s =pd.Series(5, index=[0,1,2,3])
print(s)
(a) 0 5 (b) 0 1 2 3 5 (c) 0 0 (d) 00000
1 5 1 5 11111
2 5 2 10 22222
3 5 3 15 33333
27. What will be the output of the given code?
import pandas as pd
s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])
print(s.iloc[1])
(a) 10 (b) 20 (c) 40 (d) 50

28. Write a single line command to calculate 10% from ‘sale’ column from dataframe df and
assign to new column‘Commission’.

(a) df.insert[‘Commission’]=df.sale*10/100
(b) df[‘Commission’]=df.sale*10/100
(c) df.loc[‘Commission’]=df.sale*10/100
(d) df[‘Commission’,axis=1]=df.sale*10/100

29. ___________refers to the proper manners and behaviour we need to exhibit while being
online.
(a) Human Etiquets (b) Net Etiquettes
(c) Web Etiquets (d) Online Etiquets

30. Observe the following figure and Identify the location of legend.
(a) loc=1 (b) loc=2 (c) loc=3 (d) loc=4

31. Read the statements given below and identify the right option while draw a Line Chart.

Statement A: While making line chart, it is compulsory to give legend location.


Statement B: If single list or array is provided to the plot() command, matplotlib assumes it is a
sequence of y values.
(a) Both are correct
(b) Both are incorrect
(c) Statement A is correct, but Statement B is incorrect
(d) Statement A is incorrect, but Statement B is correct
32. The command used to draw a bar graph horizontally is _________.
(a) p1.barhor(x,y) (b) p1.hbar(x,y) (c) p1.barh(x,y) (d) p1.graphbarh(x,y)
33. Which of the following not an Open Source software?
(a) Linux (b) MS Windows (c) MySql (d) Python

34. Consider the following statements with reference to the plagiarism.Which of the following is
not considered as plagiarism?
(a) The practice of taking someone else’s work or ideas and passing them off as one’s
own
(b) Copy data from internet
(c) Credit the original author in an in-text citation and reference list.
(d) Using graphs, charts, figures, or images without reference of source
35. Consider the following series named Result.
Rohan 90
Aman 60
Divya 34
Jeet 78
Raj 25

Jyoti 85

Gagan 32
Write the output of the command: print(Result[::)
(a)
Rohan 90
Aman 60
Divya 34
Jeet 78
Raj 25
Jyoti 85
Gagan 32
(b)
Gagan 32
Jyoti 85
Raj 25
Jeet 78
Divya 34
Aman 60
Rohan 90

( c) No output

(d) Error
36. Rajiv received a fake email from an unknown person who claimed that Rajiv won Lottery of
`50 Lacs. They asked Rajiv to provide his personal information for verification. What do you
think he should do?

(a) ignore it and dont give any response


(b) reply back to them and share his personal information
(c) delete the mail and hope they’ll leave him alone in future.
(d) go to the cyber police and do register the complaint.
37. What is a correct syntax to return the values of last row of a Pandas DataFrame? Assuming
the name of the DataFrame is df.
(a) df[-1] (b) df.loc[-1] (c) df.loc[0] (d) df.iloc[0]
38. Python software come under_______ category.
(a) Proprietary (b) FOSS
(c) Freeware (d) Shareware
39. Difference between drop() and del (choose the correct one)
(a) drop can operate on multiple items at a time; del operates only on one at a time.
(b) Both can operate on multiple items at a time.
(c) Both operates only on one at a time
(d) delete can operate on multiple items at a time; drop operates only on one at a time.

40. Write the output of the given program:


import pandas as pd
S=pd.Series([10,20,30,40],index=[‘a’,’b’,’c’,’d’])
print(S-3)
(a)
a7
b 17
c 27
d 37
dtype: int64
(b)
a-3 7
b-3 17
c-3 27
d-3 37
dtype: int64
(c)
a-3 10
b-3 20
c-3 30
d-3 40
dtype: int64
(d)
abcd 97
dtype: int64

41. A research student is expected to write a thesis on a topic. The student browses Internet for
the topic and luckily finds it on the Internet. He copies and submits the entire thesis as his own
research work. Which of the following activities appropriately categories the act of the writer:

(a) Spamming (b) Phishing (c) Plagiarism (d) Trojan

42. Consider the following dataframe df

Choose the correct statement/method for the required output: (5,3)


(a) df.index (b) df.shape() (c) df.shape (d) df.size

43. Write the output of the given command:


import pandas as pd
s=pd.Series([10,20,30,40,50],[1,2,3,4,5])
print(s+s)
(a)
1 20
2 40
3 60
4 80
5 100
(b)
2 20
4 40
6 60
8 80
10 100
(c)
2 10
4 20
6 30
8 40
10 50
(d) Error

44. Naman has created the following dataframe “Climate” to record the data about climatic
conditions of four years.
Which of the following code snippets will return the MaxTemp and Rainfall for year 2018 and
2019?
(a) Climate[[‘MaxTemp’,’Rainfall’]][1:3] (b) Climate[‘MaxTemp’, ‘Rainfall’][1:3]
(c) Climate.iloc[1:3] (d) Climate.iloc[1:3,1:2]

45. Photoshop software come under_______ category.


(a) Proprietary (b) FOSS (c) Freeware (d) Shareware
46. Consider the dataframe df
empno name salary
A1 101 a 3000
A2 102 b 5000
A3 103 c 8000
A4 104 d 9000
Display the information of index value A1 and A3 from dataframe df.
(a) print(df.loc[‘A1’,’A3’]) (b) print(df.loc[[‘A1’,’A3’]])
(c) print(df.loc[[‘A1’:’A3’]]) (d) print(df[‘A1’,’A3’])

47. Consider the following dataframe df


name marks
1 Nidhi 95
2 Gurjeet 97
3 Pahul 88
4 Divya 72
Which command will give the given output:
Output Required: 8
(a) print(df.shape()) (b) print(df.shape) (c) print(df.size) (d) print(df.size())
48. Consider the following data frame name df
roll name marks
0 1 aman 25
1 2 bhavna 55
2 3 rahul 60
Write the output of the given command: print(df.marks//2)
(a)
0 12.5
1 27.5
2 30.0
(b)
0 12
1 27
2 30
(c)
12.5
27.5
30.0
(d)
roll name marks
0 1 aman 12.5
1 2 bhavna 27.5
2 3 rahul 30

49. Read the statements given below. Identify the right option from the following for series and
dataframe
Statement A: Series is size immutable but value mutable.
Statement B: Dataframe is size and value mutable.
(a) Both statements are correct.
(b) Both statements are incorrect.
(c) Statement A is correct, but Statement B is incorrect
(d) Statement A is incorrect, but Statement B is correct

SECTION - C
Section C consists of 6 Questions (50 to 55). Attempt any 5 questions

Mr. Ankit is working in an University as data analyst. He uses Python Pandas and Matplotlib for
the same. He got a dataset of the students for the year 2010 and 2011. His management wants
certain information from him, but he isfacing some problems. Help him by answering few
questions given below.
CODE
import pandas as pd
df1 = pd.DataFrame({‘mark1’:[30,40,15,40],’mark2’:[20,45,30,70]}); #values change
df2 = pd.DataFrame({‘mark1’:[10,20,20,50],’mark2’:[15,25,30,30]});
print(df1)
print(df2)

50. He wants to add dataframes df1 and df2.


(i) print(df1+df2)) (ii) print(df1.sum(df2))
(iii) print(df1.append(df2)) (iv) print(df1.add(df2))
(a) Only (i) is correct (b) Both (ii) and (iii) are correct
(c) Both (iii) and (iv) are correct (d) Both (i) and (iv) are correct
51. He wants to subtract df2 from df1.
(i) print(df1-df2)) (ii) print(subtract(df1,df2))
(iii) print(df2.minus(df1)) (iv) print(df1.subtract(df2))
(a) Only (i) is correct (b) Only (iv) is correct
(c) Both (ii) and (iii) are correct (d) Both (i) and (iv) are correct
52. He wants to rename column mark1 as marks1in dataframe df1.
(a) df1.rename({‘mark1’:’marks1’}, inplace=True)
(b) df1.rename(columns={‘mark1’:’marks1’}, inplace=True)
(c) df1.rename(columns{‘mark1’:’marks1’}, inplace=True)
(d) df1.rename(colnames={‘mark1’:’marks1’}, inplace=True)

53. He wants to change index label of df1 from 0 to zero and from 1 to one.
(a) df1.rename(index = {0: “zero”, 1:”one”}, inplace = True)
(b) df1.rename(row = {0: “zero”, 1:”one”}, inplace = True)
(c) df1.rename(rows = {0: “zero”, 1:”one”}, inplace = True)
(d) df1.rename(index{0: “zero”, 1:”one”}, inplace = True)
54. He wants to delete column mark2 from dataframe df1.
(a) df1.drop(‘mark2’,axis=0,inplace=True)
(b) df1.del(‘mark2’,axis=1,inplace=True)
(c) del df[‘marks’,axis=1,inplace=True)
(d) df1.drop(‘mark2’,axis=1,inplace=True)
55. Add new column Total in dataframe df2 which is the sum of mark1 and mark2.
(a) df2[‘Total’]=df2.mark1+df2.mark2
(b) df2.column[‘Total’]=df2[mark1+mark2]
(c) df2.add[‘Total’]=df2[mark1+mark2]
(d) df2.newcolumn[‘Total’]=df2[mark1+mark2]
ANSWERS:

1. (d) 2. (c) 3. (d) 4. (a) 5. (a) 6. (b) 7. (d) 8. (c) 9. (b) 10. (b)

11. (b) 12. (b) 13. (b) 14. (c) 15. (a) 16. (b) 17. (a) 18. (d) 19. (a) 20. (c)

21. (c) 22. (b) 23. (a) 24. (c) 25. (a) 26. (a) 27. (b) 28. (b) 29. (b) 30. (d)

31. (d) 32. (c) 33. (b) 34. (c) 35. (a) 36. (d) 37. (b) 38. (b) 39. (a) 40. (a)

41. (c) 42. (c) 43. (a) 44. (a) 45. (a) 46. (b) 47. (c) 48. (b) 49. (a) 50. (d)

51. (d) 52. (b) 53. (a) 54. (d) 55. (a)

You might also like