[go: up one dir, main page]

0% found this document useful (0 votes)
63 views35 pages

Question Bank Class XII IP 065 Long Question Answer

Long answer questions.

Uploaded by

Monika Vashisht
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views35 pages

Question Bank Class XII IP 065 Long Question Answer

Long answer questions.

Uploaded by

Monika Vashisht
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Worksheet long Questions With Answer

Session : 2023-24
Class –XII
Subject- Informatics Practices (065)

Data Handling using Pandas and Data Visualization

Q.1. Write the code in pandas to create the following dataframes :


df1 df2
mark1 mark2 mark1 mark2
0 10 150 30 20
1 40 45 1 20 25
2 15 302 20 30
3 40 703 50 30
Write the commands to do the following operations on the dataframes
given above :
(i) To add dataframes df1 and df2.
(ii) To subtract df2 from df1
(iii) To rename column mark1 as marks1in both the dataframes df1 and
df2.
(iv) To change index label of df1 from 0 to zero and from 1 to one.

Answer.
import numpy as np
import pandas as pd
df1 = pd.DataFrame({'mark1':[30,40,15,40],
'mark2':[20,45,30,70]});
df2 = pd.DataFrame({'mark1':[10,20,20,50],
'mark2':[15,25,30,30]});
print(df1)
print(df2)
(i) print(df1.add(df2))
(ii) print(df1.subtract(df2))
(iii) df1.rename(columns={'mark1':'marks1'}, inplace=True)
print(df1)
(iv) df1.rename(index = {0: "zero", 1:"one"}, inplace = True)
print(df1)

Q.2. Write a program in Python Pandas to create the following DataFrame batsman
from a Dictionary:
B_NO Name Score1 Score2
1 Sunil Pillai 90 80
2 Gaurav Sharma 65 45
3 Piyush Goel 70 90
4 Kartik Thakur 80 76
Perform the following operations on the DataFrame :
1)Add both the scores of a batsman and assign to column “Total”
2)Display the highest score in both Score1 and Score2 of the DataFrame.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 1


3)Display the DataFrame

Answer.

