0% found this document useful (0 votes)
47 views

HHW 12A CS Programming Assignment

The document provides instructions for a homework assignment on computer science programs to be completed over summer break. Students are asked to write programs that perform tasks like reading and manipulating text files, generating random numbers, creating and searching binary files, and implementing stacks. The finished work is to be compiled into a word file with the source code and output of each program, then printed and submitted in a labeled file folder after summer break.

Uploaded by

coder boy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

HHW 12A CS Programming Assignment

The document provides instructions for a homework assignment on computer science programs to be completed over summer break. Students are asked to write programs that perform tasks like reading and manipulating text files, generating random numbers, creating and searching binary files, and implementing stacks. The finished work is to be compiled into a word file with the source code and output of each program, then printed and submitted in a labeled file folder after summer break.

Uploaded by

coder boy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Holiday Home work

Computer Science – Class XIIA


(a partial submission for board practical file)
Note: Every program to be executed on the system, the source code along with the output to
be pasted into a Word file. The index of questions is to be placed in the beginning. Once the
word file is ready get it printed on A4 sheets and put it in a file folder labeled with your name
and class. Finally submit it in the computer lab on the 1st day after the summer break.
1. Read a text file line by line and display each word separated by a #.
2. Read a text file and display the number of vowels/consonants/uppercase/lowercase
characters in the file
3. Remove all the lines that contain the character ‘a’ in a file and write it to another file.
4. Create a binary file with name and roll number. Search for a given roll number and
display the name, if not found display appropriate message.
5. Create a binary file with roll number, name and marks. Input a roll number and update
the marks.
6. Write a random number generator that generates random numbers between 1 and 6
(simulates a dice).
7. Create a CSV file by entering user-id and password, read and search the password for
given user id.
8. Write a function to create a text file containing following data “Neither apple nor pine
are in pineapple. Boxing rings are square. Writers write, but fingers Don’t fing. Overlook
and oversee are opposites. A house can burn up as it burns down. An Alarm goes off by
going on.”
9. Read back the entire file content using read() or readlines () and display on Screen.
10. Append more text of your choice in the file and display the content of file with Line
numbers prefixed to line.
11. Display last line of file.
12. Display first line from 10th character onwards.
13. Read and display a line from the file. Ask user to provide the line number to be Read.
14. Write a program to read a file ‘Story.txt’ and create another file, storing an index of
Story.txt telling which line of the file each word appears in. If word appears more than
Once, then index should show all the line numbers containing the word.
15. Write a program to accept a filename from the user and display all the lines from the file
which contain python comment character ‘#’.
16. Reading a file line by line from beginning is a common task, what if you want to read a
file Backward. This happens when you need to read log files. Write a program to read
and Display content of file from end to beginning.
17. Create a list/dictionary to store information of n different items, existing in a shop. The
Following data is to be stored w.r.t. each item code, name, price, qty. Write a program
to accept the data from user and store it permanently in the file. Also provide user with
facility of searching and updating the data in file based on code of item
18. Following is the structure of each record in a data file named ”PRODUCT.DAT”.
{"prod_code":value, "prod_desc":value, "stock":value}. The values for prod_code and
prod_desc are strings, and the value for stock is an integer. Write a function in PYTHON
to update the file with a new value of stock. The stock and the product_code, whose
stock is to be updated, are to be input during the execution of the function.
19. Given a binary file “STUDENT.DAT”, containing records of the following type: [S_Admno,
S_Name, Percentage] Where these three values are: S_Admno – Admission Number of
student (string) S_Name – Name of student (string) Percentage – Marks percentage of
student (float) Write a function in PYTHON that would read contents of the file
“STUDENT.DAT” and display the details of those students whose percentage is above 75.
20. Assuming the tuple Vehicle as follows: ( vehicletype, no_of_wheels) Where vehicletype
is a string and no_of_wheels is an integer. Write a function showfile() to read all the
records present in an already existing binary file SPEED.DAT and display them on the
screen, also count the number of records present in the file.
21. Write a function in PYTHON to search for a BookNo from a binary file “BOOK.DAT”,
assuming the binary file is containing the records of the following type:
{"BookNo":value, "Book_name":value} Assume that BookNo is an integer.
22. Write a function in PYTHON to search for a laptop from a binary file “LAPTOP.DAT”
containing the records of following type. The user should enter the model number and
the function should display the details of the laptop. [ModelNo, RAM, HDD, Details]
where ModelNo, RAM, HDD are integers, and Details is a string.
23. Write a program to input a matrix of n rows and m columns. Find and display the
product of the corner values in it.
24. Write a program to input a matrix of n rows and m columns. Change and display the
matrix so that the 1st row is swapped with the last row.
25. Write a program to implement a stack to store phone numbers and names of n
employees with the following operations(menu driven): push(), pop(), show_all()
26. Write a program to implement a stack to store phone numbers and names of n
employees with the following operations: deleteany(), insertafter(), show_all()

You might also like