0% found this document useful (0 votes)
53 views22 pages

FULL PORTIONS 1 ANSWER KEY Ekbs

The document is an answer key for a question paper from Everest Kenbridge Senior Secondary School, containing 37 questions across five sections, with varying marks assigned to each section. It includes programming questions that must be answered using Python and provides correct answers for multiple-choice questions and programming outputs. The document also contains instructions for answering the questions and specific guidelines for marking.

Uploaded by

saisharveshama
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)
53 views22 pages

FULL PORTIONS 1 ANSWER KEY Ekbs

The document is an answer key for a question paper from Everest Kenbridge Senior Secondary School, containing 37 questions across five sections, with varying marks assigned to each section. It includes programming questions that must be answered using Python and provides correct answers for multiple-choice questions and programming outputs. The document also contains instructions for answering the questions and specific guidelines for marking.

Uploaded by

saisharveshama
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/ 22

EVEREST KENBRIDGE SR. SEC.

SCHOOL
MARAIYUR ROAD, SITHARKADU, MAYILADUTHURAI – 609003.

ANSWER KEY – FULL PORTIONS - 1

General Instructions:
● Thisquestionpapercontains37questions.
● Allquestionsarecompulsory.However,internalchoiceshavebeenprovidedinsome questions.
Attempt only one of the choices in such questions
● Thepaperisdividedinto5Sections-A,B,C,DandE.
● SectionAconsistsof21questions(1to21).Eachquestioncarries1Mark.
● SectionBconsistsof7questions(22to28).Eachquestioncarries2Marks.
● SectionCconsistsof3questions(29to31).Eachquestioncarries3Marks.
● SectionDconsistsof4questions(32to35).Eachquestioncarries4Marks.
● SectionEconsistsof2questions(36to37).Eachquestioncarries5Marks.
● AllprogrammingquestionsaretobeansweredusingPythonLanguageonly.
● IncaseofMCQ,textofthecorrectanswershouldalsobewritten(Nomarksshouldbe
provided if student does not write the correct choice )

QNo. Section-A(21x1=21Marks) Marks

1. StateTrueor False:
(1)
ThePythonstatementprint(‘Alpha’+1)isexampleofTypeErrorError

Ans:True
2. Whatidtheoutputoffollowingcodesnippet?

country= "GlobalNetwork" (1)


result="-".join(country.split("o")).upper()
print(result)
(A) GL-BALNETW-RK
(B) GL-BA-LNET-W-RK
(C) GL-BA-LNET-W-RK
(D) GL-BA-LNETWORK

Ans:A)GL-BALNETW-RK

Page:1/22
3. Identifytheoutputofthefollowingcodesnippet:

text="The_quick_brown_fox"
index = text.find("quick")
(1)
result=text[:index].replace("_","")+text[index:].upper()
print(result)

(A) Thequick_brown_fox
(B) TheQUICK_BROWN_FOX
(C) TheQUICKBROWNFOX
(D) TheQUICKBROWN_FOX

Ans:(B)TheQUICK_BROWN_FOX

WhatwillbetheoutputofthefollowingPython expression? x = 5
4.
y= 10
result=(x**2+y)//x*y-x print(result) (1)

(A) 0
(B) -5
(C) 65
(D) 265

Ans: (C)65

Whatwillbetheoutputofthefollowingcodesnippet?
5.
(1)
text="PythonProgramming" print(text[1
: :3])

(A) Phoai
(B) yoPgmn
(C) yhnPormig
(D) Ptorgamn
Ans:(B)

6. Whatwillbetheoutputofthefollowingcode?
tuple1 = (1, 2, 3)
tuple2=tuple1+(4,)
tuple1 += (5,)
print(tuple1, tuple2) (1)

(A) (1,2,3)(1,2,3,4)
(B) (1,2,3,5)(1,2, 3)
(C) (1,2,3,5)(1,2,3,4)
(D) Error

