class 12 computer science practical paper with solution 2024
AISSCE Practical Examination 2024
COMPUTER SCIENCE (083)
Time : 3 Hours M.M. 30
Q1. 8
(i) Write a user defined function countvowels() in Python to count and display the number of vowels in a text file “data.txt”.
(ii) A binary file “employee.dat” has structure [Empid, EName, Designation ]. Write a user defined function Display() in Python to display those records from “employee.dat” where Empid is more than 101.
(iii) Write a user defined function INSERTCSV() to write data of a student containing rollno, name and fee to a csv file “student.csv”.
(iv). Write a user defined function VIEWCSV() to display data of students from a csv file “student.csv”.
Q2. Write SQL queries for the following:
Relation : Student | ||||
Name | Class | Fee | Gender | DOB |
Rahul | XII | 1200 | M | 2005-02-01 |
Mehul | XII | 1200 | M | 2004-12-11 |
Manisha | XI | 1050 | F | 2006-10-12 |
Sujoy | XI | 1050 | M | NULL |
Sonakshi | XII | 1200 | F | 2005-09-19 |
Suman | X | 950 | F | 2008-06-16 |
i. List all students studying in class XII.
ii. List names of male students in descending order of their names .
iii. Count number of students studying in class XII.
iv. Fee of all students should be increased by 500.
Q3. Report File 7
Q4.Project File 8
Q5.Viva-Voce 3
Solution:
Q1
i.
def countvowels(): f=open("data.txt","r") count=0 data=f.read() for d in data: if d in ['a','e','i','o','u']: count+=1 f.close() print('Number of vowels=',count)
ii
def Display(): f=open("employee.dat","rb") try: while True: record=pickle.load(f) if record[0]>101: print(record) except: f.close()
iii
import csv def INSERTCSV(): f=open("student.csv","w") fout=csv.writer(f) rollno=eval(input('Enter rollno=')) name=input('Enter name=') fee=eval(input('Enter fee=')) fout.writerow([rollno,name,fee]); f.close()
iv.
import csv def VIEWCSV(): f=open("student.csv","r") fin=csv.reader(f) for row in fin: print(row) f.close()
Q2.
i. Select * from student where class=’XII’;
ii. Select name from student where gender=’M’ order by name;
iii. Select count(*) from student where class=’XII’;
iv. Update student set fee=fee+500;
Class xii computer science Practical paper – 2
Class xii computer science project file
Class 12 Computer Science Practical File
Click here for Quiz on Python Basics