0% found this document useful (0 votes)
6 views36 pages

CS Practical File

Uploaded by

Coding Tracker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views36 pages

CS Practical File

Uploaded by

Coding Tracker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 36

Program 1 : Program to print a square multiplication table from 1

to 10

Code :

Output :
Program 2 : Write A Program To Check The Character Is Alphabet
Or Digit

Code :

Output :
Program 3 : Write A Program That Reads A String And Checks
Whether It Is A Palindrome Or Not

Code :

Output :

Program 4 : Define two variables first and second so that first =


‘jimmy’ and second=’johny’.
Code :
Output :

Program 5 : Program To Have A Function That Takes A Number As


An Argument And Calculates Cube For It.
Code :

Output :

Program 6 : Program For Length Conversion

Code :
Output :

Program 7 : Program For Factorial Of A Number

Code :
Output :

Program 8 : Program To Find The Fibonacci Series Of A Number

Code :
Output :

Program 9 : Program To Read A Text File And Display The Number


Of Vowels / Constants / Uppercase / Lowercase Characters In A
File.
Code :

Output :
Program 10 : Program To Remove All The Lines That Contain The
Character 'a' In A File And Write It To Another File

Code :

Output :

Program 11 : Program To Create A Binary File With Name And Roll


Number And Search For A Given Roll Number And Display The
Name, If Not Found Display Appropriate Message

Code :
Output :
Program 12 : Program to create a CSV file by entering user_id and
password, read

Code :

Output :
Program 13 : Write A Random Number Generator That Generates
Random Numbers Between 1 And 6 (Simulates A Dice)

Code :

Output :
Program 14 : Write A Python Program To Implement A Stack Using
A List

Code :
Output :
Program 15 : Program For Binary Search
Code :

Output :

Program 16 : Program To Read A Text File Line By Line And Display


Each Word Separated By A #

Code :
Output :

SQL PROGRAMS
SQL Files

Program 1) Create table Employee having EmpID, Name,


Gender, DOB with EmpID as Primary key. Write queries for the
following:
a. Display the Table Structure
b. Add a Column department varchar(10), Emp_Address(25)
c. Change the data type of the field Emp_Address to
varchar(50) and allow Null values.
d. Delete the column DOB
e. Display all the records
Program 2) Create table Customer as per following Table Instance Chart

a. Add one column Email of data type VARCHAR and size 30 to the table Customer.
b. Add one column Email of data type VARCHAR and size 30 to the table Customer.
c. Insert few records with relevant information, in the table.
d. Drop the column CustomerIncomeGroup from table Customer
Output
Program 3)
a. Display all the details of those watches whose name end with “Time”

b. Display the name and price of those watches, which have a price range in between
5000 – 15000. c. Display the total quantity in store of ‘Unisex’ type watches.

d. Display the watch names and the quantity sold in the first quarter.

e. SELECT MAX(PRICE), MIN(Qty_Store) FROM WATCHES;

f. SELECT MAX(PRICE), MIN(Qty_Store) FROM WATCHES;

g. SELECT WATCH_NAME, Qty_Store, SUM(Qty_Sold), QTY_Store-SUM(Qty_Sold)


‘’Stock’’ FROM WATCHES W, SALE S WHERE W.WATCHID = S.WATCHID GROUP BY
S.WATCHID;
Program 4) Create the following tables for the database Library

Write SQL queries for (a) to (f):

a. To show Book name, Author name and Price of books of First Publ. publishers.

b. To list names from books of Text type.

c. To display the names and price from books in ascending order of their price.

d. To increase price of price of all books of EPB and Publishers by 50.

e. To display the Book_Id, Book_Name, and Quantity_Issued for all books which have
been issued.(The query will require contents from both the tables.)

f. To insert a new row in the table Issued having the following data: “F003”, 1

g. Give the output of the following queries based on the above tables:

(i). SELECT COUNT(*) FROM BOOKS;

(ii). SELECT MAX(Price) FROM Books WHERE QUANTITY >=15;

(iii). SELECT Book_Name, Author_Name FROM Books WHERE Publishers=”EBP”;

(iv). SELECT COUNT(DISTINCT Publishers) FROM Books WHERE Price>=400;

Output
Program 5)

(i). To display Wno, Name, Gender from table WORKER in descending order of Wno.

(ii). To display the Name of all the FEMALE workers from the table WORKER.

(iii). To display the Wno and Name of those workers from the table WORKER who are
born between ‘1987-01-01’ and ‘1991-12-01’.

(iv). To count and display MALE workers who have joined after ‘1986-01-01’.

(v). SELECT COUNT(*), DCODE FROM WORKER GORUP BY DCODE HAVING


COUNT(*)>1;

(vi). SELECT DISTINCT DEPARTMENT FROM DEPT;

(vii). SELECT NAME, DEPARTMENT, CITY FROM WORKER W, DEPT D WHERE W.DCODE
= D.DCODE AND WNO<1003;

(viii). SELECT MAX(DOJ), MIN(DOB) FROM WORKER;

Output
Python Connectivity Programs

1. Write the code checking Python connectivity with MySQL


database namely, School, and then fetch all the records from
table Employee.

Code :

Output :

2. Write a program for creating a database Student table using


Interface python with MySQL.
Output :

3. Write a program to insert 10 records in above table and display


the same

Code :
Output :

4. Program showing all Fetch commands

Code :
Output :

You might also like