Ans:C)
Page:2/22
7. Dictionarymy_dictasdefinedbelow,identifytypeoferrorraisedby statement
my_dict['grape']?
my_dict={'apple':10,'banana':20,'orange':30}
ValueError (1)
(B) TypeError
(C) KeyError
(D) ValueError
Ans:(C) KeyError
8. Whatdoesthelist.pop(x)methoddoinPython?

A. Removesthefirstelementfromthelist. (1)
B. Removestheelementatindexxfromthelistandreturnsit.
C. Addsanewelementat indexxinthe list.
D. ReplacestheelementatindexxwithNone.

Ans:B.Removestheelementatindexxfromthelistandreturns it.

In a relational database table with one primary key and three unique
9. constraintsdefinedondifferentcolumns(notprimary),howmanycandidate keys
can be derived from this configuration?
(1)
(A)1
(B)3
(C)4
(D)2

Ans:C)4
10. Fillintheblankstocompletethefollowingcodesnippetchoosingthe correct
option:

withopen("sample.txt","w+")asfile:
(1)
file.write("Hello, World!")# Write a string to the file
position_after_write = file. #Getthepositionafterwriting
file.seek(0)# Move the pointer to the beginning
content=file.read(5)#Readthefirst5characters print(content)

(A) tell
(B) seek
(C)read
(D)write

Ans:(A)tell

Page:3/22
11. StatewhetherthefollowingstatementisTrueorFalse:
In Python, if an exception is raised inside a try block and not handled,
theprogramwillterminatewithoutexecutinganyremainingcodeinthe finally (1)
block.

Ans:False

Page:4/22
12. Whatwillbetheoutputofthefollowingcode? x =
4
def reset():
globalx
x=2
print(x,end='&')
def update(): (1)
x+=3
print(x,end='@')

update()
x=6
reset()
print(x,end='$')

(A) 7@2&6$
(B) 7@6&6$
(C) 7@2&2$
(D) Error
Ans:(D)Error:Unboundlocalvariablexinfunction update()
WhichSQLcommandcanmodifythestructureofanexistingtable,suchas adding
13. or removing columns? (1)

(A) ALTERTABLE
(B) UPDATETABLE
(C) MODIFYTABLE
(D) CHANGETABLE

Ans.(A)ALTERTABLE
14. Whatwillbetheoutputofthe query?
SELECT*FROMordersWHEREorder_dateLIKE'2024- 10-%';
(A) DetailsofallordersplacedinOctober2024
(B) DetailsofallordersplacedonOctober10th,2024 (1)
(C) Detailsofallordersplacedintheyear2024
(D) Detailsofallordersplacedonanydayin2024

Ans:(A)DetailsofallordersplacedinOctober2024

WhichofthefollowingstatementsabouttheCHARandVARCHAR datatypes
15.
in SQL is false?
(A) CHARisafixed-lengthdatatype,anditpadsextraspacestomatchthe
specified length. (1)
(B) VARCHARisavariable-lengthdatatypeanddoesnotpadextraspaces.
(C) ThemaximumlengthofaVARCHARcolumnisalwayslessthanthatof a
CHAR column.
(D) CHARisgenerallyusedforstoringdataofaknown,fixedlength.
Ans: (C)

Page:5/22
16. Whichofthefollowingaggregatefunctionscanbeemployedtodetermine the
number of unique entries in a specific column, effectively ignoring
duplicates?
(1)
(A) SUM()
(B) COUNT()
(C) AVG()
(D) COUNT(DISTINCTcolumn_name)
Ans:(D)COUNT(DISTINCTcolumn_name)

17. Whichprotocolisusedtosend e-mailover internet?


(A) FTP
(B) TCP
(C) SMTP
(D) SNMP (1)
Ans.(C)SMTP
18. Whichdeviceisprimarilyusedtoamplifyandregeneratesignalsina network,
allowing data to travel longer distances?
(A) Switch
(B) Router (1)
(C) Repeater
(D) Bridge
Ans: (C) Repeater
19. Which communication technique establishes a dedicated communication
path between two devices for the entire duration of a transmission, (1)
ensuring a continuous and consistent connection?

