Practical Assignment for Class Xii(2023-24)(Board)
Practical Assignment for Class Xii(2023-24)(Board)
Practical Assignment for Class Xii(2023-24)(Board)
Practical
S.No. Unit Name Marks
(Total=30)
1 Lab Test: 8
1. Python program (60% logic + 20% documentation +
20% code quality)
2. A stub program with Python SQL connectivity must 4
be provided with blanks (4 blanks) to be filled by the
student with the desired SQL query.
2 Report file: 7
• Minimum 20 Python programs.
• SQL Queries – Minimum 5 sets using one/two tables.
• Minimum 4 programs based on Python - SQL
connectivity
3 Project (using concepts learnt in Classes 11 and 12) 8
4 Viva voce 3
Function:-
File Handling:-
Q4)Write a program using function named LongLines() which reads the contents of a text file named ‘LINES.TXT’ and
display those lines from the file which have at least 10 words in it.
Q5) Write a program using function named count_Dwords() in Python to count the words ending with a digit in a text file
“Details.txt”
Q6) Write a program to read a text file ‘english.txt’ and display the number of vowels / consonants /uppercase/ lowercase
characters available in the file
Q7) Write a method COUNTLINES() in Python to read lines from text file ‘TESTFILE.TXT’ and display the lines which are not
starting with any vowel.
Q8) Write a function ETCount() in Python, which should read each character of a text file “TESTFILE.TXT” and then count and
display the count of occurrence of alphabets E and T individually (including small cases e and t too).
Q9) Count the total number of upper case, lower case, and digits used in the text file “merge.txt”.
Q10) Find the total occurrences of a specific word from a text file:
Q11) Replace all spaces from text with – (dash)
Q12) Replace multiple spaces with single space in a text file.
Q13) Write a program that copies a text file “source.txt” onto “target.txt” barring the lines starting with a ‘@’ sign.
Q14)A binary file “salary.DAT” has structure [employee id, employee name, salary]. Write a function countrec() in Python that
would read contents of the file “salary.DAT” and display the details of those employee whose salary is above 20000.
Q15) A file sports.dat contains information in following format [event, participant].
Write a program that would read the contents from file and copy only those records from sports.dat where the event name is
“Athletics” in new file named Athletics.dat
Q16) A binary file “STUDENT.DAT” has structure [admission_number, Name, Percentage]. Write a function countrec() in Python
that would read contents of the file “STUDENT.DAT” and display the details of those students whose percentage is above 75. Also
display number of students scoring above 75%.
Q.17)Write a program to write into file “one.csv” Rollno, Name and Marks separated by comma. It should have header row and
then take in input from the user for all following rows. The format of the file should be as shown if user enters 2 records.
Roll.No,Name,Marks
20,ronit,67
56,nihir,69
Q.18) Write a program to read all content of “student.csv” and display records of only those students who scored more than 80
marks. Records stored in students is in format : Rollno, Name, Marks
Q.19) Write a program to count number of records present in “data.csv” file.
Q.20)What is the output of the following program if the student.csv file contains following data?
Student.csv
Ronit, 200
Akshaj, 400
Q. 21) Write a program to copy the data from “data.csv” to “temp.csv”
Data Structure
Q22) A list contains following record of customer:
[Customer_name, Room, Type]
Write the following user defined functions to perform given operations on the stack named ‘Hotel’:
(i) Push_Cust() – To Push customers’ names of those customers who are staying in ‘Delux’ Room Type.
(ii) Pop_Cust() – To Pop the names of customers from the stack and display them. Also , display “Underflow” when
there are no customers in the stack.
Q23) Write a function in Python, Push(Vehicle) where, Vehicle is a dictionary containing details of vehicles-{ Car_Name: Maker}.
The function should push the name of car manufactured by “TATA” ( including all possible cases) to the stack.
Q24) Each node of a Stack contains the following information: PINCODE and NAME of city.
Write a PUSHCITY() function to implement push on stack like operation to add a
Q25) Write a function in Python PushBook(Book) to add a new book entry as book_no and book_title in the list of
Books , considering it to act as push operations of the Stack datastructure.
Write a function in Python PopBook(Book), where Book is a stack implemented by a list of books. The function returns
the value deleted from the stack.
Q26) Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this listpush all numbers divisible
by 5 into a stack implemented by using a list. Display thestack if it has at least one element, otherwise display
appropriate error message.
Write a function in Python POP(Arr), where Arr is a stack implemented by a list ofnumbers. The function returns
the value deleted from the stack.
Q27) Julie has created a dictionary containing names and marks as keyvalue pairs of 6 students. Write aprogram, with
separate user defined functions to perform the following operations:
● Push the keys (name of the student) of the dictionary into a stack, where the corresponding value
(marks) is greater than75.
● Pop and display the content of the stack.For example:
If the sample content of the dictionary is as follows:
R={"OM":76, "JAI":45, "BOB":89, "ALI":65, "ANU":90,"TOM":82}
The output from the program should be:
TOM ANU BOB OM
Pytho- Sql connectivity questions
Q1). Write a program to create a student table with student id, class, section, name, gender ,dob, marks as attributes,
where student id is the primary key.(using python-sql connectivity)
Q2) Write a program to insert 5 records in a student table with student id, class, section, name, gender ,dob, marks as
attributes (using python-sql connectivity
Q3) Write a program to delete the records of a particular student in a student table with student id, class, section,name,
gender ,dob, marks as attributes (using python-sql connectivity)
Q4) Write a program to increase the marks of those student by 5%whose student ID is more than 20, in a student table
with student id, class, section, name, gender ,dob, marks as attributes (using python-sql connectivity)
Q5) Write a program to display the entire content of the student table with student id, class, section, name, gender
,dob, marks as attributes (using python-sql connectivity)
Q6 ) Write a program to display student id, name, marks of those students whose marks more than 50 of the student
table with student id, class, section, name, gender ,dob, marks as attributes (using python-sql connect
Q7 ) Write a program to find the average marks of the students of the student table with student id, class, section,name,
gender ,dob, marks as attributes (using python-sql connectivity)
Q8 ) Write a program to find the number of students who are of section ‘A’ of the student table with student id, class,
section, name, gender ,dob, marks as attributes (using python-sql connectivity)
Q9 a) Write a program to add a new column email id with appropriate data type in the student table with student id,
class, section, name, gender ,dob, marks as attributes (using python-sql connectivity)
Q10 ) Write a program to add email ids of each student in the student table with student id, class, section, name, gender
,dob, marks as attributes in which email id a new column was added after table creation. (using python-sql connectivity)
Q11 ) Write a program to display the details of all those students whose name starts with ‘AN’. in the student table with
student id, class, section, name, gender ,dob, marks as attributes (using python-sql connectivity)
Q12) Write a program to change the attribute name student id to adm_no in the student table with student id, class,
section, name, gender ,dob, marks as attributes (using python-sql connectivity)
Q13) Write a program to arrange the student table according to the marks in the descending order in the student table
with student id, class, section, name, gender ,dob, marks as attributes (using python-sql connectivity)
Q14) Write a program to count the distinct class from the student table with student id, class, section, name, gender
,dob, marks as attributes (using python-sql connectivity)
Q15) Write a program to find the average marks of each class from student table with student id, class, section, name,
gender ,dob, marks as attributes (using python-sql connectivity)
Q16) Write a program to find the minimum marks of each class from student table with student id, class, section, name,
gender ,dob, marks as attributes (using python-sql connectivity)