# Python//Pandas MCQ Questions Set 2 Sample Test,Sample questions

## Question: ` print(S1[-1]) will return ___________ #â€™S1â€² is a series`

1. last element of series â€˜S1â€™

2.first element of series â€˜S1â€™

3.Key Error

4.all elements of series â€˜S1â€™

Posted Date:-2021-12-13 14:56:41

## Question: ` Raman performed addition of series â€˜S1â€™ and â€˜S2â€™ and store the result in series â€˜S3â€™. Both the series â€˜S1â€™ and â€˜S2â€™ have five mismatching index value. How many NaN will be there in â€˜S3â€™?`

1.2

2.3

3.4

4.5

Posted Date:-2021-12-13 14:49:40

## Question: ``` S2 is ____________ in given code ? S2 = S1[2 : 5] #S1 is a Series object ```

1.List

2.Tuple

3.Series

4.All the above

Posted Date:-2021-12-13 14:04:11

## Question: ` Series â€˜S1â€™ has five values with index value (0, 1, 2, 3, 4) and series â€˜S2â€™ has five values with index (2, 3, 4, 5, 6). What will be the total number of values in â€˜S3â€™ if S3 = S1 + S2`

1.5

2.6

3.7

4.8

Posted Date:-2021-12-13 14:49:06

## Question: ` Sonal is a class XII student. She is learning â€œSeriesâ€ in Python. She is confused in â€œparameter of Series( ) functionâ€. Help her to find the incorrect parameter.`

1. data

2.index

3.number

4.dtype

Posted Date:-2021-12-13 14:55:09

## Question: ``` What is the data type of series â€˜S1â€™ given below ? S1=pd.Series([11, 12.5, â€œokâ€])```

1.int64

2.float64

3.object

4.object64

Posted Date:-2021-12-13 14:27:53

## Question: ` When an operation is carried out on every value of Series object is called __`

1.Scalar Operation

2.Vector Operation

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 14:01:18

## Question: ` Which of the following function is used for basic mathematical operations in Series?`

2.mul( )

3.div( )

4.All the above

Posted Date:-2021-12-13 13:55:26

## Question: ` Which of the following returns number of non-NaN values of Series?`

1. count

2.size

3.index

4.values

Posted Date:-2021-12-13 13:13:38

## Question: ``` Write the output of the following code : import pandas as pd S1=pd.Series([1,2,3,4]) S2=pd.Series([7,8]) S3=S1+S2 print(S3.size)```

1.2

2.4

3.6

4.Error

Posted Date:-2021-12-13 13:05:31

## Question: `>>> S1[1:3] = 50 will update the value of ___________ elements`

1.1

2.2

3.3

4.4

Posted Date:-2021-12-13 14:57:23

## Question: `Amit is working in an IT company. His boss asked him to prepare a chart in python. He is confused that which library will support plotting graph and data visualization in python. Help him to find the library`

1.Pandas

2.Matplotlib

3.Numpy

4.Math

Posted Date:-2021-12-13 14:15:52

## Question: ```Amit is working in an IT firm as Data Manager. He stored the salary of all employees in Series named â€œEmpserâ€. His Boss asked him to filter the employees whose salary is more than 20000. Help him to find the correct code. Sample of data stored is shown below. 0 25000 1 20000 2 21000 3 30000```

1.print(Seremp > 20000)

2.print(Seremp (Seremp> 20000) )

3.print(Seremp [Seremp > 20000] )

4.print[Seremp> 20000]

Posted Date:-2021-12-13 14:52:36

## Question: ```An output of series â€˜S1â€™ is shown below, are the data values in â€˜S1 and _ are the data labels in â€˜S1â€™. Output: Feb 2 Mar 3 Apr 4 dtype: int64```

1.Month name, Numbers

2.Numbers, Month name

3.Month name, Month name

4.Numbers, Numbers

Posted Date:-2021-12-13 14:22:49

## Question: ```Anshuman wants to create a series named â€˜S1â€™. He has written the following codes. His friend Shubham checked the code and said that one of the code given below is not working. As a friend of Anshuman, help him to find the incorrect code. a. S1=pd.Series(data=[11, 12, 5, 6,9],index=[1,2,3,4,5])```

1.S1=pd.Series(data=[11, 12, 5, 6,9],index=[1,2,3,4,5])

2.S1=pd.Series([11, 12, 5, 6,9],index=[1,2,3,4,5])

3.S1=pd.Series([11, 12, 5, 6,9],[1,2,3,4,5])

4.S1=pd.Series(data=[11, 12, 5, 6,9], [1,2,3,4,5])

Posted Date:-2021-12-13 14:54:27

## Question: ```By default Series have _______ data labels starting from ___. ```

1.character, â€˜aâ€™

2.numeric, one

3.numeric, zero

4.character, zero