Ans: CircuitSwitching
Q20andQ21areAssertion(A)andReason(R)basedquestions.Mark the
correct choice as:
(A) Both AandRare trueandRisthecorrectexplanationfor A
(B) BothAandRaretrueandRisnotthecorrectexplanation for A
(C) AisTruebutRisFalse
(D) AisFalse butRisTrue

Assertion(A):Pythonfunctionscanacceptpositional,keyword,anddefault
20. parameters.

Reasoning(R):Defaultparametersallowfunctionargumentstobeassigned a (1)
default value if no argument is provided during the function call.

Ans : (B) Both Aand R are true and R is not the correct explanantion
for A
Assertion(A):AGROUPBYclauseinSQLcanbeusedwithoutany aggregate
21.
functions.
Reasoning(R):TheGROUPBYclauseisusedtogrouprowsthathavethe (1)
samevaluesinspecifiedcolumnsandmustalwaysbepaired with
aggregate functions.
Page:6/22
Ans:(C )Ais True ,butR is False

QNo Section-B(7x2=14Marks) Marks


ConsiderthefollowingPythoncodesnippet:
22.
a= [1,2,3]
b=a (2)
a.append(4)
c=(5,6,7)
d = c + (8,)
a. Explainthemutabilityof aandcinthecontextof thiscode.
b. Whatwillbethevaluesofbanddafterthecodeisexecuted?

Ans:a)aisamutableobject(alist),meaningitscontentscanbe
changed after it is created. This is demonstrated bythe append()
method that adds an element to the list.
c is an immutable object (a tuple). Once created, its contents cannot
bechanged.Theoperationc+(8,)doesnotmodifycbutcreatesanew tuple.

b)The valueofbwillbe[1,2,3,4],asbreferencesthesamelistasa, which was


modified by appending 4.
Thevalueofdwillbe(5,6,7,8),astheexpressionc+(8,)createsa new tuple
combining c and (8,).

(1 marks+ 1Marks)

Giveexamplesforeachofthefollowingtypesof operatorsinPython:
23.
(2)
(I)AssignmentOperators

(II)Identity Operators

Ans:

(I)Assignment Operators: ( 1 MarksforAny oneofthem)

1. Example1:=(SimpleAssignment)Usage:x=5(assignsthe value
5to x)
2. Example2:+=(AddandAssign) :Usage:x+=3(equivalenttox
=x+3)

(II)IdentityOperators:(1Marks foranyoneof them)

1. Example1: is,Usage: xisy(checksif xandyrefertothe same


object)
2. Example2: isnot:Usage: xisnoty(checksif xandydo not refer
to the same object)

Page:7/22
IfL1=[10,20,30,40,20,10,...] andL2=[5,15,25,...], then:
24.
(Answerusingbuiltinfunctionsonly)

(I) A)Writeastatementtocounttheoccurrencesof20inL1. OR (2)


B)WriteastatementtofindtheminimumvalueinL1.

(II) A)WriteastatementtoextendL1withallelementsfromL2.
OR
B)Writeastatementtogetanewlistthatcontainstheuniqueelements from L1.

Ans:I( A):count_20=L1.count(20)
(B): min_value=min(L1)

II(A): L1.extend(L2)
(B):unique_elements=list(set(L1))

(1marksforeachcorrectanswer,nomarksifdidnotused any built


in function )

25. Identifythecorrectoutput(s)ofthefollowingcode.Alsowritetheminimum and the


maximum possible values of the variable b.
importrandom
text="Adventure"
b=random.randint(1,5) for
i in range(0, b):
print(text[i],end='*') (2)

(A)A* (B)A*D*

(C)A*d*v* (D)A*d*v*e*n*t*u*
Ans: Minimumpossiblevalueof b:1( 1/2+1/2marks)
 Maximumpossiblevalueofb:5

PossibleOutputs: (A)and(C ) (1/2+1/2 marks)

Page:8/22
26. The code provided below is intended to reverse the order of elements in a
givenlist.However,therearesyntaxandlogicalerrorsinthecode.Rewrite it after
removing all errors. Underline all the corrections made.

