Python Class Room Diary – Be easy in My Python class



SET-B

KENDRIYA VIDYALAYA SANGATHAN (AGRA REGION)

XII- PRE BOARD EXAMINATION 2019-20

INFORMATICS PRACTICES (Marking Scheme)

|Section A |

|1 | |Find the output of the following program. |(1 mark for |

| | |import numpy as np |correct answer) |

| | |roll_number = np.arange(1,10,1) | |

| | |print(roll_number[::-2]) | |

| | | | |

| | |Answer: [9 7 5 3 1] | |

| | |Sumit wants to create a numpy array having 2 rows and 4 columns filled with all 1s. Fill in the |(1 mark for |

| | |blanks with appropriate data to create the required array: |correctly filling|

| | |import numpy as np |the blanks) |

| | |np.ones ([2,4]) | |

| | |Statement 1 : pl.plot(roll_no, marks) |(1 mark for |

| | |Statement 1 : pl.xlabel(“Roll Number”) |correctly filling|

| | |Or |the blanks) |

| | |Statement 1 : pl.barh(class, student_count) | |

| | |Statement 1 : pl.xlabel(“Classes”) | |

| | |( ½ mark for each correct statement) | |

| | |[1 2] [ 3 100] [12 4 1 3] |(2 marks for |

| | | |correct output) |

| |. |import matplotlib.pyplot as pl |(2 marks for |

| | |import numpy as np |correct code) |

| | |x=np.array([1,2,3,4]) | |

| | |y=[] | |

| | |z=[] | |

| | |for i in x: | |

| | |y.append(i**3) | |

| | |z.append(i*3) | |

| | |pl.bar(x,y, color='r', width=0.3) | |

| | |pl.bar(x+0.3,z, color='b', width=0.3) | |

| | |pl.show() | |

| | |import pandas as pd |(2 mark for |

| | |import numpy as np |correct code) |

| | |data = {'a' : 0., 'e' : 1., 'i' : 2.,’o’:3.,’u’:4.} | |

| | |s = pd.Series(data) | |

| | |print (s) | |

| |. |Create an 4x4 array and perform the following operations using python operations: |3 (1 mark for |

| | |Divide all the elements with 10 |each part) |

| | |Calculate square of each element of an array | |

| | |Perform addition of an array with itself | |

| | |Answer: | |

| | |import numpy as np | |

| | |import math | |

| | |a= np.array([[1,2,3,4],[2,3,4,5],[1,2,1,2], [3,3,4,5]]) | |

| | |print(a) | |

| | |print(a/10) | |

| | |print(a**2) | |

| | |print(a+a) | |

| | |OR | |

| | |Create an 3x2 array and perform the following operations using python operations: | |

| | |Calculate remainder of all elements when divided by 4 | |

| | |Multiplication of all the elements with 8 | |

| | |Adding 17 to array | |

| | |Answer: | |

| | |import numpy as np | |

| | |import math | |

| | |a= np.array([[10,12],[2,13],[9,21]]) | |

| | |print(a%4) | |

| | |print(a*8) | |

| | |print(a+17) | |

| | |(1 mark for each part) | |

|2 | |iv. applymap() |(1 mark for |

| | | |choosing correct |

| | | |option) |

| | |.T |(1 mark for |

| | |Or |correct answer) |

| | |del [] | |

| | | Name Age |(1 mark for |

| | |Friend1 Shraddha 28 |correct output) |

| | |Friend2 Monica 34 | |

| | |Relative1 Yogita 29 | |

| | | 0 |(1 mark for |

| | |0 300.0 |correct output) |

| | |1 400.0 | |

| | |2 500.0 | |

| | |Quartiles Q1, Q2 and Q3 are three points that divide a distribution into 4 parts. The 4-quantiles |(2 marks for |

| | |are called quartiles. With a quantile, the values of the distribution do not need to be multiple |correct answer) |

| | |of 0.25 while quartiles are multiple of 0.25. | |

| | |import pandas as pd |(2 marks for |

| | |d={‘Name”:[‘MANOJ’,’SANJAY’,’VIKASH’,’VIVEK’, ‘SAHIL’], ‘Age’: [30 , 34, 42, 45, 53], |correct answer) |

| | |’Designation’ :[ ‘PGT’, ’TGT’,’PRT’,’PGT’,’PGT’]} | |

| | |df=pd.DataFrame(d) | |

| | | | |

| | |Or | |

| | |df.loc[:,['Name', 'Designation']] | |