import pandas as pd
d1={'B_NO':[1,2,3,4],
'Name':["Sunil Pillai","Gaurav Sharma","Piyush Goel","Kartik
Thakur"],'Score1':[90,65,70,80], 'Score2':[80,45,95,76]
}
df=pd.DataFrame(d1)
print(df)
df['Total'] = df['Score1']+ df['Score2']

Q.3. Write Python code to plot a bar chart for India’s medal tally as shown below:

Also give suitable python statement to save this chart.

Answer.

import matplotlib.pyplot as plt


Category=['Gold','Silver','Bronze']
Medal=[20,15,18]
plt.bar(Category,Medal)
plt.ylabel('Medal')
plt.xlabel('Medal Type')
plt.title('Indian Medal tally in Olympics')
plt.show()
plt.savefig("aa.jpg")

Q.4. Write a python program to plot a line chart based on the given data to depict the
changing weekly average temperature in Delhi for four weeks.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 2


Week=[1,2,3,4]
Avg_week_temp=[40,42,38,44]

Answer.
import matplotlib.pyplot as plt
Week=[1,2,3,4]
Avg_week_temp=[40,42,38,44]
plt.plot(Week,Avg_week_temp)
plt.show()

Q.5. Mr. Som, a data analyst has designed the DataFrame df that contains data about
Computer Olympiad with ‘CO1’, ‘CO2’, ‘CO3’, ‘CO4’, ‘CO5’ as indexes shown below.
Answer the following questions:

A. Predict the output of the following python statement:


i. df.shape
ii. df[2:4]
B. Write Python statement to display the data of Topper column of indexes CO2 to CO4.
OR (Option for part iii only)
Write Python statement to compute and display the difference of data of Tot_students column
and First_Runnerup column of the above given DataFrame.

Answer.
A. Output:
i. (5,4)

ii. School tot_students Topper First_Runner_up


CO3 GPS 20 18 2
CO4 MPS 18 10 8

1 mark for each correct output


B. Python statement:
print(df.loc['CO2': 'CO4', 'Topper'])
OR
print(df.Tot_students-df.First_Runnerup)
2 marks for correct Python statement

Q.6. Ekam, a Data Analyst with a multinational brand has designed the DataFrame df that
contains the four quarter’s sales data of different stores as shown below:

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 3


Store Qtr1 Qtr2 Qtr3 Qtr4
0 Store1 300 240 450 230
1 Store2 350 340 403 210
2 Store3 250 180 145 160

Answer the following questions:


i. Predict the output of the following python statement:
a. print(df.size)
b. print(df[1:3])
ii. Delete the last row from the DataFrame.
iii. Write Python statement to add a new column Total_Sales which is the addition of all the 4
quarter sales.
OR
(Option for part iii only)
Write Python statement to export the DataFrame to a CSV file named data.csv stored at D:
drive.

Answer.
i. a. 15
b. Store Qtr1 Qtr2 Qtr3 Qtr4
1 Store2 350 340 403 210
2 Store3 250 180 145 160

ii. df=df.drop(2)
OR
df.drop(2,axis=0)

iii. df["total"]=df["Qtr1"]+df["Qtr2"]+df["Qtr3"]+df["Qtr4"]
OR
df.to_csv(“D:\data.csv”)
(1 mark for each correct output/statement)

Q.7. The heights of 10 students of eighth grade are given below:


Height_cms=[145,141,142,142,143,144,141,140,143,144]
Write suitable Python code to generate a histogram based on the given data, along with an
appropriate chart title and both axis labels.
Also give suitable python statement to save this chart.

Answer.
import matplotlib.pyplot as plt #Statement 1
Height_cms=[145,141,142,142,143,143,141,140,143,144]
#Statement 2
plt.hist(Height_cms) #Statement 3
plt.title("Height Chart") #Statement 4
plt.xlabel("Height in cms") #Statement 5
plt.ylabel("Number of people") #Statement 6
plt.show() #Statement 7
(½ mark each for each correct statement 1,2,4,5,6,7)
(1 mark for correct statement 3)
plt.savefig("heights.jpg")

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 4


(1 mark for the correct statement)

Q.8. Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below:

Also give suitable python statement to save this chart.

Answer.
import matplotlib.pyplot as plt #Statement 1
hobby = ('Dance', 'Music', 'Painting', 'Playing Sports')
#Statement 2
users = [300,400,100,500] #Statement 3
plt.bar(hobby, users) #Statement 4
plt.title("Favourite Hobby") #Statement 5
plt.ylabel("Number of people") #Statement 6
plt.xlabel("Hobbies") #Statement 7
plt.show() #Statement 8
(½ mark for each correct statement)
plt.savefig("hobbies.jpg")
(1 mark for the correct statement)

Q.9. Write Python code to plot a bar chart to depict the programming language usage as shown below:

Answer.
import numpy as np
import matplotlib.pyplot as plt

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 5


objects = ('DotNet', 'C++', 'Java', 'Python', 'C', 'CGI/PERL')
y_pos = np.arange(len(objects))
performance = [8,10,9,20,4,1]
plt.bar(y_pos, performance, align='center', color='blue')
plt.xticks(y_pos, objects) #set location and label
plt.ylabel('Usage')
plt.title('Programming language usage')
plt.show()

Q.10. Write a program to plot a bar chart to depict the changing weekly onion prices for four weeks.
Write appropriate code to provide axes labels and save the plot.
week=[1,2,3,4]
prices=[40,50,100,97]

Answer.
import matplotlib.pyplot as plt
week=[1,2,3,4]
prices=[40,50,100,97]
plt.bar(week,prices,label='Weeks',color=['red','blue','orange','yell
ow'])
plt.title("Onion prices in four weeks")
plt.xlabel("weeks")
plt.ylabel('Price')
plt.xticks([1,2,3,4])
plt.show()

Q.11. Pratigya, a data analyst, has designed the dataframe df that contains data about Employees with
‘EO1’, ‘EO2’, ‘EO3’, ‘EO4’, ‘EO5’ as indexes shown below. Answer the following questions:

Name Gender Designation City Salary

E01 Ritika F Manager Delhi 90000


E02 Geet M Programmer Mumbai 80000
E03 Rahul M IT Officer Ahmedabad 86000

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 6


E04 Rijul M Analyst Lucknow 55000
E05 Anita F Programmer Bengaluru 89000

(a) Predict the output of the following python statement:


(i) df.columns
(ii) df.loc*‘E02’: ‘E04’+
(b) Write Python statement to display the data of Designation column of indexes E01 to E03.
OR
Write Python statement to display Salary of Programmers from the above dataframe.

Answer.
(a) (i) Index(['Name', 'Gender', 'Designation', 'City',’Salary’+, dtype='object')
(ii) E02 Geet M Programmer Mumbai 80000
E03 Rahul M IT Officer Ahmedabad 86000
E04 Rijul M Analyst Lucknow 55000

(b) df.loc['E01':'E03','Designation']
Or
df[„Salary‟] or df.Salary

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 7


Database Query using SQL
Q.1.

Answer.
mysql> Select Name,SalesAmt from Store order by noOfEmp;
mysql> Select city, sum(SalesAmt) from store group by City;
mysql> Select count(*),City from store group by City having
count(*)>2;
mysql> Select Min(DateOpen) from Store;
+---------------+
| Min(DateOpen) |
+---------------+
| 2015-02-06 |
+---------------+
mysql> Select Count(StoreId), NoOfEmp from Store group by
NoOfemp having max(SalesAmt)<60000;
+----------------+---------+
| Count(StoreId) | NoOfEmp |
+----------------+---------+
| 1 | 10 |
| 1 | 11 |
|1|5|
|1|7|
+----------------+---------+

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 8


Q.2.
(i) In a school, a database named “school” is created in mysql whose
password is “cbse”. Smith is trying to add a new record of a student
havingdetails(3,‟Michelle‟,‟Agartala‟) in a“student”table.

(ii) Write the code in python to read the contents of “number.csv” file
consisting of data from a mysql table and print the data of the table on the
screen in tabular form of the table.

Answer.
i)import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="cbse",
database="school"
)
mycursor = mydb.cursor()
mycursor.execute("INSERT INTO student values(3,'Michelle',
'Agartala');")
mydb.commit()

ii) f = open('numbers.csv', 'r')


with f:
reader = csv.reader(f)
for row in reader:
for e in row:
print(e)

Q.3. Write the SQL functions which will perform the following operations:
i) To display the name of the month of the current date .
ii) To remove spaces from the beginning and end of a string, “ Panorama “.
iii) To display the name of the day eg, Friday or Sunday from your date of birth, 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

Answer.
i) monthname(date(now()))
ii) trim(“ Panaroma “)
iii) dayname(date(dob))
iv)instr(name, fname)
v) mod(n1,n2)

Q.4. Consider a table SALESMAN with the following data:

SNO SNAME SALARY BONUS DATE OF JOIN


A01 Beena Mehta 30000 45.23 29-10-2019
A02 K. L. Sahay 50000 25.34 13-03-2018
B03 Nisha Thakkar 30000 35.00 18-03-2017
B04 Leela Yadav 80000 NULL 31-12-2018

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 9


