Class 12 IP Practice Assignment Series 10

You might also like

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

Write following MCQ Question Answer in your Notebook datewise.

Series-10
Revision Practice MCQ Unsolved Questions 15-09-2021
Class 12
Topic- Pandas dataframe sorting
Subject IP
Q1. Select the correct, Ascending sorting example:
a. z to a or 100 to 1 b. a to z or 1 to 100

Q2. Select the correct, Descending sorting example:


a. z to a or 100 to 1 b. a to z or 1 to 100

Q3. Select the correct, Ascending sorting example:


a. highest to lowest b. lowest to highest

Q4. Select the correct, Descending sorting example:


a. highest to lowest b. lowest to highest

Q5. Select the correct syntax of python sorting statement:-


a. sort_values ([column name , sub column name], ascending = [True, False ])
b. sort ([column name , sub column name], ascending = [True, False ])

Q6. To sort name wise, in ascending order of following df dataframe, so select correct python code for
this:-
df-dataframe df-dataframe
name year item sales name year item sales
ram 2015 tv 2 mohan 2015 tv 1
mohan 2015 tv 1 mohan 2015 radio 5
ram 2015 radio 4 mohan 2016 tv 5
mohan 2015 radio 5 mohan 2016 radio 5
ram 2016 tv 1 ram 2015 tv 2
mohan 2016 tv 5 ram 2015 radio 4
ram 2016 radio 3 ram 2016 tv 1
mohan 2016 radio 5 ram 2016 radio 3

a. print( df.sort_values('name', ascending = False ))


b. print( df.sort_values('name', ascending = True ))

Q7. To sort name wise, in descending order of following df dataframe, so select correct python code for
this:-
df-dataframe df-dataframe
name year item sales name year item sales
ram 2015 tv 2 ram 2015 tv 2
mohan 2015 tv 1 ram 2015 radio 4
ram 2015 radio 4 ram 2016 tv 1
mohan 2015 radio 5 ram 2016 radio 3
ram 2016 tv 1 mohan 2015 tv 1
mohan 2016 tv 5 mohan 2015 radio 5
ram 2016 radio 3 mohan 2016 tv 5
mohan 2016 radio 5 mohan 2016 radio 5
a. print( df.sort_values('name', ascending = True ))
b. print( df.sort_values('name', ascending = False ))

Q8. To sort year wise, in ascending order of following df dataframe, so select correct python code for
this:-
df-dataframe df-dataframe
name year item sales name year item sales
ram 2015 tv 2 ram 2015 tv 2
mohan 2015 tv 1 ram 2015 radio 4
ram 2015 radio 4 mohan 2015 tv 1
mohan 2015 radio 5 mohan 2015 radio 5
ram 2016 tv 1 ram 2016 tv 1
mohan 2016 tv 5 ram 2016 radio 3
ram 2016 radio 3 mohan 2016 tv 5
mohan 2016 radio 5 mohan 2016 radio 5
a. print( df.sort_values('year', ascending = False ))
b. print( df.sort_values('year', ascending = True ))

Q9. To sort year wise, in descending order of following df dataframe, so select correct python code for
this:-
df-dataframe df-dataframe
name year item sales name year item sales
ram 2015 tv 2 ram 2016 tv 1
mohan 2015 tv 1 ram 2016 radio 3
ram 2015 radio 4 mohan 2016 tv 5
mohan 2015 radio 5 mohan 2016 radio 5
ram 2016 tv 1 ram 2015 tv 2
mohan 2016 tv 5 ram 2015 radio 4
ram 2016 radio 3 mohan 2015 tv 1
mohan 2016 radio 5 mohan 2015 radio 5
a. print( df.sort_values('year', ascending = True ))
b. print( df.sort_values('year', ascending = False ))

Q10. To sort item wise, in ascending order of following df dataframe, so select correct python code for
this:-
df-dataframe df-dataframe
name year item sales name year item sales
ram 2015 tv 2 ram 2015 radio 4
mohan 2015 tv 1 ram 2016 radio 3
ram 2015 radio 4 mohan 2015 radio 5
mohan 2015 radio 5 mohan 2016 radio 5
ram 2016 tv 1 ram 2015 tv 2
mohan 2016 tv 5 ram 2016 tv 1
ram 2016 radio 3 mohan 2015 tv 1
mohan 2016 radio 5 mohan 2016 tv 5
a. print( df.sort_values('item', ascending = False ))
b. print( df.sort_values('item', ascending = True ))

