0% found this document useful (0 votes)
27 views

Class 12 CS Practical Set B Answer Key (23-24)

Csc answer pratical paper

Uploaded by

seetha1981sk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Class 12 CS Practical Set B Answer Key (23-24)

Csc answer pratical paper

Uploaded by

seetha1981sk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CENTRAL BOARD OF SECONDARY EDUCATION

PRACTICAL EXAMINATION SET – B (Answer Key)


SCHOOL NAME: MEENAKSHI AMMAL GLOBAL SCHOOL
SCHOOL CODE: 55365
CLASS: XII MARKS: 30
SUBJECT: Computer Science - Practical (083) TIME: 3 hrs
1. Python program – 8 marks
Write a Program to remove all the lines that contain the characters ‘a’ in a file and write it to another file.
Source Code:

fo=open(“old.txt”,”r”)
fn=open(“new.txt”,”w”)
lines=fo.readlines()
line=” “
for line in lines:
if ‘a’ not in line:
fo.write(line)
else:
fn.write(line)
fo.close()
fn.close()
print(“Data updated successfully”)

2. SQL Queries – 4 marks

TABLE: CUSTOMER

CNO CNAME ADDRESS


101 Richa Jain Delhi
102 Surbhi Sinha Chennai
103 Lisa Thomas Bengalore
104 Imran Ali Delhi
105 Roshan Singh Chennai
TABLE: TRANSACTION

TRNO CNO AMOUNT TYPE DOT


T001 101 1500 Credit 2017-11-23
T002 103 2000 Debit 2017-05-12
T003 102 3000 Credit 2017-06-10
T004 103 12000 Credit 2017-09-12
T005 101 1000 Debit 2017-09-05

(i) To display details of all transactions ot TYPE Credit from table TRANSACTION.

Query: Select * from TRANSACTION where TYPE = “Credit”;

(ii) To display the last date of transaction (DOT) from the table TRANSACTION for the customer

having CNO as 103.

Query: Select MAX (DOT) from TRANSACTION where CNO = “103” ;

(iii) To display the Transaction number, Amount and Date of transactions of all transactions in

descending order of amount.

Query: Select TRNO, AMOUNT, DOT from TRANSACTION order by Amount Desc;

(iv) To display customer names and corresponding amounts for all customers.

Query: Select CNAME, AMOUNT from CUSTOMER, TRANSACTION where CUSTOMER.CNO =

TRANSACTION.CNO;

You might also like