Class 12 CSC Practical File Mysql
Class 12 CSC Practical File Mysql
2022-2023
COMPUTER SCIENCE
(083)
NAME: S JAYADHITYAA
CERTIFICATE
This is to certify that of
class XII bearing Board examination Roll No.
has successfully completed practical
record file during the academic year 2022-2021 in partial
fulfillment of Term – II practical examination for the subject
COMPUTER SCIENCE (083) conducted by AISSCE, CBSE
Date:
External Examiner
Computational Thinking and Programming – II
(PYTHON)
Data Structures
1) Write a Menu Based Program to implement a stack that holds list of numbers. Take care
of overflow/underflow situations. The Menu should be
1. Push
2. Pop
3. Display entire stack content
4. Display Top Node
5. Exit
2) Write a menu driven python program to implement operations on STACK named L that
stores a list of numbers. Define the required functions as per the specifications given
below
1. def PUSHSTACK (STK, N): where the numeric value N is pushed into the stack. If the
size of the stack is 10 report STACK OVERFLOW situation.
2. def IS_EMPTY (STK): returns True if stack is empty otherwise returns False
3. def POPSTACK (STK): where, the function returns the value deleted from the stack.
4. def SHOWSTACK(STK): displays the contents of the stack
5. def PEEK(STK): displays the topmost element of the stack
Write the required top-level statements and function call statements. Note the POPSTACK,
SHOWSTACK and PEEK functions will invoke IS_EMPTY function to check and report STACK
UNDERFLOW situation.
3) Write a Menu Based Program to implement a stack that holds details of books. Take care
of overflow/underflow situations. The Menu should be
1. Push
2. Pop
3. Display entire stack content
4. Display Top Node
5. Exit
Each node of the Stack will have the following
structure [BOOK_ID, TITLE, AUTHOR,
PRICE]
4) Write the definition of a function POP_PUSH ( LPop, LPush, N) in Python. The function
should Pop out the 1ast N elements of the list LPop and Push them into the list LPush .
For example:
If the contents of the list LPop are [10, 15, 20, 30]
And value of N passed is 2,
then the function should create the list LPush as [ 30, 20
J And the list LPop should now contain [10, 15]
NOTE : If the value of N is more than the number of elements present in LPop, then display the
message "Pop not possible" .
Write the required top-level statements and function call statements and execute the program.
Database Management
MYSQL
Write SQL Queries for the following:
1) Create a Database named INSTITUTE
2) Create a table named FACULTY with the following structure.
Table FACULTY
ATTRIBUTE DATATYPE CONSTRAINT
F_ID Integer PRIMARY KEY
Fname Text data with max length 25 characters NOT NULL
Lname Text data with max length 25 characters NOT NULL
and UNIQUE
HIRE_DATE DATE
SALARY DECIMAL SIZE 7,2 Must be >= 5000
4) Insert following data records into FACULTY table and COURSES table.
Table: PRODUCT
P_ ID ProductName Manufacturer Price
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120
FW12 Face Wash XYZ
Table – FACULTY
> insert into FACULTY value (102, "Amit",
"Mishra","1998-10-12",12000);
Table – COURSES
> rollback;
Query OK, 0 rows affected (0.01 sec)
Table: PRODUCT
P_ ID ProductName Manufacturer Price
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120
FW12 Face Wash XYZ
Source Code:
import mysql.connector as ms
cur = con.cursor()
#
cur.execute("insert into product
values('TP01','Talcum Powder','LAK',40)")
con.commit()
while True:
m = int(input("\nEnter input [(1) - (6)]: "))
if m == 1:
a = input("Enter p_id: ")
b = input("Enter prod_name: ")
c = input("Enter manufacturer: ")
d = int(input("Enter price: "))
print("\nDone!!!\n")
elif m == 2:
print("\n",data1,"\n")
elif m == 3:
print("\n",data2,"\n")
elif m == 4:
print("\nDone!!!\n")
elif m == 6:
print("\nYou have exited...")
break
else:
print("\nInvalid Input ... Try Again\n")
con.close()
Output:
Done!!!
Done!!!
Done!!!