C05 Gautam Gola 20000 NULL 23-01-1989
C06 Trapti Garg 70000 12.37 15-06-1987
D07 Neena Sharma 50000 27.89 18-03-1999

Write SQL queries using SQL functions to perform the following operations:
a) Display salesman name and bonus after rounding off to zero decimal places.
b) Display the position of occurrence of the string “ta” in salesman names.
c) Display the four characters from salesman name starting from second character.
d) Display the month name for the date of join of salesman
e) Display the name of the weekday for the date of join of salesman

Ans.
i) Select sname, round(bonus,0) from Salesman;
ii) Select instr(Sname, “ta”) from Salesman;
iii) Select mid(Sname,2,4) from Salesman;
alternative answer
iii) Select Substring(Sname,2,4) from Salesman;
iv) Select monthname(DateofJoin) from Salesman;
v) Select dayname(DateofJoin) from Salesman;

Q.5.
Carefully observe the following table named ‘stock’:
Table: stock
Pid PName Category Qty Price
1 Keyboard IO 15 450
2 Mouse IO 10 350
3 Wifi-router NW 5 2600
4 Switch NW 3 3000
5 Monitor O 10 4500
6 Printer O 4 17000
Write SQL queries for the following:
(a) To display the records in decreasing order of price.
(b) To display category and category wise total quantities of products.
(c) To display the category and its average price.
(d) To display category and category wise highest price of the products.

Answer.
(a) select * from stock order by price desc;
(b) select category, sum(qty) from stock group by category;
(c) select category,avg(price) from stock group by category;
(d) select category, max(price) from stock group by category;

Q.6. Satyam, a database analyst has created the following table:


Table: Student
RegNo SName Stream Optional Marks
S1001 Akshat Science CS 99
S1002 Harshit Commerce IP 95

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 10


S1003 Devika Humanities IP 100
S1004 Manreen Commerce IP 98
S1005 Gaurav Humanities IP 82
S1006 Saurav Science CS NULL
S1007 Bhaskar Science CS 95
S1007 Bhaskar Science CS 96

He has written following queries:


( a) select sum(MARKS) from student where OPTIONAL= ‘IP’ and STREAM= ‘Commerce’;
(b) select max(MARKS)+min(MARKS) from student where OPTIONAL= ‘CS’;
(c) select avg(MARKS) from student where OPTIONAL= ‘IP’;
(d) select length(SNAME) from student where MARKS is NULL;
Help him in predicting the output of the above given queries.

Answer.
(a) 193
(b) 194
(c) 93.75
(d) 6

Q.7. Based on the above given table named ‘Student’, Satyam has executed following
queries:
Select count(*) from student;
Select count(MARKS) from student;
Predict the output of the above given queries.
Also give proper justifications of the output generated through each query.

Answer.
First query will produce the output 7.
Justification: count (*) will count and display total number of rows (irrespective of any null
value present in any of the column).
Second query will produce the output 6.
Justification: count (col_name) will count and display total number of not null values in the
specified column.

Q.8. Write suitable SQL query for the following:


i. Display 7 characters extracted from 7th left character onwards from the string ‘INDIA
SHINING’.
ii. Display the position of occurrence of string ‘COME’ in the string ‘WELCOME WORLD’.
iii. Round off the value 23.78 to one decimal place.
iv. Display the remainder of 100 divided by 9.
v. Remove all the expected leading and trailing spaces from a column userid of the table
„USERS‟.

Answer.
i. select mid('INDIA SHINING',7,7);
ii. select INSTR('WELCOME WORLD','COME');
iii. select round(23.78,1);

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 11


iv. select mod(100,9);
v. select trim(userid) from users;

Q.9. Explain the following SQL functions using suitable examples.


i. UCASE()
ii. TRIM()
iii. MID()
iv. DAYNAME()
v. POWER()

Answer.
1. UCASE(): It converts the string into upper case.
Example:
SELECT UCASE(‘welcome world’);
Output:
WELCOME WORLD
2. TRIM(): It removes the leading and trailing spaces from the given string.
Example:
SELECT TRIM(‘ Welcome world ‘ );
Output:
Welcome world
3. MID(): It extracts the specified number of characters from given string.
Example:
SELECT MID(‘ Welcome world,4,,4);
Output:
Come
4. DAYNAME(): It returns the weekday name for a given date
Example:
SELECT DAYNAME(‘2022-07-22’);
Output:
Friday
5. POWER(): It returns the value of a number raised to the power of another number.
Example:
SELECT POW(6,2);
Output:
36

Q.10. Shreya, a database administrator has designed a database for a clothing shop. Help her
by writing answers of the following questions based on the given table:
TABLE: CLOTH

CCODE CNAME SIZE COLOR PRICE DOP


C001 JEANS XL BLUE 990 2022-01-21
C002 T SHIRT M RED 599 2021-12-12
C003 TROUSER M GREY 399 2021-11-10
C004 SAREE FREE GREEN 1299 2019-11-12
C005 KURTI L WHITE 399 2021-12-07

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 12


i. Write a query to display cloth names in lower case.
ii. Write a query to display the lowest price of the cloths.
iii. Write a query to count total number of cloths purchased of medium size.
OR (Option for part iii only)
Write a query to count year wise total number of cloths purchased.

Answer.
i. SELECT LOWER(CNAME) FROM CLOTH;
ii. SELECT MIN(PRICE) FROM CLOTH;

1 mark for each correct query

iii. SELECT COUNT(*) FROM CLOTH GROUP BY SIZE HAVING SIZE='M';


