Professional Documents
Culture Documents
12 CS Record Obs Material 2024 1714638166
12 CS Record Obs Material 2024 1714638166
Index
Program No Title
Program-1 Basics of Python-Phishing E-Mail
Program-2 Functions- Printing Factorial/Fibonacci/Prime Number
Program-3 Built in Module-Using Statistics/Random module
Program-4 Text File-1- Manipulating lines
Program-5 Text File-2 -Analysing characters
Program-6 Text File-3 – Manipulating words
Program-7 Binary File-1 – Inserting, Displaying and Searching with list
Program-8 Binary File-2 - Inserting, Displaying and Deleting with list
Program-9 Binary File-3 - Inserting, Displaying and Updating with Dictionary
Program-10 CSV File-1 – Inserting, Displaying and Updating with list
Program-11 CSV File-2 - Inserting, Deleting and displaying with list
Program-12 CSV File-3 - Inserting, Searching and Displaying with List
Program-13 Stack-1-Push, Pop and Display with list
Program-14 Stack-2-Push and Peek with list
Program-15 Stack-3- Push, count of stk_ele and Display with dictionary
Program-16 SQL Queries – 1 - Carden & Model Table
Program-17 SQL Queries – 2 - Sports Table
Program-18 SQL Queries – 3 - Myorder & Mystatus Table
Program-19 SQL Queries – 4 - Students Table
Program-20 SQL Queries – 5 - Employee Table
Program-21 SQL Queries – 6 - Item Table
Program-22 SQL Queries – 7 – Worker Table
Program-23 SQL Queries – 8 - Personal & Job Table
Program-24 SQL Queries – 9 - Books Table
Program-25 SQL Queries – 10 – Collections Table
Program-26 PYTHON-SQL CONNECTIVITY-1-Table creation and record insertion
Program-27 PYTHON-SQL CONNECTIVITY-2- Record updating
Program-28 PYTHON-SQL CONNECTIVITY-3- Record deletion
Program-29 PYTHON-SQL CONNECTIVITY-4- Search and Display
Program-30 PYTHON-SQL CONNECTIVITY-5- Database creation ,Table creation and
Table alteration
Class XII - Computer Science with Python(083)
Note:
Write the Title, Question, Aim , Code and Result on the R.H.S.(with blue ink) of your
observation notebook & record note book, the output alone on the L.H.S.(will be given
later).Open the link of Python program in laptop or desktop to see the code.
Start every exercise on a fresh page
Program 1:
Title: Basics of Python-Phishing E-Mail
Question: Write a Program to take 10 sample phishing emails and find the most common
occurring domain.
AIM: To write a Program to take 10 sample phishing emails and find the most common
occurring domain.
CODE:
https://drive.google.com/file/d/1u0lcPxuHzW5spMlcLSkKaBx8iCXXBj2z/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program 2:
Title: Functions- Printing Factorial/Fibonacci/Prime Number
Question: Write a program to calculate the factorial value or to print the Fibonacci series
for n terms or check whether the entered no. is prime or not based on users’ choice.
AIM:
To write a menu driven program
1. to calculate the factorial value
2. to print the Fibonacci series for n terms
3. to check whether the entered no. is prime or not.
CODE: https://drive.google.com/file/d/1RKBVdA1fstjSQlhb2um5UkGbhzezPFWY/view?
usp=share_link
Result: The above program is executed successfully and the output is verified
Program:3
Title: Built in Module-Using Statistics/Random module
Question: Write a Program to use the functions from Statistics and Random modules.
Aim: To write a menu – driven program to import and use the below modules.
1.Statistics
2.Random
CODE:
https://drive.google.com/file/d/1vfR7DkXCG9-g9hP3SlPHdUiCYlffNDXP/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program 4 :
Title: Text File-1- Manipulating lines
Question: Write a text file handling program in python to do the following
1. To read a text file line by line and display each word separated by a #.
2. To remove all the lines that contain the character `W’ from a file and write it to another
file
AIM: To write a menu – driven program to perform the following on a text file
1. To write a python function to read a text file line by line and display each word
separated by a #.
2. To write a python function to remove all the lines that contain the character `W’
from a file and write it to another file
CODE:
https://drive.google.com/file/d/16Yr-e-l8_785RP6rlcpSl9hzAFlkfQTE/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program 5:
Title : Text File-2 -Analysing characters
Question: Write a text file handling program in python to do the following
1. Display the number of vowels
2. Display the number of consonants
3. Display the number of upper-case characters
4. Display the number of lower-case characters
AIM:
To write a menu – driven program to perform the following on a text file
1. Display the number of vowels
2. Display the number of consonants
3. Display the number of upper-case characters
4. Display the number of lower-case characters
CODE:
https://drive.google.com/file/d/1TPPNBwqYgQO5HBqLfl6LsQzoy6nLsHDN/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program 6:
Title: Text File-3 – Manipulating words
Question: Write a text file handling program in python to do the following
1. Counting the specific word in a file
2. Replace the given word with another word
3. Display the words ending with character 'e'
4. Display the longest word of the file
AIM:
To write a menu – driven program to perform the following on a text file
1. Counting the specific word in a file
2. Display the text after replacing the given word with another word
3. Display the words ending with character 'e'
4. Display the longest word of the file
CODE:
https://drive.google.com/file/d/18RF9KkhkCVzGRLuB2qyiEkI2LYjzS1_q/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program 7:
Title: Binary File-1 – Inserting, Displaying and Searching with list
Question: Write a Program to create a product record on a binary file.
AIM: To write a python
1.Insert record
2.Display record
3.Search record
4.Exit
CODE:
https://drive.google.com/file/d/1ZMM3S_5Y1AF5xNpt_io_I_Bu96hxsqil/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program 8:
Title : Binary File-2 - Inserting, Displaying and Deleting with list
Question: Write a Program to Create an Employee Record on a Binary File.
AIM:
To write a menu – driven program to perform the following tasks on a Binary file
1.Insert record
2.Display record
3.Delete record
4.Exit
CODE:
https://drive.google.com/file/d/1mCEZhqjz9I28ZuHCWP2Q2pIZsyvPz-X2/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program 9:
Title : Binary File-3 - Inserting, Displaying and Updating with Dictionary
Question: Write a Program to Create a Student Record on a Binary File.
AIM:
To write a menu – driven program to perform the following tasks on a Binary file
1.Enter data
2.Display data
3.Update data
4.Exit
CODE:
https://drive.google.com/file/d/1d5K2-3nmhmfxGZPA7nPFsznLMlwLHf-W/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program -10:
Title : CSV File-1 – Inserting, Displaying and Updating with list
Question: Write a Program to Create a Customer record with CSV file.
AIM:
To write a menu – driven program to perform the following tasks on a CSV file
1-Add record
2-Display records
3-Modify record
4-Exit
CODE:
https://drive.google.com/file/d/16m2LVWzE5ydfAKq-dzjFkJ0S2UN_LFlo/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program -11:
Title : CSV File-2 - Inserting, Deleting and displaying with list
Question: Write a Program to Create a Book Details Record using CSV file.
AIM:
To write a menu – driven program to perform the following tasks on a CSV file
1. Add New Book
2. Display Books in sorted order
3. Delete Book
4. Quit
CODE:
https://drive.google.com/file/d/1mX-9jgIN5u46OhARZKEjtyRX0ElFV-i_/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program -12:
Title : CSV File-3 - Inserting, Searching and Displaying with List
Question: Write a Program to Create a record of user credentials using CSV file.
AIM:
To write a menu – driven program to perform the following tasks on a CSV file
1: Create
2: Search
3: Display
4: Exit
CODE:
https://drive.google.com/file/d/1E2AKA0kH28ArcKh5ef6rZF6QLFTo5bfl/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program -13:
Title : Stack-1-Push, Pop and Display with list
Question: Write a Program to Create and perform all basic operations of Stack with list of
numbers
AIM:
To write a menu – driven program to perform the following tasks on a number Stack.
STACK OPERATIONS
1: PUSH the elements divisible by 5
2: POP
3: Display
4: Exit
CODE:
https://drive.google.com/file/d/1IRP-pyVPEgyoYWFd5GNxBDCQNqjTNpSr/view?usp=drive_link
Result: The above program is executed successfully and the output is verified
Program -14:
Title : Stack-2-Push and Peek with list
Question: Write a Program to Create and perform all basic operations of Stack with
customer details
AIM:
To write a menu – driven program to perform the following tasks on a
Customer[Customer_name, Phone_number, City] Stack
1: PUSH - The customer details based on city
2: PEEK
3: EXIT
CODE:
https://drive.google.com/file/d/1D5PNGSHzTJ8j6sn2Wmx4dR6IZbcKqzq5/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program -15:
Title : Stack-3- Push, count of stk_ele and Display with dictionary
Question: Write a Program to Create and perform all basic operations of Stack with
dictionary {pname:price}
AIM:
To write a menu – driven program to perform the following tasks on a product Stack
STACK OPERATIONS
1: PUSH Product names with price > 75
2: Count the no. of elements in stack
3: Display
4: Exit
CODE:
https://drive.google.com/file/d/1zpQ197lynswzZmiyUW2VmohYuWSuP_fc/view?usp=share_link
Result: The above program is executed successfully and the output is verified
Program 16
Title: SQL Queries – 1 - Carden & Model Table
Question: Write SQL queries to perform the following task on PRACTICALS”
database with the given Table(s).
Aim:
To create the following table(s) and insert records
To execute the following queries on the created table(s)
Table : CARDEN
Ccode CarName Color Capacity Charges
501 A-Star RED 3 14
503 Indica SILVER 3 12
502 Innova WHITE 7 15
509 SX4 SILVER 4 14
510 C Class RED 4 35
Table :MODEL
Tabe: SPORTS
Result: The above tables are created, records have been inserted, queries are
executed and outputs are verified successfully
Program 18
Title: SQL Queries – 3 - Myorder & Mystatus Table
Question: Write SQL queries to perform the following task on “PRACTICALS” database
with the given Table(s).
Aim:
To create the following table(s) and insert records
To execute the following queries on the created table(s)
Table: MYORDER
OrderID Pname Quantity Rate Sale_date Discount
1001 Pen 10 20 2019-10-05 Null
1002 Pencil 20 10 2019-10-21 Null
1003 Book 10 100 2019-11-12 50
1004 Eraser 100 5 2019-12-05 25
1005 Ruler 50 25 2019-12-10 Null
Table:MYSTATUS
OrderI Status
D
1001 Booked
1002 Despatche
d
1007 Pending
1004 Despatche
d
(i)To display Pname, 1005 Despatche Quantity and Rate for all the
orders that are either pen d or pencil
SELECT 1006 Despatche PNAME,QUANTITY,RATE
FROM MYORDER d WHERE PNAME IN
(‘PEN’,’PENCIL’);
(ii)To display orders which are not getting any discount
SELECT * FROM MYORDER WHERE DISCOUNT IS NULL;
(iii)To display OrderID, Sale_date, Status.
SELECT MYORDER.ORDERID, SALE_DATE, STATUS FROM
MYORDER,MYSTATUS WHERE MYORDER.ORDERID = MYSTATUS.ORDERID;
(iv) To display the order details of the product whose rate is more than 20
SELECT * FROM MYORDER WHERE RATE>20;
Result: The above tables are created, records have been inserted, queries are executed
and outputs are verified successfully
Program 19
Title: SQL Queries – 4 – Students Table
Question:Write SQL queries to perform the following task on “PRACTICALS” database
with the given Table(s).
Aim:
To create the following table(s) and insert records
To execute the following queries on the created table(s)
Table: “STUDENTS”
i)To display the records from table students in alphabetical order as per the name of the student.
SELECT * FROM STUDENTS ORDER BY NAME;
ii)To display Class, DOB and City whose marks is between 450 and 551
SELECT CLASS, DOB, CITY FROM STUDENTS WHERE MARKS BETWEEN 450
AND 551;
iii)To display the highest marks and lowest marks of class-XII students
SELECT MAX(MARKS) , MIN(MARKS) FROM STUDENTS WHERE
CLASS=”XII”;
iv)To display the name and gender of the student those who are born in the year 1995
SELECT NAME, GENDER FROM STUDENTS WHERE YEAR(DOB)=1995;
Result: The above tables are created, records have been inserted, queries are executed and
outputs are verified successfully
Program 20
Title: SQL Queries – 5 – Employee Table
Question:
Write SQL queries to perform the following task on “PRACTICALS” database with
the given Table.
Aim:
To create the following table(s) and insert records
To execute the following queries on the created table(s)
Table :“EMPLOYEE”
i) To display Ecode, Ename, JoinDate, Salary of all faculty members in descending order of
their salary.
SELECT ECODE, ENAME, JOINDATE, SALARY FROM EMPLOYEE ORDER BY
SALARY DESC;
ii) To increase the salary of all faculties by 2000, who are either teaching the subject
“Programming” or teaching the subject “Maths”.
UPDATE EMPLOYEE SET SALARY = SALARY + 2000 WHERE SUBJECT IN
(‘PROGRAMMING’,’MATHS’)
iii) To display details of all faculty whose name ends with letter “n”.
SELECT * FROM EMPLOYEE WHERE ENAME LIKE “%N”;
iv)To count the employees gender wise.
SELECT COUNT(*),SEX FROM EMPLOYEE GROUP BY SEX;
Result: The above tables are created, records have been inserted, queries are executed
and outputs are verified successfully
Program 21
Table:ITEM
i)To display the Item name with stockdate in the year 2010.
SELECT NAME, STOCKDATE FROM ITEM WHERE YEAR(STOCKDATE)=2010;
ii) To display the ItemNo and name of those items whose Unitprice is more than Rs10.
SELECT ITEMNO, NAME FROM ITEM WHERE UNITPRICE > 10;
iii) To display the total Qty of each Dcode.
SELECT SUM(QTY) , DCODE FROM ITEM GROUP BY DCODE;
iv) To change the unit price of CD to 30.
UPDATE ITEM SET UNITPRICE=30 WHERE NAME=”CD”;
Result: The above tables are created, records have been inserted, queries are executed
and outputs are verified successfully
Program 22
Table : WORKER
WNO NAME DOJ DOB GENDER DCODE
101 Guru 2013-09-02 1991-09-01 MALE D001
102 Ramya 2012-12-11 1990-12-15 FEMALE D003
104 Manila 2012-12-09 1986-11-14 FEMALE D001
105 Sanjay Roy 2013-11-18 1987-03-31 MALE D002
106 Jaya 2014-06-09 1985-06-23 FEMALE D005
(iii) To display the WNO and Name of those workers who are born between ‘1988-01-01’ and
‘1992-12-01’.
SELECT WNO, NAME FROM WORKER WHERE DOB BETWEEN ‘1988-01-01’ AND ‘1992-12-01’;
(iv) To count and display Male workers who have joined after ‘1986-01-01’.
SELECT COUNT(*) FROM WORKER WHERE GENDER=”MALE” AND DOJ > ‘1986-01-01’;
Result: The above tables are created, records have been inserted, queries are executed
and outputs are verified successfully
Program 23
Table : Job
(i) To show Book name, Author name and Price of books of EPB.
SELECT BOOK_NAME, AUTHOR_NAME, PRICE FROM BOOKS
WHERE PUBLISHERS=”EPB”;
(ii) To list the names from books of cookery type.
SELECT BOOK_NAME FROM BOOKS WHERE TYPE=”COOKERY”;
(iii) To display the names and price from books in ascending order of their price.
SELECT BOOK_NAME, PRICE FROM BOOKS ORDER BY PRICE;
(iv) To increase the price of all books of TDH Publishers by 3%.
UPDATE BOOKS SET PRICE=PRICE + PRICE*3/100 WHERE
PUBLISHERS=”TDH’;
Result: The above tables are created, records have been inserted, queries are executed
and outputs are verified successfully
Program 25
Question:
Write SQL queries to perform the following task on “PRACTICALS”
database with the given Table(s).
Aim:
To create the following table(s) and insert records
To execute the following queries on the created table(s)
Result: The above tables are created, records have been inserted, queries are executed
and outputs are verified successfully
Program -26
Title: PYTHON-SQL CONNECTIVITY- 1- Table creation and record insertion
Question :Write a menu driven program to perform the following task on “XII”
database:
i) Creating the following table “CARDEN”
ii) Inserting the given records
Ccode CarName Make Color Capacity Charges
501 A-Star Suzuki RED 3 14
503 Indigo Tata SILVER 3 12
502 Innova Toyota WHITE 7 15
509 SX4 Suzuki SILVER 4 14
510 C Class Mercedes RED 4 35
AIM :
To write a menu driven program to perform the following task on “XII” database .
CODE:
https://drive.google.com/file/d/1OKJavwkSVrbhXx9OBq3ObU1-sP6paprU/view?
usp=drive_link
Result: The above program is executed successfully and the output is verified
Program -27
Title:PYTHON-SQL CONNECTIVITY-2- Record updation
CODE:
https://drive.google.com/file/d/1SCNrHjipRE0C2fzP9O1A6Vd9-Cko_SrL/view?usp=drive_link
Result: The above program is executed successfully and the output is verified
Program -28
Title: PYTHON-SQL CONNECTIVITY-3-Record deletion
Question : Write a program to delete the rows where class is 10 on “sports” table of
“XII” database:
CODE:
https://drive.google.com/file/d/1XQ2HZuGWK52_08NscT8mH1L7krAbLHp0/view?usp=drive_link
Result: The above program is executed successfully and the output is verified
Program -29
Title:PYTHON-SQL CONNECTIVITY-4-Search and Display
Question : Write a program to do the following task on “students” table of “XII” database:
AIM:
To Write a program
To sort the records according to the students name in alphabetical order
To display class, dob and city whose marks is between 450 and 551
To display the highest marks class wise
CODE:
https://drive.google.com/file/d/1qSDe5T_XyLylDfGrHmdIMF0PWKagSHxI/view?usp=drive_link
Result: The above program is executed successfully and the output is verified
Program -30
Title:PYTHON-SQL CONNECTIVITY-5-Database creation ,Table creation and Table alteration
CODE:
https://drive.google.com/file/d/1LY5rtRby69KiBNVnP7Sgsq7n70SX9luS/view?usp=drive_link
Result: The above program is executed successfully and the output is verified
Database Commands in MySql
1. To get list of available databases:
mysql>SHOW DATABASES;
3. To delete a database:
mysql>DROP database <databasename>;
5. To remove table:
mysql>droptable <tablename>;
6. To show list of tables in opened database:
mysql>SHOW TABLES;
mysql>CREATE TABLE Orders(OrderID int NOT NULL, OrderNumber int NOT NULL, PersonID int, PRIMARY
KEY(OrderID),FOREIGN KEY(PersonID) REFERENCES PERSONS(ID);
19. To select rows using Like operator with relational and logical operator:
mysql>SELECT Name,City FROM Student WHERE Class>=8 AND Name LIKE ‘%Kumar%’;
20. To display data after removal of duplicate values from specific column:
mysql>select distinct class from student;
14
31. To DROP PRIMARY KEY constraint from a table
mysql>ALTER TABLE student DROP CONSTRAINT MyPrimaryKey;
mysql>ALTER TABLE student DROP PRIMARY KEY;
40. To group the records by column with aggregate functions (with where and order by clause):
mysql>select class,avg(marks) from student where class<10 group by class order by marks desc;
42. To group there cords with aggregate functions & having clause:
mysql>select class,avg(marks) from student group by class having avg(marks)<90; mysql>select
class,avg(marks) from student group by class having count(*)<3;
16
46. To display the records using LEFT Outer Join :
mysql>Select* from a left outer join b on(a.name=b.name);
17