0% found this document useful (0 votes)
19 views25 pages

Ssce MS

The document outlines the SSCE Practical Examination for Computer Science for the academic year 2024-2025, detailing various sets of questions across Python programming, SQL queries, report files, projects, and viva assessments. Each set contains specific tasks such as writing Python programs for file handling and data processing, as well as SQL commands for database management. The total marks for each set are 30, with a duration of 3 hours for completion.

Uploaded by

dani.naz2108
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views25 pages

Ssce MS

The document outlines the SSCE Practical Examination for Computer Science for the academic year 2024-2025, detailing various sets of questions across Python programming, SQL queries, report files, projects, and viva assessments. Each set contains specific tasks such as writing Python programs for file handling and data processing, as well as SQL commands for database management. The total marks for each set are 30, with a duration of 3 hours for completion.

Uploaded by

dani.naz2108
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

SSCE PRACTICAL EXAMINATION (2024 - 2025)

COMPUTER SCIENCE - NEW (083)


STD : XII SET A SCHOOL CODE: 55406
MAX. MARKS : 30 DURATION: 3 hrs

QUESTIONS MARKS

1. Python Program 08

i)Write a program to read the content of file & to display each word separated by '#'

f=open("D:\\story.txt",'r')

a=f.read()

b=a.split()

for i in b:

print(i,end="#")

f.close()

ii) Write a Python program to count vowels in an inputted string.

print("program to count vowels in a string")

count=0

string = input("enter any text:")

for i in string.lower():

if i in 'aeiou':

count+=1

print(count,"vowels are used in the text")

OR

ii)Write a Python Program to Create a binary file with Empno, Name, Salary
then read and display their details on screen.

import pickle

def write():

f=open("d:\\employee.dat", 'wb')
while True:

emp=int(input("enter employee id:"))

name=input("enter employee name:")

slry=int(input("enter employee salary:"))

data=[emp,name,slry]

pickle.dump(data,f)

ch= input("do you want to continue(Y/N)?")

if ch=='n' or ch=='N':

break

f.close()

def read():

fi=open("d:\\employee.dat",'rb')

try:

print("file contents")

while True:

x=pickle.load(fi)

print(x)

except:

fi.close()

write()

read()

2. DBMS – SQL queries 04


RollNo Name Age Department DateOfAdm Fee Sex

1 Pankaj 24 Computer 1997-01-10 120 M

2 Shalini 21 History 1998-01-24 200 F


3 Sanjay 22 Hindi 1996-12-12 300 M

4 Sudha 25 Hindi 1999-07-01 400 F

5 Rakesh 22 History 1997-05-05 250 M

6 Shakeel 30 Computer 1998-06-27 300 M

7 Surya 34 Hindi 1997-02-25 300 M

8 Shika 23 Computer 1997-07-31 200 F

9 Zaheer 36 Computer 1997-03-12 230 M

TABLE : STUDENT

Write the Commands for the following and execute.

a) To show all the information about the student of history department.

ANS: SELECT * FROM STUDENT WHERE Department=’History’;

b) To list the names of all students with their Date of joining in ascending order.

ANS: SELECT Name, DateOfAdm FROM STUDENT ORDER BY


DateOfAdm;

c) To list the name and department of all students whose name starts with ‘S’

ANS: SELECT Name, Department FROM STUDENT WHERE name


LIKE ‘S%’;

Predict the output for the following SQL commands.

d) Select count(distinct( department)) from students;

count(distinct department)

e) Select * from students where sex=”F” and department=”hindi”;

RollNo Name Age Department DateOfAdm Fee Sex

4 Sudha 25 Hindi 1999-07-01 400 F

3. REPORT FILE 07

4. PROJECT 08

5. VIVA 03

TOTAL 30
SSCE PRACTICAL EXAMINATION (2024 - 2025)
COMPUTER SCIENCE - NEW (083)
STD : XII SET B SCHOOL CODE: 55406
MAX. MARKS : 30 DURATION: 3 hrs
QUESTIONS MARKS

1. Python Program 08

i) Write a program to read a text file & display the number of vowels/

consonants/ uppercase/ lowercase characters in the file.

f=open("d:\story.txt", 'r')

line=f.read()

print("The content in the text file")

print(line)

v=0

c=0

l=0

u=0

for i in line:

if i in 'aeiouAEIOU':

v+=1

if i in 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ':

c+=1

if i.islower():

l+=1

if i.isupper():

u+=1

print("No. Of. Vowels =",v)

print("No. Of. Consonents =",c)

print("No. Of. Lower case =",l)

print("No. Of. Upper case =",u)