OR
SELECT YEAR(DOP),COUNT(*) FROM CLOTH GROUP BY YEAR(DOP);
2 marks for correct query

Q.11. Preeti manages database in a blockchain start-up. For business purposes, she created a
table named BLOCKCHAIN. Assist her by writing the following queries:
TABLE: BLOCKCHAIN

i. Write a query to display the year of oldest transaction.


ii. Write a query to display the month of most recent transaction.
iii. Write a query to display all the transactions done in the month of May.
iv. Write a query to count total number of transactions in the year 2022.

Answer.
i. SELECT YEAR(MIN(TRANSACTION_DATE)) FROM BLOCKCHAIN;
ii. SELECT MONTH(MAX(TRANSACTION_DATE)) FROM BLOCKCHAIN;
iii. SELECT * FROM BLOCKCHAIN WHERE MONTHNAME
(TRANSACTION_DATE)='MAY';
iv. SELECT COUNT(ID) FROM BLOCKCHAIN WHERE
YEAR(TRANSACTION_DATE)=2022;
(1 mark for each correct query)

Q.12. Write suitable SQL queries for the following:


i. To calculate the exponent for 3 raised to the power of 4.
ii. To display current date and time.
iii. To round off the value -34.4567 to 2 decimal place.
iv. To remove all the probable leading and trailing spaces from the column userid of
the table named user.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 13


v. To display the length of the string „FIFA World Cup‟.

Answer.
i. SELECT POWER(3,4);

ii. SELECT NOW();


iii.SELECT ROUND(-34.4567,2);
iv. SELECT TRIM(USERID) FROM USER;
v. SELECT LENGTH("FIFA World Cup");
(1 mark for each correct query)

Q.13. Kabir has created following table named exam:


+-------+---------+------------------+-------+
| RegNo | Name | Subject | Marks |
+-------+---------+------------------+-------+
| 1 | Sanya |Computer Science| 98 |
| 2 | Sanchay | IP | 100 |
| 3 | Vinesh | CS | 90 |
| 4 | Sneha | IP | 99 |
| 5 | Akshita | IP | 100 |
+-------+---------+------------------+-------+
Help him in writing SQL queries to the perform the following task:
i. Insert a new record in the table having following values:
[6,'Khushi','CS',85]
ii. To change the value “IP” to “Informatics Practices” in subject column.
iii. To remove the records of those students whose marks are less than 30 .
iv. To add a new column Grade of suitable datatype.
v. To display records of “Informatics Practices” subject.

Answer.

i. INSERT INTO EXAM VALUES(6,'Khushi','CS',85);


ii. UPDATE EXAM SET subject= "Informatics Practices" where
subject = "IP";
iii. DELETE FROM EXAM WHERE marks<30;
iv. ALTER TABLE EXAM ADD COLUMN grade varchar(2);
v. Select * from exam where subject="Informatics Practices";

(1 mark for each correct query)

Q.14. Write the SQL commands which will perform the following operations?
a. To display the starting position of your last name (lname) from the whole name
(name).
b. To display dayname, month name and year from today‟s date.
c. To display the remainder on dividing 3 raised to power 5 by 5.
d. To display „I am here‟ in lower as well as uppercase.

Answer.
select instr(name,lname)
select dayname(now()),monthname(now()),year(now());

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 14


select mod(power(3,5),5);
select lcase('I am here'),ucase('I am here');

Q.15. Consider the table Salesman with the given data

Write SQL queries using function to perform the following operation:


a. Display Scode and Sales after rounding off the Sales to 1 decimal place.
b. Display the dayname from Dojoin of Salesman.
c. Display the position of occurrence of “a” in the Sname.
d. Display three characters from Sname starting from the second character for those
salesmen whose name ends with „t‟.

Answer.
Select scod, round(Sales,1) from Salesman
Select dayname(Dojoin) from Salesman
Select instr(Sname,”a”) from Salesman
Select substr(Sname,2,3) from Salesman where name like “%t”

Q.16. Write the SQL commands which will perform the following operations?
a. To display the position of space character in your name (myname).
b. To display day, month and year from today‟s date.
c. To compute 5 raised to the power remainder on dividing 15 by 4.
d. To display the leftmost as well as the rightmost character of the string „PYTHON‟.

Answer.

select instr(myname,‟ „)
select day(now()),month(now()),year(now());
select pow(5,mod(15,4));
select left('PYTHON',1),right('PYTHON',1);

Q.17. Consider the table Salesman with the given data

Write SQL queries using function to perform the following operation:


a. Display maximum sales for each area.
b. Display the month name from Dojoin of Salesman.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 15


c. Display those addresses which anywhere contain „i‟.
d. Display two characters from Sname starting from the first character for those
salesmen who belong to Delhi.

Answer.
select area,max(sales) from Salesman group by area
select monthname(dojoin) from salesman
select(Address) from salesman where Address like „%i%‟
select left(Sname,2) from Salesman where Address=”Delhi”

Q.18. Write the SQL functions which will perform the following operations:
i) To display the name of the month of the current date .
ii) To remove spaces from the beginning and end of a string, “ Panorama “.
iii) To display the name of the day eg, Friday or Sunday from your date of birth, dob.
iv) To display the starting position of your first name(fname) from your whole name
(name).

Answer.
i) monthname(date(now()))
ii) trim(“ Panaroma “)
iii) dayname(date(dob))
iv)instr(name, fname)

Q.19. Consider the following table of automobile

Write SQL queries using SQL functions to perform the following operations:
a) Display company name and body wheel base after rounding off to nearest ten’s
decimalplaces.
b) Display the position of occurrence of the string “dan” in body style.
c) Display the 3 characters from company name starting from second character.
d) Display the year of manufacturing for sedan;

