Solution
AISSCE PRACTICAL EXAMINATION [2025-26]
TIME: -3 HOURS SUBJECT: COMPUTER SCIENCE [083] MM:30
Q1. LAB TEST [8]
(a) Create a python program to read a text file and display the number of vowels / consonants / lower case /
upper case / characters in the file.
f=open("[Link]", 'r')
Contents=[Link]()
Vowels=0
Consonants=0
Lower_case=0
Upper_case=0
for ch in Contents:
if ch in 'aeiouAEIOU':
Vowels=Vowels+1
if ch in 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ':
Consonants=Consonants+1
if [Link]():
Lower_case=Lower_case+1
if [Link]():
Upper_case=Upper_case+1
[Link]()
print("The total numbers of vowels in the file:", Vowels)
print("The total numbers of Consonants in the file:", Consonants)
print("The total numbers of Upper case in the file:", Upper_case)
print("The total numbers of Lower case in the file:", Lower_case )
(b) Create a python program to create a stack of student's marks.
a) Write function PUSH to add marks in to the stack and
b) Write function POP to remove the marks from stack and display the same.
Ans: -
marks = []
def PUSH(m):
[Link] (m)
def POP ():
if marks == []:
print ("Empty Stack")
else:
p = [Link] ()
print(p)
#to invoke push for five times
print("PUSHING")
for a in range (5):
num = int (input ("Enter Number: "))
PUSH (num)
#to invoke pop for six times
print("POPPING")
for a in range(6):
POP()
OUTPUT: -
PUSHING
Enter Number: 1
Enter Number: 4
Enter Number: 6
Enter Number: 2
Enter Number: 3
POPPING
3
2
6
4
1
Q2. To write queries for the following Questions based on the given table: SALESMEN [4]
S_ID NAME CITY COMMISSION(%)
S_101 Mohan Delhi 12.5
S_102 Gopal Mumbai 13
S_103 Hari Lucknow 14.5
S_104 Krishna Vrindavan 15
S_105 Ram Ayodhya 20
S_106 Vishnu Vaikuntha 12
S_107 Raman Lucknow 15
a. Display the names and commission of the salesmen.
b. Display the name of the salesmen belonging to the city “Vrindavan”.
c. Display the name of the salesmen, who are getting less than 14% commission.
d. Display the list of all salesmen in descending order of commissions
Ans: -
a. SELECT NAME, COMMISSION FROM SALESMEN;
b. SELECT NAME FROM SALESMEN WHERE CITY=“Vrindavan”;
c. SELECT NAME FROM SALESMEN WHERECOMMISSION<14;
d. SELECT * FROM SALESMEN ORDER BY COMMISSION DESC;