Q11. To sort item wise, in descending order of following df dataframe, so select correct python code for
this:-
df-dataframe df-dataframe
name year item sales name year item sales
ram 2015 tv 2 ram 2015 tv 2
mohan 2015 tv 1 ram 2016 tv 1
ram 2015 radio 4 mohan 2015 tv 1
mohan 2015 radio 5 mohan 2016 tv 5
ram 2016 tv 1 ram 2015 radio 4
mohan 2016 tv 5 ram 2016 radio 3
ram 2016 radio 3 mohan 2015 radio 5
mohan 2016 radio 5 mohan 2016 radio 5
a. print( df.sort_values('item', ascending = True ))
b. print( df.sort_values('item', ascending = False ))

Q12. To sort sales wise, in ascending order of following df dataframe, so select correct python code for
this:-
df-dataframe df-dataframe
name year item sales name year item sales
ram 2015 tv 2 ram 2016 tv 1
mohan 2015 tv 1 mohan 2015 tv 1
ram 2015 radio 4 ram 2015 tv 2
mohan 2015 radio 5 ram 2016 radio 3
ram 2016 tv 1 ram 2015 radio 4
mohan 2016 tv 5 mohan 2015 radio 5
ram 2016 radio 3 mohan 2016 tv 5
mohan 2016 radio 5 mohan 2016 radio 5
a. print( df.sort_values('sales', ascending = False ))
b. print( df.sort_values(' sales ', ascending = True ))

Q13. To sort sales wise, in descending order of following df dataframe, so select correct python code for
this:-
df-dataframe df-dataframe
name year item sales name year item sales
ram 2015 tv 2 mohan 2015 radio 5
mohan 2015 tv 1 mohan 2016 tv 5
ram 2015 radio 4 mohan 2016 radio 5
mohan 2015 radio 5 ram 2015 radio 4
ram 2016 tv 1 ram 2016 radio 3
mohan 2016 tv 5 ram 2015 tv 2
ram 2016 radio 3 ram 2016 tv 1
mohan 2016 radio 5 mohan 2015 tv 1
a. print( df.sort_values(‘sales’, ascending = True ))
b. print( df.sort_values('sales', ascending = False ))

Q14. Select the correct sort statement of above dataframe df.

first name wise ascending and then year wise ascending for each name
name year item sales
1 mohan 2015 tv 1
3 mohan 2015 radio 5
5 mohan 2016 tv 5
7 mohan 2016 radio 5
0 ram 2015 tv 2
2 ram 2015 radio 4
4 ram 2016 tv 1
6 ram 2016 radio 3
a. print( df.sort_values(['name' , ‘year’], ascending = [False, False] ))
b. print( df.sort_values(['name' , ‘year’], ascending = [True, True] ))

Q14. Select the correct sort statement of above dataframe df.

first name wise ascending and then year wise descending for each name
name year item sales
5 mohan 2016 tv 5
7 mohan 2016 radio 5
1 mohan 2015 tv 1
3 mohan 2015 radio 5
4 ram 2016 tv 1
6 ram 2016 radio 3
0 ram 2015 tv 2
2 ram 2015 radio 4
a. print( df.sort_values(['name' , ‘year’], ascending = [False, False] ))
b. print( df.sort_values(['name' , ‘year’], ascending = [True, False] ))

Q15. Select the correct sort statement of above dataframe df.

first name wise descending and then year wise descending for each name
name year item sales
4 ram 2016 tv 1
6 ram 2016 radio 3
0 ram 2015 tv 2
2 ram 2015 radio 4
5 mohan 2016 tv 5
7 mohan 2016 radio 5
1 mohan 2015 tv 1
3 mohan 2015 radio 5
a. print( df.sort_values(['name' , ‘year’], ascending = [True, False] ))
b. print( df.sort_values(['name' , ‘year’], ascending = [False, False] ))

Q16. Select the correct sort statement of above dataframe df.

first name wise descending and then year wise asending for each name
name year item sales
0 ram 2015 tv 2
2 ram 2015 radio 4
4 ram 2016 tv 1
6 ram 2016 radio 3
1 mohan 2015 tv 1
3 mohan 2015 radio 5
5 mohan 2016 tv 5
7 mohan 2016 radio 5
a. print( df.sort_values(['name' , ‘year’], ascending = [False, True] ))
b. print( df.sort_values(['name' , ‘year’], ascending = [False, False] ))

Previous MCQ Question pdf file

Date Pdf file link


06-09-2021 Class 12 IP Practice Assignment Series 1
07-09-2021 Class 12 IP Practice Assignment Series 2
08-09-2021 Class 12 IP Practice Assignment Series 3
09-09-2021 Class 12 IP Practice Assignment Series 4
10-09-2021 Class 12 IP Practice Assignment Series 5
11-09-2021 Class 12 IP Practice Assignment Series 6
12-09-2021 Class 12 IP Practice Assignment Series 7
13-09-2021 Class 12 IP Practice Assignment Series 8
14-09-2021 Class 12 IP Practice Assignment Series 9

You might also like