0% found this document useful (0 votes)
27 views

cs lab questions

Uploaded by

revsbalaji99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

cs lab questions

Uploaded by

revsbalaji99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

SET-1

Q-1 a) Write a menu driven program to perform following operations into a binary file (8)
shoes.dat

1.Add record 2.Display records 3.Search record 4.Exit


The structure of file content is: [s_id, name, brand, type, price]

Q-1 b) Write SQL command and output for the following queries using the Relation- STU
(4)
Rollno Name Gender Age Dept DOA Fees

1 Arun M 24 COMPUTER 1997-01-10 120

2 Ankit M 21 HISTORY 1998-03-24 200

3 Anu F 20 HINDI 1996-12-12 300

4 Bala M 19 NULL 1999-07-01 400

5 Chera M 18 HINDI 1997-09-05 250


n

6 Deepa F 19 HISTORY 1997-06-27 300

7 Dinesh M 22 COMPUTER 1997-02-25 210

8 Usha F 23 NULL 1997-07-31 200

a) Write a query to list the names of those students whose name have second
alphabet 'n' in their names.
b) Write a Query to delete the details of Roll number is 8.
c) Write a Query to add a new column Area of type varchar in table STU.
d) Display max price and min price of each company

Set 2
Q-1 a)Write a menu driven python program to create a stack of a student's record which
contains [admo, marks ]. (8)
i)Write function PUSH to add record in to the stack and
ii)Write a function DISPLAY to display those students whose marks greater than 70..

Q-1 b)Write SQL command and output for the following queries using the Relation- STU (4)
Rollno Name Gender Age Dept DOA Fees

1 Arun M 24 COMPUTER 1997-01-10 120

2 Ankit M 21 HISTORY 1998-03-24 200

3 Anu F 20 HINDI 1996-12-12 300

4 Bala M 19 NULL 1999-07-01 400

5 Chera M 18 HINDI 1997-09-05 250


n

6 Deepa F 19 HISTORY 1997-06-27 300

7 Dinesh M 22 COMPUTER 1997-02-25 210

8 Usha F 23 NULL 1997-07-31 200

a)To show all information about students of History department.


b)Write a Query to change the fess of Student to 170 whose Roll number is 1, if
the existing fess is less than 130.
c)Write a Query to add new record table STU.

d) write a mysql query to add a new column Area of type varchar in table
STU.

SET-3
Q-1 a) Write a program to count a total number of lines and count the total number of
lines starting with 'A', 'B', and 'C' from the file myfile.txt.
Example:
File Contents as given below
Python is super and trending language.
Allows to store the output in the files.
A text file stores textual data.
Binary files can handle binary data.
Binary files use pickle module to store data.
CSV files can handle tabular data.
CSV files can be read easily using CSV reader object.
Program output must be as follows
Total Number of lines are: 7
Total Number of lines starting with A are: 2
Total Number of lines starting with B are: 2
Total Number of lines starting with C are: 2

Q.1 b).Write SQL command and output for the following queries using the Relation- STU (4)
Rollno Name Gender Age Dept DOA Fees

1 Arun M 24 COMPUTER 1997-01-10 120

2 Ankit M 21 HISTORY 1998-03-24 200

3 Anu F 20 HINDI 1996-12-12 300

4 Bala M 19 NULL 1999-07-01 400

5 Chera M 18 HINDI 1997-09-05 250


n

6 Deepa F 19 HISTORY 1997-06-27 300

7 Dinesh M 22 COMPUTER 1997-02-25 210

8 Usha F 23 NULL 1997-07-31 200

a) Write a Query to insert all the rows of above table into Info table.
b) Write a Query to display all the details of the Employees from the above table 'STU'.
c) Write a query to display Rollno, Name and Department of the students from
STUtable.
d)Implement python interface with mysql to show all information about students of
History department.
SET-4
Q-1 a) Write a program to add students details in CSV file students.csv as mentioned in below
table format , and print them with tab delimiter. Ignore first row header to print in tabular
form.
Field 1 Data Type
StudentID Integer
StudentName String
Score Integer

Q.1 b).Write SQL command and output for the following queries using the Relation- STU
(4)
Rollno Name Gender Age Dept DOA Fees

1 Arun M 24 COMPUTER 1997-01-10 120

2 Ankit M 21 HISTORY 1998-03-24 200

3 Anu F 20 HINDI 1996-12-12 300

4 Bala M 19 NULL 1999-07-01 400

5 Chera M 18 HINDI 1997-09-05 250


n

6 Deepa F 19 HISTORY 1997-06-27 300

7 Dinesh M 22 COMPUTER 1997-02-25 210

8 Usha F 23 NULL 1997-07-31 200

a) Write a Query to insert all the rows of above table into Info table.
b) Write a Query to display all the details of the Employees from the above table 'STU'.
c) Write a query to display Rollno, Name and Department of the students from
STUtable.
d)Implement python interface with mysql to show all information about students of
History department.

You might also like