f.close()

OR

i) Write a Python program that implements a stack using a list. The stack
should only contain integers that are divisible by 3 but not divisible by 6.
Your program should include the following user-defined functions:

push(x): Adds an element x to the stack if it is divisible by 3 but not


divisible by 6. If x is divisible by 6 or not divisible by 3, the function
should not add the element to the stack.

pop(): Removes the top element from the stack. If the stack is empty, the
function should return a message indicating that the stack is empty.

display(): Displays the current elements of the stack.

S=[]

def push(x):

for i in x:

if i%3==0 and not i%6==0:

S.append(i)

def display():

print("THE STACK 'S'CONTAINS",S[::-1])

def pop(b):

if S!=[]:

print("the element popped from the stack 'S' is",S.pop())

else:

print('STACK IS EMPTY')

l=eval(input("enter the elements :"))

push(l)

display()

pop(S)

2. DBMS – SQL queries 04


TABLE : BOOKS

Book_ID Book_Name Authour_Name Publishers Price Type Qty

C001 Fast Cook Lata Kapoor EPB 355 Cookery 5

F001 The Tears William Hopkins First Publ 650 Fiction 20

T001 My First C++ Brain & Brooke EPB 350 Text 10

T002 C++ Brainer A.W.Rossaine TDH 350 Text 15

F002 Thunderbolts Anna Roberts First Publ 750 Fiction 50

Book_ID Quantity_issued

T001 4

C001 5

F001 2

TABLE: ISSUED

Write the Commands for the following and execute.

a) To display the Book_ID,Book_Name and Quantity_issued for all books which have
been issued.(The query will require contents from both the tables)

ANS: SELECT B.Book_ID, B.Book_Name, I.Quantity_issued FROM BOOKS B,


ISSUED I WHERE I.Book_ID = B.Book_ID;

b) To increase the price of all books of EPB Publishers by 50.

ANS: UPDATE BOOKS SET Price=Price+50 WHERE Publishers = ‘EPB’;

c) To display the number of books in each publishers

ANS: SELECT count(*), Publishers FROM BOOKS GROUP BY Publishers;

Predict the output for the following SQL commands.

d) Select count(distinct( Publishers)) from Books where Publishers = “First Publ”;

count(distinct Publishers)

e) Select max(Price) from Books where Qty >=15;

max(Price)

750
3.REPORT FILE 07

4.PROJECT 08

5.VIVA 03

TOTAL 30

SSCE PRACTICAL EXAMINATION (2024 - 2025)


COMPUTER SCIENCE - NEW (083)
STD : XII SET C SCHOOL CODE: 55406
MAX. MARKS : 30 DURATION: 3 hrs

QUESTIONS MARKS

1. Python Program: 08

Write a Python program Create a CSV file to store Rollno, Name, Age
and search any Rollno and display Name, Age and if not found display
appropriate message

import csv

def write():

f=open("store.csv", 'w', newline='')

fobj=csv.writer(f)

fobj.writerow(['rollno', 'name', 'age'])

n=int(input("enter no. of records:"))

for i in range(n):

rno=int(input("enter roll no:"))

name=input("enter name:")

age=int(input("enter age:"))
data=[rno, name, age]

fobj.writerow(data)

print("records inserted successfully")

f.close()

def search():

fi=open("store.csv", 'r', newline='')

rno=int(input("enter roll no. to search:"))

s=0

fobj=csv.reader(fi)

for i in fobj:

if i[0].isdigit():

if int(i[0])==rno:

print(i[1],i[2])

s=1

break

if s==0:

print("record not found")

fi.close()

write()

search()

2. DBMS – SQL queries 04

Table : WORKER

WNO NAME DOJ DOB GENDER DCODE

1001 Sethuram 2013-09-02 1991-09-01 MALE D01

1002 Anil 2012-12-11 1990-12-15 FEMALE D02

1003 Shivaram 2014-01-17 1987-09-04 MALE D01

1007 Bala 2012-12-09 1984-10-19 MALE D03

1004 Laura 2013-11-18 1987-03-31 FEMALE D04


Write the Commands for the following and execute.

a) To count and display MALE workers who have joined after ‘1986-01-01’.

ANS: SELECT COUNT(*) FROM WORKER WHERE DOJ > ’1986-01-01’


AND GENDER = MALE;

b) To display the names of workers having exactly four letters.

ANS: SELECT NAME FROM WORKER WHERE NAME LIKE ‘____’;

c) To display the number of distinct gender

ANS: SELECT count(DISTINCT( GENDER)) FROM WORKER;

Predict the output for the following SQL commands.

