Final Board Practicals 2023-2024 CS Programs
Final Board Practicals 2023-2024 CS Programs
SOURCE CODE:
SCORE={"KAPIL":40,"SACHIN":55 , "SAURAV":80,"RAHUL":35, "YUVRAJ":110
}
def PUSH(S,R):
S.append(R)
def POP(S):
if S!=[]:
return S.pop()
else:
return None
ST=[ ]
for k in SCORE:
if SCORE[k]>49:
PUSH(ST,k)
while True:
if ST!=[]:
print(POP(ST),end=" ")
else:
break
OUTPUT:
YUVRAJ SAURAV SACHIN
Q2. MySQL 4 Marks
Consider the following table ‘Doctor’.
2. Group & Display all the details of doctor according to their gender.
SELECT * FROM DOCTOR GROUP BY SEX;
Write a Python Program to get student data (rollno,name,marks) from user and write
onto a binary file. The program should be able to get data from the user and write onto
the file as long as the user wants.
SOURCE CODE:
import pickle
stud={}
stufile=open("stud.dat","wb")
ans='y'
while ans=='y':
rno=int(input("Enter the Roll number:"))
name=input("Enter the Name of the Student:")
marks=float(input("Enter marks:"))
stud['Rollno']=rno
stud['Name']=name
stud['marks']=marks
pickle.dump(stud,stufile)
ans=input("Want to enter more records? (Y/N)-")
stufile.close()
OUTPUT:
Enter the Roll number:11
Enter the Name of the Student:Gokul
Enter marks:83.5
Want to enter more records? (Y/N)-y
Enter the Roll number:12
Enter the Name of the Student:Mano
Enter marks:81.5
Want to enter more records? (Y/N)-y
Enter the Roll number:13
Enter the Name of the Student:James
Enter marks:80
Want to enter more records? (Y/N)-N
Q2. MySQL 4 Marks
Consider the table ‘EMPLOYEES’
NO NAME DEPARTMENT DATE OFJOINING SALARY SEX
1 RAJA COMPUTER 21/05/1998 8000 M
2 SANGILA HISTORY 21/05/1997 9000 F
3 RITU SOCIOLOGY 29/08/1998 8000 F
4 KUMAR LINGUISTICS 13/06/1996 10000 M
5 VENKATRAMAN HISTORY 31/10/1999 8000 M
6 SIDHU COMPUTER 21/05/1986 14000 M
7 AISWARYA SOCIOLOGY 11/01/1988 12000 F
Write SQL commands for the following:
1. Write a query to display the lowest salary of teacher in all the departments.
SELECT MIN (SALARY) AS 'LOWEST SALARY' FROM EMPLOYEES;
SOURCE CODE:
def arCalc(x,y):
return x+y,x-y,x*y,x/y,x%y
print("ARITHMETIC OPERATIONS")
num1=int(input("Enter number 1:"))
num2=int(input("Enter number 2:"))
add,sub,mul,div,mod=arCalc(num1,num2)
print("Sum of given numbers:",add)
print("Subtraction of given numbers:",sub)
print("Product of given numbers:",mul)
print("Division of given numbers:",div)
print("Modulo of given numbers:",mod)
OUTPUT:
ARITHMETIC OPERATIONS
Enter number 1:4
Enter number 2:7
Sum of given numbers: 11
Subtraction of given numbers: -3
Product of given numbers: 28
Division of given numbers: 0.5714285714285714
Modulo of given numbers: 4
Q2. MySQL 4 Marks
Consider the following table ‘ACTIVITY’
2. Write a query to display the activity names, Acode in ascending order of prize
money who is in ‘Star Annex’ stadium.
SELECT ACTIVITYNAME, ACODE FROM ACTIVITY WHERE STADUIM
= ‘STAR ANNEX’ ORDER BY PRIZE_MONEY;
Write SQL output based on the given query:
3. SELECT SUM (PARTICIPANT_NUM) AS 'TOTAL' FROM ACTIVITY
WHERE PRIZE_MONEY > 9000;
TOTAL
36
4. ALTER TABLE ACTIVITY ADD CITY VARCHAR(20);
ACTIVITY PARTICIPANTS PRIZE SCHEDULE
ACODE STADIUM CITY
NAME NUM MONEY DATE
RELAY STAR
1001 16 10000 23-JAN-04 NULL
100x4 ANNEX
HIGH STAR
1002 10 12000 12-DEC-03 NULL
JUMP ANNEX
SUPER
1003 SHOT PUT 12 8000 14-FEB-04 NULL
POWER
LONG STAR
1005 12 9000 01-JAN-04 NULL
JUMP ANNEX
DISCUSS SUPER
1008 10 15000 19-MAR-04 NULL
THROW POWER
SET 4
SOURCE CODE:
fileobj=open("vowels.txt","r")
vowel=0
consonants=0
upper=0
lower=0
L=fileobj.read()
vowels=['a','e','i','o','u','A','E','I','O','U']
for i in L:
if i.isalpha():
if i.islower():
lower+=1
if i.isupper():
upper+=1
if i in vowels:
vowel+=1
else:
consonants+=1
print("Number of upper:",upper)
print("Number of lowercase:",lower)
print("Number of vowels:",vowel)
print("Number of consonants:",consonants)
OUTPUT:
The Content in vowels file is:
The Program will create the file name in your program's folder..
Number of upper: 2
Number of lowercase: 49
Number of vowels: 19
Number of consonants: 32
Q2. MySQL 4 Marks
Consider the following tables ‘Customer’ and ‘ Order’.
Table: Customer
CUSTOMERID CUSTOMERNAME CITY MOBILENO
C1 ABHISHEK AHMEDABAD 9999999999
C2 BHAVIK BARODA 8888888888
C3 CHANDABI AHMEDABAD 6666666666
C4 DHARA MUMBAI 55555555555
C5 DIVYA PATNA 7777777777
Table: Order
ORDERID ORDERDATE ORDERAMT CUSTOMERID
O1 2024-04-10 1500 C1
O2 2024-05-20 1800 C5
O3 2024-05-31 1000 C6
O4 2024-06-12 1400 C3
SOURCE CODE:
N=[12, 13, 34, 56, 21, 79, 98, 22,35, 38]
def PUSH(S,N):
S.append(N)
def POP(S):
if S!=[]:
return S.pop()
else:
return None
ST=[]
for k in N:
if k%2!=0:
PUSH(ST,k)
while True:
if ST!=[]:
print(POP(ST),end=" ")
else:
break
OUTPUT:
35 79 21 13
Q2. MySQL 4 Marks
Consider the tables ‘Books’ and ‘Issued’
Table : Books
BID BNAME AUNAME PRICE TYPE QTY
COMP11 LET US C YASHWANT 350 COMPUTER 15
GEOG33 INDIA MAP RANJEET P 150 GEOGRARHY 20
HIST66 HISTORY R BALA 210 HISTORY 25
COMP12 MY FIRST C VINOD DUA 330 COMPUTER 18
LITR88 MY DREAMS ARVIND AD 470 NOBEL 24
Table : Issued
BID QTY_ISSUED
HIST66 10
COMP11 5
LITR88 15