Answer.
a) Select company, round(wheel-base,-1) from automobile;
b) Select instr(body-style,’dan’) from automobile;
c) Select substr(company,2,3) from automobile; /mid(company,2,3)
d) Select year(dateofmanufacture) from automobile where body-style=’sedan’;

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 16


e) Select dayname(dateofmanufacture) from automobile;

Q.20. Write the SQL functions which will perform the following operations:

i) To display the name of the month of your birthdate .


ii) To remove spaces from the beginning of a string, “ Python“.
iii) To display the day of the week eg, Sunday from current date.
iv) To display the starting 3 characters from your name .
v) To compute the power of 2 to the power 3

Answer.
i)select monthname(‘1998-11-20’);
ii)select ltrim(‘ Python’);
iii)select dayname(now());
iv)select left(‘Nitin’,3);
v)Select power(2,3);

Introduction to Computer Networks


Q.1. A company in Mega Enterprises has 4 wings of buildings as shown in the
diagram :

Center to center distances between various Buildings:


W3 to W1 - 50m
W1 to W2 - 60m
W2 to W4 - 25m
W4 to W3 - 170m

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 17


W3 to W2 - 125m
W1 to w4 - 90m
Number of computers in each of the wing:
W1 - 150
W2 - 15
W3 - 15
W4 - 25
Computers in each wing are networked but wings are not networked The company
has now decided to connect the wings also.
i. Suggest a most suitable cable layout for the above connections.
ii. Suggest the most appropriate topology of the connection
between the wings.
iii. The company wants internet accessibility in all the wings.
Suggest a suitable technology .
iv. Suggest the placement of the following devices with
justification if the company wants minimized network traffic
a)Repeater
b)Hub / switch
v. The company is planning to link its head office situated in
New Delhi with the offices in hilly areas. Suggest a way to connect it
economically.

Answer.
i) Most suitable layout according to distance is :

1 mark for an appropriate cable layout


ii) Star Topology
1 mark for correct topology
iii) Broadband.
1 mark for suggesting suitable technology
iv). a. Not required. Repeaters may be skipped as per above layout (because
distance is less than 100 m)
b. In every wing

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 18


½ mark for placement of repeater ½ mark for placement of hub / switch
iv) Radio Waves
1 mark for the appropriate connectivity mode between HQ and other offices

Q.2. “Anutulya Creations”-A start-up fashion house has set up its main centre at Kanpur,
Uttar Pradesh for its dress designing, production and dress supplying activities. It has 4
blocks of buildings.
Distance between the various blocks is as follows:
A to D 50 m
A to P 60 m
A to S 110m
D to S 60m
P to S 50m
P to D 150m
Numbers of computers in each block
Block A - 20
Block D - 80
Block P - 15
Block S - 8

Based on the above specifications, answer the following questions:


(a) Out of LAN, WAN and MAN, what type of network will be formed if we interconnect
different computers of the campus? Justify.
(b) Suggest the topology which should be used to efficiently connect various blocks of
buildings within Kanpur centre for fast communication.
Also draw the cable layout for the same.
(c) Suggest the placement of the following device with justification
i. Repeater
ii. Hub/Switch
(d) Now a day, video-conferencing software is being used frequently by the company to
discuss the product details with the clients. Name any one video conferencing software.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 19


Also mention the protocol which is used internally in video conferencing software.

Answer.
(a) LAN

As computers are placed with-in the same campus with-in a small range.
½ Mark for correct answer
½ Mark for correct justification
(b) Star topology

½ Mark for correct answer


Cable Layout:

½ Mark for correct cable layout


(c)
i. Repeater should be placed in between Block ‘D’ (Design) and Block ‘P’ as distance is more.
ii. Hub/Switch should be placed in each building to connect various computers together.

½ Mark for each correct answer


(d) Video Conferencing software: Teams, Zoom, Skype etc. (Any one)

Protocol of Video Conferencing software: VOIP


½ Mark for each correct answer

Q.3. Prime Computer services Ltd. is an international educational organization. It is planning


to set up its India campus at Mumbai with its head office in Delhi. The Mumbai office
campus has four main buildings-ADMIN, ACCOUNTS, EXAMINATION and RESULT.
You as a network expert have to suggest the best network related solutions for their problems
raised in (i) to (v), keeping in mind the distances between the buildings and other given
parameters.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 20


(i) Suggest the most appropriate location of the server inside the MUMBAI campus (out of
the four buildings) to get the best connectivity for maximum number of computers. Justify
your answer.
(ii) Suggest and draw cable layout to efficiently connect various buildings within the
MUMBAI campus for a wired connectivity.
(iii) Which networking device will you suggest to be procured by the company to
interconnect all the computers of various buildings of MUMBAI campus?
(iv) Company is planning to get its website designed which will allow students to see their
results after registering themselves on its server. Out of the static or dynamic, which type of
website will you suggest?
(v) Which of the following will you suggest to establish the online face to face
communication between the people in the ADMIN office of Mumbai campus and Delhi head
office?
a) Cable TV
b) Email
c) Video conferencing
d) Text chat

Answer.
(i) Server should be installed in Admin department as it has maximum number of
computers
(ii)

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 21


iii. Hub/Switch
iv. Dynamic
v. Video conferencing

Q.4. XYZ Media house campus is in Delhi and has 4 blocks named Z1, Z2, Z3 and Z4. The
tables given below show the distance between different blocks and the number of computers
in each block.

The company is planning to form a network by joining these blocks.