Posted Date:-2021-12-13 14:19:41

## Question: `By using Matplotlib, we can generate __`

1.Histograms

2.Bar charts

3.Scatterplots

4.All the above

Posted Date:-2021-12-13 14:16:36

## Question: `Can a Series have duplicate index value?`

1.yes

2.no

3.Yes, Only series with integer values

4.Yes, Only series with character values

Posted Date:-2021-12-13 14:45:42

## Question: ```Choose the correct statement : Statement1 : A Numpy array requires homogeneous data. Statement2 : Pandas DataFrame can have heterogeneous data. ```

1.Statement1 is correct

2.Statement2 is correct

3.Both the statements are correct

4.Both the statements are wrong

Posted Date:-2021-12-13 14:12:26

## Question: ```dataâ€™ in the following code could be _____ S1 = pd.Series(data)```

1.Python sequence

2.Scalar value

3.Python dictionary

4.All the above

Posted Date:-2021-12-13 14:10:41

## Question: ```How many elements will be there in given series â€˜S1â€™? import pandas as pd S1=pd.Series('python practice') print(S1)```

1.0

2.1

3.2

4.15

Posted Date:-2021-12-13 14:24:11

## Question: ```How many times value â€™10â€™ will be displayed in the given series â€˜S1â€™? import pandas as pd S1=pd.Series(10, index = range(1, 10, 3)) print(S1)```

1.1

2.3

3.5

4.4

Posted Date:-2021-12-13 14:25:36

## Question: ```How many values will be modified by last statement of given code ? import pandas as pd S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'], index=['A', 'B', 'C', 'D']) S1['A' : 'C'] = 'ND'```

1.1

2.2

3.3

4.4

Posted Date:-2021-12-13 12:59:28

## Question: ```How many values will be modified by last statement of given code ? import pandas as pd S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'], index=['A', 'B', 'C', 'D']) S1['A' : 'C'] = 'ND'```

1.name

2. index.name

3. size

4.Series.name

Posted Date:-2021-12-13 13:01:39

## Question: `Installing Pandas is very similar to installing __`

1.Microsoft Word

2.Numpy

3.Python

4.MySQL

Posted Date:-2021-12-13 14:17:25

## Question: `Mathematical Operations on two Series object is done by matching ______`

1.indexes

2.values

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 13:57:07

## Question: `Mr. Kumar is working in an IT company. He stored the salaries of all the employees of January month in Series â€˜Jan_Salâ€™ and salaries of February month in Series â€˜Feb_Salâ€™. Now he wants to add the salaries of both months. He has written the following statement. Identify the correct one.`

1.print(Feb_Sal + Jan_Sal)

3.print(Feb_Sal plus Jan_Sal)

4.None of the above

Posted Date:-2021-12-13 15:13:42

## Question: ```Number of students in each section of class 9th is stored in series â€˜S1â€™. Write a statement to change the value of section â€˜Aâ€™ and â€˜Bâ€™ to 50. A 41 B 44 C 40 D 42 E 47```

1. S1[ : 2] = 50 b.

2.S1[0 : 2] = 50

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 14:47:44

## Question: `Pandas DataFrame is size ________ and value ____`

1.Mutable, Mutable

2.Immutable, Immutable

3.Immutable, Mutable

4.Mutable, Immutable

Posted Date:-2021-12-13 14:09:31

## Question: `Pandas is the ____ library.`

1.Freeware

2.Proprietary

3.Open source

4.End source

Posted Date:-2021-12-13 14:07:32

## Question: `Pandas Series is size __________ and value _____`

1.Mutable, Mutable

2.Immutable, Immutable

3.Immutable, Mutable

4.Mutable, Immutable

Posted Date:-2021-12-13 14:08:29

## Question: `Python libraries contain a collection of built-in __`

1.Data

2.Modules

3.Packages

4.Data Structure

Posted Date:-2021-12-13 14:05:02

## Question: `Roshan has written few points about iloc( ) function of Series in Python. His friend Suman told that one of the written statement is not correct. Help him to find the incorrect statement.`

1. In iloc( ) method, we have to pass an integer index.

2.This method include the last element of the range passed.

3.S1.iloc[3] will display fourth value of Series â€˜S1â€™

4.S1.iloc[:3] will display first three values of Series â€˜S1â€™

Posted Date:-2021-12-13 14:55:55

## Question: `Rosy wants to display the series â€˜S1â€™ in reverse order. Help her to find the correct code.`

1.>>> S1[ : : 1]

2.>>> S1[ : : -1]

3. >>> S1[ -1 : :]

4.>>> S1[ : 1 1]

Posted Date:-2021-12-13 14:46:34

## Question: `S1.values will return all the values of Series â€˜S1â€™ in ___`

1. Tuple

2.Dictionary

3.List

4.String

Posted Date:-2021-12-13 13:02:22

