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

Practice Questions Class12 Cs

The document outlines various programming tasks involving binary files and data structures in Python, including functions for inserting, searching, and displaying records for students, employees, and books. It also includes operations on stacks for managing course details and doctor information, as well as SQL queries for retrieving and modifying data from tables related to stationery and cars. The tasks emphasize file handling, data manipulation, and database querying techniques.

Uploaded by

timepasses1211
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)
24 views

Practice Questions Class12 Cs

The document outlines various programming tasks involving binary files and data structures in Python, including functions for inserting, searching, and displaying records for students, employees, and books. It also includes operations on stacks for managing course details and doctor information, as well as SQL queries for retrieving and modifying data from tables related to stationery and cars. The tasks emphasize file handling, data manipulation, and database querying techniques.

Uploaded by

timepasses1211
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/ 5

A binary file “student.dat” has structure [rollno, name, marks]. i.

Write a user
defined function insertRec() to input data for a student and add to student.dat. ii.
Write a function searchRollNo( r ) in Python which accepts the student’s rollno as
parameter and searches the record in the file “student.dat” and shows the
details of student i.e. rollno, name and marks (if found) otherwise shows the
message as ‘No record found’.

2. A binary file “emp.dat” has structure [EID, Ename, designation, salary]. i. Write
a user defined function CreateEmp() to input data for a record and create a file
emp.dat. ii. Write a function display() in Python to display the detail of all
employees whose salary is more than 50000.

3. A binary file named “EMP.dat” has some records of the structure [EmpNo,
EName, Post, Salary] (a) Create a binary file “EMP.dat” that stores the records of
employees and display them one by one. (b) Display the records of all those
employees who are getting salaries between 25000 to 30000
4. (i) A binary file “book.dat” has structure[BookNo,
Book_name,Author ,Price].
(a) Write a user defined function CreateFile() to input data for record and
add to Book.dat.
(b) Write a function countRec(Author) in python which accepts the Author
name as parameter and count and return number of books by the given Author
are stored in binary file
“Book.dat”
Write a function in python to count the number lines in a text file ‘Country.txt’
which is starting with an alphabet ‘W’ or ‘H’.

Write a user defined function countwords() to display the total number


of words present in the file from a text file “Quotes.Txt”.
Write a function DISPLAYWORDS( ) in python to display the count of
words starting with “t” or “T” in a text file ‘STORY.TXT’.
Write the following user defined functions in Python and perform the specified
operations on a stack named BigNums.
(a) PushBig(): It checks every number from the list Nums and pushes all such
numbers which have 5 or more digits into the stack BigNums.
(b) PopBig(): It pops the numbers from the stack, BigNums and displays them.
The function should also display "Stack Empty" when there are no more numbers
left in the stack.
13 - A list contains following record of course details for a University:
[Course_name, Fees, Duration]
Write the following user defined functions to perform given operations on the
stack named 'Univ':
(a) Push_element(): To push an object containing the Course_name, Fees, and
Duration of a course, which has fee greater than 100000 to the stack.
(b) Pop_element(): To pop the object from the stack and display it. Also, display
"Underflow" when there is no element in the stack.

To write a Python program to implement Stack using a list data-structure, to


perform the following operations:
(i) To Push an object containing Doc_ID and Doc_name of doctors who
specialize in "ENT" to the stack.
(ii) To Pop the objects from the stack and display them.
(iii) To display the elements of the stack (after performing PUSH or
POP)
c) Consider the given tables stationery and distributor, write queries given below:
Table – Stationary
S_ID Stationary Name Company Price
DP01 Dot Pen Cello 10
PL02 Pencil DOMS 5
ER05 ErasorDOMS 5
PL01 Pencil Nataraj 4
GP01 Gel Pen Rotomac 8
Table: distributor
D_ID Distributor City S_ID
1 Excellent Stationary Surat PL01
2 Vidhya Stationary Baroda GP02
3 Student Book Shop Surat DP01
4 Pupils Corner Surat Pl02
5 Abhyass Stationary Baroda DP01
(i) Display unique cities from distributor.
(ii) Display maximum and minimum price for each company.
(iii) Display all stationary name, company, distributor along with city.
(iv) Display the stationary details and distributor details which
distributor name contains stationary.

Based on the tables write SQL queries for the following:


1. To display the names of all the silver coloured cars.
2. To display names of car, make and capacity of cars in descending order of
their
sitting capacity.
3. To modify the Colour to ‘BLACK’ whose code is 501.
4. To display the customer name and the corresponding name of the cars hired
by
them.

You might also like