Professional Documents
Culture Documents
Ip pb1 QP Ms Agra Set A
Ip pb1 QP Ms Agra Set A
Ip pb1 QP Ms Agra Set A
MARKING SCHEME
Section A
Answer the following questions :
1 a) Find the output of following program 1
import numpy as np
d=np.array([100,200,300,400,500,600,700])
print(d[-6:-2])
Ans : [200 300 400 500] (1 mark for correct output)
b) Point out the incorrect statement: 1
c) Fill in the blank with appropriate numpy method to calculate and print the variance of 1
an array.
import numpy as np
data=np.array([10,20,30,40,50,60])
print(np. (data,ddof=0)
OR
Page 1 of 17
Ans : print(np.var(data,ddof=0)) (1 mark for appropriate function var)
OR
Z=np.arange(10,40,3)
a = np.arange(16).reshape(4,4)
b = np.vsplit(a,2)
print b
(1 mark for correct use of vsplit( ), 1 mark for correct example.)
e) Write a Python programming code to display a bar chart of the popularity of 2
programming Languages.
Sample data:
Programming languages: Java, Python, PHP, JavaScript, C#, C++
Popularity: 22.2, 17.6, 8.8, 8, 7.7, 6.7
Page 2 of 17
Ans : Pandas Series is a one dimensional labeled array capable of holding data of any
type(integer,string,float,python objects etc)
import pandas as pd
data=pd.Series([1,2,3,4,5])
print(data)
(g) Write a Numpy program to find out smallest and sum of array elements 3
0,1,2,3,4,5,6,7,8,9.
OR
Write a python programming code to display and create a 8x8 ndarray and fill it
with a checkerboard pattern i.e. 0 and 1 at alternative positions.
arr=np.array([0,1,2,3,4,5,6,7,8,9])#s1 marks
for
a=arr.min() #s2
correc
b=arr.sum() #s3
t code
print(a)
OR
import numpy as np
c=np.zeros((8,8),dtype=int)
c[1::2,::3]=1
c[::2,1::2]=1
Print(c)
Page 3 of 17
2 a) Which Pandas Dataframe function is used to get list from DataFrame column headers: 1
A. print(list(df.columns.values))
B. print(list(df.rows.values))
C. print(list(df.columns.index))
D. print(list(df.head))
Ans : OPTION A
b) Find the output of following program: 1
import pandas as pd
columns=['max_speed', 'shield'])
Ans : 2
c) Explain Pandas iterrow(). Give example. 1
iterrows() − iterate over the rows as (index,series) pairs. Example :
df = pd.DataFrame(np.random.randn(4,3),columns = ['col1','col2','col3'])
print row_index,row
Page 4 of 17
f) Write a python code to create a dataframe as per given structure in the figure. 2
Country Rank
0 Russia 121
1 Colombia 40
2 Chile 100
3 Equador 130
4 Nigeria 11
OR
Write a small python code to create a dataframe with headings (sid, age) from the list given
below.
[ [‘S1’,20],[‘S2’,30],[‘S3’,40], [‘S4’,50] ]
print(data)
OR
import pandas as pd
df1=pd.dataframe([‘S1’,20],[‘S2’,30] ],columns=[‘id’,’age’] ]
df1.=df1.append(df2)
Page 5 of 17
g) Consider the following dataframe, and answer the questions given below: 3
import pandas as pd
data = pd.DataFrame(np.arange(12).reshape((3, 4)),
index=['Ohio', 'Colorado', 'New York'],columns=['one', 'two', 'three', 'four'])
(i) Write the code to rename column name from 'Ohio' to 'SanF'.
(ii) Write the code to find mean value from above dataframedf over the
index and column axis. (Skip NaN value).
(iii) Use sum() function to find the sum of all the values over the index axis.
OR
Consider the following dataframe df and answer the questions given below:
import pandas as pd
df = pd.DataFrame([[10, 20, 30, 40], [7, 14, 21, 28], [55, 15, 8, 12],
[15, 14, 1, 8], [7, 1, 1, 8], [5, 4, 9, 2]],
columns=['Apple', 'Orange', 'Banana', 'Pear'],
index=['Basket1', 'Basket2', 'Basket3', 'Basket4', 'Basket5', 'Basket6'] )
i) Write a command to calculate minimum value for each of the columns
ii) Write a command to calculate maximum value for each of the rows
OR
Page 6 of 17
print("\n----------- Minimum -----------\n")
print(df[['Apple', 'Orange', 'Banana', 'Pear']].min())
print("\n----------- Maximum -----------\n")
print(df[['Basket1', 'Basket2', 'Basket3', 'Basket4',
'Basket5', 'Basket6']].max())
Page 7 of 17
i) Find the output of the following code: 4
import pandas as pd
import numpy as np
s1 = pd.Series(['100', '200', 'python', '300.12', '400'])
s2 = pd.Series(['10', '20', 'php', '30.12', '40'])
print("Data Series:")
print(s1)
print(s2)
df = pd.concat([s1, s2], axis=1)
print("New DataFrame combining two series:")
print(df)
0 10
1 20
2 php
3 30.12
4 40
( 01 mark for correct output of print(s1), 01 mark for correct output of print(s2),
02 mark for correct output of print(df) )
Section B
Answer the following questions :
Page 8 of 17
3 a) Which of the following is NOT the phase consisting on spiral model of software 1
development.
A) Planning
B) Design
C) Engineering
D) Risk-Analysis
Ans : Option B
b) is the process of checkinq the developed software for its correctness and error free working 1
A. Specification
B. Desiqn/Implementation
C.Validation/Testing
D. Evolution
Ans : Option C
c) Write down any one benefit of version control. 1
Ans : merge all the changes into a common version. (1 mark for correct answer)
d) 2
What are differences between commit/update and push/pull requests ?
Ans : Commit refers to updating the file in local repository on a distributed version control system.
Push refers to updating the file in remote repository on a distributed version control
software process.
OR
Explain spiral delivery model. Also mention one advantage and one disadvantage of spiral
delivery
Page 9 of 17
Ans : The water fall model is a linear and sequential approach of software development where software
develops systematically from one phase to another in a downward fashion. The model is divided into
different phases and the output of one phase is used as input of next phase.
The phases are as follows:
1. Requirements specifications 2. Analysis and system design
3. Implementation and unit testing 4. Integration and system testing
5. Operation and maintenance
Advantage : Simple and easy to understand
Disadvantage : No working software till the last phase
3 marks (1 mark for explanation 1 mark for correct advantage and 1mark for correct
disadvantage)
OR
Spiral Model is a combination of a waterfall model and iterative model. Each phase in spiral
model begins with a design goal and ends with the client reviewing the progress.
OR
Define about scrum and pair programming used in agile software development.
Page 10 of 17
Agile software development
Scrum is an agile framework for managing knowledge work, with an emphasis on software
development, although it has wide application in other fields and is slowly starting to be explored by
traditional project teams more generally. It is designed for teams of three to nine members, who break
their work into actions that can be completed within time boxed 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.
Pair programming is an agile software development technique in which two programmers work
together at one workstation. One, the driver, writes code while the other, the observer or navigator
reviews each line of code as it is typed in. The two programmers switch roles frequently.
(11/2 mark for correct explanation of Scrum and 11/2 mark for correct explanation for Pair
programming )
g) Draw a use-case diagram for a online cab / taxi booking app. 4
OR
Page 11 of 17
Ans :
Section C
Answer the following questions :
4 a) Which command is used to create a new app named OLA in Django project? 1
Page 12 of 17
b) The COUNT function in SQL returns the number of ______________ 1
C. Group By D. Columns
OR
A. Alter B. Update
C. Select D. Delete
Ans : Option A
OR
Update
d) What is the name of a special control structure that facilitates the row-by-row processing of
records in the result set during Python-MySQL connectivity? 1
Ans : Database cursor.
e) Which command is used for destroying table in mysql ? 1
Ans : Drop
f) The doc_name column of a table hospital is given below 3
Doc_name
Avinash
Ranjeet
Aman
Kushagra
Based on the information ,find the output of the following queries:
(i)Write mysql command to display Doc_name starting with letter ‘K’ having any
length.
(ii) Write mysql command to display Doc_name ending with letter ‘A’ having only four
character.
(iii) Write mysql command to change name ‘Aman’ by new name ‘Arun’.
Page 13 of 17
Member_id Member_nam Address Age Fees
Ans : (i)select doc_name from ehospital where doc_name like “K%”.
M001 Sumit New Delhi 20 1000
(ii) select doc_name
M002 from hospital
Nisha where doc_name
Gurgaon like “_
19_ _A”. 1500
M003 Niharika New Delhi 21
(iii)Update Hospital set Doc_name=’Arun’ where Doc_name=’Aman’; 2100
M004 Sachin Faridabad 18 1500
g) Observe the 3
table ‘Club’ given below:
Club
i. What is the cardinality and degree of the above given table?
ii. If a new column contact_no has been added and two more members have
joined the club then how these changes will affect the degree and
cardinality of the above given table.
Ans : i. Cardinality:4
Degree: 5
(½ mark for each correct answer)
ii. Cardinality: 6
Degree: 6
(½ mark for each correct answer)
iii. Alter table Club add contact_no varchar(20);
(1 Mark Each for queries from (i) to (iii) )
h) Consider the table FLIGHT given below. Write commands in SQL for (i) to (iv) and output 4
for (v) to (vi). ( queries from (i) to (iii)=1 Mark Each & from (iv) to (v)= ½ Mark Each)
(1 Mark Each for queries from (i) to (iii), ½ Mark Each for correct output )
OR
(i)In a bank,a database named PNB is created in mysql whose password is
“123”.Reema is trying toad a new record of PNB having
details(‘E1’,’Meena’,’Delhi’) in a PNB table.
(ii)Write the python code to read the contents of “first.csv” file consisting of data from a
mysql table and print data of table on the screen in tabular form of table.
Ans.import mysql.connector
Mydb=mysql.connector.connect(host=”localhost”,user=”root”,passwd=”123”,
database=”PNB”)
mycursor=mydb.cursor()
mycursor.excute(“insert into PNB values(‘E1’,’Meena’,’Delhi’);”)
mydb.commit()
(ii)f=open(‘first.csv’,’r’)
with f:
reader =csv.reader(f)
for row in reader:
for e in row:
print(e)
Section D
Answer the following questions :
5 a) Vinod is preparing financial analysis report of its organisation. Can he copy and paste 1
information from the Internet for reference in his report?
Ans : Yes, he can do this but only after giving the reference to all the sources, otherwise it will be
treated as copyright violation.
b) What does the term “Intellectual Property Rights” covers? 1
Ans : The term “Intellectual Property Rights” covers Copyrights, Trademarks and Patents.
c) What are the environmental issues of e-waste? 1
Page 15 of 17
Ans : E-waste, or electronic waste, is waste from all sorts of electronics ranging from computers
and mobile phones, to household electronics such as food processors, pressure cookers, etc.
The effects of improper disposal of this e-waste on the environment are little known;
however, damage to the atmosphere is one of the biggest environmental impacts of e-waste.
d) What do you understand by the term Plagiarism? Write two software used as plagiarism 2
checker.
Ans : Plagiarism is “copying and publication” of another author’s “language, thoughts, ideas, or
expressions” and the representation of them as one’s own original work. Plagiarism is
considered academic dishonesty and a breach of journalistic ethics.
The software available for Plagiarism checker are:
(i) DupliChecker (ii) Grammarly (iii) Paperrater (iv) Plagiarisma
(1 mark for correct explanation of Plagiarism and 1 mark for two software)
Explain the role of online social media campaigns, crowdsourcing and smart mobs in
society.
Computer ethics are a set of moral principles that govern the behaviour of a group or an
individual and regulate the use of computers. These include intellectual property rights
(such as copyrighted electronic content), privacy concerns, and how computers affect our
society. (3 mark for correct answer)
OR
Crowdsourcing is the practice of engaging a ‘crowd’ or group for a common goal — often
innovation, problem solving, or efficiency. It is powered by new technologies, social media
and web 2.0. Crowdsourcing can take place on many different levels and across various
industries.
Smart mobs, so named because each person in the group uses technology to receive
information on where to go and what to do. This ability to stay on top of current events
makes smart mobs extremely effective
3 marks (1 mark for one correct role of social media campaign, 1 mark for one correct role
of Crowdsourcing and 1 mark for one correct role of Smart mob)
Page 16 of 17
Page 17 of 17