## Question: `S1[0 : 2] = 50`

1. last, first

2. first, second

3.last, seven

4. first, last

Posted Date:-2021-12-13 14:48:36

## Question: `Two common ways for accessing the elements of a series are _________ and ____`

1.Indexing, Concatenation

2. Labelled Indexing, Positional Indexing

3.Indexing, Slicing

4. Slicing, Cutting

Posted Date:-2021-12-13 14:25:01

## Question: `We can access elements in Series by using ________ index and ____________index.`

1.Numeric, labelled

2.Positional, Naming

3.Positional, labelled

4.None of the above

Posted Date:-2021-12-13 12:56:38

## Question: `We can perform _____________ on two series in Pandas.`

2.Subtraction

3.Multiplication

4.All the above

Posted Date:-2021-12-13 13:15:24

## Question: ```What is the data type of given series â€˜S1â€™? import pandas as pd S1=pd.Series('a', index=(2.0, 3.0, 4.0, 5.0)) print(S1)```

1.float64

2.int64

3.object

4.string

Posted Date:-2021-12-13 14:23:36

## Question: ```What is the index value of 31 in given Series â€˜S1â€™? import pandas as pd S1=pd.Series([1,2,31,4], index = ['a','b','c','d'])```

1.â€˜câ€™

2.2

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 14:03:18

## Question: ```What is the index value of â€œRaviâ€ in the following Series? import pandas as pd S1 = pd.Series["Ram", "Raju", "Ravi", "Ramesh", "Rishabh"]```

1.0

2.1

3.2

4.3

Posted Date:-2021-12-13 14:21:25

## Question: `What type of error is returned, when the length of index and the length of data in Series() function is not same?`

1.Key Error

2.Value Error

3.Syntax Error

4.Name Error

Posted Date:-2021-12-13 14:30:53

## Question: ```Which of the following are valid operations on Series â€˜S1â€™? ```

1.>>> S1 + 2

2.>>> S1 ** 2

3.>>> S1 * 2

4.All the above

Posted Date:-2021-12-13 14:00:14

## Question: `Which of the following attribute is used to check NaN value in Series?`

1. hasNans

2.hasnans

3.Hasnans

4.HasNans

Posted Date:-2021-12-13 14:29:17

## Question: `Which of the following attribute of Series is used to set the name of Series object?`

1.size

2.name

3.index.name

4.values

Posted Date:-2021-12-13 14:28:40

## Question: `Which of the following attribute of Series returns the tuple?`

1.size

2.shape

3.values

4.index

Posted Date:-2021-12-13 14:29:59

## Question: `Which of the following attributes returns all the values of Series?`

1.size

2.index

3.name

4.values

Posted Date:-2021-12-13 13:04:18

## Question: `Which of the following attributes returns True if there is no value in Series?`

1.index

2.size

3.empty

4.values

Posted Date:-2021-12-13 13:03:42

## Question: ```Which of the following fills the missing values in Series? a. ```

1.fill value

2.fill-value

3.fill_value

4.fill_value( )

Posted Date:-2021-12-13 13:46:52

## Question: `Which of the following is a high level data manipulation tool used for analyzing data.?`

1.Nump

2.Pandas

3.Matplotlib

4.Math

Posted Date:-2021-12-13 14:06:43

## Question: `Which of the following is parameter of Series( ) function?`

1.data

2.index

3.dtype

4.All the above

Posted Date:-2021-12-13 14:27:04

## Question: `Which of the following library help to visualize data?`

1.Pandas

2.Numpy

3.Matplotlib

4.Random

Posted Date:-2021-12-13 14:06:00

## Question: `Which of the following method is used to add two series?`

1. sum( )

4.None of the above

Posted Date:-2021-12-13 13:16:25

## Question: `Which of the following method is used to subtract the two series?`

1.subtract( )

2.subtraction( )

3.diff( )

4.sub( )

Posted Date:-2021-12-13 15:15:40

## Question: `Which of the following property/attribute return total number of values in Series â€˜S1â€™?`

1.size

2.values

3.index

4.None of the above

Posted Date:-2021-12-13 13:02:59

## Question: `Which of the following statement is correct to add NaN value in series?`

1.S1=pd.Series([10, np.NaN,11])

2.S1=pd.Series([10, None, 11])

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 14:26:20

## Question: `Which of the following statement is replacing missing values of Series A and Series B by 100 .`

1. >>> A.add(B, fill_value = 100)

Posted Date:-2021-12-13 13:56:36

## Question: ```Which of the following statement return Boolean result? import pandas as pd S1=pd.Series([11, 12, 5, 6,9]) print(S1) #Statement 1 print(S1>7) #Statement 2 print(S1[S1>7]) #Statement 3```

1.Statement 1

2.Statement 2

3.Statement 3

4.None of the above

Posted Date:-2021-12-13 14:50:26

