Grade XII CS Board Practicals (SAMPLE) - 1
Grade XII CS Board Practicals (SAMPLE) - 1
(A) Write a user defined function filter_str_with_a( ) that takes a list of strings as (4)
arguments and returns a new list containing only strings that contains the
letter "a".
(B) A binary file “employee.dat” has structure [Empid, EName, Designation ]. (4)
a) Write a user defined function Create() to input data for a record and add it
to employee.dat .
b) Write a user defined function Display() in Python to display those records
from “employee.dat” where Empid is more than 101.
Q.2 : SQL QUERIES: (4)
Consider the following tables and write SQL queries to:
(A) Create tables CUSTOMERS and PURCHASES and shown above and insert all records.
(B) Display the number of CUSTOMERS along with their respective CITIES in each of the CITIES.
(C) To display the CNAME and CITIES of all CUSTOMERS in ascending order of their QTY purchased.
(D) To display details of all CUSTOMERS whose CITIES are neither Delhi nor Mumbai.
(A) A text file named AGENCIES.TXT contains some text. Write the definition for a function (4)
Showsites() in Python which displays all such words of the file which have more than 9
characters and start with "www.".
(B) A li st contai ns followin g record of a customer: [Cu stomer_name, (4)
Phone_nu mb er, City]
Wr it e t he fo llow ing user defined funct io ns t o per for m given operat io ns
o n t he st ack named ‘stat us’ :
i. Pu sh_element() – To Push an o bject co nt aining name and P ho ne
number o f cust o mer s who live in Goa t o the st ack
ii. Pop _element() – To Pop t he o bject s fro m t he st ack and disp la y
t hem. Also, d ispla y “St ack E mpt y” when t her e ar e no ele ment s in
t he st ack.
Q.2 : SQL Interface with Python : (4)
(A) Write a function LShift(Arr,n) in Python, which accepts a list Arr of numbers and n is a numeric (4)
value by which all elements of the list are shifted to left.
Sample Input Data of the list Arr= [ 10,20,30,40,12,11], n=2
Output Arr = [30,40,12,11,10,20]
(B) Write a Program in Python that defines and calls the following user defined functions: (4)
(i) ADD() – To accept and add data of an employee to a CSV file ‘record.csv’. Each
record consists of a list with field elements as empid, name and mobile to store
employee id, employee name and employee salary respectively.
( ii) COUNTR() – To count the number of records present in the CSV file named
‘record.csv’. Also, d ispla y “St ack E mpt y” when t her e ar e no
ele ment s in t he st ack.
Q.2 : SQL Interface with Python : (4)
(A) Write a user defined function FilterWords() in python which read lines from a text file (4)
NewsLetter.TXT, and display those words, which are lesser than 4 characters and starts with a
vowel.
(B) A dictionary contains names and marks as key-value pairs of 5 students. Write a program, (4)
with separate user-defined functions to perform the following operations:
i. Push the keys (name of the student) of the dictionary into a stack, where the
corresponding value (marks) is greater than 70.
ii. Pop and display the content of the stack.
W ri t e S Q L Q u e ri e s t o
( A ) Create the above table and insert values in it.
(B) Display product name and brand name from the tables PRODUCT and BRAND.
(C) Display the average rating of Medimix and Dove brands
(D)Display the name, price, and rating of products in descending order of rating.
Q.3 Practical file (7)
Q.4 Project file (8)
Q.5 Viva Voce (3)