Tuesday, 23 February 2021

IP with Python Practical File Programs for Class 12 IP

 

1.      WAP in Python to plot a quadratic equation using dashed Line Chart.

Equation is 0.5*x**2+1

 

2.      WAP in Python to plot frequency of marks using Line Chart

Marks=[50,40,50,65,65,75,75,80,80,90,90,90]

 

3.      WAP in Python to compare the sugar levels among men and women in a city using histogram.

Men:[113,85,90,150,149,88,93,115,135,80,77,82,129]

Women:[67,98,120,133,150,84,69,89,79,120,112,100]

bins:[80,100,125,150]

 

4.      Write a Python Program to plot two or more lines with legends, different width, color, marker and style.

 

5.      WAPin Python to create a bar chart by using multiple x values on the same chartfor men and women.

men: (22,30,35,35,26)

women: (25,32,30,35,29)

 

6.      First 10 terms of Fibonacci series are stored in a list namely fib:                  

 

fib = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

 

Write a program to plot Fibonacci terms and their square-roots with two separate lines on the same plot.

(a)    Series should be plotted as a cyan line with ‘o’ markers having size as 5 and edge-color as red.

(b)   The square-root series should be plotted as a black line with ‘+’ markers having size as 7 and edge-color as red.

 

7.      Given a series nfib that contains reversed Fibonacci numbers with Fibonacci numbers as show below:

[0, -1, -1, -2, -3, -5, -8, -13, -21, -34, 0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

 

Write a program to plot nfib with following specifications:                 

 

(a)    The line color should be magenta

(b)   The marker edge color should be black with size 5

(c)    Grid should be displayed


8.      Write a program to plot a bar chart from the medals won by the four countries. Make sure that bars are separately visible.                             

Country

Gold

Silver

Bronze

Total

India

26

20

20

66

Australia

80

59

59

198

England

45

45

46

136

Canada

10

12

14

36


9.      Create a Series using dictionary.

 

10.  Create a data frame using dictionary.

  

11.  WAP in Python to sort the pandas DataFrame on the basis of a single column in ascending order.

 

12.  Create a Series and access the top 2 and last 2 elements using head() and tail() methods.

 

13.  WAP to perform mathematical operation addition, subtraction and multiplication on two series.

 

14. WAP to show indexes and axes of a DataFrame.

 

15. WAP to represent size and shape of the  DataFrame.


16. WAP to transpose the values of index and columns in a DataFrame.


17. WAP in Python to create a DataFrame to store weight, age and names of 3 people. Print the DataFrame and its transpose.

18. Consider the saleDf shown below.

 

Target

Sales

ZoneA

56000

58000

ZoneB

70000

68000

ZoneC

75000

78000

ZoneD

60000

61000

Write a program to rename indexes of ZoneC and ZoneD as Central and Dakshin respectively and the column names Target and Sales as Targeted and Achieved respectively.

19. WAP in Python to create a the following DataFrame –

 

Population

Hospitals

Schools

Delhi

10927986.0

189.0

7916.0

Mumbai

12691836.0

208.0

8508.0

Kolkata

46192.0

149

7226.0

Chennai

4328063.0

157

7617.0

Banglore

5678097.0

1200.0

1200.0

Create another DataFrame from the above DataFrame which not contains column ‘Population’ and raw Banglore.

20. Consider the following DataFrame saleDf

 

Target

Sales

ZoneA

56000

58000

ZoneB

70000

68000

ZoneC

75000

78000

ZoneD

60000

61000

WAP a program to add a column namely Orders having values 6000, 6700, 6200 and 6000 respectively for the zones A, B, C and D. The program should also add a new row for a new zone ZoneE. Add some dummy values in this row.

21. WAP to  create a DataFrame to store weight, age and names of 3 people. Print the DataFrame and its transpose.

22. Consider the DataFrame (dfmks)given below.

 

A

B

C

D

Acct

99

94.0

92

97.0

Eco

90

94.0

92

97.0

Eng

95

89.0

91

89.0

IP

94

NaN

99

95.0

Math

97

100.0

99

NaN

WAP to print the maximum marks scored in each subject across all sections.

23. Consider the DataFrame (dfmks)given below.

 

A

B

C

D

Acct

99

94.0

92

97.0

Eco

90

94.0

92

97.0

Eng

95

89.0

91

89.0

IP

94

NaN

99

95.0

Math

97

100.0

99

NaN

WAP to print the maximum marks scored in a section, across all subjects.

24. WAP to calculate mode for each subject and each section in DataFrame dfmks.

 

A

B

C

D

Acct

99

97

92

97

Eco

94

94

92

97

Eng

95

89

91

89

IP

94

87

99

94

Math

97

87

99

99

 

25. WAP to calculate median and mean for each subject in DataFrame dfmks.

 

A

B

C

D

Acct

99

97

92

97

Eco

94

94

92

97

Eng

95

89

91

89

IP

94

87

99

94

Math

97

87

99

99

 

 

Part – 2 MYSQL

SQL Practical

17. Create a student table with student_id, name, and marks as attributes, where student_id is the primary key.

18. Insert the details of 5 students into the student table.

19. Delete the details of a student from the student table.

20. Use the SELECT command to get the details of students with marks greater than 30.

21. Shiva, a student of Class XII, created a table named CLASS. Grade is one of the columns of this table. Write an SQL query to find the details of students whose grades have not been entered.

22. Shiva is using a table with the following details:

Students(Name, Class, Stream_id, Stream_Name)

Write an SQL query to display the names of students who have not been assigned any stream or whose Stream_Name ends with "computers".

23. Write the differences between the DROP, DELETE, and TRUNCATE commands with examples.

24. Write short notes on the GROUP BY, HAVING, and WHERE clauses with examples.

25. Write an SQL query to find the square root of 26.

26. Shiva is using a table named Employee with the following details:

Employee(Code, Name, Salary, DeptCode)

Write an SQL query to display the maximum salary department-wise.

27. Write an SQL query to display the difference between the highest and lowest salaries of each department whose maximum salary is greater than 4000.

28. Write an SQL query to increase the salary by 20% for employees whose experience is more than 5 years in the following table:

Emp(id, name, salary, exp)

29. Write an SQL query to perform an inner join on the following two tables:

Emp(eid, ename, salary, dept_id)
Dept(dept_id, dname)

30. Write an SQL query to perform a full outer join on the following two tables:

Emp(eid, ename, salary, dept_id)
Dept(dept_id, dname)

31. Write an SQL query to insert the data of 5 employees into the following table using a single query:

Emp(eid, ename, salary, city, dob)

32. Display 4 characters extracted from the string 'ABCDEFG', starting from the fifth character from the right.

33. Write a query to create a string from the ASCII values 65, 67.3, and 68.3.

Note: The image shows decimal values 67.3 and 68.3; these have been retained as printed.

34. Display the names 'MR. MODI' and 'MR. Sharma' in lowercase.

35. How many characters are there in the string 'CANDIDE'?

36. Create the following table and find the number of customers from each country using GROUP BY:

Customer(customer_id, name, country)

37. Consider the SQL string 'Active Number'. Write commands to display:

  • (a) 'Act'
  • (b) 'Numb'

38. Write any one similarity and one difference between the PRIMARY KEY and UNIQUE constraints.

39. Write the difference between CHAR() and VARCHAR().

40. Write the difference between COUNT(column_name) and COUNT(*).