d) select count(*),DCODE from WORKER group by DCODE having

count(*) >1;

count(*) DCODE

2 D01

e) select max(DOJ),Min(DOB) from WORKER;

max(DOJ) Min(DOB)

2014-01-17 1984-10-19

3.REPORT FILE 07

4.PROJECT 08

5.VIVA 03

TOTAL 30
SSCE PRACTICAL EXAMINATION (2024 - 2025)
COMPUTER SCIENCE - NEW (083)
STD : XII SET D SCHOOL CODE: 55406
MAX. MARKS : 30 DURATION: 3 hrs

QUESTIONS MARKS

1. Python Program 08

Python program to create a binary file with roll number, name and marks. Input a
roll number and update the marks

import pickle

def write():

f = open("d:\\record.dat", 'wb')

l = []

while True:

rno = int(input("enter roll no.:"))

name = input("enter name:")

mrks = int(input("enter marks:"))

data = [rno, name, mrks]

l.append(data)

ch = input("do you want to continue (Y/N):")

if ch == 'n' or ch == 'N':

break

pickle.dump(l, f)

f.close()

def update():

fi = open("d:\\record.dat", 'rb+')

roll = int(input("enter the roll no to update:"))

try:

x = pickle.load(fi)

s=0
for i in x:

if i[0] == roll:

i[2] = int(input("enter the updated marks:"))

s=1

break

if s == 0:

print("record not found")

else:

fi.seek(0)

pickle.dump(x, fi)

print("record updated successfully")

except:

fi.close()

write()

update()

2. DBMS – SQL queries


Table : ADMIN

Code Gender Designation

1001 Male Vice principal

1009 Female Coordinator

1203 Female Coordinator

1045 Male Hod


04
1123 Male Senior teacher

1167 Male Senior teacher

1215 Male Hod

Table: School
Code TeacherName Subject DOJ Periods Experience

1001 Ravi Shankar English 12/3/2000 24 10


1009 Priya Rai Physics 03/09/1908 26 12

1203 Lisa Anand English 09/04/2000 27 5

1045 Yashraj Maths 24/08/2000 24 15

1123 Ganan Physics 16/07/1999 28 3

1167 Harish B Chemistry 19/10/1999 27 5

1215 Umesh Physics 11/05/1998 22 16

Write the Commands for the following and execute.

a) To display DESIGNATION without duplicate entries from the table ADMIN.

ANS: SELECT DISTINCT(DESIGNATION) FROM ADMIN;

b) To display TEACHERNAME, CODE and corresponding DESIGNATION from tables


SCHOOL and ADMIN of Male teachers.

ANS: SELECT TEACHERNAME,CODE,DESIGNATION from SCHOOL,ADMIN


WHERE ADMIN.CODE=SCHOOL.CODE AND GENDER=’MALE’;

c) To add a column as age to the table admin

ANS: ALTER TABLE ADMIN ADD AGE INT;

Predict the output for the following SQL commands.

d) SELECT TEACHER FROM SCHOOL WHERE EXPERIENCE >12 ORDER BY

TEACHER;

TEACHER

Umesh

Yashraj

e) SELECT COUNT (*), GENDER FROM ADMIN GROUP BY GENDER;

COUNT(*) GENDER

5 MALE

2 FEMALE

3.REPORT FILE 07

4.PROJECT 08

5.VIVA 03

TOTAL 30
SSCE PRACTICAL EXAMINATION (2024 - 2025)
COMPUTER SCIENCE - NEW (083)
STD : XII SET E SCHOOL CODE: 55406
MAX. MARKS : 30 DURATION: 3 hrs
QUESTIONS MARKS

1. Python Program 08

Write a Python program Create a CSV file to store bookid, bookname, price and count
and display the number of books where the price is more than 1000.

import csv

def writecsv():

f=open("d:\\books.csv",'w',newline='')

fobj=csv.writer(f)

fobj.writerow(['BOOKID','BNAME','AUTHORNAME','PRICE'])

n=int(input("enter the number of records:"))

rec=[]

for i in range (n):

b_id=int(input("enter the book id:"))

bname=input("enter the name of the book")

a_name=input("enter the name of the author:")

price=int(input ("enter the price of the book:"))

data=[b_id,bname,a_name,price]

rec.append(data)

fobj.writerows(rec)

def countcsv():

f=open("d:\\books.csv",'r',newline='')

c=0

fobj=csv.reader (f)

x=list(fobj)

for i in x:

if i [3].isdigit():

if int(i[3])>1000:

c+=1

print(" the no.of books above 1000 is ",c)

f.close()

writecsv()

