Computer Practical File
Computer Practical File
Class XIIth
Commerce
Roll No- 65
As per CBSE Guidelines, and Syllabus
per the Academic Year 2020-21
Computer
Practical File
RPM Academy
Introduction – I
Contents
Concepts
TEACHER NAME: -
TEACHER SIGNATURE: -
DATE: -
• Create a table EMPLOYEE with Fields FIRST_NAME, LAST_NAME, AGE, SEX and INCOME in
TESTDB.
Q:10- = Consider the file “SarojiniPoem.txt”
Autumn Song
Sarojini Naidu
(b) Modify the program so that the lines are printed in reverse order.
(c) Modify the code so as to output to another file instead of the screen. Let your script overwrite the
output file.
(d)Change the script of part (c) that it append output to an existing file.
(e) Modify the program so that each line is printed with a line number at beginning.
• Create a table EMPLOYEE with Fields FIRST_NAME, LAST_NAME, AGE, SEX and INCOME in
TESTDB.
Q:-11-Write a Python database connectivity script that deletes records from category table of database
items that have name = 'Stockable'
Q;-12- Design a Python application that fetches all the records from Pet table of menagerie database.
Q:-13- Read a text file by line by line and display each word separated by #.
Q:-14-Read a text file and display the number of vowels / consonants/ uppercase/ lowercase characters in
the file.
Q:-15-Write a random number generator that generates random numbers between 1 to 6.
Q:-16-Write a Python program to implement a stack and queue using a list data-structure.
Q-17- Create a binary file with rollno , name , and marks. Input the roll number and update the marks.
Q:-18- Create a binary file with name, and roll no. Search for a given roll no and display the name , If not
found display appropriate message.
Q:-19-Write a python program to sort a dictionary by key.
Q:-20-DATABASE MANAGEMENT
->Create a student table and insert data. Implement the following SQL commands on the student table.
ALTER table to add new attributes / modify data type / drop attribute
UPDATE table to modify data.
ORDER BY to display data in ascending /descending order
DELETE to remove tuple(s)
Program # 1
CODE:
a="";
for row in range(0,7):
for column in range(0,7):
if (((row == 0 or row == 6) and column >= 0 and column <= 6) or row+column==6):
a=a+"*"
else:
a=a+" "
a=a+"\n"
print(a);
OUTPUT:
Program # 1.b
CODE :
n=int(input("enter the number of nows : "))
for i in range (n, 0, -1):
for j in range (i, 0, -1):
print('*', end=' ')
print()
print()
OUTPUT :
PROGRAM # 2
CODE:
a = (0,1,1)
for i in range(6):
a = a + ( a [ i +1] + a [ i + 2 ] ,)
print(a)
OUTPUT:
if ans:
print("The word is a Palindrome !")
else:
print("No, the given is not a palindrome !")
OUTPUT:
PROGRAM # 4
CODE:
t=tuple( )
n=int(input("Number of Units you want in your tuple : "))
for i in range(n):
a=input("Enter numbers you want to add: ")
t+=(a,)
for i in t:
print('The Element Tuples are : ', i)
OUTPUT:
if num > 1:
for i in range(2,num):
if (num % i) == 0:
print(num,"is not a prime number")
break
else:
print(num,"is a prime number")
else:
print(num,"is not a prime number")
OUTPUT:
b)
D)
E)
CODE:
file=open("sample.txt","r")
doc=file.readlines()
for i in doc:
words=i.split()
for a in words:
print(a+"#")
print("")
file.close()
OUTPUT:
PROJECT # 14
CODE:
infile = open("Sample.txt", "r")
countV = 0
countC = 0
for c in infile.read():
if c in vowels:
countV += 1
elif c in cons:
countC += 1
OUTPUT:
PROJECT #15
CODE:
import random
OUTPUT:
PROJECT # 16
CODE: