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

Set - 1 CS

The document contains two programming tasks: one involves writing a Python program to read a text file and display words starting with vowels, and another involves creating a stack of students' marks from a dictionary. Additionally, it includes SQL queries for retrieving and displaying data from WORKER and DEPT tables, such as listing female workers and counting male workers who joined after a specific date. The document provides code snippets for both Python and SQL tasks.

Uploaded by

Soham Dongre
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)
10 views3 pages

Set - 1 CS

The document contains two programming tasks: one involves writing a Python program to read a text file and display words starting with vowels, and another involves creating a stack of students' marks from a dictionary. Additionally, it includes SQL queries for retrieving and displaying data from WORKER and DEPT tables, such as listing female workers and counting male workers who joined after a specific date. The document provides code snippets for both Python and SQL tasks.

Uploaded by

Soham Dongre
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

SET---1

1.)Write a Python Program to read a text file line by line and display
those words of each line which started with any vowel character.
 with open("[Link]") as f:
for line in f:
print([w for w in [Link]() if
w[0].lower() in "aeiou"])
OR

1.) create a python program to create a stack of student’s marks, which


retrieve the information from a dictionary. Stud = {‘Amit’: 40,
‘Rajeev’: 59’, ‘Nilam’ : 75, ‘Sanyam’: 49}

 Write function PUSH(Student) to add marks of those students


which have marks more than 50 from a dictionary Student. and
Write function POP to remove the marks from stack and display the
same.
 Stud = {'Amit':40, 'Rajeev':59, 'Nilam':75,
'Sanyam':49}
stack = []

def PUSH(Student):
for m in [Link]():
if m > 50:
[Link](m)

def POP():
if stack:
print([Link]())

PUSH(Stud)
POP()
SET---1
2.) Consider the following DEPT and WORKER tables. Write SQL
queries for (i) to (iv):

To display Wno,
Name, Gender from the table WORKER in descending order of WNO.
a. To display the Name of all the FEMALE workers from the table
WORKER.
b. To display the Wno and Name of those workers from the table
WORKER who are
born between ‘1987-01-01’ and ‘1991-12-01’.
To count and display MALE workers who have joined after ‘1986-01-
01’

 (i)
 SELECT Wno, Name, Gender FROM WORKER ORDER BY
Wno DESC;

 (a)
 SELECT Name FROM WORKER WHERE Gender =
'FEMALE';

 (b)
 SELECT Wno, Name FROM WORKER
SET---1
 WHERE DOB BETWEEN '1987-01-01' AND '1991-12-
01';

 (c)
 SELECT COUNT(*) FROM WORKER
 WHERE Gender = 'MALE' AND DOJ > '1986-01-01';

You might also like