IP Question Paper 2020-2021
IP Question Paper 2020-2021
1
7. What will be the output of the statements: 1
data=numpy.array([10,20,30,40,50,60,70,80])
print(data[-4:])
a) [40 50 60 70 80]
b) [10 20 30 40]
c) [50 60 70 80]
d) [50 40 30 20 10]
8. Write the output of the following code : 1
import numpy as np
array1=np.array([10,12,14,16,18,20,22])
array2=np.array([10,12,15,16,12,20,12])
a=(np.where(array1==array2))
print(array1[a])
9. If the axis value omitted while concatenating two arrays, the array will join: 1
a) Row wise
b) Column wise
c) Both Row and Column
d) Both will merge together
15. The fraudulent activity of attracting people to a legitimate looking fake website is 1
called ____________________________
16. Write ONE main difference between a Gateway and Bridge in networking. 1
2
18. What is Mean Absolute Deviation (MAD) of a data set? 1
a) Average distance between each item.
b) Average distance between mean and Standard Deviation
c) Average distance between Median and Mean
d) Average distance between each data value and the Mean.
19. Write the command to change the name of a Column ‘sal’ to ‘salary’ in a table 1
employee using ALTER.
20. What will be the output of the following aggregate function? 1
Select avg(Salary) from employee:
Id Name Salary
1000 Raj 7000
1001 Harry NULL
1002 Kiran 5000
Section -II
Both the case study based questions (21 & 22) are compulsory.
Attempt any four sub parts from each question. Each sub question carries 1 mark.
ii) If a new column contact_no has been added and two more members have joined the 1
club then how these changes will affect the cardinality and degree of the above given
table.
a) Cardinality - 6, Degree - 7
b) Cardinality - 5, Degree - 7
c) Cardinality - 7, Degree - 6
d) Cardinality - 6, Degree - 6
3
iii) Which query will add the new column contact_no to the table Club? 1
a) Update table Club Modify contact_no varchar(12);
b) Update table Club Add contact_no varchar(12);
c) Alter table Club Update contact_no varchar(12);
d) Alter table Club Add contact_no varchar(12);
iv) Which query will update the fees by 5% for the people in New Delhi? 1
a) Update Club set Fees = 5 where Address like ‘New Delhi’;
b) Update Club set Fees = Fees * 5% where Address like ‘New Delhi’;
c) Update Club set Fees = Fees + Fees * 5% where Address like ‘New Delhi’;
d) Update table Club set Fees = Fees + Fees * 5% where Address like ‘New Delhi’;
v) Select the name printed for the following query: 1
Select Member_Name from Club where Member_Name like ‘%i _ _ ’;
a) Sumit
b) Sachin
c) Niharika
d) All the above
22. Consider the following Python code to create a Series and answer the questions 1
below:
import pandas as pd
regno=[101, 102, 103, 104, 105, 106]
marks=[70, 80, 60, 45, 55, 65]
sr=pd.Series(marks,index=regno)
i) The print(sr.size) statement will print 1
a) 1
b) 2
c) 6
d) 12
ii) The print(sr.nbytes) statement will print 1
a) 6
b) 8
c) 36
d) 48
iii) Write the statement which will print the highest marks 1
a) print(sr.max())
b) print(pd.max(sr))
c) print(highest(sr))
d) print(sr.highest())
iv) The statement print(sr * 2) will print 1
a) 70 80 60 45 55 65
70 80 60 45 55 65
b) 140 160 120 90 110 130
c) Syntax Error
d) None
4
v) The sr.tail(2) function retrieve
a) The first two values
b) The last two values
c) The values except first two values
d) The values except last two values
Part - B
Section – I
27. Name SQL Single Row functions (for each of the following) that 2
i. returns a number.
ii. returns lowercase letters.
iii. returns names of days. For example : ‘‘Monday’’, ‘‘Tuesday’’.
iv. returns weekday number. For example : 1 for Sunday, 2 for Monday etc.
28. Write SQL query to create a table ‘Sports’ with the following structure: 2
Section – II
33. Consider the following DataFrame consisting the sales of a company in four quarters 3
in five different areas, answer the questions given below:
6
OR
What is a Histogram? How can we create a Histogram from a DataFrame?
Show appropriate example.
36. Pranay created a table named “Friends” to store his friend’s detail. Table “Friends” is 3
shown below. Write MySQL queries for the requirements given below for i) to iii)
i) To list name and city of those friends who don’t have an email id.
Section – III
37. Consider the following dataset: 5
Name Age Salary
Tom 35 1000
Jack 36 8000
Paul 35 4000
Sara 36 2500
Lara 35 2000
Harry 37 1500
i. Write code in Python to create a DataFrame named ‘Employee’ from the dataset.
ii. Set the index as the Name.
iii. Write code to find the total salary in each age group.
vi. Write code to set each employee’s salary as the highest salary in that age group.
7
38. Consider the two Databases – ITEM and VENDOR with the following information. 5
Write MySQL queries for (i) to (iii), based on the tables ITEM and VENDOR
Table : ITEM
ICode IName Price Colour VCode
S001 Refrigerator 20000 Blue P01
S002 Mobile Phone 45000 Black P02
S003 LCD 60000 Silver P03
S004 Washing Machine 12500 Smoke P01
S005 Air Conditioner 16000 White P03
S006 Refrigerator 15000 White P02
Table: VENDOR
VCode VName VCity
P01 Satish Mumbai
P02 Manoj Delhi
P03 Subodh Chennai
P04 Jacob Bangalore
i. To display Item Code , Item Name, Vendor Name and Vendor City of all the
Vendors, who manufacture “Refrigerator”
ii. To display Item Code, Item Name and Price of all the products whose price is more
than 20000 and Vendor from Delhi.
iii. Identify the Primary Key and Foreign Key of both table if any.
OR
Consider the following table named ‘‘EXAM’’ with details of marks. Write command
of MySQL for (i) to (iii) and output for (iv) and (v).
8
iii. To add another column Bus_Fees with datatype and size as Decimal (8,2).
iv. SELECT SName, Percentage FROM EXAM WHERE Name LIKE "%a";
v. SELECT ROUND(Percentage,0) FROM EXAM WHERE ClSection like ‘12A’;
39. Bharath Industries has set up its new center at Rajaji Nagar for its office and web 5
based activities. The company compound has 4 buildings as shown in the diagram
below:
Raj Fazz
Building Building
Jazz
Harsh
Building Building