~ Co-Powered PraniAracdeXnetworks


A.I.S.S.C.E.(PRACTICAL EXAMINATION-2025) 

SUBJECT: COMPUTER SCIENCE (083) 

CLASS: XII 

SET A 



1.Write a Python program to create a text file 'rd.txt' and write following text in it - 

India ushered in its 75th Republic Day with a grand display of its women power and military might that included elite marching contingents, missiles, warplanes, surveillance gadgets and lethal weapon systems, with French President Emmanuel Macron gracing the occasion as the chief guest. This year's themes of Republic Day 2024 are the "Viksit Bharat" and "Bharat - Loktantra ki Matruka". 

Now read the file and write functions to: 

vowel_count()→Count no of vowels 

digit_count() Count no of digits


ANS) # Write the text to 'rd.txt'

text = '''India ushered in its 75th Republic Day with a grand display of its women power and military might that included elite marching contingents, missiles, warplanes, surveillance gadgets and lethal weapon systems, with French President Emmanuel Macron gracing the occasion as the chief guest. This year's themes of Republic Day 2024 are the "Viksit Bharat" and "Bharat - Loktantra ki Matruka".'''


with open('rd.txt', 'w') as file:

    file.write(text)


# Function to count vowels by reading the file

def vowel_count():

    with open('rd.txt', 'r') as file:

        content = file.read()

    count = 0

    for char in content:

        if char in 'aeiouAEIOU':

            count += 1

    return count


# Function to count digits by reading the file

def digit_count():

    with open('rd.txt', 'r') as file:

        content = file.read()

    count = 0

    for char in content:

        if char >= '0' and char <= '9':

            count += 1

    return count


# Output the counts

print(f"Number of vowels: {vowel_count()}")

print(f"Number of digits: {digit_count()}")


2.Create the following table Shop inside a database B1_CS_24: 

Write sql queries for (I) to (III): 

1) To display Id and SName of all Shops located in Nehru Place. 

II) To display the Area and no of Suppliers from each area. 

III) To display the suppliers who have 'tech' in their name. 



ANS) CREATE DATABASE B1_CS_24;

USE B1_CS_24;


CREATE TABLE Shop (

    Id VARCHAR(10),

    SuppName VARCHAR(100),

    Area VARCHAR(50)

);


-- Insert data into the table

INSERT INTO Shop (Id, SuppName, Area) VALUES

('S01', 'ABC Computeronics', 'CP'),

('S02', 'All Infotech Media', 'GK II'),

('S03', 'Tech Shoppe', 'Nehru Place'),

('S04', 'Geeks Techno Soft', 'CP'),

('S05', 'Hitech Tech Store', 'Nehru Place');


I) SELECT Id, SuppName

FROM Shop

WHERE Area = 'Nehru Place';


II)SELECT Area, COUNT(Id) AS NumberOfSuppliers

FROM Shop

GROUP BY Area;


III)SELECT Id, SuppName

FROM Shop

WHERE SuppName LIKE '%tech%';





SET B


1. Write a Python program to create a text file 'ppc.txt' and write following text in it (Ignore the bullets) 

  • The interaction every youngster is waiting for is back. 

  • Pariksha Pe Charcha with Prime Minister Narendra Modi is here! 

  • Leave your stress and nervousness behind and get ready to set those butterflies in your stomach free! 

  • On popular demand, this time, the Prime Minister's massively popular interaction will not only have students but also parents and teachers. 

  • You too can get a chance to hang out with one of the most inspiring Prime Ministers ever, ask him for tips, seek advice. You could pose questions you always wanted answers for! 

  • So, how do you (a student, parent or teacher) get a chance to participate in the Seventh edition of Pariksha Pe Charcha?

  •  It's very simple. 

Now read the file and write functions to: 

line_count()→Count no of lines 

word_count()→ Count no of words 


ANS) # Step 1: Write the given text to 'ppc.txt'

text = '''The interaction every youngster is waiting for is back.

Pariksha Pe Charcha with Prime Minister Narendra Modi is here!

Leave your stress and nervousness behind and get ready to set those butterflies in your stomach free!

On popular demand, this time, the Prime Minister's massively popular interaction will not only have students but also parents and teachers.

You too can get a chance to hang out with one of the most inspiring Prime Ministers ever, ask him for tips, seek advice. You could pose questions you always wanted answers for!

So, how do you (a student, parent or teacher) get a chance to participate in the Seventh edition of Pariksha Pe Charcha?

It's very simple.'''


# Writing the text into the file

with open('ppc.txt', 'w') as file:

    file.write(text)


# Step 2: Read the file and define the functions


# Function to count the number of lines

def line_count():

    with open('ppc.txt', 'r') as file:

        lines = file.readlines()  # Reads all lines and returns a list

    return len(lines)


# Function to count the number of words

def word_count():

    with open('ppc.txt', 'r') as file:

        content = file.read()  # Read the entire file content

    words = content.split()  # Split content into words using space as a delimiter

    return len(words)


# Output the counts

print(f"Number of lines: {line_count()}")

print(f"Number of words: {word_count()}")


2.Create the ACCESSORIES table in MYSQL inside a database B2_CS_24 and insert the records as shown below.

Consider the Accessories table given above. Write sql queries for (I) to (III)

I) To arrange the records in descending order of price.

II) To display those records where price range is from 300 to 500

III) To display the average price of Keyboard.

ANS) CREATE DATABASE B2_CS_24;

USE B2_CS_24;


CREATE TABLE ACCESSORIES (

    No VARCHAR(10),

    Name VARCHAR(100),

    Price INT,

    S_Id VARCHAR(10)

);


-- Insert the given records into the ACCESSORIES table

INSERT INTO ACCESSORIES (No, Name, Price, S_Id) VALUES

('A01', 'Mother Board', 12000, 'S01'),

('A02', 'Keyboard', 500, 'S02'),

('A03', 'Mouse', 300, 'S01'),

('A04', 'Mother Board', 13000, 'S02'),

('A05', 'Keyboard', 400, 'S03'),

('A06', 'LCD', 6000, 'S04'),

('A07', 'LCD', 5500, 'S05');


I)SELECT * FROM ACCESSORIES

ORDER BY Price DESC;

II)SELECT * FROM ACCESSORIES

WHERE Price BETWEEN 300 AND 500;

III)SELECT AVG(Price) AS Average_Keyboard_Price

FROM ACCESSORIES

WHERE Name = 'Keyboard';