countcsv()
OR

Write a Python Program to Create a binary file with Empno, Name, Salary then read and
display their details on screen

import pickle

def write():

f=open("d:\\employee.dat", 'wb')

while True:

emp=int(input("enter employee id:"))

name=input("enter employee name:")

slry=int(input("enter employee salary:"))

data=[emp,name,slry]

pickle.dump(data,f)

ch= input("do you want to continue(Y/N)?")

if ch=='n' or ch=='N':

break

f.close()

def read():

fi=open("d:\\employee.dat",'rb')

try:

print("file contents")

while True:

x=pickle.load(fi)

print(x)

except:

fi.close()
write()

read()

2. DBMS – SQL queries 04


Table: CUSTOMER
CUSTID NAME PRICE QTY CID

101 ROHAN SHARMA 70,000 20 222

102 DEEPAK KUMAR 50,000 10 666

103 MOHAN KUMAR 30,000 5 111

104 SAHIL BANSAL 35,000 3 333

105 NEHA SONI 25,000 7 444

106 SONAL AGGARWAL 20,000 5 333

Table : COMPANY

CID NAME CITY PRODUCTNAME

111 SONY DELHI TV

222 NOKIA MUMBAI MOBILE

333 ONIDA DELHI TV

444 SONY MUMBAI MOBILE

555 BLACKBERRY MADRAS MOBILE

Write the Commands for the following and execute.

a) To display those company name which is in delhi.

ANS: SELECT NAME FROM COMPANY WHERE CITY=’DELHI’;

b) To delete the QTY column from the table customer

ANS: ALTER TABLE CUSTOMER DROP QTY;

c) To increase the price by 3000;

ANS: UPDATE CUSTOMER SET PRICE=PRICE+3000;

Predict the output for the following SQL commands.

d) SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r;

AVG(QTY)

7.5
e) SELECT PRODUCTNAME,CITY, PRICE
FROM COMPANY, CUSTOMER WHERE
COMPANY. CID=CUSTOMER.CID AND PRODUCTNAME=”MOBILE”;

productname city price

mobile mumbai 70000

mobile mumbai 25000

3.REPORT FILE 07

4.PROJECT 08

5.VIVA 03

TOTAL 30

SSCE PRACTICAL EXAMINATION (2024 - 2025)


COMPUTER SCIENCE - NEW (083)
STD : XII SET F SCHOOL CODE: 55406
MAX. MARKS : 30 DURATION: 3 hrs
QUESTIONS MARKS

1. Python Program 08

Write a Python program Create a CSV file to store Rollno, Name, Age and search any
Rollno and display Name, Age and if not found display appropriate message.

import csv

def write():

f=open("store.csv", 'w', newline='')

fobj=csv.writer(f)

fobj.writerow(['rollno', 'name', 'age'])

n=int(input("enter no. of records:"))

for i in range(n):

rno=int(input("enter roll no:"))

name=input("enter name:")

age=int(input("enter age:"))

data=[rno, name, age]

fobj.writerow(data)

print("records inserted successfully")

f.close()

def search():

fi=open("store.csv", 'r', newline='')

rno=int(input("enter roll no. to search:"))

s=0

fobj=csv.reader(fi)

for i in fobj:

if i[0].isdigit():

if int(i[0])==rno:

print(i[1],i[2])

s=1
break

if s==0:

print("record not found")

fi.close()

write()

search()

2. . DBMS – SQL queries


Table: CUSTOMER
CUSTID NAME PRICE QTY CID

101 ROHAN SHARMA 70,000 20 222

102 DEEPAK KUMAR 50,000 10 666

103 MOHAN KUMAR 30,000 5 111

104 SAHIL BANSAL 35,000 3 333

105 NEHA SONI 25,000 7 444

106 SONAL AGGARWAL 20,000 5 333

Table : COMPANY

CID NAME CITY PRODUCTNAME

111 SONY DELHI TV


04
222 NOKIA MUMBAI MOBILE

333 ONIDA DELHI TV

444 SONY MUMBAI MOBILE

555 BLACKBERRY MADRAS MOBILE

Write the Commands for the following and execute.

a) To display those company name which is in delhi.

ANS: SELECT NAME FROM COMPANY WHERE CITY=’DELHI’;

b) To delete the QTY column from the table customer

ANS: ALTER TABLE CUSTOMER DROP QTY;

c) To increase the price by 3000;

ANS: UPDATE CUSTOMER SET PRICE=PRICE+3000;


Predict the output for the following SQL commands.

d) SELECT AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r;

AVG(QTY)

7.5

e) SELECT PRODUCTNAME,CITY, PRICE