| | |df['Age'].mean() | |

| | |.(i) wdf.sum(axis=1) |3(1 mark for each|

| | |(ii) wdf.loc [6 : , ].mean() |correct answer) |

| | |(iii) wdf.loc [:7, ‘maxTemp’:’Rainfall’]. mean() | |

| | |OR | |

| | |Write the code to create df1 and df2 dataframes. | |

| | |import pandas as pd | |

| | |import math as mt | |

| | |d1= {'marks1':[30,40,15,40], 'marks2':[20,45,30,70]} | |

| | |d2= {'marks1':[10,20,25,50], 'marks2':[15,25,30,30]} | |

| | |d1= pd.DataFrame(d1) | |

| | |d2= pd.DataFrame(d2) | |

| | |print(d1) | |

| | |print(d2) | |

| | |Write the command to add df1 and df2. | |

| | |df1+df2 | |

| | |Write a command to find the average of marks1 column of df2 dataframe. | |

| | |df2['marks1'].mean() | |

| |Ans. | English Chemistry Maths Physics |3 marks for |

| | |Student1 NaN 78 78 45 |correct answer |

| | |Student2 NaN 70 67 56 | |

| | |Student3 NaN 90 87 65 | |

| |Ans. | |4(1 mark for each|

| | |0 1 2 |correct answer) |

| | |0 1 2 3 | |

| | |1 4 5 6 | |

| | | | |

| | |0 1 2 | |

| | |0 3 2 5 | |

| | |1 5 7 8 | |

| | | | |

| | |0 1 2 | |

| | |0 5 5 5 | |

| | |1 4 4 4 | |

| | |II. | |

| | |Output for dfr1+dfr2: | |

| | |0 1 2 | |

| | |0 4 4 8 | |

| | |1 9 12 14 | |

| | |Output for dfr1.add(dfr2): | |

| | |0 1 2 | |

| | |0 4 4 8 | |

| | |1 9 12 14 | |

| | |III. | |

| | |Output for dfr2-dfr1: | |

| | |0 1 2 | |

| | |0 2 0 2 | |

| | |1 1 2 2 | |

| | |Output for dfr2.rsub(dfr2): | |

| | |0 1 2 | |

| | |0 -2 0 -2 | |

| | |1 -1 -2 -2 | |

| | | | |

| | |IV. | |

| | |iteritems() − to iterate over the (key,value) pairs | |

| | |iterrows() − iterate over the rows as (index,series) pairs | |

| | |itertuples() − iterate over the rows as named tuples | |

|Section B |

|3 | |Waterfall |(1 mark for |

| | | |correct answer) |

| |. |Scalability |(1 mark for |

| | | |correct answer) |

| | |Commit refers to updating the file in local repository on a distributed version control system. |(1 mark for |

| | |Push refers to updating the file in remote repository on a distributed version control system. |correct answer) |

| | |Scrum is an agile process framework for managing complex knowledge work, with an initial emphasis |2 |

| | |on software development, although it has been used in other fields and is slowly starting to be | |

| | |explored for other complex work, research and advanced technologies It is designed for teams of | |

| | |ten or fewer members, who break their work into goals that can be completed within timeboxed | |

| | |iterations, called sprints, no longer than one month and most commonly two weeks, then track | |

| | |progress and re-plan in 15-minute time boxed stand-up meetings, called daily scrums. | |

| | |OR | |

| | |Sprint is one timeboxed iteration of a continuous development cycle. Within a Sprint, planned | |

| | |amount of work has to be completed by the team and made ready for review. The term is mainly used | |

| | |in Scrum Agile methodology but somewhat basic idea of Kanban continuous delivery is also essence | |

| | |of Sprint Scrum. | |

| | |Sprint literal meaning is a short race at full speed. Accordingly, teams usually define a short | |

| | |duration of a Sprint up to 2-4 weeks. Team collaboratively sets their target with Product Owner | |

| | |as “Sprint Goal” and plan their work in “Sprint backlog”. As soon race starts after planning | |

| | |session, team work together to complete planned work effectively and make it ready for review by | |

| | |the end of that period. | |

| | |A software process (also known as software methodology) is a set of related activities that leads |3 marks for |

| | |to the production of the software. These activities may involve the development of the software |correct answer |

| | |from the scratch, or, modifying an existing system. | |

| | |Any software process must include the following four activities: | |

| | |1. Software specification (or requirements engineering): Define the main functionalities of the | |

| | |software and the constrains around them. | |

