Download as pdf
Download as pdf
You are on page 1of 6
Sample Question Paper 14) (Detailed Answers) Computer Science CBSE Class 12th 1 Tue 2. (0) Stops the current iteration 3. (6) jump 4. (a) 0.25 5. (¢) Any number of keys 6. (a) cursor) 7. (a) one column 8% 9. (a) 56 10. (b) width and decimal places 1A. () Wolcomo to arin 12. (A) IN 13. (d) Both (a) and (6) are incorrect 14. (@)-3 15. (o)Ethernet card 46. (b) Statiow 117. (a) Both A and A are true and A is the correct explanation of A 18. (b) Both Aand R ave true but Ris not the correct explanation of A. 19. {) Open source internet browser - Chromium (Open source operating system - Linux (i) Domain Name System or {) WWW (Worla Wide Web) is a system of Intemet servers that supports hypertext and multimedia to Internet protocols on a singe intra (i) Charactorstic o26 mobile technology is that ithas introdu 20. output zis: 100 New value of global zis : 50 Value of zis : 50 21. Output No Ouipu Or Output 1 coess several sddata services for me jie starting with text messaging 22. The ci Syntax SELECT colum_name(s) FROM tablel ROSS JOIN S JOIN keyword retums all records from both tables (table and table2). ablez 23. 24. 25. 26. 27. © Stage i Excellence Level Computer Science Class 12 e.g. SELECT Customers.CustomerName, Orders.drderID FROM Customers CROSS JOIN Orders: or (Degree is the number of attributes or columns present in a table, So Degree is 5. Cardinality is the number of tuples or rows present in a table. So, Cardinalty is 6 {() MOVIEID should be made the primary key as it uniquely identifies each record of the table. ‘When constant and variables of cifferent types are mixed in an expression, they are converted to same type. This process 's called type conversion, () Implict type conversion {Explicit type conversion (i) Mytiends | (i) MYFRIENDS or Output 12 13 14 15 15 def execmain © x= input (“Pater @ number") if (abs ) print ("You entered a positive number :") else xiset Print (“Number made positive : ". x) ecrain() () SELECT Name, ProjectNo FROM STUDENT WHERE. Section: ( UPADATE STUDENT SET Section=3 WHERE Class="X11" (iy SELECT Name, PNane FROM STUDENT S, Project P WHERE S.ProjectNo = P.ProjectNo AND Name LIKE “Ba” import csv def csvread(filename, rollno) with open(fitename, ‘r*) as file: reader = csv.reader(file) headers ~ next(reader) for row in reader: row_rollno = int(row[0}) status = row{1] if row_rollno print (row, rolino and status rollno, status) or "su def Sportsread(filenane, collegename) try with open(filenane, ‘r') as file for line in £77 record = line.split() if record(1] ~~ collegename: print(ine) Succeed Sample Paper 14 © Stage m Excellence Level except FileNotFoundError: print(f*File '(filename}' not found.") Sportsread(*College.dat™, *IIT*) 28. {) SELECT Gamel .Game2 FROM Sports WHERE Name LIKE “AS (i) ALTER TABLE SPORTS ADD MARKS number (5) (ii) UPDATE SPORTS SET MARKS ~200 WHERE GRADES"A* and GRADE="B" 29. def find_word(sentence, word) word_accurrences words = sentence. split) for i, w in enumerate(words) if w == word: word_occurrencesti] = return word_occurrences sentence = “He is such a boy who is very good in studies word = “is” result = find_word(sentence, word) print(result) 30. garment_gict = {1's ['Shirt', 6500). ‘2's ['Trouser*, 2000]. stack = for key, value in garment_dict.items() garment_price = valuel1] if garment_price > 5000 stack. append(value[0]) print("Garment items with prices above S000:") while stack: print (stack.pop(}) (@) SELECT Deparment, COUNT(*} "No of Patient” FROM HOSPITAL GROUP BY Deparment (0) SELECT Depariment FROM HOSPITAL WHERE Department LIKE "Séogy"; (6) DROP HOSPITAL; (@) SELECT MAX(Charges) FROM HOSPITAL; 32. import csv fropen("data.csw", "r") sv. reader (f) : [*Coat", 15000)) 31. next (f) ma for i in dz if intGL2])>max. max=int(iL2]) f.close() feopen("data./esw", "r") decsv.reader(f) next(f) for 1 ind Gf int L2))--max: print() F.close() 4 © Stage i Excellence Level Computer Science Class 12 33. 0 Research Buiaing ‘Academic Building ‘aero Buiging (i) The most suitable place to house the server is Academic Building as it has maximum number of computers. Thus, it decreases the cabling cost and increase efficiency of network Gi) (@) Switen isto be installed in each of building to connect all the computers. {i (9 Satelite connection (\) MAN (Metropolitan Area Network) 34. (a) Difference between equi join and cross join Equi join ‘Gross join ‘An equi jin isa type of oi that combines A cross jon, also known as a Cartesian ‘ows Irom two of more tables based ona Join, combines every row fom the fist fable ‘matching conciton specified using the wth every row from the second table, fequalty operator (~) between resuting in a Cartesian procuct of the two ccotesponsing columns tables (0) import: mysqi.connector def ChangeDala(Pcode, val) ab ~ mysql .connector.connect( host="localhast™ users"root" password="sqipwd", database="Proj08" cursor = db.cursor() sql ~ “UPDATE Praject SET Team ~ Team + #5 WHERE ProjCode ~ ts" cursor.execute(sqi, (val, Pcode)) ab. commit) cursor.close() ab.close() ChangeData("PO1", 5) or (@) Ina database, areco'dis a collection of fields or attributes that are organised and treated as a single unit information. Itrepresenis a spectfic inslance or entry in a database table. Each record conlains data related to a particular entity, such as a person, product, of transaction. ‘The other commonly used term for arecord isa row" (©) import mysql.connector cnx = mysql -connector. connect ( host="localhost" user="root", password="Arn@2021", database="DefDB cursor = cnx.cursor() query ~ "SELECT Wing, Grade FROM Defence WERE Rank ~ 'Major’ OR Rank ~ "Brigadier’™ cursor .execute(query) results = cursor.fetchall() Succeed Sample Paper 14 © Stage m Excellence Level 5 for row in results: wing, grade = row print(f*Wing: {wing}\tGrade: {grade)") cursor .close() cnx. close() 35. () Theread{size) and.ead( functions are both used to read data romatilein Python, bul they havea slight cfference: read(size) Ths function reads at most size bytes from the fil and retums the data a a sting. Ithe size parameterisnot speciied or negative it reads and returns the enlire contents ofthe file read() This function reads the entre contents ofthe fe and relumns them as a sting It reads all the bytes from the fle Untl the end ofthe file fs reached. ( inport csv def StoreSoftware( software_records = (] while True soft_id = input(*Enter Software 1D: ") soft_name = input("Enter Software Name: ") software type = input ("Enter Software Type: ") man_hours = int (input(*Enter Manhours: *)) if software type. lower() == "web" software_records.append ({soft_id, soft_name, software_type, man_hours chaice = input(*Do you want to enter another record? (yin): *) if choice.lower() I= "y* break with open(*Software.csv", "a". newline="*) as fil writer = csv.writer(file) writer.writerows (software_records) print(*Records stored successfully!") def SearchSoft(man_hours) found_records = False with open(*Software.csv", "r") as file: reader = csv.reader(file) for row in reader: Sf Ten(row) >= 4 and int(row(3]) > man_hours print(*SoftiD:", row[01) print(*Softname:", row[1]) printC*Type:", row[2]) print(*Manhours:*, row[31) found_records = True if not found_records print(*No records found with Manhours above", man_hours) Storesoftware() man_hours = 10000 SearchSoft(man_hours) or (0 Thecther parameter tothe seek) function indicates the reference point from where the offsets applied. tcan take one of the folowing values: "0" It sets the reference point to the beginning ofthe file “1" It sets the reference point tothe current position. "2" It sets the reference point tothe end of the file (i) import pickle def Addebi11() consumer_data a © Stage m Excellence Level Computer Science Class 12 while True consumer_id = input ("Enter Consumer [D (0 to exit): ") if consumer_id == ‘0° break meter_no = input(*Enter Meter Number: *) bill_amt = floatCinput(*Enter Bi11 Amount: *)) pay_status = input("Enter Payment Status: *) consumer_data.append((consumer_id, meter_na, bill_amt, pay_status)) with open(*Electricity.dat", *ab*) as file for data in consumer_data: pickle.dunp(data, file) print(*Consumers with bill amount less than 1000:") for data in consumer_data if data(2 < 1000 print(datatol) def Showreport() with open(*Electricity.dat", *rb*) as file: print("Customers with unpaid status:") try while True: consumer_data = pickle.load(file) if consumer_datal3). lower) print(consumer_data) except F0FFrror pass “unpaid” AddebIT1O Showreport()

You might also like