FROM COMPANY, CUSTOMER WHERE
COMPANY. CID=CUSTOMER.CID AND PRODUCTNAME=”MOBILE”;

productname city price

mobile mumbai 70000

mobile mumbai 25000

3.REPORT FILE 07

4.PROJECT 08

5.VIVA 03

TOTAL 30
SSCE PRACTICAL EXAMINATION (2024 - 2025)
COMPUTER SCIENCE - NEW (083)
STD : XII SET G SCHOOL CODE: 55406
MAX. MARKS : 30 DURATION: 3 hrs
QUESTIONS MARKS

1. Python Program 08

Write a program that implements a stack using a dictionary to store stationery items and
their prices. The stack should only contain stationery items whose price is greater
than100. Your program should include the following user-defined functions:

1. push(): Adds a stationery item name to the stack if the price is greater than 100.

2. peek(): Displays the name of the top item in the stack without removing it. If the
stack is empty, the function should return a message indicating that the stack is
empty.

3. pop(): Removes and displays item from the stack. If the stack is empty, the
function should return a message indicating that the stack is empty

dict1={'pen':50,'notebook':120,'markers':200,'pencil':20,'paint':240,'glue':90}

stack=[]

def push(a):

for i in a:

if a[i]>100:

stack.append(i)

return stack

def peek(x):

if stack!=[]:

print("the top element in the stack is:",(stack[-1]))

else:

print("stack empty")

def pop(y):

for i in range(len(stack)+1):
if stack!=[]:

print("The top element being removed from the stack is:",stack.pop())

else:

print("THE STACK IS EMPTY")

print(push(dict1))

peek(stack)

pop(stack)

2. DBMS – SQL queries 04


Table: STUDENT

Write the Commands for the following and execute.

a) To display data in ascending / descending order by name

ANS: select * from student order by name;

b) To remove any one student record from the student table.

ANS: delete from student where sno=2;

c) To display the number of students in each dept.

ANS: select count(*),dept from student group by dept;

Predict the output for the following SQL commands.

d) Select COUNT(distinct dept) from student.

COUNT(distinct dept)

4
e) Select MAX(age) from student where Gender=’F’.

MAX(age)

21

3.REPORT FILE 07

4.PROJECT 08

5.VIVA 03

TOTAL 30

SSCE PRACTICAL EXAMINATION (2024 - 2025)


COMPUTER SCIENCE - NEW (083)
STD : XII SET H SCHOOL CODE: 55406
MAX. MARKS : 30 DURATION: 3 hrs
QUESTIONS MARKS

1. Python Program
Ishita, an IT consultant, has a binary file products.dat containing product details. She
needs to write a user-defined function Filter_items() to create a new binary file
available_products.dat, which includes all product details except the product with
item_id 404. The data in the binary file is stored as: {item_id: [product_name,
quantity_available]}. Guide her in completing this task with the appropriate Python
code. 08

import pickle

def Filter_items():

d={}
f=open("d:\\products.dat",'rb')

f1=open("d:\\available_products.dat", 'wb')

try:

product = pickle.load(f)

for i in product:

if i!=404:

d[i]=product[i]

pickle.dump(d,f1)

print("items dumped to new file excluding product having item_id 404")

except EOFError:

f.close()

f1.close()

Filter_items()

2. DBMS – SQL queries


To write SQL commands for the following on the basis of given relations.

Table: Stationary Table : Consumer

04

a) To display the details of those consumers whose Address is Delhi.


ANS: SELECT * FROM CONSUMER WHERE ADDRESS=’DELHI’;

b) To display the details of Stationary whose Price is in the range of 4 to 22.


ANS: SELECT * FROM STATIONARY WHERE PRICE BETWEEN
4 AND 22;

c) To display the C_name, Address from Table consumer, and Company


and price from table stationary ,with their corresponding matching
P_ID.

ANS: SELECT C_NAME,ADDRESS,COMPANY,PRICE FROM


STATIONARY,CONSUMER WHERE
STATIONARY.PID=CONSUMER.PID;

d) Select Distinct Address from Consumer.

Distinct Address

DELHI
CHENNAI
BANGALORE
MUMBAI

e) Select company, MAX(price),MIN(price),COUNT(*) from


stationaryGROUPBYcompany

COMPANY MAX(PRICE) MIN(PRICE) COUNT(*)

CAMLIN 30 20 2

DOMS 5 5 2
3.REPORT FILE 07

4.PROJECT 08

5.VIVA 03

TOTAL 30

INTERNAL EXAMINER EXTERNAL EXAMINER

You might also like