0% found this document useful (0 votes)
27 views4 pages

Important Xii Practical Questions: For Example

The document outlines a series of practical programming questions involving data structures, file handling, and SQL queries. It includes tasks such as creating stacks from dictionaries, managing employee data in CSV files, and manipulating binary files. Additionally, it requires writing SQL commands for various operations on tables related to teachers, employees, flights, and library books.

Uploaded by

Harshit Saxena
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)
27 views4 pages

Important Xii Practical Questions: For Example

The document outlines a series of practical programming questions involving data structures, file handling, and SQL queries. It includes tasks such as creating stacks from dictionaries, managing employee data in CSV files, and manipulating binary files. Additionally, it requires writing SQL commands for various operations on tables related to teachers, employees, flights, and library books.

Uploaded by

Harshit Saxena
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/ 4

IMPORTANT XII PRACTICAL QUESTIONS

1. Jomia has created the following dictionary containing Indian names of some herbs and their
corresponding names in English: Herbs={'Adrak':'Ginger', 'Amla': 'Gooseberry', 'Babool': 'Indian
Gum', 'Dhania': 'Coriander', 'Lahsun':'Garlic', 'Tulsi': 'Basil'}
Write a program to add those key value pairs where the corresponding value (English name) starts
with 'G'. Write separate user defined functions to perform the following operations:
a) DPush- the item (key, value pair) into a stack,
b) DPop- to remove a key value pair from the stack
c) Display- to show the content of the stack (top to bottom)

2. Manoj has created a dictionary containing roll numbers and grades as key value pairs
of 5 students. Write a program to add those roll numbers to a stack where the corresponding value
(grade) is either “A” or “B”. The following user defined functions MUST be implemented separately

a) RPush – to add a roll no. of the student to a stack, .


b) RPop – to remove a roll number from the stack
c) Display- to show the content of the stack(from top to bottom)
For example:
If the sample content of the dictionary is as follows:
R={1: "A",2: "B", 3:"D", 4:"B", 5:"C"}
The output from the program should be:
4 2 1

3. write a Program in Python that defines and calls the following user Defined functions:
a) add() – To accept and add data of an employee to a CSV file ‘furdata.csv’. Each
record consists of a list with field elements as fid, fname and fprice to store
furniture id, furniture name and furniture price respectively.

b) search()- To display the records of the furniture whose price is more than 10000.

4. A Binary file “Book.dat” has structure [ Bookno, Book_Name, Author, Price ]. Write a menu driven
code to perform the following functions.
(8)
(a) CreateFile( )- to input data for a record and add records to Book.dat
(b) CountRec(Author)- which accepts the author name as parameter and count and return number of
books by the given Author which are stored in the binary file “Book.Dat”

5.Alam has a list containing 10 integers. You need to help him create a program to maintain a stack of even
numbers by implementing separate user defined functions for the following operations.(8)
a. Push- To add a number to the stack .
b. Pop – to remove a number from the stack
c. Display- to show the content of the stack(top to bottom)
For Example:
If the sample Content of the list is as follows:
N=[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
38 2 98 56 34 12

6. A file “rain.txt” contains average rainfall for few towns. Write the
user defined functions Bellevue 34.5
Blockton 36.28
for the following Britt 31.54
Buckeye 33.66
a. Srch()- Find the town which receives the highest Burl ington 36.94
rainfall Carroll 33.33
b. Lessrain() - to copy all the records where rainfall is Cascade 33.48
less than 34 to a file called lessrain.txt

7. Consider the tables Teacher(T_ID as primary key) and Placement as shown below and write the queries for the
following

(i) To display highest and lowest salaries drawn in each department


(ii) To display all teacher’s name along with their place of posting in ascending order of their names
(iii) To decrease the width of department by 2 characters
(iv) To change the department of Saman to geography

8. Considering the tables Employee(ECODE as primary key) and SAL as shown below, write the queries for the
following
(i) To display the name and designation of the youngest Employee
(ii) To decrease the HRA of S02 grade employees by 2%
(iii) To display last three characters of employee names with DOJ in descending order of DOJ
(iv) To remove primary key from employee table

9.

(i) Display the Trainer Name, City & Salary in descending order of their Hiredate.

(ii) To display the TNAME and CNAME of all trainers who joined the Institute in the month of December 2001.

(iii) To display number of Trainers from each city.

(iv) To display the Trainer ID and Name of the trainer who does not belong to ‘Mumbai’ and ‘DELHI’

10. Considering the table Employee(EmployeeID as primary key) and Job, write the queries for the following

(i) To display the name of the employee with least sales


(ii) To display the average salaries of all types of jobs(use jobId)
(iii) To add a column location-varchar(20) in Job table
(iv) To increase the sales of all employees by 2% of all employees with names beginning with S
11. Consider the table flights(flightid as primary key) and booking as shown below and write the queries for the
following

(i) To display all booking details of the bookings whose destination is KOL in descending order
of price.
(ii) To list all ticket numbers with their respective flight ids and companies(of flights)
(iii) To increase the size of destination by 5 characters
(iv) To remove the primary key from flights table

12. Consider the following tables BOOKS and ISSUED in a database named “LIBRARY”. Write
SQL commands for the statements (i) to (iv).

(i) Display book name ,author name and price of computer type books in ascending order of their prices.
(ii) To increase the price of all history books by Rs 50.
(iii) to add a column stock_date in issued table to store date of taking stocks of books
(iv) To display book id, book name and quantity issued for all books which have been issued.

You might also like