Class 12 CSC Practical Record File 2024-25 Final
Class 12 CSC Practical Record File 2024-25 Final
Class 12 CSC Practical Record File 2024-25 Final
2024-2025
COMPUTER SCIENCE
(083)
NAME:
CERTIFICATE
This is to certify that _________________________________ of
class XII bearing Board Examination Roll No.: _____________
has successfully completed the Practical Record File during the
academic year 2024-2025 in partial fulfillment of SSCE Practical
Examination for the subject COMPUTER SCIENCE (083)
conducted by CBSE
Date:
External Examiner
2
Computational Thinking and Programming – II
(PYTHON)
FUNCTIONS
a) A function that takes a number as a parameter and calculates the cube for it. The function does not
return a value. If there is no value passed to the function in the function call statement as an
argument, the function should calculate and print the cube of 2
b) A function that takes two strings as arguments and return True if both the strings are equal otherwise
returns False
2) Write a function that has two numeric parameters and generates a random number between those two
numbers. Using this function, the main program should be able to print three numbers randomly.
3) Write a function that receives two string arguments and checks whether they are the same length strings
(return True in this case otherwise False). Write Function Call statement and display “Same Length” or “Not
Same Length” based on the result received from the function.
4) Write a function that takes a number n and then returns a number that has maximum face value in unit’s place.
Example: if numbers passed are 491 and 278, then the function will return 278.
5) Define a function named LINEARSEARCH (lst,k) that accepts a list lst and key to be searched k as
parameters, Implements linear search to find all occurrences of k in lst and returns another list containing all
the indexes/positions where k is found in lst. The function should return None if k is not found in lst. Write
an appropriate function call statement and print the result accordingly.
6) Define a function that accepts a list of numbers as a parameter, find and print the sum and the average of all
elements. Write an appropriate function call statement and print the result accordingly.
7) Define a function that takes two lists as parameters and create a third list that contains the elements from both
the lists and sort it in ascending order. Write an appropriate function call statement and print the result
accordingly.
8) Write a function part_reverse(<list>,start, end) to reverse elements in a part of the list passed as a parameter
to the function. The parameters start and end are the starting and ending index of the part of the list which
must be reversed.
Assume that start < end, start>=0 and end<len(list)
Sample Input Data of List
my_list=[1,2,3,4,5,6,7,8,9,10]
Function Call = part_reverse(my_list,3,6)
Output is
my_list=[1,2,3,7,6,5,4,8,9,10]
9) Define a function named Unit_Seven(*n) that takes variable length parameters. The function should find and
return a list of all values of input parameters that are ending with the digit seven. Write appropriate top level
statements to call the function and to display the list obtained as result
Sample Function call:
L=Unit_Seven(127,200,400,207,17,-127)
After the execution L will have [127,207,17,-127]
10) Write a user defined function to check the validity of a password string passed as a parameter. The function
returns True if all the Validation Rules given below are satisfied otherwise it returns False.
Validation Rules:
4
24) Assuming that a text file “poem.txt” has some content, write a program to create “file2.txt”
that contains only those words from the file “poem.txt” that do not start with an uppercase
vowel.
25) Accept the names of players for two teams into the files named “Team1.txt” and “Team2.txt”
respectively with each team having 6 players. Create a new file named “FinalTeam.txt” which
has alternate names from “Team1.txt” and “Team2.txt”
Team1.txt Team2.txt FinalTeam.txt
Suman Yash Suman
Kiran Ranjan Ranjan
Bheem Jagan Bheem
Ram Mohan Mohan
Tom Rajesh Tom
Harry Suresh Suresh
26) Write a program to open the file “new.txt” created in question number 22 and add all the words
of file named “sample.txt” that start with 't' or 'T' (Note: Existing content of “new.txt” must be
retained)
27) Write a Menu Based Python program to count the number of spaces, digits, words and lines
from a text file called “D:\Exam\word.txt”. The menu should be
1. Add fresh contents to file
2. Display (contents of file & counters)
3. Exit
28) Write a Menu Based Python Program to count the number of uppercase letters and digits from
a text file called “word.txt”. Also make a copy of the file into “word2.txt”. The menu should be.
1. Add fresh contents to file
2. Make a Copy of the file
3. Display (contents of original file, copied file & counters)
4. Exit
29) Write a program to perform the following operations according to the sequence of steps given
below.
1. Open and display the contents of a file whose location is entered by the user.
2. Call a user defined function named ReplaceAll(oldword, newword) that
changes all the occurrences of oldword with newword in the file opened above and
returns the changed content. (Note: oldword and newword are entered by the user
and are passed to the functions as arguments)
3. Display the changed content.
30) Write a program to perform the following operations according to the sequence of steps given
below.
1. Accept n names from the user and store in a text file named “nameslist.txt”
2. Display the contents of the file “nameslist.txt”
3. Create a new file named “lexical_nameslist.txt” that stores the names of “nameslist.txt”
sorted lexicographically (i.e. alphabetic order)
4. Display the contents of “lexical_nameslist.txt”
5
Topic: Binary File Handling
1) WAP to write a tuple of 5 elements into a binary file named tupbin.dat. Also read and display
the contents of tupbin.dat
2) WAP to store n random numbers of 4 digits each in a list named pwdlist. Write the contents of
the list pwdlist into a binary file. Also read and display the binary file contents.
3) Write a program to create a binary file called emp.dat and write into it the employee details of
n employees available in the form of dictionaries.
For Ex. D= {empNo:"123", ename:"Ajay”, Salary: 50000}
4) Write a program to open the file “Emp.dat” (created in program 3), read the objects written in it
and display them.
5) Consider the following definition of a dictionary traTicket
traTicket={tnum: _____________ , source : _____________ ,
destination: _____________ ,cost: _____________}
Write definitions for the following user defined functions
a) def insert(filename) : To insert a dictionary object into the file passed as the
parameter.
b) def displayall(filename) : To display all the records stored in the file passed as
the parameter. (Display appropriate messages if file doesn’t exist or if there are zero records)
c) def search(filename, kTnum) : To find and display all the contents in a pickled
file passed as parameter, where tnum key of the dictionary is matching with the value passed
as kTnum
d) def modify_withtemp(filename, kTnum) : To find and modify all the records
in a pickled file passed as parameter, where tnum key of the dictionary is matching with the
value passed as kTnum (Using Temporary File)
e) def modify_withouttemp (filename, kTnum) : To find and modify all the
contents in a pickled file passed as parameter, where tnum key of the dictionary is matching
with the value passed as kTnum (without Using temporary File)
f) def Delete_withtemp(filename, kTnum) : To find and delete all the records in
a pickled file passed as parameter, where tnum key of the dictionary is matching with the value
passed as kTnum (Using Temporary File)
Create a Menu as follows and invoke the required function defined above to execute the task
chosen by the user.
MENU:
1. Insert a New Ticket Record (Retain previous data)
2. View all Records
3. Search a particular Ticket
4. Modify Ticket Details (Using Temporary File)
5. Modify Ticket Details (Without Using Temporary File)
6. Delete a record
7. Exit
6) Write required function definitions and menu options to implement the following additional
functionalities to above program
a) To delete all records where the Source is “Delhi” and “Destination” is “Mumbai”.
Display appropriate messages if the record doesn’t exist.
b) To display the number of records in the file
c) To increase the cost of all tickets by 20%
6
Topic: CSV File Handling
1) Write definitions for the following user defined functions
a) def Write_info() : To insert a record into a csv file named “Product.csv”
(Ensure that the header row is written only once into a file) with the following details:
[prod_id ,prod_name, prod_price, prod_qty] with ;(semicolon as delimiter)
b) def Read_info() : To display all the records stored in the csv file passed as the parameter.
(Display appropriate messages if file doesn’t exist or if there are zero records)
Create a Menu as follows and invoke the required function defined above to execute the task
chosen by the user.
MENU:
1. Insert a New Record (Retain previous data)
2. View all Records
3. Exit
2) Write a Python program
a) To write a nested list(with 3 records) with the following details
[M_type,M_name,M_price] to a
“Medicine.csv” in one go. (M_type takes the value “safe ” and “unsafe”)
b) After writing the content to “Medicine.csv” file read and display the content.
3) From the CSV file created in the above program “Medicine.csv”
a) Display only those records where type is “unsafe”
b) Display only those records M_price is more than 400
c) To display the number of records in the file(don’t count the header row).
4) Write a Python program to copy the contents of above file “Medicine.csv” into “Temp.csv”, but
with a different delimiter.
5) Write a program that reads a csv file and creates another csv file with the same content
except those records where the type is “safe”
6) Read the records from "Medicine.csv" file and display alternate records.
7) Write a program that reads a csv file and creates another csv file with price field value
Increased by 20% for all the medicines where the type is unsafe.
DATA STRUCTURES
1) Write a Menu Based Program to implement a stack that holds list of numbers. Take care of
overflow/underflow situations. The Menu should be
1. Push
2. Pop
3. Display entire stack content
4. Display Top Node
5. Exit
2) Write a menu driven python program to implement operations on STACK named L that stores a
list of numbers. Define the required functions as per the specifications given below
a) def PUSHSTACK (STK, N): where the numeric value N is pushed into the stack. If the size
of the stack is 10 report STACK OVERFLOW situation.
b) def IS_EMPTY (STK): returns True if stack is empty otherwise returns False
c) def POPSTACK (STK): where, the function returns the value deleted from the stack.
d) def SHOWSTACK(STK): displays the contents of the stack
7
e) def PEEK(STK): displays the topmost element of the stack
Write the required top-level statements and function call statements. Note the POPSTACK,
SHOWSTACK and PEEK functions will invoke IS_EMPTY function to check and report
STACK UNDERFLOW situation.
3) Write a Menu Based Program to implement a stack that holds details of books. Take care of
overflow/underflow situations. The Menu should be
1. Push
2. Pop
3. Display entire stack content
4. Display Top Node
5. Exit
Each node of the Stack will have the following structure
[BOOK_ID, TITLE, AUTHOR, PRICE]
4) Write the definition of a function POP_PUSH ( LPop, LPush, N) in Python. The function
should Pop out the 1ast N elements of the list LPop and Push them into the list LPush .
For example:
If the contents of the list LPop are [10, 15, 20, 30]
And value of N passed is 2,
then the function should create the list LPush as [ 30, 20]
And the list LPop should now contain [10, 15]
NOTE : If the value of N is more than the number of elements present in LPop, then display the
message "Pop not possible" .
Write the required top-level statements and function call statements and execute the program.
8
Database Management
Write SQL Queries for the following:
4) Insert following data records into FACULTY table and COURSES table.
11