QP PB1 Ip 0
QP PB1 Ip 0
Part - A
Section - I
Attempt any 15 questions from questions 1 to 21
1. Find the output of following program. 1
import numpy as np
x= [1, 2, 3, 99, 99, 3, 2, 1]
x1, x2, x3 = np.split(x, [3,5])
print(x1, x2, x3)
2. Consider the matrix of 5 observations each of 3 variables X0,X1,X2 whose observed 1
values are held in the three rows of the array X:
X = np.array([ [0.1, 0.3, 0.4, 0.8, 0.9], [3.2, 2.4, 2.4, 0.1, 5.5], [10., 8.2, 4.3, 2.6, 0.9] ])
Write the python statement to print the covariance of X and state that what does
the diagonal element of the resultant matrix depicts.
3. The statement in SQL which allows to change the definition of a table is 1
4. Fill in the blank with appropriate numpy method to calculate and print the variance 1
of an array.
import numpy as np
data=np.array([1,2,3,4,5,6])
print(np.___(data,ddof=0)
6. Using Python Matplotlib can be used to count how many values fall into each 1
interval.
a) line plot
b) bar graph
c) histogram
8. A dataframe fdf stores data about passengers, flights and years. First few rows of 1
dataframe are shown below.
Year Month Passenger
0 2009 January 112
1 2009 February 118
2 2009 March 132
3 2009 April 129
4 2009 May 121
Using above dataframe, write command for compute total Passenger per year.
10. Rajani has stolen a credit card. She used that credit card to purchase a laptop. What 1
type of offence has she committed?
12. The practice of taking someone else's work or ideas and passing them off as 1
13. Write a small python code to del a column from dataframe labeled as “xyz”. 1
14. Name the primary law in India dealing with cybercrime and electronic 1
commerce.
18. The____ command can be used to makes changes in the columns of a table in SQL. 1
(i) 0 value
(ii) 1 value
(iii) None value
(iv) None of the above
A. Spammers
B. Phishers
C. Spyware
D. Spam ware
Section -II
Both the case study based questions (22 & 23) are compulsory. Attempt any four sub parts
from each question. Each sub question carries 1 mark.
22. Given the two DataFrames df1 and df2 as given below and answer any four questions
from (i)- (v):
df1 df2
(iv) To display those rows in df1 where value of third column is more than 45.
(v) Which of the following command will display the column labels of the DataFrame?
a. print(df.columns())
b. print(df.column())
c. print(df.column)
d. print(df.columns)
Page 4 of 13
23. Consider the table STUDENT given below:
(i) Which SQL statement allows you to find the highest price from the table 1
BOOK_INFORMATION?
(a) SELECT BOOK_ID, BOOK_TITLE, MAX(PRICE) FROM BOOK_INFORMATION;
(b) SELECT MAX(PRICE) FROM BOOK_INFORMATION;
(c) SELECT MAXIMUM(PRICE) FROM BOOK_INFORMATION;
(d) SELECT PRICE FROM BOOK_INFORMATION ORDER BY PRICE DESC;
(ii) Which SQL statement lets you find the sales amount for each store? 1
(iii) Which statement lets you find the total number of stores in the SALES table? 1
(iv) What SQL statement do we use to print out the record of all students whose last 1
name starts with ’L’?
(a) SELECT * FROM EXAM_RESULTS WHERE LNAME LIKE ‘L%’;
(b) SELECT * FROM EXAM_RESULTS WHERE LNAME LIKE ‘L’;
(c) SELECT * FROM EXAM_RESULTS WHERE LNAME = ‘L’;
(d) SELECT * FROM EXAM_RESULTS WHERE LNAME <> ‘L’;
(v) What SQL statement do we use to find the average exam score for EXAM_ID = 1? 1
25. Tony has recently started working in MySQL. Help him in understanding the 2
difference between the following :
(i) Where and having clause
(ii) Count(column_name) and count(*)
OR
What is the difference between the order by and group by clause when used along
with the select statement? Explain with an example.
26. Write the output of following MYSQL queries: 2
Sample data:
Original DataFrame
col1 col2 col3
0 1 4 7
1 2 5 8
2 3 6 9
New DataFrame after renaming columns:
Column1 Column2 Column3
0 1 4 7
1 2 5 8
2 3 6 9
28. (i) There is column salary in table employee. The following two statements are giving 2
different outputs. What may be the possible reasons?
Select count(*) from employee; select count(salary) from employee;
(ii) Mr. Sanghi created two tables with City as Primary Key in Table1 and Foreign key
in Table2 while inserting row in Table2 Mr. Sanghi is not able to enter value in the
column City. What is the possible reason for it?
29. In a database there are two tables ‘LOAN’ and ‘BORROWER’ as shown below: 2
LOAN
BORROWER
Customer_Name Loan_number
Jones L-170
Smith L-230
Hayes L-155
OR
Consider the following hospital table
(ii) To insert a new row in the above table with the following data :
11, ‘Rakesh’, 45, ‘ENT’, {08/08/08}, 1200, ‘M’
(i) From the given data set print first and last five rows
(ii) Find the most expensive car company name
a. Wi-Fi
b. IDLE
c. TCP/IP
d. VoIP
33. Neelam has recently shifted to new city and new College. She does not many people 2
in her new city and school. But all of a sudden, someone is posting negative,
demeaning comments on her social networking profile, college site’s forum etc.
She is also getting repeated mails from unknown people. Every time she goes online,
she finds someone chasing her online.
Section -II
34. Write a NumPy program to compute sum of all elements, sum of each column and 3
sum of each row of a given row.
Input:
[ [ 0 1]
[ 2 3]]
35. Explain the role of online social media campaigns, crowdsourcing and smart mobs in 3
Page 8 of 13
society.
OR
What is net Neutrality? Do India Net Neutrality by law?
36. Write the code to plot the following figure in python 3
OR
Write a code to plot the bar chart as shown in the figure given below:
Page 9 of 13
9 RUBINA 500 COMP. Sc. 62 I
10 VIKAS 400 MATHS 57 II
(a) List the names of those students who have obtained DIV I sorted by NAME.
(b) Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend
received in a year assuming that the STIPEND is paid every month.
(c.) To count the number of students who are either PHYSICS or COMPUTER SC
graduates.
Section -III
38. Assume following data is stored in data frame named as df1. Write following 5
commands:
Name of
Employee Sales Quarter State
12560
RSahay 0 1 Delhi
23560
George 0 1 Tamil Naidu
21340
JayaPriya 0 1 Kerala
18900
ManilaSahai 0 1 Haryana
45600
RymaSen 0 1 West Bengal
17200
ManilaSahai 0 2 Haryana
20140
JayaPriya 0 2 Kerala
39. Write the SQL functions which will perform the following operations: 5
Page 10 of 13
dob.
iv) To display the starting position of your first name (fname) from your whole
name (name).
v) To compute the remainder of division between two numbers, n1 and n2
OR
Consider the following tables Consignor and Consignee. Write SQL commands for the
statements (i) to (iv) and give outputs for SQL queries (v) to (vi).
40. Uplifting Skills Hub India is a knowledge and skill community which has an aim to 5
uplift the standard of knowledge and skills in the society. It is planning to setup its
training centers in multiple towns and villages pan India with its head offices in the
nearest cities. They have created a model of their network with a city, a town and 3
villages as follows.
As a network consultant, you have to suggest the best network related solutions for
their issues/problems raised in (i) to (iv) keeping in mind the distances between
various locations and other given parameters.
Page 11 of 13
Shortest distances between various locations :
VILLAGE 1 to B_TOWN 2 KM
VILLAGE 2 to B_TOWN 1.0 KM
VILLAGE 3 to B_TOWN 1.5 KM
VILLAGE 1 to VILLAGE 2 3.5 KM
VILLAGE 1 to VILLAGE 3 4.5 KM
VILLAGE 2 to VILLAGE 3 2.5 KM
A_CITY Head Office to B_HUB 25 KM
Note :
In Villages, there are community centers, in which one room has been given as
training center to this organization to install computers.
The organization has got financial support from the government and top IT
companies.
(i) Suggest the most appropriate location of the SERVER in the B_HUB (out of the 4
locations), to get the best and effective connectivity. Justify your answer.
(ii) Suggest the best wired medium and draw the cable layout (location to location) to
efficiently connect various locations within the B_HUB.
(iii) Which hardware device will you suggest to connect all the computers within each
location of B_HUB?
----------------------Best of Luck----------------------
Page 13 of 13