0% found this document useful (0 votes)
71 views13 pages

12 Practical Q and Answer

The document outlines 15 programming tasks including: 1) Reading a text file and displaying words separated by #. 2) Reading a file and counting vowels, consonants, uppercase, lowercase. 3) Removing lines containing a character from one file and writing to another. 4) Creating a binary file with name and roll number and searching by roll number. 5) Creating a binary file with roll number, name, and marks and updating marks by roll number.

Uploaded by

Suchit Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views13 pages

12 Practical Q and Answer

The document outlines 15 programming tasks including: 1) Reading a text file and displaying words separated by #. 2) Reading a file and counting vowels, consonants, uppercase, lowercase. 3) Removing lines containing a character from one file and writing to another. 4) Creating a binary file with name and roll number and searching by roll number. 5) Creating a binary file with roll number, name, and marks and updating marks by roll number.

Uploaded by

Suchit Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

1.

Read a text file line by line and display each


word separated by #.
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. Program to enter two numbers and print the
arithmetic operations like +,-,*, /, // and %.

1|Page
9. Write a program to find whether an inputted
number is perfect or not.
10. Write a Program to check if the entered
number is Armstrong or not.
11. Write a Program to find factorial of the
entered number.
12. Write a Program to enter the number of
terms and to print the Fibonacci Series.
13. Write a Program to enter the string and to
check if it’s palindrome or not using loop.
14. Write a Program to search an element
using linear search.
15. Write a program to sort a sequence using
insertion sort.

2|Page
1)Read a text file line by line and display each word
separated by #.

OR

3|Page
OUTPUT:

2. Read a text file and display the number of


vowels/consonants/uppercase/lowercase characters
in the file

4|Page
OUTPUT:

5|Page
3. Remove all the lines that contain the character a’ in
a file and write it to another file

OR

6|Page
OUTPUT:

7|Page
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.

8|Page
OUTPUT:

5. Create a binary file with roll number, name and


marks. Input a roll number and update the marks.

9|Page
6. Write a random number generator that generates
random numbers between 1 and 6 (simulates
a dice)

10 | P a g e
Output:

7. Create a CSV file by entering user-id and password,


read and search the password for given user-id.

11 | P a g e
Output:

8. Program to enter two numbers and print the


arithmetic operations like +,-,*, /, // and %.

12 | P a g e
Output:

9. Write a program to find whether an inputted


number is perfect or not.

Output:

13 | P a g e

You might also like