I REVIEW OF CLASS XI PAGE SIGN
a. Script to check whether the number entered by the user is
an Armstrong number or not.
b. Script to check whether the number entered by the user is
a Perfect number or not.
c. Script to check whether the number entered by the user is
a Prime number or not.
d. Script to generate the first n Prime numbers where the
value of n is entered by the user at run-time.
e. Script to check whether the number entered by the user is
a Composite number or not.
f. Script to generate the first n Composite numbers where the
value of n is entered by the user at run-time.
g. Script to generate the first n terms of the Fibonacci Series
where the value of n is entered by the user at run-time.
h. Script to find the LCM and GCD of two numbers entered
by the user.
i. Script to check whether the string entered by the user is a
palindrome or not.
j. Script to accept a string from the user at run-time, count
and display the number of vowels, consonants, uppercase
and lowercase characters in the string.
k. Script to display the number of words in a string entered
by the user at run-time.
l. Script to count the number of words beginning with ‘a’ in
a string entered by the user at run-time.
m. Script to input the first name, middle name and last name
of a user and display only the initials of the name.
n. Script to remove the duplicate elements from a list of
integers.
o. Script to display the smallest and largest value in a tuple
of integers entered by the user.
p. Script to rearrange a list containing positive and negative
integers. Rearrange the list such that all the negative
values appear in the beginning followed by all the positive
values.
q. Script to input a list of integers and swap elements at the
even location with the elements at the odd location.
r. Script to search for a value in a list of integers using the
Linear Search method.
s. Script to search for a value in a sorted list of integers using
the Binary Search method.
t. Implement a contact book using the concept of Python
dictionary. For each contact, store the name, address and
phone number. The code should perform the following
functions:
i. Add a contact to the contact book.
ii. Show the details of all the contacts stored in the
dictionary.
iii. Search and display the details of the contact whose
name is entered by the user at run-time.
iv. Search and edit the phone number of the contact
whose name is entered by the user at run-time.
v. Search and delete the record of the contact whose
name is entered by the user at run-time.
u. Implement a nested dictionary to store the student details.
The dictionary key is the roll number whose value is a
nested dictionary containing the student name and marks.
The code should perform the following functions:
i. Add a student record to the dictionary.
ii. Show the details of all the students stored in the
dictionary.
iii. Search and display the details of the student whose
roll number is entered by the user at run-time.
iv. Search and edit the marks of the student whose roll
number is entered by the user at run-time.
v. Search and delete the record of the student whose
roll number is entered by the user at run-time.
II USER-DEFINED FUNCTIONS PAGE SIGN
a. Write User-Defined Functions to find the sum of two
numbers using all four function styles.
b. Write User-Defined Functions to find the square of a
number using all four function styles.
c. Write a User-Defined Function to demonstrate the use of
Default and Positional arguments.
d. Write a User-Defined Function to demonstrate the use of
Default, Keyword and Positional arguments.
e. Write Python script to illustrate the use of global and local
variables.
f. Write Python script to illustrate the use of global keyword.
g. Write Python script to illustrate the use of nested function.
h. Write Python script to show how a string is passed as an
argument to a function.
i. Write Python script to show how a tuple is passed as an
argument to a function.
j. Write Python script to show how a list is passed as an
argument to a function.
k. Write Python script to show how a dictionary is passed as
an argument to a function.
III DATA FILE HANDLING
A TEXT FILE – CHARACTER BASED CODES PAGE SIGN
Create a text file called ‘moral.txt’ and write the following
contents in it.
No matter how much the world tries to hold you back, always
continue with the belief that what you want to achieve is
possible. Believing you can become successful is the most
important step in actually achieving it.
Write a menu-driven program using user defined functions
that performs the following tasks on the text file “moral.txt”:
a. Display the entire file.
b. Display the total number of characters stored in the file.
c. Display the total number of lowercase and uppercase
letters stored in the file.
d. Display the total number of alphabets, digits, spaces and
special characters stored in the file.
e. Display the total number of vowels and consonants stored
in the file.
f. Display the total number of times the character ‘a’ appears
in the file.
g. Display the file character by character with each character
separated by ‘#’.
B TEXT FILE – WORD BASED CODES PAGE SIGN
Create a text file called ‘quotes.txt’ and write the following
contents in it.
Where there is a will there is a way
Tough times do not last tough people do
Man proposes God disposes
Honesty is the best policy
Write a menu-driven program using User defined functions
that performs the following tasks on the text file “quotes.txt”:
a. Display the file word by word.
b. Display the total number of words stored in the file.
c. Display the total number of words with length 4.
d. Display the words that begin with the character ‘t’.
e. Display the words that end with the character ‘t’.
f. Display the separate count of the words ‘is’ and ‘do’.
g. Display all words in reverse.
h. Read the file line by line and display each word separated
by a #.
i. Display the shortest and the longest word stored in the file.
j. Display the most frequently occurring word stored in the
file.
C TEXT FILE – LINE BASED CODES PAGE SIGN
Create a text file called ‘quotes.txt’ and write the following
contents in it.
Where there is a will there is a way
Tough times do not last tough people do
Man proposes God disposes
Honesty is the best policy
Write a menu-driven program using User defined functions
that performs the following tasks on the text file “quotes.txt”:
a. Display the file line by line.
b. Display the total number of lines stored in the file.
c. Display the lines that begin with the character ‘T’.
d. Display the lines that end with the character ‘y’.
e. Display all lines in reverse.
f. Read the file line by line and display each word separated
by a #.
g. Display the shortest and the longest line stored in the file.
h. Remove all the lines that contain the character 'a' in a file
and write it to another file.
D BINARY FILES PAGE SIGN
A binary file “student.dat” stores the details of students in the
following format: [rollno, name, marks]
Write a menu-driven program using User defined functions
that performs the following tasks on the binary file
“student.dat”:
a. Append records to the file.
b. Show all records stored in the file.
c. Search and display the student record from the file on the
basis of the roll number passed as an argument.
d. Search and display the student record from the file on the
basis of the name passed as an argument.
e. Search the student record on the basis of roll number
entered by the user and update the name and marks as
desired.
f. Search the student record on the basis of roll number
entered by the user and delete it.
E CSV FILES PAGE SIGN
A csv file “stud.csv” stores the following details for each student
: rollno, name, marks
Write a menu-driven program using User defined functions
that performs the following tasks on the csv file “stud.csv”:
a. Append records to the csv file.
b. Show all records stored in the csv file.
c. Search and display the student record from the csv file on
the basis of the roll number passed as an argument.
d. Search and display the student record from the csv file on
the basis of the name passed as an argument.
IV STACKS AND QUEUES PAGE SIGN
Implement a Stack of integers using a list data-structure.
Write a menu-driven program using User defined functions
that performs the following tasks on the Stack of integers:
a. Push a new value to the Stack
b. Pop/Remove a value from the Stack.
c. Display the Stack in LIFO order
Implement a Queue of Country names using a list data-structure.
Write a menu-driven program using User defined functions
that performs the following tasks on the Stack of integers:
a. Add a new country name to the Queue
b. Remove a country name from the Queue
c. Display the Queue in FIFO order
V INTERFACE OF PYTHON WITH MySQL PAGE SIGN
DATABASE
Write Python script to implement database connectivity with a
MySQL database. The script should be menu-driven with User
defined functions to perform the following operations:
a. Create database TESTDB
b. Open database TESTDB
c. Create table emp in TESTDB database with the
following structure:
empno : integer [Primary key]
ename : varchar(30)
age : integer
gender : char
sal : integer
d. Insert records into emp table.
e. Display all records stored in emp table.
f. Display the record of an employee on the basis of given
empno
g. Display the record(s) of an employee on the basis of
given ename
h. Update the name, age or salary as required by the user
i. Delete the record of an employee on the basis of given
empno
j. Close the connection to the database TESTDB.
VI MySQL ACTIVITIES