defreverse_list(lst)
if not lst:
return (2)
lstreversed_lst=lst[::-
1] return reversed_lst
print("Reversedlist:"reverse_list[1,2,3,4])

Ans: Corrections: (1/2x 4 =2)


iAddedacolon(:)afterthe functiondefinition.
ii. Indentedtheifstatementandthereturnstatementforproper
structure.
iii. Put()whilecallingthefunctionreverse_list()
iv. Addedacomma (,)intheprintstatementforcorrectsyntax.

27. (I)
A) Whatconstraintshouldbeappliedtoatablecolumntoensurethatall values
in that column must be unique and not NULL?
OR
B) Whatconstraintshouldbeappliedtoatablecolumntoensurethatitcan have
multiple NULL values but cannot have any duplicate non-NULL values? (2)

(II)
A) Write an SQL command to drop the unique constraint named
unique_emailfromacolumnnamedemailinatablecalledUsers.
OR
B) WriteanSQLcommandtoaddauniqueconstrainttotheemailcolumn of an
existing table named Users, ensuring that all email addresses are unique.

Ans:(I)(A):UsetheUNIQUEconstraintalongwiththeNOTNULLOR
PRIMARY KEY constraint.
OR
(B):UsetheUNIQUEconstraintalone,allowingformultipleNULL
values.
Example:column_nameINTUNIQUENULL

(II)(A):ALTERTABLEUsersDROPCONSTRAINTunique_email;
OR
(B):ALTERTABLEUsersADDCONSTRAINTunique_emailUNIQUE (email);

(1markeachforcorrectpartforeachquestionsanycorrectexample as
ananswer is acceptable )

Page:9/22
28. A) Explainoneadvantageandonedisadvantageofmeshtopologyin
computer networks.
OR (2)
B) ExpandthetermDNS.WhatroledoesDNSplayinthefunctioningofthe
Internet?

Ans:
(A) :AdvantageofMeshTopology:Highredundancy;ifoneconnection fails,
data can still be transmitted through other nodes.
DisadvantageofMeshTopology:Complexityandhighcost;requires more
cabling and configuration compared to simpler topologies.
OR

(B) : ·DNS stands for Domain Name System. It translates human-


readabledomainnames(likewww.example.com)intoIPaddressesthat
computers use to identify each other on the network.

(for partA 1/2 + 1/2)


(forpartB 1/2 for correctabbreviationand1/2forcorrect use)

QNo. Section-C(3x3=9Marks) Marks

29. A) Write a Python function that extracts and displays all the words present in a
text file “Vocab.txt” that begins with a vowel..
OR (3)
B) Write a Python function that extracts and displays all the words
containing a hyphen ("-") from a text file "HyphenatedWords.txt", which
has a three letter word before hypen and four letter word after hypen.
For example : “for-them” is such a word.
Ans :A)
defdisplay_words_starting_with_vowel():
vowels = 'AEIOUaeiou'
withopen('Vocab.txt','r')asfile:
words=file.read().split()
#Loopthroughthewordsandcheckifthefirstletterisavowel for
word in words:
ifword[0]invowels: print(word)

B)
def display_specific_hyphenated_words():
withopen('HyphenatedWords.txt','r')asfile:
words=file.read().split()
#Loopthroughthewordsandcheckiftheymatchthepattern for
word in words:
parts=word.split('-')
#Checkifthewordishyphenatedandmatchestheformat"XXX- XXXX"
iflen(parts)==2andlen(parts[0])==3andlen(parts[1])==4: print(word)

Page:10/22
1/2 mark forfileopening+1/2 mark forcorrectloop+1/2markfor
correctuseofsplit()+1markforcorrectcondition+1/2markfor output

(A) You have a stack named MovieStack that contains records of movies.
30. Each movie record is represented as a list containing movie_title,
director_name,andrelease_year.Writethefollowinguser-definedfunctions in
Python to perform the specified operations on the stack MovieStack:

(I) push_movie(MovieStack, new_movie): This function takes the stack


MovieStackandanewmovierecordnew_movieasargumentsandpushes the
new movie record onto the stack.

(II) pop_movie(MovieStack):Thisfunctionpopsthetopmostmovierecord
from the stack and returns it. If the stack is empty, the function should
display "Stack is empty".

(III) peek_movie(MovieStack): This function displays the topmost movie (3)


recordfromthestackwithoutdeletingit.Ifthestackisempty,thefunction should
display "None".

OR

(B) Write the definition of a user-defined function push_odd(M) which


acceptsalistofintegersinaparameterMand pushesallthoseintegers which are
odd from the list M into a Stack named OddNumbers.

Writethefunctionpop_odd()topopthetopmostnumberfromthestackand return it.


If the stack is empty, the function should display "Stack is empty".

Writethefunctiondisp_odd()todisplayallelementsofthestackwithout deleting
them. If the stack is empty, the function should display "None".

For example:

IftheintegersinputintothelistNUMBERSare:[7,12,9,4, 15]

ThenthestackOddNumbersshouldstore:[7,9,15]

Ans:(A)
def push_movie(movie_stack, new_movie): #1mark

movie_stack.append(new_movie)

def pop_movie(movie_stack):

if not movie_stack: #1mark

return "Stack is empty"

Page:11/22
return movie_stack.pop()

defpeek_movie(movie_stack):

if not movie_stack: #1mark

return "None"

returnmovie_stack[-1]
OR

(B)defpush_odd(M,odd_numbers):

for number in M: #1mark

if number % 2 != 0:

odd_numbers.append(number)

def pop_odd(odd_numbers):

if not odd_numbers: #1mark

return "Stack is empty"

returnodd_numbers.pop()

def disp_odd(odd_numbers):

if not odd_numbers: #1mark

return "None"

returnodd_numbers

Page:12/22
31. Predicttheoutputofthefollowingcode:
data=[3,5,7,2]
result=""
fornumindata:
for i in range(num):
result+=str(i)+"*"
result=result[:-1]
print(result)
OR

Predicttheoutputofthefollowingcode: (3)
numbers = [10, 15, 20]
for num in numbers:
forjinrange(num//5):
print(j,"+",end="")
print()

Ans: 0*1*2*0*1*2*3*4*0*1*2*3*4*5*6*0*1
(1markforpredictingcorrectoutputsequenceof numbers
+ 1 mark for predicting correct placement of * + 1
mark for removing last * )

OR
0+1+
0+1+2+
0+1+2+3+
(1MARKForputtingoutputinthreelines+1markfor predicting
correct sequence of numbers in each line ( 1/2 for
incorrect partially correct) + 1 mark for
correctplacementof+)
QNo. Section-D( 4x4=16Marks) Marks

32. ConsiderthetableORDERSasgivenbelow

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
1005 David Tablet NULL 7000

Note:Thetablecontainsmanymorerecordsthanshown here. (4)


A) Writethefollowingqueries:
(I) TodisplaythetotalQuantityforeachProduct,excludingProductswith total
Quantity less than 5.
(II) TodisplaytheORDERStablesortedbytotalpriceindescendingorder.
(III) TodisplaythedistinctcustomernamesfromtheORDERS table.
Page:13/22
(IV)Todisplaythesum ofthePriceofalltheordersforwhichthequantity is NULL.
OR
B) Writethe output:
(I) SELECTC_Name,SUM(Quantity)ASTotal_QuantityFROMORDERS
GROUP BY C_Name;
(II) SELECT*FROMORDERSWHEREProductLIKE'%phone%';
(III) SELECTO_Id,C_Name,Product,Quantity,PriceFROMORDERS
WHERE Price BETWEEN 1500 AND 12000;
(IV) SELECTMAX(Price)FROMORDERS;

Ans:(A)(1MARKEACH)
(I) SELECTProduct,SUM(Quantity)ASTotal_Quantity
FROM ORDERS
GROUP BY Product
HAVINGSUM(Quantity)>=5;