i. Out of the four blocks on campus, suggest the location of the server that will provide the
best connectivity. Explain your response.
ii. For very fast and efficient connections between various blocks within the campus, suggest
a suitable topology and draw the same.
iii. Suggest the placement of the following devices with justification
(a) Repeater
(b) Hub/Switch
iv. VoIP technology is to be used which allows one to make voice calls using a broadband
internet connection. Expand the term VoIP.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 22


v. The XYZ Media House intends to link its Mumbai and Delhi centers. Out of LAN, MAN,
or WAN, what kind of network will be created? Justify your answer.

Answer.

i. Z2 as it has maximum number of computers.


ii. For very fast and efficient connections between various blocks within the campus suitable
topology: Star Topology

iii. Repeater: To be placed between Block Z2 to Z4 as distance between them is more than
100 metres.
Hub/Switch: To be placed in each block as each block has many computers that needs to be
included to form a network.
iv. Voice Over Internet Protocol
v. WAN as distance between Delhi and Mumbai is more than 40kms.
(1 mark for each correct answer)

Q.5. Shop Biz Ltd. is an international educational organization. It is planning to set up its India
campus in Bengaluru with its head office in Delhi. The Bengaluru campus has four main buildings—
ADMIN, ENGINEERING, BUSINESS and MEDIA.

You, as a network expert, have to suggest the best network-related solutions for the
problems raised in (a) to (e), keeping in mind the distances between the buildings and
other given parameters.
Shortest distance between various buildings:

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 23


(a) Suggest the most appropriate location for the server inside the Bengaluru campus (out of the four
buildings) to get the best connectivity for a maximum number of computers. Justify your
answer.
(b) Suggest and draw the cable layout to efficiently connect various buildings within the Bengaluru
campus for connecting the computers.
(c) Which hardware device will you suggest to be procured by the company to protect and control
internet use within the campus?
(d) Which of the following will you suggest to establish online face-to-face communication between
the people in the Admin Office of the Bengaluru campus and Delhi Head Office?
(i) Cable TV (ii) Email (iii) Video conferencing (iv) Text Chat
(e) The company has created its website for better reach to the people but it is not yet published.
What is the name of the procedure that allows them to construct their own websites and make them
accessible to internet users?

Answer.
(a) ADMIN (due to a maximum number of computers) or MEDIA (due to shorter distance from other
buildings).
(b) The cable layout for connecting computers in the Bengaluru campus:

(c) Firewall or Router


(d) (iii) Video conferencing
(e) Web hosting

Q.6. Perfect Edu. Services Ltd. is an educational organization. It is planning to set up its India campus
at Chennai
with its head office in Delhi. The Chennai campus has four main buildings—ADMIN, ENGINEERING,
BUSINESS and MEDIA. 4
You, as a network expert, have to suggest the best network-related solutions for their problems
raised in
(a) to (d), keeping in mind the distances between the buildings and other given parameters.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 24


(a) Suggest the most appropriate location for the server inside the Chennai campus (out of the 4
buildings)
to get the best connectivity for maximum number of computers. Justify your answer.
(b) Suggest and draw the cable layout to efficiently connect various buildings within the Chennai
campus
for connecting the computers.
(c) Which hardware device will you suggest to be procured by the company to be installed to protect
and
control the internet use within the campus?
(d) Which of the following will you suggest to establish online face-to-face communication between
the
people in the Admin Office of the Chennai campus and Delhi Head Office?
(i) Cable TV (ii) Email (iii) Video conferencing (iv) Text Chat

Answer.
(a) ADMIN (due to maximum number of computers) or MEDIA (due to shorter distance from other
buildings)
(b) The suitable cable layout is:

(c) Firewall or Router


(d) (iii) Video conferencing

Q.7. Quick Learn University is setting up its academic blocks at Prayag Nagar and planning to set up a
network.
The university has 3 academic blocks and one human resource centre as shown in the diagram given
below:

Number of computers in each of the buildings is as follows:


Law block 15
Technology block 40

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 25


HR centre 115
Business block 25

(a) Suggest a cable layout of connection between the blocks.


(b) Suggest the most suitable place to house the server of the organization with suitable reason.
(c) Which device should be placed/installed in each of these blocks to efficiently connect all the
computers
within these blocks?
(d) The university is planning to link its Sales counters situated in various parts of the same city.
Which
type of network out of LAN, MAN or WAN will be formed?

Answer.
(a) The cable layout of connection between the blocks is:

(b) HR Centre because it consists of the maximum number of computers to house the server.
(c) Switch should be placed in each of these blocks.
(d) MAN will be formed as Sales counters are in the same city.

Q.8. Indian School, in Mumbai is starting up the network between its different wings.
There are four Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL. The
distance between various buildings is as follows:

The number of computers is as follow:

a. Suggest the cable layout of connections between the buildings.


b. Suggest the most suitable place (i.e., building) to house the server of this school,
provide a suitable reason.
c. Suggest the placement of the following devices with justification.
Repeater, Hub/Switch
d. The organisation also has inquiry office in another city about 100 kms away in hilly
region. Suggest the suitable transmission media to interconnect to school and inquiry
office out of the following :
Fiber optic cable, Microwave, Radiowave

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 26


Answer.

Server can be placed in the ADMIN building as it has the maxium number of computer.
Repeater can be placed between ADMIN and SENIOR building as the distance is more
than 110 m.
Also, hub/switch to be used in each building.
Radiowaves can be used in hilly regions as they can travel through obstacles.

Q.9. Trine Tech Corporation (TTC) is a professional consultancy company. The


company is planning to set up their new offices in India with its hub at Hyderabad. As a
network adviser, you have to understand their requirements and suggest them the best
available solutions. Their queries are mentioned as (a) to (d) below. TTC is having three
blocks, namely Human Resource Block, Conference Block and Finance Block.

