Practical File 2024-25
Practical File 2024-25
Practical File 2024-25
Q7. Write a program in python , to input a string check and display given string is
a palindrome or not.
Q8. Write a program in python, to create a number list. Search and display largest
and smallest number present in a list .Without using built-in function.
Q9. Write a program in python, to create a number list. Calculate and display sum
of those elements whose last digit is 5.
Q10. Write a program in python, to create two number lists a and b . Swap and
display all elements of both lists.
Page 1
Q11. Write a UDF in python, it will take a list as a function argument . Replace and
display first half elements with second half elements of a list.
Output is : 4 5 3 1 2
Q12. Write a function in PYTHON that counts the number of “Me” or “My” words
present in a text file “DIARY.TXT”. If the “DIARY.TXT” contents are as follows:
Q14. Write a function EUCount() in PYTHON, which should read each character of a
text fileIMP.TXT, should count and display the occurrences of alphabets E and
U (including small cases e and u too).
Q15. Write a function in PYTHON to search for a BookNo from a binary file
“BOOK.DAT”, assuming the binary file is containing the records of the following
type: ("BookNo", "Book_name").Assume that BookNo is an integer.
Q16. Write a function in Python for PushS(List) and for PopS(List) for performing
Push and Pop operations with a stack of List containing integers.
Q17. Write a menu-driven program implementing user-defined functions to perform
different functions on a csv file “student” such as:
(a) Write a single record to csv.
(b) Write all the records in one single go onto the csv.
(c) Display the contents of the csv file.
Q18. Write a menu-driven program to perform all the basic operations using
dictionary on student binary file such as inserting, reading, updating,
searching and deleting a record.
Q19. Write a program to create a stack called student, to perform the basic
operations on stack using list. The list contains two data values called roll
number and name of student. Notice that the data manipulation operations
are performed as per the rules of a stack.
Page 2
Write the following functions :
• PUSH ( ) - To push the data values (roll no. and name) into the
stack.
• POP() - To remove the data values from the stack.
• SHOW() - To display the data values (roll no. and name) from the
stack.
Q20. ABC Infotech Pvt. Ltd. needs to store, retrieve and delete the records of its
employees. Develop an interface that provides front-end interaction through
Python, and stores and updates records using MySQL. The operations on
MySQL table “emp” involve reading, searching, updating and deleting the
records of employees.
(a) Program to read and fetch all the records from EMP table having salary
more than 70000.
(b) Program to update the records of employees by increasing salary by 1000 of
all those employees who are getting less than 80000.
(c) Program to delete the record on the basis of inputted salary.
SECTION –B (SQL)
Q1. Consider the tables EMPLOYEE and SALGRADE given below and answer (a) and
(b)parts of this question.
(ii) To display NAME and DESIG of those EMPLOYEEs whose SALGRADE is either S02 or S03.
(iii) To display the content of the entire EMPLOYEEs table, whose DOJ is in between ‘09-Feb-
2006’ and ‘08-Aug-2009’.
109,‘Harish Roy’,‘HEAD-IT’,‘S02’,‘9-Sep-2007’,‘21-Apr-1983’
Page 3
(b) Give the output of the following SQL queries:
Q2. Study the following table and write SQL queries for questions (i) to (iv) and output for (v)
and (vi).
(i) Write SQL query to display Pname, Quantity and Rate for all the orders that are either
Pencil or Pen.
(ii) Write SQL query to display the orders which are not getting any Discount.
(iii) Write SQL query to display the Pname, Quantity and Sale_date for all the orders whose
(iv) Write SQL query to display the orders whose Rate is in the range 20 to 100.
(vi) SELECT Pname, Quantity, Rate FROM Orders Order BY Quantity DESC;
Q3. Write SQL commands for (i) to (vi) on the basis of relations given below:
(ii) To display cost of all the books published for FIRST PUBL.
Page 4
(iii) Depreciate the price of all books of EPB publishers by 5%.
(iv) To display the BOOK_NAME and price of the books, more than 3 copies of which have
been issued.
(i) To show all information of students where capacity is more than the no. of students in
order of rtno.
(ii) To show area_covered for buses covering more than 20 km., but charges less than
80000.
(iii) To show transporter-wise total no. of students travelling.
(iv) To show rtno, area_covered and average cost per student for all routes where average cost
per student is—charges/noofstudents.
(v) Add a new record with the following data:
(11, “Motibagh”,35,32,10, “kisan tours”, 35000)
(vi)Give the output considering the original relation as given:
(a) select sum(distance) from schoolbus where transporter= “Yadav travels”;
(b) select min(noofstudents) from schoolbus;
(c) select avg(charges) from schoolbus where transporter= “Anand travels”;
(d) select distinct transporter from schoolbus;
Page 5