(II) SELECTO_Id,C_Name,Product,Quantity,Price
FROM ORDERS
ORDER BYPriceDESC;

(III) SELECTDISTINCTC_Name
FROM ORDERS;

(IV) SELECTSUM(Price)ASTotal_Price_Null_Quantity
FROM ORDERS
WHERE QuantityISNULL;

OR
(B)(1MARKEACH) (I)
C_NameTotal_Quantity
Jitendra 1
Mustafa2
Dhwani1
Alice 1
David NULL

(II)
O_IdC_Name Product Quantity Price
1002MustafaSmartphone2 10000
1004Alice Smartphone1 9000

Page:14/22
(III)

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
(IV)
MAX(Price)
12000

ACSVfile"HealthData.csv"containsthedataofahealthsurvey.Each record of
33. the file contains the following data:

 Nameof a country
 LifeExpectancy(averagenumberofyearsapersonisexpectedto live)
 GDPpercapita(GrossDomesticProductperperson)
 Percentageofpopulationwithaccessto healthcare

Forexample,asamplerecordofthefilemaybe:['Wonderland',82.5,40000, 95].
(4)
WritethefollowingPythonfunctionstoperformthespecified operations on
this file:

(I)Readallthedatafromthefileinthe formofalistanddisplayallthose records for


which the life expectancy is greater than 75.

(II)Countthenumberof recordsinthefile.

Ans:(I)
importcsv
def read_health_data(filename):
records=[]
withopen(filename,mode='r')asfile:
reader = csv.reader(file)
next(reader)#Skiptheheaderrowifpresent for
row in reader:
country = row[0]
life_expectancy=float(row[1])
gdp_per_capita= float(row[2])
access_to_healthcare=float(row[3]) if
life_expectancy > 75 :
records.append([country,life_expectancy,gdp_per_capita,
access_to_healthcare])
returnrecords

Page:15/22
(II)
defcount_records():
records=read_health_data(“HealthData.csv”)
return len(records)
Alex has been tasked with managing the Student Database for a High
34. School.HeneedstoaccesssomeinformationfromtheSTUDENTSand
SUBJECTS tables for a performance evaluation. Help him extract the
following information by writing the desired SQL queries as mentioned
below.
Table:STUDENTS
FNam Mark
S_ID LName Enrollment_Date
e s
201 John Doe 15-09-2020 85
202 Jane Smith 10-05-2019 90 (4)
203 Alex Johnso 22-11-2021 75
n
204 Emily Davis 30-01-2022 60
Micha
205 Brown 17-08-2018 95
el

Table: SUBJECTS

Sub_ID S_ID SubName Credits


301 201 Mathematics 3
302 202 Science 4
303 203 History 2
304 204 Literature 3
305 205 Physics 4
Computer
306 201 3
Science
WritethefollowingSQLqueries:
(I) Todisplaycompletedetails(fromboththetables)ofthosestudents
whose marks are greater than 70.
(II) Todisplaythedetailsof subjectswhosecreditsareintherangeof2to4 (both
values included).
(III) Toincreasethecreditsofallsubjectsby1whichhave"Science"intheir subject
names.
(IV) (A)Todisplaynames(FNameandLName)ofstudentsenrolledinthe
"Mathematics" subject.
(OR)
(B)TodisplaytheCartesianProductofthesetwotables.

Ans: (I )
SELECT*FROMSTUDENTSS
JOINSUBJECTSSubONS.S_ID=Sub.S_ID
WHERE S.Marks > 70;

Page:16/22
(II)
SELECT*
FROMSUBJECTS
WHERECreditsBETWEEN2AND4; (III)
UPDATESUBJECTS
SETCredits=Credits+1
WHERESubNameLIKE'%Science%';
(IV) A:
SELECTFName,LName FROM
STUDENTS S
JOINSUBJECTSSubONS.S_ID= Sub.S_ID
WHERESub.SubName='Mathematics'; OR
B:
SELECT*
FROMSTUDENTS,SUBJECTS;

