Computer science practical paper 2024 class 12 with solution
AISSCE Practical Examination 2024
COMPUTER SCIENCE (083)
Time : 3 Hours M.M. 30
Q1. 8
(i) Write a user defined function countwords() in Python to count and display the number of times words “this” and “that” appear in a text file “data.txt”.
(ii) Write a user defined function countdigits() in Python to count and display the number of digits from a text file “data.txt”.
OR
(i) ADD() – To accept and add data of an employee to a CSV file ‘emp.csv’. Each record consists of a list with field elements as empid, name and salary to store employee id, employee name and employee salary
(ii) COUNTR() – To count the number of records present in the CSV file named ‘emp.csv’.
Q2. Write sql queries as per following tables. 4
Shop:
Employee |
||
id | Name | Designation |
101 | Naresh | Clerk |
102 | Ajay | Manager |
103 | Manisha | Clerk |
104 | Komal | Advisor |
Details |
||
id | Salary | PhoneNo |
101 | 32000 | 9898090909 |
102 | 45000 | 9888000909 |
103 | 33000 | 8008078787 |
104 | 40000 | 7009876543 |
i. View Name and salary of all employees.
ii. List Name and designation of all Clerks.
iii. Display id, Name and Phone number of all employees.
iv. Display records of all employees whose name starts with alphabet ‘K’.
Q3.Practical File 7
Q4.Project File 8
Q5.Viva-Voce 3
Solution:
Q1
i.
def countwords(): f=open("data.txt","r") countthis=0 countthat=0 data=f.readlines() for d in data: word=d.split() for w in words: if w=='this': countthis+=1 if w=='this': counthat+=1 print(‘Number of times "this" appears=’,countthis) print(‘Number of times "that" appears=’,countthat) f.close()
ii
def countdigits(): f=open("data.txt","r") count=0 data=f.read() for d in data: if d.isdigit(): count+=1 print(‘Number of Digits=’,count) f.close()
OR
(i)
import csv def ADD(): f=open(‘emp.csv’,’a’,newline=”) w=csv.writer(f) empid=int(input(‘Enter employee id=’)) name=input(‘Enter employee name=’) salary=float(input(‘Enter salary =’)) rec=[empid,name,salary] w.writerow(rec) f.close() (ii)
def COUNTR(): f=open(‘emp.csv’,’r’) r=csv.reader(f) count=0 for rec in r: count+=1 print(‘Number of records=’,count) f.close()
Q2.
i. select name,salary from employee, details where employee.id=details.id;
ii. select name,designation from employee where designation=’Clerk’;
iii. select employee.id, name,phoneno from employee, details where employee.id=details.id;
iv. select * from employee where name like ‘K%’;
Class xii computer science practical paper -1
Class xii computer science practical paper -2
Class xii computer science Sample paper 2023 with solutions