| | |2. Software design and implementation: The software is to be designed and programmed. | |

| | |3. Software verification and validation: The software must conforms to it’s specification and | |

| | |meets the customer needs. | |

| | |4. Software evolution (software maintenance): The software is being modified to meet customer and | |

| | |market requirements changes. | |

| | |The goal of a customer in relation to our money vending machine (ATM) is to withdraw money. So, we|3 marks for |

| | |are adding Withdrawal use-case. Withdrawing money from the vending machine might involve a bank |correct answer |

| | |for the transactions to be made. So, we are also adding another actor – Bank. Both actors | |

| | |participating in the use-case should be connected to the use-case by association. Money vending | |

| | |machine provides Withdrawal use-case for the customer and Bank actors. | |

| | |All agile methods have to conform to a set of rules called Agile Manifesto. The main four |4 marks for |

| | |guidelines: |correct answer |

| | |Individuals and interactions-In agile development, self- organization and motivation are | |

| | |important, as are interactions like co-location and pair programming. | |

| | |Working software-Working software is more effective than presenting documents to clients in | |

| | |meetings. | |

| | |Customer collaboration-Continuous Customer involvement is very important because requirements | |

| | |cannot be fully collected at the beginning of the software development cycle. | |

| | |Responding to change-Agile development is focused on quick responses to change and continuous | |

| | |development. | |

| | |Or | |

| | |Draw a Business use-case diagram for Restaurant Management system. | |

| | |Ans Draw a Business use-case diagram for Restaurant Management system. | |

| | |[pic] | |

|Section C |

|4 | |python manage.py startapp abc |(1 mark for |

| | | |correct answer) |

| | |an alternate key |(1 mark for |

| | |OR |correct answer) |

| | |UPDATE command is used to change or modify data in existing table | |

| | |A connection in MySQL is the session between an application and database system. |(1 mark for |

| | | |correct answer) |

| | |iv SELECT * FROM Persons |(1 mark for |

| | | |correct answer) |

| | |iii. Structured Query Language |(1 mark for |

| | | |correct answer) |

| | |CHAR datatype specifies a fixed length character string. On the other hand, VARCHAR datatype |3(1 mark for each|

| | |specifies a variable length character string. |correct |

| | |COUNT (*) returns the number of rows in a table, including NULL values and duplicates. On the |difference) |

| | |other hand COUNT (column_name) returns number of non-null values. | |

| | |DELETE command is used to delete rows from the table whereas DROP command is used to drop the | |

| | |table from the database. | |

| | |Degree=7 and Cardinality=3 |3(1 mark for |

| | |ALTER TABLE CLUB ADD Address Varchar(30); |correct answer) |

| | |UPDATE CLUB SET PAY=PAY+PAY*.05 WHERE SEX=’F’; | |

| | |SELECT GNAME FROM GARMENT WHERE SIZE=’L’; |4(1 mark for each|

| | |SELECT GCODE, GNAME FROM GARMENT WHERE GNAME LIKE ‘Ladies%’; |correct query and|

| | |SELECT GNAME,GCODE, PRICE FROM GARMENT WHERE PRICE BETWEEN 1100 AND 1600; |½ mark for each |

| | |4 |correct output) |

|Section D |

|5 | |‘Plagiarism’ is stealing someone else’s intellectual work and representing it as your own work |(1 mark for |

| | |without citing the source of information. |correct answer) |

| | |The Information Technology Amendment Act,2008 |(1 mark for |

| | | |correct answer) |

| | |A Smart mob is an organized group of people who have gathered through the use of social media to |(1 mark for |

| | |protest for a publicized social or political cause. |correct answer) |

| | |She should check whether it is a valid bank site or not by checking the in the url https. It is |2 marks for |

| | |always better to type the url and then login to the site. She should not click on the link |correct answer |

| | |provided in the email. | |

| | |Fraud committed using the Internet is called Online fraud. |2 marks for |

| | |Example: Stealing information, fraudulent payments, non-deliverd goods, non-existent companies |correct answer |

| | |etc. | |

| | |Filtering and matching of the content being displayed and delivered on the internet, as per the |3 marks for |

| | |reader’s personal interests, views and liking, is known as ‘Internet as Echo Chamber’. |correct answer |

| | |OR | |

| | |To ensure secure data transmission, majorly following techniques are applied: | |

| | |SSL secure data transmission. | |

| | |Data Encryption. | |

| | |Using Safe protocols. | |

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download