12 CS 2023-24 QP PB ISM Set123
12 CS 2023-24 QP PB ISM Set123
12 CS 2023-24 QP PB ISM Set123
083/1/1
NUMBER
I I I I SET NUMBER 1
GENERAL INSTRUCTIONS:
2. All aggregate functions except _____ ignore null values in their input collection. 1
(a) Count(attribute) (b) Count(*) (c) Avg( ) (d) Sum( )
Page 1 of 9
6. Name the protocol that is used to send emails. 1
(a) SMTP (b) IP (c) TCP (d) FTP
7. The command to merge the dictionary Book with Library would be: 1
(a) Book+Library (b) Book.add(Library)
(c) Book.update(Library) (d) Book.merge(Library)
8. Consider the statements given below and then choose the correct output from the given 1
options:
SS="PYTHON"
print( SS[ :3:])
(a) THON (b) HON (c) PYTH (d) PYT
9. Consider a tuple tupl = (10, 15, 25, 30). Identify the statement that will result in an error. 1
(a) print(tup1[2]) (b) tupl[2] = 20
(c) print(min(tupl)) (d) print(len(tupl))
10. Which is NOT the possible output for the following Python code? 1
import random
flowers=["Rose", "Jasmine", "Sunflower", "Lily"]
for I in range(random.randint(0,2)):
print(flowers[I],'*',end=" ")
Page 2 of 9
15. Fill in the blank: 1
------
is a device that connects dissimilar networks.
(a) Router (b) Repeater (c) Modem (d) Gateway
16. To move a file pointer f, 10 bytes ahead from the current position of file, function used is - 1
(a) f.seek(l0) (b) f.seek(lO,0) (c) f.seek(l0,1) (d) f.seek(l0,2)
Ql 7 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice
as
(a) Both A and Rare true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
18. Assertion (A):- To use a function from a particular module, we need to import the module. 1
Reasoning (R):- import statement can be written anywhere in the program, before using a
function from that module.
SECTIONB
OR
20. The code given below accepts a number as an argument and returns sum of all digits of a 2
number. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.
Def SumOfDigits(num):
s=0
whilenum>0
d==num % 10
s=s+d
num //=10
returns
print(SumOIDigits(1234))
21. Write a function VOWELS(STR) that takes string STR as an argument and returns the 2
number of vowels in the string.
OR
Write a function countCity(CITY) in Python, that takes the dictionary, CITY as an argument
and displays the names (in uppercase) of the cities whose names are longer than 7 characters.
Page 3 of 9
For example, Consider the following dictionary
CITY= {1:"Sydney" ,2: "Tokyo",3:"Pinkcity" ,4:"Beijing",5 :"Suncity"}
The output should be:
PINKCITY
23. Write the Python statement for each of the following tasks usmg BUILT-IN 2
functions/methods only:
(i) To insert an element 500 at the third position, in the list named, MYLIST.
(ii) To count number of characters in a string named, STRl including spaces.
OR
A list named Lstdata stores list of numbers. Write the Python command to import the
required module and (using built-in function) to display the middle value of numeric data in
a list Lstdata.
24. Ms. Shalini has just created a table named CAR containing columns CARID, Model, Maker 2
and Price.
Write SQL commands to :
(i) Add a column FUELTYPE to the table with datatype as varchar with 20 characters.
(ii) To display the structure of the table CAR.
OR
Kamal has created a table named WORKER. The attributes of Worker are as follows:
WORKER ID - CHARACTER OF SIZE 3
NAME - CHARACTER OF SIZE 10
SALARY-NUMERIC
Write SQL commands to:
(i) Kamal wants to increase the size of the NAME column from 10 to 20 characters.
Write an appropriate command to change the size.
(ii) Delete the table WORKER.
26. What output will be generated when the following Python code is executed? 3
s='criCkeT23'
n = len(s)
m="
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m + s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m=m+s[i-1]
else:
m=m+'#'
print(m)
27. Write the output of the queries (i) to (iii) based on the table, PATIENT given below: 3
Table: PATIENT
PNO NAME AGE DEPARTMENT CHARGES GENDER
PlOl Kavita 52 Surgery 800 F
P102 Ravi 35 ENT 200 M
P103 Sunil 45 Cardiology 250 M
P104 Shikha 40 ENT 300 F
P105 Rakhi 35 ENT 350 F
P106 Varun 30 Surgery 500 M
28. Write a function, COUNT_TLINES() in python to read a text file "Report.txt", that counts 3
and displays the number of lines which are starting with 'T' present in the text file.
OR
Write a function, COUNT_WORDS( ) in Python that counts and displays the number of
"DIET" word present in the text file "Health.txt".
Page5 of 9
Based on the data given above answer the following questions:
(i) If 3 columns are added and 1 row is deleted from the table GRADUATE, what will
be the new degree and cardinality of the above table?
(ii) Increase the STIPEND by 20% whose NAME starts with 'R'.
30. A list named, CList contains following record of customer as list elements: 3
[Customer_name, RoomType, Advance]
Each of these records are nested together to form a nested list. Write the following user
defined functions in Python to perform the specified operations on the stack named 'Hotel'
(i) Push_Cust( CList) - It takes the nested list as an argument and pushes a list object
containing name and advance of those customers who are staying in 'Delux' Room
Type.
(ii) Pop_Cust( )- It pops the objects from the stack and displays them. Also, the function
should display "Stack Empty" when there are no elements in the stack.
For example:
If the nested list contains the following data:
CList= [["Sunil","Delux",2000],["Rahul","Standard",1000],["Jerry","Delux",1500]]
31. Write queries (i) to (iv) based on the tables TRADERS and ITEMS given below: 4
Table: TRADERS
TCODE TNAME CITY
TOI ELECTRONICS SALES MUMBAI
T02 BUSY STORE CORP DELHI
T03 DISP HOUSE INC CHENNAI
Table: ITEMS
CODE INAME QTY PRICE COMPANY ITCODE
1001 Digital Pad 120 11000 XENITA TOI
1006 LED Screen 70 38000 SANTORA T02
1004 CAR GPS 60 2150 GEOKNOW TOI
1003 Digital Cam 12 X 160 '1 8000 DIGICLICK T02
1005 PenDrive 32GB 600 1200 STOREHOME T03
Page 6 of 9
(i) Display name, price and company of all the items in descending order of company .
(ii) Display item name and price of all those items, whose price is in the range of 5000and
1 5000. (both values inclusive).
(iii)Display Item name , company and Trader name from tables ITEMS and TRADERS.
(iv) Display the number of items, which are traded by each trader.
The expected output of this query should be:
TOI 2
T 03 1
T 02 2
3 2. Write a Program in Python that defines and calls the following user defined functions: 4
(i) addrec( )- To accept and add data of an item to a CSV file 'item.csv'. Each record
consists of a list with field elements as icode, description and price to store item
code, item description and price respectively.
(ii) countrec( )-To count and display the number of items with price less than 1 000.
SECTIONE
33. Bhartiya Connectivity Association located in Delhi has set up its new centre at Mangalore. 5
The Manglore office has 4 buildings as shown in the diagram below:
MANGLORE OFFICE
DELHI
HEAD OFFICE
TRAINING
RESOURCE
FINANCE
Page 7 of 9
Number of computers in each building is as follows:
ADMIN Building 25
FINANCE Building 50
TRAINING Building 150
RESOURCE Building 10
(i) Suggest and draw the cable layout to economically connect various buildings within
the Mangalore Centre for connecting the digital devices.
(ii) Suggest the most suitable place (i.e. building) to house the SERVER in Manglore
office with a suitable reason.
(iii) Suggest the placement of the following devices in each building at MANGLORE
office with justification:
• Repeater
• Switch
(iv) Which fast and very effective wireless transmission medium should preferably be
used to connect the head office at DELHI with the campus in MANGLORE?
(v) Suggest the type of network (out of LAN, MAN and WAN) to connect Training
Department in Manglore to Delhi Head office with suitable reason.
34. (i) Differentiate between 'w+' and 'r+' file modes in Python. 2+3=5
OR
(ii) Vivek wants to write a program in Python to insert the following record in the
table named BOOKS in MYSQL database, LIBRARY:
• bookid - integer
• bookname - string
• bookprice - float
Page 8 of 9
.
Note the following to establish connectivity between Python and MySQL:
• Usemame - root
• Password - tiger
• Host - localhost
The values of fields bookid, bookname and bookprice has to be accepted from the user.
Help Vivek to write the program in Python.
OR
(i) Give one difference between candidate key and alternate key.
(ii) Ravi has created a table named BOOKS in MYSQL database, LIBRARY:
• Bookid - integer
• bookname - string
• bookprice - float
Ravi, now wants to display the records of books whose price is less than 2000. Help
Ravi to write the program in Python.
Page 9 of 9
IIII CODE
NUMBER
SET NUMBER
083/1/2
2
GENERAL INSTRUCTIONS:
5. All aggregate functions except _____ ignore null values in their input collection. 1
(a) Count(attribute) (b) Count(*) (c) Avg( ) (d) Sum( )
Page 1 of 9
6. Which of these is not an example of unguided media? 1
(a) Optical Fibre Cable (b) Radio wave (c) Bluetooth (d) Satellite
7. The command to merge the dictionary Book with Library would be: 1
(a) Book+Library (b) Book.add(Library)
(c) Book.update(Library) (d) Book.merge(Library)
8. Consider the statements given below and then choose the correct output from the given 1
options:
S="DIGITAL#INDIA"
print(S[-4: 1:-2])
(a) N#AI (b) TG (c) N#AII (d) No Output
9. Consider a tuple tupl = (10, 15, 25, 30). Identify the statement that will result in an error. 1
(a) print(tupl [2]) (b) tup1[2] = 20
(c) print(min(tup 1)) (d) print(len(tup 1))
10. Which is NOT the possible output for the following Python code? 1
import random
flowers=["Rose", "Jasmine", "Sunflower", "Lily"]
for I in range(random.randint(0,2)):
print(flowers[I],'*',end=" ")
11. We can upload a file to a web server using a protocol called ____ 1
(a) FPT (b) IP (c) TCP (d) FTP
Page 2 of 9
15. Fill in the blank: 1
------ is a device that connects dissimilar networks.
(a) Router (b) Repeater (c) Modem (d) Gateway
16. To move a file pointer f, 10 bytes ahead from the current position of file, function used is - 1
(a) f.seek(l0) (b) f.seek(l0,0) (c) f.seek(l0, l ) (d) f.seek(l0,2 )
Ql7 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice
as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
18. Assertion (A):- To use a function from a particular module, we need to import the module. 1
Reasoning (R):- import statement can be written anywhere in the program, before using a
function from that module.
SECTIONB
OR
20. The code given below accepts a number as an argument and returns sum of all digits of a 2
number. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.
Def SumOfDigits(num):
s=0
while num>0
d== num % 10
s=s+d
num//=10
returns
print(SumOfDigits(1234))
21 . Write a function VOWELS(STR) that takes string STR as an argument and returns the 2
number of vowels in the string.
OR
Write a function countCity(CITY) in Python, that takes the dictionary, CITY as an argument
and displays the names (in uppercase) of the cities whose names are longer than 7 characters.
Page 3 of 9
For example, Consider the following dictionary
CITY={l :"Sydney",2:"Tokyo",3:"Pinkcity",4:"Beijing",5:"Suncity"}
The output should be:
PINKCITY
23. Write the Python statement for each of the following tasks usmg BUILT-IN 2
functions/methods only:
(i) To insert an element 300 at the fifth position, in the list named, LSTl.
(ii) To count number of characters in a string named, STRl including spaces.
OR
A list named Lstdata stores list of numbers. Write the Python command to import the
required module and (using built-in function) to display the middle value of numeric data in
a list Lstdata.
24. Ms. Shalini has just created a table named CAR containing columns CARID, Model, Maker 2
and Price.
Write SQL commands to :
(i) Add a column FUELTYPE to the table with datatype as varchar with 20 characters.
(ii) To display the structure of the table CAR.
OR
Kamal has created a table named WORKER. The attributes of Worker are as follows:
WORKER ID - CHARACTER OF SIZE 3
NAME - CHARACTER OF SIZE 10
SALARY - NUMERIC
Write SQL commands to
(i) Kamal wants to increase the size of the NAME column from 10 to 20 characters.
Write an appropriate command to change the size.
(ii) Delete the table WORKER.
b=5
callme( a,b)
callme(r= 1 0,q= 1)
Page 4 of 9
SECTION C
26. What output will be generated when the following Python code is executed? 3
Msgl ="WeLcOME"
Msg2="GUeSTs"
Msg3=""
fo r I in range(0,len(Msg2)+1):
if Msgl [I]>="A" and Msgl[I]<="M":
Msg3=Msg3+Msgl[I]
elif Msgl[I]>="N" and Msgl[I]<="Z":
Msg3=Msg3+Msg2[I]
else:
Msg3=Msg3 +"*"
print(Msg3)
27. Write the output of the queries (i) to (iii)based on the table, PATIENT given below: 3
Table: PATIENT
PNO NAME AGE DEPARTMENT CHARGES GENDER
P lOl Kavita 52 Surgery 800 F
P102 Ravi 35 ENT 200 M
P103 Sunil 45 Cardiology 250 M
P104 Shikha 40 ENT 300 F
P105 Rakhi 35 ENT 350 F
P106 Varun 30 Surgery 500 M
28. Write a function, DISPLAYLINES( ) in Python to read a text file 'Story.txt' and displays 3
those lines which are not starting with an alphabet 'S'.
OR
Write a function, Count_Dwords( ) in Python that counts and displays the number of words
ending with a digit in the text file named "Message.txt".
Page 5 of 9
Based on the data given above answer the following questions:
(i) If 1 column is added and 2 rows are deleted from the table GRADUATE, what will
be the new degree and cardinality of the above table?
(ii) Increase the STIPEND by 10% whose NAME ends with 'N'.
30. A list named, CList contains following record of customer as list elements: 3
[Customer_name, RoomType, Advance]
Each of these records are nested together to form a nested list. Write the following user
defined functions in Python to perform the specified operations on the stack named 'Hotel'
(i) Push_Cust( CList)-It takes the nested list as an argument and pushes a list object
containing name and advance of those customers who are staying in 'Delux' Room
Type.
(ii) Pop_Cust( )- It pops the objects from the stack and displays them. Also, the function
should display "Stack Empty" when there are no elements in the stack.
For example:
If the nested list contains the following data:
CList=[["Sunil","Delux",2000],["Rahul","Standard",1000],["Jerry","Delux",1500]]
31. Write queries (i) to (iv) based on the tables TRADERS and ITEMS given below: 4
Table: TRADERS
TCODE TNAME CITY
TOI ELECTRONICS SALES MUMBAI
T02 BUSY STORE CORP DELHI
T03 DISP HOUSE INC CHENNAI
Table: ITEMS
CODE INAME QTY PRICE COMPANY ITCODE
1001 Digital Pad 120 11000 XENITA T0l
1006 LED Screen 70 38000 SANTORA T02
1004 CAR GPS 60 2150 GEOKNOW T0l
1003 Digital Cam 12 X 160 8000 DIGICLICK T02
1005 PenDrive 32GB 600 1200 STOREHOME T03
Page 6 of 9
(i) Display name, price and company of all the items in descending order of item names .
(ii) Display item name and price of all those items, whose price is in the range of 10000
and 22000. (both values inclusive).
(iii)Display Item name and Trader name from tables ITEMSand TRADERS.
(iv) Display the number of items, which are traded by each trader.
The expected output of this query should be:
TOI 2
T 03 1
T 02 2
32. Write a Program in Python that defines and calls the following user defined functions: 4
(i) addrec( )- To accept and add data of an item to a CSV file 'item.csv'. Each record
consists of a list with field elements as icode, description and price to store item
code, item description and price respectively.
(ii) searchrec( )-To display the records of the those items with price less than 1000.
SECTIONE
33. Bhartiya Connectivity Association located in Delhi has set up its new centre at Mangalore. 5
The Manglore office has 4 buildings as shown in the diagram below:
MANGLORE OFFICE
DELHI
HEAD OFFICE
TRAINING
RESOURCE
FINANCE
Page 7 of 9
Number of computers in each building is as follows:
ADMIN Building 25
FINANCE Building 50
TRAINING Building 150
RESOURCE Building 10
•
(i) Suggest and draw the cable layout to economically connect various buildings within
the Mangalore Centre for connecting the digital devices.
(ii) Suggest the most suitable place (i.e. building) to house the SERVER in Manglore
office with a suitable reason.
(iii) Suggest the placement of the following devices in each building at MANGLORE
office with justification:
• Repeater
• Switch
(iv) Which fast and very effective wireless transmission medium should preferably be
used to connect the head office at DELHI with the campus in MANGLORE?
(v) Suggest the type of network (out of LAN, MAN and WAN) to connect Training
Department in Manglore to Delhi Head office with suitable reason.
34. (i) Differentiate between 'w+' and 'a+' file modes in Python. 2+3=5
OR
(ii) Aamir wants to write a program in Python to insert the following record in the
table named BOOKS in MYSQL database, LIBRARY:
• bookid - integer
• bookname - string
• bookprice - float
Page 8 of 9
Note the following to establish connectivity between Python and MySQL:
• Usemame - root
• Password - tiger
• Host - localhost
The values of fields bookid, bookname and bookprice has to be accepted from the user.
Help Aamir to write the program in Python.
OR
(ii) Sanjeev has created a table named BOOKS in MYSQL database, LIBRARY:
• Bookid - integer
• bookname - string
• bookprice - float
Sanjeev, now wants to display the records of books whose price is more than 1000.
Help Sanjeev to write the program in Python.
Page 9 of 9
CODE NUMBER 083/1/3
SET NUMBER
I 3
I
INDIAN SCHOOL MUSCAT
FIRST PRE BOARD EXAMINATION 2023
COMPUTER SCIENCE(083)
GENERAL INSTRUCTIONS:
5. All aggregate functions except _____ ignore null values in their input collection. 1
(a) Sum( ) (b) Count(*) (c) Avg( ) (d) Count(attribute)
Page 1 of 9
6. Which of these is not an example of unguided media? 1
(a) Satellite (b) Radio wave (c) Bluetooth (d) Optical Fibre Cable
7. The command to merge the dictionary Book with Library would be: 1
(a) Book+Library (b) Book.add(Library)
(c) Book.update(Library) (d) Book.merge(Library)
9. Consider a tuple tupl = (10, 15, 25, 30). Identify the statement that will result in an error. 1
(a) tup1[2] = 20 (b) print(tupl [2])
(c) print(min(tup1)) (d) print(len(tup1))
10. Which is NOT the possible output for the following Python code? 1
import random
flowers=["Rose","Jasmine","Sunflower","Lily"]
for I in range(random.randint(0,2)):
print(flowers[I],'*',end=" ")
Page 2 of 9
15. Fill in the blank: 1
------ is a device that connects dissimilar networks.
(a) Router (b) Repeater (c) Modem (d) Gateway
16. To move a file pointer f, 20 bytes ahead from the current position of file, function used is - 1
(a) f.seek(20) (b) f.seek(20,0) (c) f.seek(20,1) (d) f.seek(20,2)
QI 7 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice
as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
17. Assertion (A):- To use a function from a particular module, we need to import the module. 1
Reasoning (R):- import statement can be written anywhere in the program, before using a
function from that module.
SECTIONB
OR
(i) Give one advantage of bus topology and one advantage of star topology.
(ii) Explain packet switching.
20. The code given below accepts a number as an argument and returns sum of all digits of a 2
number. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.
Def SumOIDigits(num):
s=0
while num>0
d == num % 10
s=s+d
num //=10
return s
print(SumOIDigits(1234))
21. Write a function VOWELS(STR) that takes string STR as an argument and returns the 2
number of vowels in the string.
OR
Write a function countCity(CITY) in Python, that takes the dictionary, CITY as an argument
and displays the names (in uppercase) of the cities whose names are longer than 7 characters.
Page 3 of 9
For example, Consider the following dictionary
CITY= { 1: "Sydney",2: "Tokyo",3: "Pinkcity",4: "Beijing",5: "Suncity"}
The output should be:
PINK.CITY
23. Write the Python statement for each of the following tasks usmg BUILT-IN 2
functions/methods only:
(i) To add elements 10, 60, 90 to the end of the list named, LISTI.
(ii) To count number of characters in a string named, STRl including spaces.
OR
A list named Lstdata stores list of numbers. Write the Python command to import the
required module and (using built-in function) to display the middle value of numeric data in
a list Lstdata.
24. Ms. Shalini has just created a table named CAR containing columns CARID, Model, Maker 2
and Price.
Write SQL commands to :
(i) Add a column FUELTYPE to the table with datatype as varchar with 20 characters.
(ii) To display the structure of the table CAR.
OR
Kamal has created a table named WORKER. The attributes of Worker are as follows:
WORKER ID -CHARACTER OF SIZE 3
NAME -CHARACTER OF SIZE 10
SALARY -NUMERIC
Write SQL commands to
(i) Kamal wants to increase the size of the NAME column from 10 to 20 characters.
Write an appropriate command to change the size.
(ii) Delete the table WORKER.
26. What output will be generated when the following Python code is executed? 3
Msgl ="AuGMenTeD"
Msg2="REality"
Msg3=""
for I in range(0,len(Msg2)+1):
ifMsgl[I]>="A" and Msgl[l]<="M":
Msg3=Msg3+Msgl [I]
elifMsgl[I]>="N" and Msgl[I]<="Z":
Msg3=Msg3+Msg2[1]
else:
Msg3=Msg3+"*"
print(Msg3)
27. Write the output ofthe queries (i) to (iii) based on the table, PATIENT given below: 3
Table: PATIENT
PNO NAME AGE DEPARTMENT CHARGES GENDER
P lOl Kavita 52 Surgery 800 F
P l 02 Ravi 35 ENT 200 M
P103 Sunil 45 Cardiology 250 M
P104 Shikha 40 ENT 300 F
P105 Rakhi 35 ENT 350 F
P106 Varun 30 Surgery 500 M
28. Write a function, DISPLAY( ) in Python to read a text file 'Diary.txt' and displays those 3
lines which are starting with an alphabet 'D'.
OR
Write a function, CountUpper( ) in Python to read a text file "Notes.txt" that counts and
displays the number ofuppercase letters present in the text file.
Page 5 of 9
Based on the data given above answer the following questions:
(i) If 1 column is deleted and 3 rows are added to the table GRADUATE, what will be
the new degree and cardinality of the above table?
30. A list named, CList contains following record of customer as list elements: 3
[Customer_name, Room Type, Advance]
Each of these records are nested together to form a nested list. Write the following user
defined functions in Python to perform the specified operations on the stack named 'Hotel' :
(i) Push_Cust( CList)- It takes the nested list as an argument and pushes a list object
containing name and advance of those customers who are staying in 'Delux' Room
Type.
(ii) Pop_Cust( )-It pops the objects from the stack and displays them. Also, the function
should display "Stack Empty" when there are no elements in the stack.
For example:
If the nested list contains the following data:
CList=[["Sunil","Delux",2000],["Rahul","Standard",1000],["Jerry","Delux",1500]]
31. Write queries (i) to (iv) based on the tables TRADERS and ITEMS given below: 4
Table: TRADERS
TCODE TNAME CITY
TOI ELECTRONICS SALES MUMBAI
T02 BUSY STORE CORP DELHI
T03 DISP HOUSE INC CHENNAI
Table: ITEMS
CODE INAME QTY PRICE COMPANY ITCODE
1001 Digital Pad 120 11000 XENITA TOI
1006 LED Screen 70 38000 SANTORA T02
1004 CAR GPS 60 2150 GEOKNOW TOI
1003 Digital Cam 12 X 160 8000 DIGICLICK T02
1005 PenDrive 32GB 600 1200 STOREHOME T03
Page 6 of 9
(i) Display name, price and company of all the items in ascending order of item names.
(ii) Display item name and price of all those items, whose price is in the range of 1 0000
and 40000. (both values inclusive).
(iii) Display Item name, Trader name and City from tables ITEMS and TRADERS.
(iv) Display the number of items, which are traded by each trader.
The expected output of this query should be:
TOI 2
T 03 1
T 02 2
32. Write a Program in Python that defines and calls the following user defined functions: 4
(i) addrec( ) - To accept and add data of a product to a CSV file 'product.csv'. Each
record consists of a list with field elements as pcode, description and price to store
product code, product description and price respectively.
(ii) searchrec( )-To display the records of the those products with price more than 3000.
SECTIONE
33. Bhartiya Connectivity Association located in Delhi has set up its new centre at Mangalore. 5
The Manglore office has 4buildings as shown in the diagram below:
MANGLORE OFFICE
DELHI
HEAD OFFICE
TRAINING
RESOURCE
FINANCE
Page 7 of 9
Number ofcomputers in each building is as follows:
ADMIN Building 25
FINANCE Building 50
TRAINING Building 150
RESOURCE Building 10
(i) Suggest and draw the cable layout to economically connect various buildings within
the Mangalore Centre for connecting the digital devices.
(ii) Suggest the most suitable place (i.e. building) to house the SERVER in Manglore
office with a suitable reason.
(iii) Suggest the placement of the following devices in each building at MANGLORE
office with justification:
• Repeater
• Switch
(iv) Which fast and very effective wireless transmission medium should preferably be
used to connect the head office at DELHI with the campus in MANGLORE?
(v) Suggest the type of network (out of LAN, MAN and WAN) to connect Training
Department in Manglore to Delhi Head office with suitable reason.
34. (i) Differentiate between 'r+' and 'a+' file modes in Python. 2+3=5
OR
(ii) Samir wants to write a program in Python to insert the following record in the
table named BOOKS in MYSQL database, LIBRARY:
• bookid - integer
• bookname - string
• bookprice - float
Page 8 of 9
Note the following to establish connectivity between Python and MySQL:
• Usemame - root
• Password - tiger
• Host - localhost
The values of fields bookid, bookname and bookprice has to be accepted from the user.
Help Samir to write the program in Python.
OR
(ii) Ramesh has created a table named BOOKS in MYSQL database, LIBRARY:
• Bookid - integer
• bookname - string
• bookprice - float
Ramesh, now wants to display the records of books whose price is more than 2000.
Help Ramesh to write the program in Python.
Page 9 of 9
~