0% found this document useful (0 votes)
17 views5 pages

Mock Practical

The document outlines various Python programming tasks, including creating a Fibonacci series, reading text files to count characters, and generating CSV files for employee data. It also includes SQL queries for managing a student database, such as creating tables, inserting data, and querying specific information. The tasks cover a range of programming concepts and database operations suitable for practice and learning.

Uploaded by

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

Mock Practical

The document outlines various Python programming tasks, including creating a Fibonacci series, reading text files to count characters, and generating CSV files for employee data. It also includes SQL queries for managing a student database, such as creating tables, inserting data, and querying specific information. The tasks cover a range of programming concepts and database operations suitable for practice and learning.

Uploaded by

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

1. Creating a python program to display Fibonacci series.

(Set-1)

2. Write a program to read a text file "story.txt" and display the number of vowels/ consonants/
lowercase/ uppercase characters in the file. (Set-3)

3. 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. (Set-5)
4. Write a Python Program to Read a text file "Story.txt" line by line and display each word separated by
'#'.(Set-2)

5. 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.(Set-4)

6. Write a Python program to implement python mathematical functions to find:


1. To find Square of a Number
2. To find Log of a Number(i.e. Log10)
3. To find Quad of a Number
7. Write a Python program to generate random number between 1 to 6 to simulate the dice.

8. Write a Python program to implement Stack using a list data-structure, to perform the following
operations:
1. To Push an object containing Doc_ID and Doc_name of doctors who specialize in "ENT" to the
stack.
2. To Pop the objects from the stack and display them.
3. To display the elements of the stack (after performing PUSH or POP)

9. Write a method Disp() in Python, to read the lines from poem.txt and display those words which are
less than 5 characters.
01. 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);
02. Write a Query to list name of female students in Hindi Department.
SELECT NAME FROM STU WHERE DEPT='HINDI' AND GENDER='F';
03. Write a Query to add a new column Area of type varchar in table STU.
ALTER TABLE STU ADD AREA VARCHAR(20);
04. Write a Query to Display Name of all students whose Area Contains NULL.
SELECT NAME FROM STU WHERE AREA IS NULL;
05. Write a Query to insert all the rows of above table into STU table.
INSERT INTO STU VALUES (1,'Arun','M', 24,'COMPUTER','1997-01-10', 120);
INSERT INTO STU VALUES (2,'Ankit','M', 21,'HISTORY','1998-03-24', 200);
INSERT INTO STU VALUES (3,'Anu','F', 20,'HINDI','1996-12-12', 300);
INSERT INTO STU VALUES (4,'Bala','M', 19, NULL,'1999-07-01', 400);
INSERT INTO STU VALUES (5,'Charan','M', 18,'HINDI','1997-06-27', 250);
INSERT INTO STU VALUES (6,'Deepa','F', 19,'HISTORY','1997-06-27', 300);
INSERT INTO STU VALUES (7,'Dinesh','M', 22,'COMPUTER','1997-02-25', 210);
INSERT INTO STU VALUES (8,'Usha','F', 23, NULL,'1997-07-31', 200);
06. To show all information about students of History department.
SELECT * FROM STU WHERE DEPT='HISTORY';
07. Write a Query to Rollno, Name and Department of the students from STU table.
SELECT ROLLNO,NAME,DEPT FROM STU;
08. Write a Query to list name of the students whose ages are between 18 to 20.
SELECT NAME FROM STU WHERE AGE BETWEEN 18 AND 20;
09. Write a Query to display the name of the students whose name is starting with 'A'.
SELECT NAME FROM STU WHERE NAME LIKE 'A%';
10. Write a Query to list the names of those students whose name have second alphabet 'n' in their
names.
SELECT NAME FROM STU WHERE NAME LIKE '_N%';
11. Write a Query to delete Area Column from the table STU.
ALTER TABLE STU DROP AREA;
12. Write a Query to delete table from Database.
DROP TABLE STU;
13. Write a Query to select distinct Department from STU table.
SELECT DISTICT(DEPT) FROM STU;
14. Write a Query to change the fees of Students to 170 whose Roll number is 1, if the existing fees
is less than 130.
UPDATE STU SET FEES=170 WHERE ROLLNO=1 AND FEES<130;
15. Write a Query to Display Name of all students whose dept Contains NULL.
SELECT NAME FROM STU WHERE DEPT IS NULL;

You might also like