Cs2study.com



KENDRIYA VIDYALAYA SANGATHAN ERNAKULAM REGIONCLASS XII –HALF YEARLY EXAMINATION 2019 MARKING SCHEMECOMPUTER SCIENCE (083)1. a) Identify the valid identifiers from the following__A, add1b)List one similarity and one difference between List and Dictionary datatype.The Dictionary is similar to lists as both are collection of data items.Lists are ordered collection of data items where as dictionaries are unordered collection of data items.11c)Find out errors if any, and correct the code by rewriting it and underline theCorrections.Z=int(“enter the value for Z”)S=0fori in range(10,Z,3) s=+iIf i%2=0: print (i*2)Else : print(i*3)Corrections:Z=int(input(“enter the value for Z”))S=0for i in range(10,Z,3): s+=iIf i%2==0: print (i*2)else : print(i*3)print(s)For each correction 1/5 mark2d)e)Predict the output for the following code:G*L*TMEWhat is the output for the following. d)error C)none of the mentioneda) 0 1 221112 a)Write the term suitable for the following descriptions:i)A name inside the parenthesis of function header that can receive a value: parameterii)A variable created inside a function body: local variable11b)Which of these is not true about recursion?c)Recursive calls take up less memory1c)Write a python function that takes two numbers and return the smaller number. Also write how to call this function.def SMALLER(a,b): if a>b: return b else: return aprint(SMALLER(15,10)) 1/21/21/21/2d).Comment on the efficiency of linear and binary search in relation to the number of elements in the list being searched.?The linear search compares the search item with each elementof the arrayone by one.if the item is at the beginning then the comparisons are low.however if it is at the end then search technique proves to be the worst so many comparisons takes place.binary search on the other handtries to locatethe search item in minimum possible comparisons and it is efficient in almost all cases. ORDefine efficiency of a program. How to evaluate efficiency of programs.?It is the ratio of output to input in a given system.It can be evaluated on the basis of two factors- in terms of time, on the basis of no. of operations111e)Write definition of a method/function HowMany(ID,Val) to count and display numberof times the value present in the list ID.def Howmany(ID,Val): c=0 for I in ID: if Value==I: c+=1 print(“count:”,c) ORFind and write the output for the following:Numbers = [9,18,27,36]for K in Numbers: for J in range(1, K%8): print(J,”#”,end=””) print()1 # 1 # 2 # 1 # 2 # 3 #2 marks for correct answer.2f)Write a definition of a function EVENSUM(num) to add those values in the list of numbers which are odd. Also write the code for calling the same.def EVENSUM(NUM): s=0 for I in NUM: if I%2!=0: s+=I print(s)EVENSUM([1,2,3,4,5,6,7])1/51/51/51/51g).Base case: the smallest problem that we know how to solve and it is the case that causes the recursion to end.Recursive case: It is the general case of the problem which we are trying to solve using recursive call to same function.def binary_search(LIST,BEG,END,VAL): if END<BEG: return none else: mid=(BEG+END)//2 if LIST[mid]>VAL: return binary_search(LIST,BEG,mid-1,VAL) elif LIST[mid]<VAL: return binary_search(LIST,mid+1,END,VAL) else: return mid1123a)Which file must be part of the folder containing python module files to make it importable python package.?__init__.py1b).What are the possible outputs executed from the following code.Also specify the maximum and minimum values that can be assigned to variable P.import randomP=random.randint(0,3)DIST=[“CALICUT”,”ERNAKULAM”,”TRIVANDRUM”,”KANNUR”]for I in DIST: print( ) for J in range(1,P): print(I,end=” “)i) CALICUT CALICUT ii) CALICUTERNAKULAM ERNAKULAM ERNAKULAM TRIVANDRUM TRIVANDRUM TRIVANDRUM KANNUR KANNUR KANNURMin vale:0Max value:32c)Predict the out put.>>>s="one two one two one two">>> print(s.replace("one","111",2)111 two 111 two one two14a)What would be the datatype of the variable data in the following statements:data=f.readlines()data=f.read(10)i)listii) string ORWrite a statement in Python to open a text file MYFILE.TXT so thatNew content can be written in it.F=open(“MYFILE.TXT”,”w”)1b)Write a program to count and display the no of lines starting with ‘S’ present ina text file “lines.txt”. def countS(): f=open(“lines.txt”,’r’) lines=0 l=readlines() for i in l: if i[0]==’S’: lines+=1 print(“No of lines are”,lines) ORWrite a function ISTOUPCOUNT() in python to read the contents of a text file “ WRITER .txt , to count and display the occurrence of the word “is” or “to” or “up” def ISTOUPCOUNT(): f=open(“WRITER .txt”,”r”) count=0 contents=f.read() word=contents.split() for I in word: if I in [“is”,”to”,”up”]: count+=1 print(count)????????c)Write a python statement to plot list elements using line chart.import matplotlib.pyplot as pp.plot([1,2,3,4,5,6], [2,4,6,8,10,12],label=”numbers”,color=”r”)??d)Write a python program to create a pie chart for sequence pop=[25.7,22.8,28,35,40] for AREAs [‘NORTH’,’SOUTH’,’EAST’,’WEST’,’CENTRAL’]Show NORTH area ‘s value exploded.Show % population of each area.import matplotlib.pyplot as ppop=[25.7,22.8,28,35,40] AREA= [‘NORTH’,’SOUTH’,’EAST’,’WEST’,’CENTRAL’]p.pie(pop,labels=AREA,colors=[‘r’,’g’,’b’,’m’],explode=[0.1,0,0,0,0],autopct=’%2.2%%)p.show()????e)Write a python program to create a bar chart with title of the popularity of programming languages.Sample data: Programming languages: JAVA,PYTHON, PHP,C#,C++,VISUAL BASICPopulariy: 14.2,27.8,8.8,7.6,6.7import matplotlib.pyplot as ppopularity=[14.2,27.8,8.8,7.6,6.7]lang= [‘JAVA’,’PYTHON’, ‘PHP’,’C#’,’C++’,’VISUAL BASIC’]p.bar(lan,popularity,colors=[‘r’,’g’,’b’,’m’],width=3)p.show()????5a)Write a menu driven python program with functions to push and pop elements In a stack for the book details (like bookno and book name). Any correct code- Partial marks –to be given accordingly. ORWrite Qin(client) and Qout(client) functions in Python to add new client and delete a client from a list of client names , considering them to act as insert and delete operations of the Queue data structure. def Qin(client): Q.append(client) If len(Q)==1: Front=rear=0 else: Rear=len(Q)-1def Qout(client): if not len(Q): print(“queue is empty”) else: item=Q.pop(0) If len(Q)==0: Front=rear=None return item 422b)Any correct code- 2 marksPartial marks –to be given accordingly.2c).Predict the output:Fruits=['apple','mango','banana']Fruits.append('plum')print(Fruits)Fruits.pop(0) print(Fruits)Output: ['apple', 'mango', 'banana', 'plum'] ['mango', 'banana', 'plum'] ORIf the elements “A”,“B”, “C” and “D” are placed in a queue and are delete done at a time, in whatorder will theybe removed?ABCD16a)What do you understand by the following term URL. Give egA location on a net server is called URL(Uniform Resource LocatorEg: cbse.nic.in/academics.html??b)What is cloud in computing?A cloud is a combination of networks ,hardware ,services ,storage ,and interfaces that helps in delivering computing as a service.1c)IPV4 is c)32 bitd)Give one example for wireless and wired media. Radiowaves OFC1e)Expand the following:TCP/ IP: Transmission Control Protocol/ Internet ProtocolMAC : Multiple Access Control1f)Name the network tool used in the given situation:To troubleshoot internet connection problem.: ipconfigTo see the IP address associated with a domain name. :nslookup??g)What is VoIP?It is a protocol that is used for transmitting voice data and multimedia data over internet protocol data network. It offers a set of facilities to mange the delivery of voice information over internet in digital form.1h)What is Secure Communication.?Secure communication is when two entities are communicating and do not want a third party to listen to. For that they need to communicate in a way not susceptible to interception.1iWhat is Iot? What are the technologies that have enabled IoT.?It is a network of things embedded with electronics , software,sensors and network connectivity which enables these objects to collect and exchange data.RFID, Sensors, smart technologies, software, network connectivity.117 a)What are protocols? List two protocols related to email.A protocol refers to a set of rules used over network.SMTP,POP311b)What do you mean by network congestion.? What are the main factors for network congestion.? Network congestion is a specific condition in a network when more data packets are coming to network devices than they can handle and process at a time.The main factors for its cost are:Too many hosts in the network.Low bandwidth of the network.11c) working of email. : proper explanation 2 marks2d)FTP – 1Telnet.-12e)IP Addressing. : 1 mark IPV4-I MARKIPV6- 1 MARKf)Global Infocom. Ltd. Is setting up the network in Ahmedabad. There are four departments –Market, Fun, Legal, Sales.Distance between the departments is a s under:Market Dept to Fun Dept80mMarket Dept to legal Dept180mMarket Dept to SalesDept100mLegal Dept to Sales Dept150mLegal Dept to Fun Dept.100mFun dept to Sales dept.50mNumber of computers :Market Dept: 20Legal Dept: 10Fun Dept:8Sales Dept:42i)Suggest the network type between the departments. LAN ii)Suggest the most suitable building to place the server with suitable reason.Sales Dept as the department has more no of computers.iii)Suggest the placement of the following devices :RepeaterHub/SwitchRepeater between Market Dept to Legal Dept. as the distance between these 180 m. to reduce the signal lossiv)The organization is planning to link its sale counters situated in various parts of the same city. Which type of network out of LAN,MAN,WAN will be formed? Justify your answer.MAN.- 1 MARKJustification: 1 mark4 ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download