/**/ Python & MySQL: October 2021

Sunday, October 17, 2021

CBSE IP CLASS 11 PRACTICAL FILE (TERM-1)

INFORMATICS PRACTICES (065)

CLASS - XI

PRACTICAL LIST

========================================

EXPERIMENT – 1

Objective: The marks obtained by a student in 3 different subjects are input by the user. Your program should calculate the average of subjects and display the grade. The student gets a grade as per the following rules:

Average           Grade

90-100             A

80-89              B

70-79              C

60-69              D

0-59               F

Solution:

sub1 = int(input("Enter marks obtained in subject 1: "))

sub2 = int(input("Enter marks obtained in subject 2: "))

sub3 = int(input("Enter marks obtained in subject 3: "))

avg_marks =(sub1+sub2+sub3)/3

print("Average mark:",avg_marks)

if avg_marks>=90:

    print("Grade is A")

elif avg_marks>=80:

    print("Grade is B")

elif avg_marks>=70:

    print("Grade is C")

elif avg_marks>=60:

    print("Grade is D")

else:

    print("Grade is F")


EXPERIMENT – 2

Objective: WAP in Python to find the sale price of an item with a given cost and discount (%).

Solution:
price=float(input("Enter Price : "))
dp=float(input("Enter discount % : "))
discount=price*dp/100
sp=price-discount
print("Cost Price : ",price)
print("Discount: ",discount)
print("Selling Price : ",sp)

EXPERIMENT – 3
Objective: To calculate perimeter/circumference and area of shapes such as triangle, rectangle, square and circle.

Solution:

import math
def area_square(a):
    area1=float(a*a);
    print("Area of square is:",area1)
def area_circle(r):
    area2=float(3.14*r*r);
    print("Area of circle is:",area2)
def area_rectangle(a,b):
    area3=float(a*b);
    print("Area of rectangle is:",area3)
def area_triangle(x,y):
    area4=float((x*y)/2);
    print("Area of triangle is:",area4)
def peri_square(a):
    peri1=float(4*a);
    print("Perimeter of square is:",peri1)
def peri_circle(r):
    peri2=float(2*3.14*r);
    print("Perimter of circle is:",peri2)
def peri_triangle(a,b):
    hypotenuse=float(math.sqrt(a*a+b*b))
    peri3=float(a+b+hypotenuse)
    print("Perimter of right angled triangle is:",peri3)
def peri_rectangle(a,b):
    peri4=float(2*(a+b))
    print("Perimter of rectangle is:",peri4)

side=float(input("enter the side of square:"))
area_square(side)
print()
peri_square(side)
radius=float(input("enter the radius of circle:"))
area_circle(radius)
peri_circle(radius)
length=float(input("enter the length of rectangle:"))
breadth=float(input("enter the breadth of rectangle:"))
area_rectangle(length,breadth)
peri_rectangle(length,breadth)
base=float(input("enter the base of right angled triangle:"))
height=float(input("enter the height of right angled triangle:"))
area_triangle(base,height)
peri_triangle(base,height)

EXPERIMENT - 4

Objective: To calculate Simple and Compound interest.

Solution:

principal = float(input('Enter amount: '))
time = float(input('Enter time: '))
rate = float(input('Enter rate: '))

simple_interest = (principal*time*rate)/100
compound_interest = principal * ( (1+rate/100)**time - 1)
print('Simple interest is: %f' % (simple_interest))
print('Compound interest is: %f' %(compound_interest))

EXPERIMENT - 5
Objective: Write a python program to input cost price, selling price of product from user and check whether is profit or loss and also print the Profit/loss amount

Solution:

cp=float(input("Enter the Cost Price : "));
sp=float(input("Enter the Selling Price : "));
if cp==sp:
    print("No Profit No Loss")
elif sp>cp:
    print("Profit of ",sp-cp)
else:
    print("Loss of ",cp-sp)

                                EXPERIMENT - 6
Objective: Python program to calculate monthly EMI (Equated Monthly Instalments)

Solution:

# EMI Formula = p * r * (1+r)^n/((1+r)^n-1)

# Monthly Interest Rate (r) = R/(12*100)

# p = Principal or Loan Amount
# r = Interest Rate Per Month
# n = Number of monthly instalments

p = float(input("Enter principal amount: "))
R = float(input("Enter annual interest rate: "))
n = int(input("Enter number of months: " ))

r = R/(12*100)
emi = p * r * ((1+r)**n)/((1+r)**n - 1)
print("Monthly EMI = ", emi)

EXPERIMENT – 7

Objective: To calculate tax - GST / Income Tax.

Solution:

item=input("Enter item name :")

sp_cost=float(input("How much is selling price of item:"))

gst_rate=float(input("What is GST rate % :"))

cgst=sp_cost*((gst_rate/2)/100)

sgst=cgst

amt=sp_cost+cgst+sgst

print("CGST (@",(gst_rate/2),"%) :",(cgst))

print("SGST(@",(gst_rate/2),"%) :",(sgst))

print("Amount payable: ",(amt))

EXPERIMENT – 8

Objective: To find the largest and smallest numbers in a list.

Solution:

lst = [ ]

num = int(input('How many numbers: '))

for n in range(num):

    numbers = int(input('Enter number '))

    lst.append(numbers)

print("Maximum element in the list is :", max(lst), "\nMinimum

 element in the list is :", min(lst))

EXPERIMENT – 9

Objective: To find the third largest/smallest number in a list.

Solution:

num = [2,3,7,4,5,6,10,11,120]

largest_num = num[0]

second_largest_num = num[0]

third_largest_num = num[0]

for i in num :

    if i > largest_num :

        third_largest_num = second_largest_num

        second_largest_num = largest_num

        largest_num = i

    elif i > second_largest_num :

        third_largest_num = second_largest_num

        second_largest_num = i

    elif i > third_largest_num :

        third_largest_num = i

print("Third largest number of the list is {}".format(third_largest_num))

EXPERIMENT – 10

Objective:To find the sum of squares of the first 100 natural

 numbers.

Solution:

n = int(input("Enter nth number : "))

sum = 0

for s in range(1, n+1):

   sum = sum + (s*s)

print("Sum of squares is : ", sum)


EXPERIMENT – 11

Objective:To print the first ‘n’ multiples of a given number.

Solution:

number = int(input("Enter number: "))

print("The multiples are: ")

for i in range(1,11):

    print(number*i, end =" ")


EXPERIMENT – 12

Objective: To count the number of vowels in a user entered

 string.

Solution:

string=input("Enter string:")

vowels=0

for i in string:

      if(i=='a' or i=='e' or i=='i' or i=='o' or i=='u' or i=='A' or i=='E' or i=='I' or i=='O' or i=='U'):

            vowels=vowels+1

print("Number of vowels are:")

print(vowels)

==================================


Wednesday, October 13, 2021

IP - Pandas & Numpy [Important Questions]

Informatics Practices (065)

Important Question For Term - 1

Class - XII

=====================================

Q.1 Best what to import the pandas module in your program?

(a) import pandas                            (b) import pandas as p    

(c) from pandas import *                  (d) All of the above

Ans: (d)

Q.2 Which of the following find the maximum number in the Numpy array?

(a) max(array)                                   (b) array.max()                 

(c) array(max)                                   (d) None of these

Ans: (b)

Q.3 For what purpose a Pandas is used?

(a) To create a GUI programming               (b) To create a database

(c) To create a High level array                    (d) All of the above

Ans: (c)

Q.4 In data Science, which of the python library are more popular?

(a) Numpy                                                        (b) Pandas                         

(c) OpenCv                                                       (d) Django

Ans: (b)

Q.5 Minimum number of argument we require to pass in pandas series?

(a) 0                                                                   (b) 1                     

(c) 2                                                                   (d) 3

Ans: (b)

Q.6 Series in Pandas is………

(a) 1D array                                                      (b) 2D array                       

(c) 3D Array                                                      (d) None of the above

Ans: (a)

Q.7 Way to install the pandas library?

(a) install pandas                                             (b) pandas install python

(c) python install pandas                (d) None of the above

Ans: (d)

Q.8 We can analyse the data in pandas with:

(a) Series                                                           (b) DataFrame                  

(c) Both (a) and (b)                                          (d) None of these

Ans: (c)

Q.9 What we pass in DataFrame in pandas?

(a) Integer                                                        (b) String                            

(c) Pandas series                                             (d) All of the above

Ans: (c)

Q.10 How we can change the shape of the Numpy array in python?

(a) By shape()                                                   (b) By reshape()                

(c) By ord()                                                       (d) By change()

Ans: (b)

Q.11 How we can convert the Numpy array to the list in python?

(a) list(array)                                                    (b) list.array                      

(c) array.list                                                      (d) None of these

Ans: (a)

Q.12 How can we find the type of numpy array in python?

(a) dtype                                                           (b) type               

(c) typei                                              (d) itype

Ans: (a)

Q.13 How we install Numpy in the system?

(a) install numpy                                             (b) pip install python numpy         

(c) pip install numpy                                       (d) pip install numpy python

Ans: (c)

Q.14 It is possible to convert the Numpy array to list in python?

(a) Yes                                                               (b) No                  

(c) Sometimes                                                 (d) None of these

Ans: (a)

Q.15 Numpy in the Python provides the

(a) Function                                                      (b) Lambda function                       

(c) Type casting                                               (d) Array

Ans: (d)

Q.16 Numpy.array(list), what it does?

(a) It convert array to list                              (b) It convert list to array

(c) It convert array to array                          (d) Error

Ans: (b)

Q.17 Shape() function in Numpy array is used to

(a) Find the shape of the array                     (b) Change the shape of the array

(c) Bothe of the above                                  (d) None of these

Ans: (a)

Q.18 What is the use of the size attribute in Numpy array in python?

(a) It find the direction                                  (b) It find the number of items

(c) It find the shape                                        (d) All of these

Ans: (b)

Q.19 What is the use of the zero() function in Numpy array in python?

(a) To make a Matrix with all element 0    (b) To make a Matrix with all diagonal

                                                                       element 0     

(c) To make a Matrix with first row 0             (d) None of these

Ans: (a)

Q.20 Which of the following counts the number of elements of in Numpy array?

(a) count()                                                        (b) return()                         

(c) shape()                                                        (d) size()

Ans: (d)

Q.21 Which of the following find the maximum number in the Numpy array?

(a) max(array)                                                  (b) array.max()                 

(c) array(max)                                                  (d) None of these

Ans: (b)

Q.22 Which of the following is correct way to import the Numpy module in your program?

(a) import numpy                                            (b) import numpy as np

(c) from numpy import *                (d) All of these

Ans: -(d)

Q.23 Which of the following is not valid to import the numpy module?

(a) import numpy as np                                 (b) import numpy as n

(c) import numpy as p                                    (d) None of these

Ans: (d)

Q.24Which of the following keyword is used to access the numpy module in python?

(a) access                                                         (b) import           

(c) fetch                                                            (d) from

Ans: (b)

Q.25 Which of the following is used to convert the list data type to Numpy array?

(a) array(list)                                                    (b) array.list       

(c) numpy.array(list)                                       (d) None of these

Ans: (c)

Q.26 Which of the following is the essential argument to pass in full() function of Numpy array?

(a) shape                                                          (b) value              

(c) both (a) and (b)                                          (d) None of these

Ans: (c)

Q27. Assume that you are given lists:

                             a = [1,2,3]

                             b = [4,5,6]

Your task is to create a list which contains all the elements of a and b in a single dimension.

Output:

                              a = [1,2,3,4,5,6]

Which of the following function will you use?

(a) a.append(b)                                      (b) a.extend(b)

(c) any of the above                               (d) None of above

Ans: (b)

Q.28 DataFrame in pandas is….

(a) 1D array                                                      (b) 2D array        

(c) 2D arrat                                                       (d) None of these

Ans: (b)


=================================

NEW SAMPLE PAPER 2021 (TERM-1)

INFORMATICS PRACTICES (065) 

SAMPLE PAPERS QUESTIONS

FOR TERM - 1

===============================================


IP SAMPLE PAPER WITH MARKING SCHEME FOR CLASS - XII

https://docs.google.com/document/d/1IXTjbjaJD5xan0DJt28G__mFS5JYiXq_/edit?usp=sharing&ouid=115801682097240005048&rtpof=true&sd=true

IP SAMPLE PAPER WITH MARKING SCHEME FOR CLASS - XI

https://docs.google.com/document/d/1R363K_mm3_5p-pxgHLgS1thhm-BhyGhg/edit?usp=sharing&ouid=115801682097240005048&rtpof=true&sd=true


========================================

CLASS XI HALF YEARLY QP WTH MS 2024

  Half Yearly Examination: 2024-25 Informatics Practices (065) Class- XI       Time Allowed: 3hrs                                     ...