Distance between blocks:

Block (From) Block (To) Distance


Human Conference 110
Resource
Human Finance 40
Resource
Conference Finance 80

Also, the number of computers to be installed in each block are:

Block Computers
Human Resource 25
Finance 120
Conference 90

a. What will be the most appropriate block, where TTC should plan to install their server?
b. Draw a block to cable layout to connect all the buildings in the most appropriate
manner for efficient communication.
c. What will be the best possible connectivity out of the following, you will suggest to
connect the new setup of offices in Bangalore with its London based office: Satellite
Link, Infrared, Ethernet Cable
d. Which of the following device will be suggested by you to connect each computer in
each of the buildings: Switch, Modem, Gateway

Answer.
Finance block because it has the maximum number of computers.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 27


Satellite link
Switch

Q.10. ABC is an online corporate training provider company for IT related courses. The
company is setting up their new campus in Kolkata. You as a network expert have to
study the physical locations of various blocks and the number of computers to be
installed. In the planning phase, provide the best possible answers for the queries (i) to
(iv) raised by them.

Distance between blocks:

Block (From) Block (To) Distance


Administrative Finance 60
Administrative Faculty studio 120
Finance Faculty studio 70

Also, the number of computers to be installed in each block are:

Block Computers
Administrative 20
Finance 40
Faculty studio 120

a. Suggest the most appropriate block, where ABC should plan to install the server.
b. Suggest the most appropriate block to block cable layout to connect all three blocks
for efficient communication.
c. Which type of network out of the following is formed by connecting the computers of
these three blocks? LAN, MAN, WAN
d. Which wireless channel out of the following should be opted by ABC to connect to
students from all over the world? Infrared, Microwave, Satellite.

Answer.
Faculty studio
Star topology
LAN
Satellite Connection

Q.11. A company XYZ Enterprises has four blocks of buildings as shown:

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 28


Center to center distance between various blocks.

B3 TO B1 40 M
B1 TO B2 50 M
B2 TO B4 15 M
B4 TO B3 150 M
B3 TO B2 115 M
B1 TO B4 90 M

Number of computers in each block :

B1 140
B2 20
B3 18
B4 30

Computers in each block are networked but blocks are not networked. The company has
now decided to connect the blocks also
a. Suggest the most appropriate topology for the connections between the blocks.
b. The company wants internet accessibility in all the blocks. The suitable and cost-
effective technology for that would be ___.
c. Which device will you suggest for connecting all the computers within each of their
blocks?
d. The company is planning to link its head office situated in New Delhi with the offices in
hilly areas. Suggest a way to connect it economically:

Answer.
Star topology
Broadband
Switch/Hub
Radio waves

Q.12. The Virtual Connects organization has set up its new centre at Noida for its office
and web-
based activities. It has 4 blocks of buildings as shown in the diagram below:

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 29


(i) Suggest the most suitable place (the Block) to install the server of this organization
with a
suitable reason.
(ii) Which device will you suggest to be placed/installed in each of these blocks to
efficiently
connect all the computers within these blocks?
(iii) Suggest the placement of a Repeater in the network with justification.
(iv) The organization is planning to link its office to an office in the hilly areas. Suggest a
wayto connect it economically. Justify your answer.

Answer.
(i) The most suitable place to install the server is Block C as this place has maximum
number of
computers.
(ii)Switch
(iii) Repeater may be placed when the distance between 2 buildings is more than 70
metres, i.e.,
Block B to Block C
Block A to Block D
Block B to Block D
(iv) Radio waves, because these waves are easy to generate, can travel long distances
and can
penetrate mountains easily.

Societal Impacts
Q.1. Match the following:
Column A Column B

Fakers, by offering special rewards or money prize


Plagiarism asked for personal information, such as bank account
information

Copy and paste information from the Internet into your


Hacking
report and then organize it

The trail that is created when a person uses the


Credit card fraud
Internet.

Digital Foot Print


Breaking into computers to read private emails and

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 30


other files

Answer.

Q.2. Why is it so important to carefully think of digital footprint?

Answer. It is very important to have a clean and secure digital footprint because:-

• It gives us a digital persona by defining our online behavior.


• The digital footprint is often used by universities before approving admissions to a
student.
• The digital footprint is also used by future employers, and law enforcement offices, to
find people with positive and clean digital footprint.
• The digital footprint should not provide personal information as it could be
misinterpreted or misused for theft of identity

Q.3. What is plagiarism? How can you avoid plagiarism while


referring to someone's else's creation?

Answer. Plagiarism is stealing someone else's intellectual work and representing it as


your own work without citing the source of information.

We can avoid plagiarism while referring to someone's else's creation by giving credit
whenever we use
• Another person's idea, opinion, or theory.
• Quotations of another person's actual spoken or written words.
• Paraphrase of another person's spoken or written words

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 31


Q.4. How can you protect your digital properties?
Answer.
Some protective measures:-

• Anti-Temper Solutions: - There are many anti-tamper solution available today which
ensure that your digital property is tamper-proof. These anti-temper solutions use a host
of advanced technologies to prevent hackers from hacking, reverse-engineering or
manipulating your digital properties such as utility tools, software, apps, video games
and so forth.
• Legal Clauses: - Add legal clause in the clauses of use of your software/digital
properties. You must include a transparent clause in your software's Terms of Service
that prohibits the scraping of your software's source code for reuse. This is a sound legal
backup for you.
• Limit the sharing of software code: - You should share your software code only with
trusted individuals who are part of development team. You should also use a Digital
Rights Management (DRM) solution to protect your software from being scraped for
source code using decompilers etc.

Q.5. What are some types of software licenses?Explain.


Answer.
Some types of software licenses are:-

(i) GNU General Public License (GPL):- The GNU General Public License (GPL) is
probably one of the most commonly used licenses for open-source projects. The GPL
grants and guarantees a wide range of rights to developers who work on open-source
projects. Basically, it allows users to legally copy, distribute and modify software.

(ii) GNU Lesser General Public License (LGPL):- It offers lesser rights to a work than the
standard GPL license. The LGPL is used to license free software so that it can be
incorporated into both free software and proprietary software. The LGPL and GPL
licenses differ with one major exception; with LGPL the requirement that you have to
release software extensions in open GPL has been removed.

Mostly, LGPL is used by libraries. LGPL is also called GNU libraries and formally called
the Library GPL.

(iii) BSD License: - BSD licenses represent a family of permissive free software licenses
that have fewer restrictions on distribution compared to other free software licenses such
as the GNU General Public License.

(iv) MIT License: - The MIT License is the shortest and probably broadest of all the
popular open-source licenses. Its terms are very loose and more permissive than most
other licenses.

(v) Apache License: - The Apache License, grants a number of rights to users. These
rights can be applied to both copyrights and patents.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 32


Q.6. What are some health concerns related to the excessive use
of technology?
Answer. Although technology has improved our lives enormously yet it should be used in
moderate amounts. Excessive use of technology, such as smart phones, computers,
online gaming, social media etc. leads to many health related problems. In the following
lines we are discussing major health concerns related to excessive technology usage:

1. Impact on Hearing: - Studies have proven that listening to music that loud for more
than 15 minutes cause hearing damage over time. Also, it has been said that using
headphones increases the bacteria levels in your ears over 700 times when used for
more than an hour. This shocking statistic came from a study way back in 1992 when
experts measured bacteria on 20 headsets.

2. Impact on Bones and Joints: - Use of technology has affected our postures. Most of
the times, we sit in the same postures and make similar, repetitive movements, e.g.,
thumb movements on mobile phones. Slouching, or using your joints and muscles in
repetitive movements all cause strain on our muscles and joints. A Repetitive Strain
Injury (RSI) is an injury or disorder of the muscles, nerves, tendons, ligaments and joints.

3. Eye Problems: - Constant exposure to smart phone, laptops and computer screens
impacts our vision and may lead to other eye related problems. The blue light that
comes from our phones and computers is very damaging on the retina, even more than
UV light; this may even lead to vision loss. Computer Vision Syndrome (CVS) is a
technology related health condition affecting eyesight.

4. Sleep Issues: - Excessive smartphone, computer and tablet use can disrupt our sleep.
Bright lights from these devices block melatonin secretion, the hormone that regulates
sleep and this leads to smaller sleep cycles and disrupted sleep. Sleep is so essential
for overall health that it impacts our normal thinking and behavioral patterns, memory
and attention span.

5. Mental Health Issues: - Excessive use of technology leads to isolation as people don't
get time to physically socialize. It sometimes also leads to anxiety and depression as by
looking at picture perfect social media profile of others, people often tend to think that
their "connections" have "perfect rosy lives" while they are not.
Excessive use of technology and Internet leads to addiction. People keep obsessively
looking through emails and messages. They start feeling stress if they don't get some
likes or replies on their posts etc. This problem is formally termed as Internet addiction
disorder.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 33


Q.7. Compare and Contrast
(i) Free software and Open source software
(ii) OSS and FLOSS
(iii) Proprietary software and Free software
(iv) Freeware and Shareware
(v) Freeware and Free software.

Answer.
(i) Free software: - Software available free of cost and also can be copied and
redistributed but no source code is available.

Open source software: - Software whose source code is available and which can be
modified, copied and redistributed.

(ii) Open source software: - Software whose source code is available and which can be
modified, copied and redistributed.

FLOSS: - Free Libre and Open Source Software or to Free Livre and Open Source
Software. The term FLOSS is used to refer to a software which is both free software as
well as open source software. Here the words libre (a Spanish word) and livre (a
Portuguese word) mean freedom.

(iii) Proprietary software: - Proprietary software is the software that is neither open nor
freely available. Its use is regulated and further distribution and modification is either
forbidden or requires special permission by the supplier or vendor. Source code of
proprietary software is normally not available.

Free software: - Software available free of cost and also can be copied and redistributed
but no source code is available.

(iv) Freeware: - The term freeware is generally used for software, which is available free
of cost and which allows copying and further distribution, but not modification and whose
source code is not available. Freeware should not be mistaken for open software or for
free software. Freeware is distributed in binary form (ready to run) without any licensing
fee. In some instances the right to use the software is limited to certain types of users,
for instance, for private and non-commercial purposes. One example is Microsoft
Internet Explorer, which is made available as freeware.

Shareware: - Shareware is software, which is made available with the right to


redistribute copies, but it is stipulated that if one intends to use the software, often after a
certain period of time, then a license fee should be paid.

(v) Freeware: - The term freeware is generally used for software, which is available free
of cost and which allows copying and further distribution, but not modification and whose
source code is not available. Freeware should not be mistaken for open software or for
free software. Freeware is distributed in binary form (ready to run) without any licensing
fee. In some instances the right to use the software is limited to certain types of users,

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 34


for instance, for private and non-commercial purposes. One example is Microsoft
Internet Explorer, which is made available as freeware.

Free software: - Software available free of cost and also can be copied and redistributed
but no source code is available.

Prepared By Mr. Gautam Somani PGT(CS/IP) Alok School Sector-11,Udaipur Page 35

You might also like