Grade12 Practical Questions
Grade12 Practical Questions
Grade12 Practical Questions
Instructions:
• Copy the source code in a word document
• Screenshot of the output should be pasted after each program
• Font Style – Bookman Old style, Fontsize = 12
• Questions should be underlined and bold
1. Write a function COUNTWORDS (), to count the number of words in each line of
a text file “POEM.TXT”
2. Write a function SNAME (), to create a text file “names.txt” and search for a
name.
3. Write a function COPYTEXT () to create a text file “story.txt” copy all sentences
starting with ‘t‘into a new file “temp.txt” and print it.
4. Write a function COPYB (), to copy all word starting with ‘b’ into a new file.
5. Write a function HESHE (), to count the number of times the word ‘he’ or ‘she’
appears in story.txt
6. Write a function PALIN (),to search and print all palindrome words from
story.txt.
7. Write a function LINE ()to read a text file line by line and display each word
separated by a #.
8. Write a function CHARACTER (), to read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
9. Write a function REMOVEA (),to remove all the lines that starts with the
character 'a' in a file and write it to another file.
10. Write a function DISPLAYWORDS() in Python to read lines from a text file
“POEM.TXT” and display those words which are less than 4 characters.
11. Write a function to create a CSV file by entering user-id and password, read
and search the password for given user id.
12. Create a csv file with fields bno, name, type, and price. Write a menu driven
program using functions:
1. To already existing book.csv add more data
2. To existing book.csv if type is fiction increase price by 20, update the
file
3. Display the file
4. Counting the number of book belonging to type “Comedy”
5. Delete a particular record from the file book.csv.
13. Create a CSV file called stud.csv with fields sno,sname,stream and marks.Write
a function csvcopy(), to copy the contents of stud.csv to class.csv.
14. Create a binary file emp.dat which have n dictionaries with fields ecode, ename,
designation and salary. Write a menu driven program using functions for:
1. appending
2. displaying
3. searching (for a particular employee based on ecode)
4. Updating salary by 500 if designation is manager, 200 if operator.
15. Write a function to make a new file with only managers and print name of
manager with highest salary.
16. Write a function to insert a new record assuming details are in ascending order
of ecode:
1. Create a binary file of list
2. Display it
3. Sort it
17. Write a random number generator that generates random numbers between 1
and 6 (simulates a dice).
18.
19. Consider the following tables SCHOOL and answer this question :
Write SQL statements for the following:
1.To display TEACHERNAME, PERIODS of all teachers whose periods are more
than 25.
2. To display all the information from the table SCHOOL in descending order of
experience.
3.To display DESIGNATION without duplicate entries from the table ADMIN.
4.To display TEACHERNAME, CODE and corresponding DESIGNATION from
tables SCHOOL and ADMIN of Male teachers.
-----------------------------------------------------------------------------------------
20. Write SQL statements for the following using the table given:
1.To display NO, NAME, TDATE from the table TRIP in descending order of NO.
2.To display the NAME of the drivers from the table TRIP who are traveling by
transport vehicle with code 101 or 103.
3.To display the NO and NAME of those drivers from the table TRIP who
travelled
between ‘2015-02-10’ and ‘2015-04-01’.
4.To display all the details from table TRIP in which the distance travelled is
more than 100 KM in ascending order of NOP
21. Consider the following tables Supplier and Consumer. Write SQL
commands for the statements (a) to (d).
(a) To display the C_ID, Supplier name, Supplier Address, Consumer Name and
Consumer Address for every Consumer
(b) To display Consumer details in ascending order of CName
(c) To display number of Consumers from each city
(d) To display the details of suppliers whose supplier city is ‘Panjim’
-----------------------------------------------------------------------------------------
22. Write the outputs of the SQL queries (i) to (iv) based on the
relations Drink and Consumer given below:
-----------------------------------------------------------------------------------------
23. Write SQL commands for the queries (i) to (iv) based on a table
COMPANY andCUSTOMER
1. To display those company name which are having prize less than 30000.
2. To display the name of the companies in reverse alphabetical order.
3. To increase the prize by 1000 for those customer whose name starts with
‘S’?
4. To add one more column totalprice with decimal(10,2) to the table customer
-----------------------------------------------------------------------------------------
24. Write a menu driven program using functions to implement all the
stack operations?
(STNO, STNAME, GENDER, MARKS, )
25. Vignesh has created a dictionary “employee” with employee name as key and
their salary as values. Write a program to perform the following operations in
Python: (a) Push the names of those employees into a stack where the salary is
less than 50000 (b) Pop the elements of the stack and display those names.
26. Harsha has created a list 'mylist' of 10 integers. You have to help him to create
a stack by performing the following functions in Python: (a) Traverse each
element of the list and push all those numbers into the stack which are
divisible by 3. (b) Pop from the stack and display all the content
27. Write Python connectivity program to
1. create the table SALESMAN in SALES database
• Code
• Sales Man Name
• Address
• Commission
• Salary
2. Retrieve all the data from a table SALESMAN
3. Delete all the records from SALESMAN table whose SALARY >6000
-----------------------------------------------------------------------------------------
28. Write a menu driven program to demonstrate four major operations using my
SQL connectivity
Create a Table STUDENT with (rollno,name,marks,city,Age)
• Add
• Update
• delete
• display