## Question: ```Which of the following statement return Filtered result? import pandas as pd S1=pd.Series([11, 12, 5, 6,9]) print(S1) #Statement 1 print(S1>7) #Statement 2 print(S1[S1>7]) #Statement 3```

1.Statement 1

2.Statement 2

3.Statement 3

4.None of the above

Posted Date:-2021-12-13 14:51:36

## Question: `Which of the following statement shows first five values of Series â€˜S1â€™?`

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 13:06:09

## Question: `Which of the following statement will display the difference of two Series â€˜Aâ€™ and â€˜Bâ€™?`

1.>>>A â€“ B

2.>>>A.sub(B)

3.Both of the above

4.None of the above

Posted Date:-2021-12-13 13:40:33

## Question: `Which of the following statement will display values more than 40 from Series â€˜S1â€™?`

1.>>>S1

2.>>> S1 > 40

3.>>>S1[S1 > 40]

4.None of the above

Posted Date:-2021-12-13 13:58:08

## Question: `Which of the following statement will modify the first three values of Series â€˜S1â€™?`

1. S1[0, 1, 2] = 100

2.S1[0 : 3] = 100

3.S1[ : 3] = 100

4.All the above

Posted Date:-2021-12-13 14:02:14

## Question: `Which of the following statement will print Series â€˜S1â€™ in reverse order?`

1.print(S1[: : 1]

2. print(S1[: : -1]

3.print(S1[-1: : 1]

4. print(S1.reverse( ))

Posted Date:-2021-12-13 12:59:07

## Question: `Which of the following statement will return 10 values from the bottom/end of the Series â€˜S1â€™?`

1.S1.tail( )

2.S1.tail(10)

4.S1(10)

Posted Date:-2021-12-13 13:58:58

## Question: `While performing mathematical operations on series, index matching is implemented and all missing values are filled in with ___________ by default`

1.NaN

2.None

3.0

4.1

Posted Date:-2021-12-13 15:10:25

## Question: ```Write a statement to display 12.5 as output using positional indexing. import pandas as pd S1=pd.Series([11, 12.5, None, 6], index=["J","F","M","A"])```

1. print(S1[1])

2.print(S1[â€œJâ€])

3.print(S1[0])

4.print(S1[â€œFâ€])

Posted Date:-2021-12-13 14:31:47

## Question: `Write a statement to import pandas with alias name â€˜pdsâ€™`

1.import pandas as pds

2.Import pandas as pds

3. import panda as pds

4.import Pandas as pds

Posted Date:-2021-12-13 14:20:33

## Question: ```Write the output of the following : import pandas as pd S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'], index=['India', 'USA', 'UK', 'France']) print(S1['India', 'UK'])```

1.India NewDelhi UK London dtype: object

2.India NewDelhi UK Washington dtype: object

3.Error

4.None of the above

Posted Date:-2021-12-13 12:58:12

## Question: ```Write the output of the following : import pandas as pd S1=pd.Series([1,2,3,4]) S2=pd.Series([7,8,9,10]) S2.index=['a','b','c','d'] print((S1+S2).count())```

1.8

2.6

3.0

4.6

Posted Date:-2021-12-13 13:14:41

## Question: ```Write the output of the following : import pandas as pd S1=pd.Series([1,2,3,4]) S2=pd.Series([7,8]) print((S1+S2).count())```

1.6

2.4

3.2

4.0

Posted Date:-2021-12-13 13:06:46

## Question: ```Write the output of the following code: import pandas as pd S1=pd.Series() print(pd.Series().empty)```

1.True

2.False

3.Error

4.None of the above

Posted Date:-2021-12-13 13:04:45

## Question: ```Write the output of the following: import pandas as pd S1=pd.Series(data=[11, 12, None, 6,9,7],index=[1,12,3,4,2,4]) print(S1.count())```

1.4

2.6

3.5

4.Error

Posted Date:-2021-12-13 14:58:48

## Question: ```Write the statement to get NewDelhi as output using positional index. import pandas as pd S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'], index=['India', 'USA', 'UK', 'France'])```

1.print(S1[0])

2. print(S1[â€˜Indiaâ€™])

3.Both of the above

4.print(S1.India)

Posted Date:-2021-12-13 12:55:15

## Question: `_________ function is used to sort a Series object on the basis of values.`

1.sort.values( )

2.sort_values( )

3.sort_value( )

4. sort_Values

Posted Date:-2021-12-13 14:53:18

## Question: `_________ statement will assigns a name to the Series â€˜S1â€™.`

1.>>> S1.name = â€œEmplâ€

2. >>> S1_name = â€œEmplâ€

3. >>> S1[name] = â€œEmplâ€

4.>>> S1.indexname = â€œEmplâ€

Posted Date:-2021-12-13 14:58:18

## More MCQS

##### R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!