0% found this document useful (0 votes)
19 views3 pages

Student Roll Name Class Marks 1 Akash Singh 11 90 2 Ishita Sinha 12 79 3 Pulkit Sharma 12 65

The document outlines a series of programming tasks involving user-defined functions in Python for manipulating stacks and CSV files, as well as SQL commands for creating and managing tables in a database. It includes functions for pushing and popping even numbers, city names, and laptop and bus records, along with SQL commands for creating tables, inserting data, and querying student and employee information. Additionally, it discusses operations on customer and project tables, emphasizing data management and retrieval in both Python and SQL contexts.

Uploaded by

bhullasingh254
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)
19 views3 pages

Student Roll Name Class Marks 1 Akash Singh 11 90 2 Ishita Sinha 12 79 3 Pulkit Sharma 12 65

The document outlines a series of programming tasks involving user-defined functions in Python for manipulating stacks and CSV files, as well as SQL commands for creating and managing tables in a database. It includes functions for pushing and popping even numbers, city names, and laptop and bus records, along with SQL commands for creating tables, inserting data, and querying student and employee information. Additionally, it discusses operations on customer and project tables, emphasizing data management and retrieval in both Python and SQL contexts.

Uploaded by

bhullasingh254
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/ 3

Q1 a) Write the following user defined functions :

(i) pushEven(N) - This function accepts a list of integers named N as parameter. It then pushes only even
numbers into the stack named EVEN.
(ii) popEven(EVEN) - This function pops each integer from the stack EVEN and displays the popped
value. When the stack is empty, the message "Stack Empty" is displayed.

b) A csv file “LAPTOP.csv” has structure [ ModelNo, Brand , Price ]


i. Write a user defined function add() to input data for a record and add to “LAPTOP.csv”
ii. Write a function in python to read and display the details of all the laptop which are priced more than
50000.

Q1 a) Write the following user defined functions :


(i) push(N) - This function accepts a list of integers named N as parameter. It then pushes only numbers
which end with the digit 3 in stack named THREE
(ii) pop(THREE) - This function pops each integer from the stack THREE and displays the popped value.
When the stack is empty, the message "Stack Empty" is displayed.

b) A csv file “Bus.csv” has structure =[ Bno , From, To]


i. Write a user defined function add() to input data for a record and add to Bus.csv .
ii. Write function to display() to display the bus from “delhi” to “agra” stored in BUS.csv file

Q1 (a) Write separate user defined functions for the following :


(i) PUSH(N) - This function accepts a list of names of city , N as parameter. It then pushes only those
city names in the stack named ACity which starts with “A”
(ii) POP(ACity) - This function pops each name from the stack ACity and displays it. When the stack is
empty, the message
"EMPTY" is displayed.

(b) A binary file “MEMBER.DAT” has structure [M_number, M_Name, City]


i. Write a user defined function CreateFile() to input data for a record and add to “MEMBER.DAT”.
ii. Write a function CountRec(city) in Python which accepts the city as parameter and count and return
number of member of that city are stored in the binary file “MEMBER.DAT”.

Q2 Consider the below given STUDENT table in MySQL school database:

STUDENT

Roll Name Class Marks

1 Akash Singh 11 90

2 Ishita Sinha 12 79

3 Pulkit Sharma 12 65
write SQL command to :-
a. Create table student with following structure :-
Field name type constraints
Roll integer primary key
Name Varchar(50)
Class integer
Marks integer
b. insert row in student table with following value
(Roll-4, Name-“Vina”, Class-11, Marks-85)
c. display the names of the students from the STUDENT table which end with character ‘a’.
Print roll and marks of all the students from the STUDENT table in ascending order of marks.

Q2 Consider the below given EMPLOYEE table in MySQL company database:

EMPLOYEE

Empid Name Dept Salary

1001 Anuj Kumar CS 10000

1002 Raghvendra CS 20000

1003 Kanak Kumar IT 40000

a. Create table student with following structure :-


Field name type constraints
Empid integer primary key
Name Varchar(50)
Dept varchar(10)
Salary integer

b. insert row in student table with following value


(Empid-1004, Name-“Abhijeet”, Dept-“HR”, Salary-50000)
c. display the names of the employees whose name contains ‘Kumar’ anywhere.
Display department-wise number of employees.

Q2 Consider the below given customer table in MySQL school database:

Customer

C_id C_name Product DOP

101 Jitender Laptop 2024-12-25

102 Riya SmartPhone 2024-12-31

103 Bhawna Headphone 2025-01-02


write SQL command to :-
a. Create table student with following structure :-
Field name type constraints
C_id integer primary key
C_Name Varchar(50)
Product varchar(20)
DOP Date

b. Update the name of product to Bluetooth Headphones whose order id is 103


c. display customer name and DOP of those customer who purchased laptop
display details of customer who purchased product in 2024.

Q2 Consider the below given EMPLOYEE and SALARY tables in MySQL company database:

Project

pid PName Language Startdate

1001 Blood Bank Python 2024-06-12

1002 Food delivery C++ 2024-07-15

1003 Payroll Java 2024-07-25

a. Create table student with following structure :-


Field name type constraints
Empid integer primary key
Name Varchar(50)
Dept varchar(10)
Salary integer

b. Delete the project whose name is Food delivery


c. Display all details of the Project which start in july month.
Display pid and name of project which are created in java language

You might also like