Atable,namedELECTRONICS,inthePRODUCTDBdatabase,hasthe following
35. structure:

Field Type
productID int(11)
productNamevarchar(20)
price float
stockQty int(11)
(4)
WritethefollowingPythonfunctiontoperformthespecifiedoperation:

AddAndDisplay(): To input details of a product and store it in the table


ELECTRONICS.Thefunctionshouldthenretrieve anddisplayallrecords from
the ELECTRONICS table where the price is greater than 150.
AssumethefollowingforPython-Databaseconnectivity: Host:
localhost
User: root
Password:Electro123

Ans:
importmysql.connector
def AddAndDisplay():
#Connecttothedatabase
conn=mysql.connector.connect(
host='localhost',
user='root',
password='Electro123',
database='PRODUCTDB'
)
cursor=conn.cursor()
productID=int(input("EnterProductID:"))

Page:17/22
productName=input("EnterProductName:") price
= float(input("Enter Price: "))
stockQty=int(input("EnterStockQuantity:"))
cursor.execute("INSERTINTOELECTRONICS
(productID, productName,
price,stockQty)VALUES(%s,
%s, %s, %s)", (productID,
productName,price,stockQty))
conn.commit()
cursor.execute("SELECT*FROMELECTRONICS
WHEREprice>150")
records = cursor.fetchall()
print("\nRecordswithpricegreaterthan150:") for
record in records:
print(record)
cursor.close()
conn.close()|
(1Mark forDeclarationofcorrectConnection Object
+1 Mark forcorrectinput+1 marksfor correctly
usingexecute()method+1marksforshowing output
using loop )

Q.No. SECTIONE(2X5=10Marks) Marks


Raj is a supervisor at a software development company. He needs to
36. managetherecordsofvariousemployees.Forthis,hewantsthefollowing
information of each employee to be stored:
Employee_ID – integer
Employee_Name–string
Position – string
Salary–float (5)
You,asaprogrammerofthecompany,havebeenassignedtodothisjobfor Raj.
(I) Writeafunctiontoinputthedataofanemployeeandappendittoabinary file.
(II) Writeafunctiontoupdatethedataofemployeeswhosesalaryisgreater than
50000 and change their position to "Team Lead".
(III) Writeafunctiontoreadthedatafrom thebinaryfileanddisplaythedata of all
those employees who are not "Team Lead".

Ans : (I)
importpickle
def add_employee(filename):
employee_id = int(input("Enter Employee ID: "))
employee_name=input("EnterEmployeeName:") position
= input("Enter Position: ")
salary=float(input("EnterSalary:"))
new_employee=(employee_id,employee_name,position,salary) with
open(filename, 'ab') as file:
pickle.dump(new_employee,file)

(1/2 markfor input+1 markfor correctuseof dump()to addnew emp

Page:18/22
data)
(II)
defupdate_employee(filename):
employees = []
withopen(filename,'rb')asfile: try:
while True:
employees.append(pickle.load(file))
exceptEOFError:
pass
foriinrange(len(employees)): if
employees[i][3] > 50000:
employees[i]=(employees[i][0],employees[i][1],"TeamLead",
employees[i][3])
withopen(filename,'wb')asfile: for
employee in employees:
pickle.dump(employee,file)
(1markforcorrectuseofload()methodtoretrievedata+1/2markfor correct
loop + 1/2 mark for correct condition within loop )

(III)
def display_non_team_leads(filename):
print("\nEmployeeswhoarenotTeamLeads:") with
open(filename, 'rb') as file:
try:
while True:
employee= pickle.load(file)
ifemployee[2]!="TeamLead":
print(f"ID:{employee[0]},Name:{employee[1]},Position:
{employee[2]},Salary:{employee[3]}")
except EOFError:
pass
(1markforcorrectuseofTryexceptblockand1/2markforcorrect use of
while loop )

Page:19/22
Interstellar Logistics Ltd. is an international shipping company. They are
37. planningtoestablishanewlogisticshubinChennai,withtheheadofficein
Bangalore. The Chennai hub will have four buildings - OPERATIONS,
WAREHOUSE, CUSTOMER_SUPPORT, and MAINTENANCE. As a
networkspecialist,yourtaskistoproposethebestnetworkingsolutionsto address
the challenges mentioned in points (I) to (V), considering the distances
between the various buildings and the given requirements.

(5)
Building-to-BuildingDistances(inmeters):

From To Distance
OPERATIONS WAREHOUSE 40 m
OPERATIONS CUSTOMER_SUPPORT 90 m
OPERATIONS MAINTENANCE 50 m
WAREHOUSE CUSTOMER_SUPPORT 60 m
WAREHOUSE MAINTENANCE 45 m
CUSTOMER_SUPPORT MAINTENANCE 55 m

DistanceofBangaloreHeadOfficefromChennaiHub:1300km Number

of Computers in Each Building/Office:

Location Computers
OPERATIONS 40
WAREHOUSE 20
CUSTOMER_SUPPORT 25
MAINTENANCE 22
BANGALOREHEADOFFICE15

Page:20/22
(I) SuggestthemostsuitablelocationfortheserverwithintheChennaihub.
Justify your decision.

(II) Recommendthehardwaredevicetoconnectallcomputerswithineach
building efficiently.

(III) DrawacablelayouttointerconnectthebuildingsattheChennaihub
efficiently.Whichtypeofcablewouldyourecommendforthefastestand most
reliable data transfer?

(IV) Isthereaneedforarepeaterintheproposedcablelayout?Justifyyour
answer.

(V) A)Recommendthebestoptionforlivevideocommunicationbetween the


Operations Office in the Chennai hub and the Bangalore Head Office from
the following choices:

 a)Video Conferencing
 b) Email
 c)Telephony
 d)Instant Messaging
