Class 12 Cs Practical Programs 2023-2024 (Updated)
Class 12 Cs Practical Programs 2023-2024 (Updated)
PRACTICAL PROGRAMS
FOR GRADE - XII [2023-2024]
Prepared by:
TABLE OF CONTENTS
EX.NO: 1 DATE:
AIM:
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
***********************************************************************************
****
EX.NO: 2 DATE:
AIM:
To write a Python Program to display Fibonacci Series up to 'n' numbers.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Python Executed Program Output:
***********************************************************************************
******
EX.NO: 3
DATE:
CREATING A MENU DRIVEN PROGRAM TO FIND FACTORIAL AND SUM OF LIST OF NUMBERS USING
FUNCTION.
AIM:
To write a menu driven Python Program to find Factorial and sum of list of numbers
using function.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Python Executed Program Output:
***********************************************************************************
*************
EX.NO: 4
DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT RETURNING VALUE(S) FROM FUNCTION
AIM:
To Write a Python program to define the function Check(no1,no2) that take two
numbers and Returns the number that has minimum ones digit.
Source Code:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
Sample Output:
**********************************************************************************
EX.NO: 5
DATE:
AIM:
To write a Python program to implement python mathematical functions to find:
(i) To find Square of a Number.
(ii) To find Log of a Number(i.e. Log10)
(iii) To find Quad of a Number
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Python Executed Program Output:
***************************************************************************
EX.NO: 6
DATE:
AIM:
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Python Executed Output Program:
**********************************************************************************
EX.NO: 7 DATE:
CREATING A PYTHON PROGRAM TO READ A TEXT FILE LINE BY LINE AND DISPLAY EACH WORD
SEPARATED BY '#'
AIM:
To write a Python Program to Read a text file "Story.txt" line by line and display
each word separated by '#'.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Story.txt:
EX.NO: 8
DATE:
CREATING A PYTHON PROGRAM TO READ A TEXT FILE AND DISPLAY THE NUMBER OF
VOWELS/CONSONANTS/LOWER CASE/ UPPER CASE CHARACTERS.
AIM:
To write a Python Program to read a text file "Story.txt" and displays the number
of Vowels/ Consonants/ Lowercase / Uppercase/characters in the file.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Story.txt:
***********************************************************************************
****
EX.NO: 9 DATE:
AIM:
To Write a method Disp() in Python, to read the lines from poem.txt and display
those words which are less than 5 characters.
Source Code:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
Sample Output: Poem.txt:
**********************************************************************************
EX.NO: 10
DATE:
CREATING A PYTHON PROGRAM TO COPY PARTICULAR LINES OF A TEXT FILE INTO AN ANOTHER
TEXT FILE
AIM:
To write a python program to read lines from a text file "Sample.txt" and copy
those lines into another file which are starting with an alphabet 'a' or 'A'.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Python Executed Program output: Sample.txt:
New.txt:
***********************************************************************************
******
EX.NO: 11 DATE:
AIM:
To write a Python Program to Create a binary file with roll number and name. Search
for a given roll number and display the name, if not found display appropriate
message.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUPUT:
***********************************************************************************
********
EX.NO: 12 DATE:
AIM:
To write a Python Program to Create a binary file with roll number, name, mark and
update/modify the mark for a given roll number.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
PYTHON PROGRAM EXECUTED OUTPUT:
**********************************************************************************
EX.NO: 13 DATE:
AIM:
To write a Python program Create a CSV file to store Empno, Name, Salary and search
any Empno and display Name, Salary and if not found display appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
PYTHON PROGRAM EXECUTED OUTPUT:
******************************************************************************
AIM:
EX.NO: 14 DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT STACK OPERATIONS(LIST)
(ii) (ii) To Pop the objects from the stack and display them. (iii)
(iv) (iii) To display the elements of the stack (after performing PUSH or POP)
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Python Program Executed Output:
***********************************************************************************
*****
EX.NO: 15 DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT STACK OPERATIONS(Dictionary)
AIM:
To Write a program, with separate user-defined functions to perform the following
operations:
(i) To Create a function Push(Stk,D) Where Stack is an empty list and D is
Dictionary of Items. from this Dictionary Push the keys (name of the student) into
a stack, where the corresponding value (marks) is greater than 70.
(ii) To Create a Function Pop(Stk) , where Stk is a Stack implemented by a list of
student names. The function returns the items deleted from the stack.
(iii) To display the elements of the stack (after performing PUSH or POP).
Source Code:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
Sample Output:
*********************************************************************************
EX.NO: 16 DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (CREATING DATABASE AND
TABLE)
AIM:
To write a Python Program to integrate MYSQL with Python to create Database and
Table to store the details of employees.
Source Code:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
Sample Output:
***********************************************************************************
********************
EX.NO: 17 DATE:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (INSERTING RECORDS AND
DISPLAYING RECORDS)
AIM:
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Python Executed Program Output:
***********************************************************************************
***********************************************************************************
********
EX.NO: 18 DATE:
AIM:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (SEARCHING AND DISPLAYING
RECORDS)
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
EX.NO: 19 DATE:
AIM:
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (UPDATING RECORDS)
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
SAMPLE OUTPUT:
Python Executed Program Output:
***********************************************************************************
***************************************************************
SQL COMMANDS EXERCISE - 1
Ex.No: 20 DATE:
AIM:
To write Queries for the following Questions based on the given table:RollnoName
GenderAgeDeptDOAFees1ArunM24COMPUTER1997-01-101202AnkitM21HISTORY1998-03-242003AnuF
20HINDI1996-12-123004BalaM19NULL1999-07-014005CharanM18HINDI1997-09-052506DeepaF19
HISTORY1997-06-273007DineshM22COMPUTER1997-02-252108UshaF23NULL1997-07-31200
(a) Write a Query to Create a new database in the name of "STUDENTS".
USE STUDENTS;
(c) Write a Query to create the above table called: "STU"
CREATE TABLE STU(ROLLNO INT PRIMARY KEY,NAME VARCHAR(10), GENDER VARCHAR(3), AGE
INT,DEPT VARCHAR(15),
DOA DATE,FEES INT);
SHOW DATABASES;(e) Write a Query to List all the tables that exists in the current
database.
SHOW TABLES;
Output:
35
AIM:
To write Queries for the following Questions based on the given table:RollnoName
GenderAgeDeptDOAFees1ArunM24COMPUTER1997-01-101202AnkitM21HISTORY1998-03-242003AnuF
20HINDI1996-12-123004BalaM19NULL1999-07-014005CharanM18HINDI1997-09-052506DeepaF19
HISTORY1997-06-273007DineshM22COMPUTER1997-02-252108UshaF23NULL1997-07-31200(a)
Write a Query to insert all the rows of above table into Info table.
Output:
36
(c) Write a query to Rollno, Name and Department of the students from STU table.
Output:
Output:
***********************************************************************************
*********
Output:
(b) Write a Query to list name of the students whose ages are between 18 to 20.
Output:
38
(c) Write a Query to display the name of the students whose name is starting with
'A'.
Output:
(d) Write a query to list the names of those students whose name have second
alphabet 'n' in their names.
Output:
***********************************************************************************
***********************
Ex.No: 23 SQL COMMANDS EXERCISE - 4
DATE:
AIM:
To write Queries for the following Questions based on the given table:
RollnoNameGenderAgeDeptDOAFees1ArunM24COMPUTER1997-01-101202AnkitM21HISTORY1998-03-
242003AnuF20HINDI1996-12-123004BalaM19NULL1999-07-014005CharanM18HINDI1997-09-05250
6DeepaF19HISTORY1997-06-273007DineshM22COMPUTER1997-02-252108UshaF23NULL1997-07-31
200
(a) Write a Query to delete the details of Roll number is 8.
(b) Write a Query to change the fess of Student to 170 whose Roll number is 1, if
the existing fess is less than 130.
Output(After Update):
(c) Write a Query to add a new column Area of type varchar in table STU.
Output:
(d) Write a Query to Display Name of all students whose Area Contains NULL.
SELECT NAME FROM STU WHERE AREA IS NULL;
Output:
(e) Write a Query to delete Area Column from the table STU.
Output:
Output:
***********************************************************************************
********
AIM:
To write Queries for the following Questions based on the given table:
TABLE: UNIFORM
UcodeUnameUcolorStockDate1ShirtWhite2021-03-312PantBlack2020-01-013SkirtGrey2021-
02-184TieBlue2019-01-015SocksBlue2019-03-196BeltBlack2017-12-09
TABLE: COST
UcodeSizePriceCompany1M500Raymond1L580Mattex2XL620Mattex2M810Yasin2L940Raymond3M770
Yasin3L830Galin4S150Mattex
(a) To Display the average price of all the Uniform of Raymond Company from table
COST.
Output:
(b) To display details of all the Uniform in the Uniform table in descending order
of Stock date.
Output:
Output:
(d) To display the company where the number of uniforms size is more than 2.
Output:
(e) To display the Ucode, Uname, Ucolor, Size and Company of tables uniform and
cost.
Output:
***********************************************************************************
******