OR

(V)B)Whattypeofnetwork(PAN,LAN, MAN,orWAN)wouldbesetup among


the computers within the Chennai hub?

Ans :
(I) TheservershouldbeplacedintheOPERATIONSbuilding.
Justification:

 Ithasthelargestnumberofcomputers(40),makingitthemost
central location in terms of the network load.
 Thedistancestootherbuildingsarerelativelyshort,ensuring
efficient data transfer. (1 Mark)

(II) A switch should be used within each building to connect all


computers.Aswitchisidealforcreatingalocalareanetwork(LAN) and
ensures efficient communication between devices in a single
building. ( 1 Mark)

(III) Themostefficientcablelayoutwouldinvolveconnectingthe
buildings as follows:

 OPERATIONStoWAREHOUSE (40 m)
 OPERATIONStoMAINTENANCE(50m)
 OPERATIONStoCUSTOMER_SUPPORT(90m)
 WAREHOUSEtoMAINTENANCE(45m)
 WAREHOUSEtoCUSTOMER_SUPPORT(60m)

Page:21/22
CUSTOMER_SUPPORT

(90m)

OPERATIONS

/ | \

(40 m)(50m)(60 m)

/ | \

WAREHOUSEMAINTENANCE

CableRecommendation:Fiberopticcableisrecommendedforhigh- speed
data transfer and reliable communication over distances. It offers
better bandwidth and lower signal degradation over long distances
than copper cables.( 1/2 + 1/2 mark)

(III) There is no need for a repeater in this layout. The maximum distance
betweenanytwobuildingsis90meters,whichiswellwithinthe100-meter limit
for Ethernet cable or fiber optics before requiring a repeater.

( 1mark)

(IV) A) The best option for live communication between the Chennai
Operations Office and the Bangalore Head Office would be Video
Conferencing.Thisallowsreal-timeface-to-facemeetingsandvisual
communication across long distances, which is ideal for inter-office
collaboration.

OR

(V) B)ThenetworktypeintheChennaihubwouldbeaLAN(LocalArea
Network), as all computers are located within a confined geographical
area (the logistics hub) and are connected to each other for data
communication within the same campus.

(1markforanycorrectpart solution )

Page:22/22

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy