TYBCS IP SLIPS 10 Marks
2) . Design a HTML form to accept a string. Write a PHP script for the following.
a) Write a function to count the total number of Vowels from the script.
b) Show the occurrences of each Vowel from the script.
a) Write a function to count the total number of Vowels from the script.
b) Show the occurrences of each Vowel from the script.
5 ) Write a PHP script to display following information using super global variable.
a) Client IP Address.
b) Browser detection/information.
C) To check whether the page is called from ‘https’ or ‘http’.
a) Client IP Address.
b) Browser detection/information.
C) To check whether the page is called from ‘https’ or ‘http’.
7) Write a menu driven program to perform various file operations. Accept filename from user.
a) Display type of file.
b) Delete a file.
a) Display type of file.
b) Delete a file.
8) Write a menu driven program the following operation on an associative array
a) Reverse the order of each element’s key-value pair.
b) Traverse the element in an array in random order.
a) Reverse the order of each element’s key-value pair.
b) Traverse the element in an array in random order.
TYBCS IP SLIPS 20 Marks

19 Comments
This comment has been removed by the author.
ReplyDeletegive me zip file of this complete solution
ReplyDeleteCreate you own
DeleteNice articel, This article help me very well. Thank you. Also please check my article on my site Know All About Deprecated: Non-Static Method Templates::Override_tax_template().
ReplyDeletePhoenix Binary System is a professional Website Development Company in Anand Gujarat. Mobile App, SEO company in Anand, Web Design Company in Surat.
ReplyDeleteNice Information... Thanks for this wonderful information..
ReplyDeletephp classes in pune
Glad to find this. Your site very helpful and this post gives lots of information. Do share more updates.
ReplyDeletePHP Course in Chennai
PHP Training Online
PHP Course in Coimbatore
Thanks for sharing such a Excellent Blog! We are linking too this particularly great post on our site. Keep up the great writing.
ReplyDeleteprogramming assignment help
Write the simulation program for demand paging and show the page
ReplyDeletescheduling and total number of page faults according the optimal page
replacement algorithm. Assume the memory of n frames.
Reference String : 8, 5, 7, 8, 5, 7, 2, 3, 7, 3, 5, 9, 4, 6, 2
please sir we want code for this opt question.
#prime even odd
ReplyDeletedef is_prime(n):
if n < 2:
return False
for i in range(2, n):
if n % i == 0:
return False
return True
nums = [2, 3, 4, 9, 11, 15]
for n in nums:
if is_prime(n):
print(n, "is Prime")
elif n % 2 == 0:
print(n, "is Even")
else:
print(n, "is Odd")
2) Flatten a Nested List (Recursive)
ReplyDeletedef flatten(lst):
result = []
for item in lst:
if type(item) == list:
result += flatten(item)
else:
result.append(item)
return result
print(flatten([1, [2, [3, 4], 5], 6]))
3Arithmetic Calculator with Exception Handling
ReplyDeletetry:
a = float(input("Enter first number: "))
b = float(input("Enter second number: "))
op = input("Enter + - * / : ")
if op == '+':
print(a + b)
elif op == '-':
print(a - b)
elif op == '*':
print(a * b)
elif op == '/':
print(a / b)
else:
print("Invalid operator")
except Exception as e:
print("Error:", e)
4...Bank Account Class
ReplyDeleteclass BankAccount:
def __init__(self):
self.balance = 0
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
if amount <= self.balance:
self.balance -= amount
else:
print("Not enough balance")
def check_balance(self):
print("Balance:", self.balance)
acc = BankAccount()
acc.deposit(1000)
acc.check_balance()
acc.withdraw(300)
acc.check_balance()
5......Vehicle, Car, Motorcycle (Method Overriding)
ReplyDeleteclass Vehicle:
def describe(self):
print("This is a vehicle")
class Car(Vehicle):
def describe(self):
print("This is a car")
class Motorcycle(Vehicle):
def describe(self):
print("This is a motorcycle")
Car().describe()
Motorcycle().describe()
6) Extract Email Addresses (Regex)
ReplyDeleteimport re
text = "Contact us at abc@example.com or support123@test1.org or hello@myemail123.com"
emails = re.findall(r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9]+\.com", text)
print(emails)
7) Word Count Program
ReplyDeletesentence = input("Enter a sentence: ")
words = sentence.lower().split()
word_count = {}
for word in words:
if word in word_count:
word_count[word] += 1
else:
word_count[word] = 1
file = open("word_count.txt", "w")
for word, count in word_count.items():
file.write(word + " : " + str(count) + "\n")
file.close()
print("Word occurrences saved to word_count.txt")
8) Student Management System (List & Dictionary)
ReplyDeletestudents = []
def add_student():
roll = input("Enter Roll No: ")
name = input("Enter Name: ")
marks = input("Enter Marks: ")
student = {"roll": roll, "name": name, "marks": marks}
students.append(student)
print("Student added")
def display_students():
if not students:
print("No records")
return
for s in students:
print("Roll:", s["roll"], "Name:", s["name"], "Marks:", s["marks"])
def search_student():
roll = input("Enter Roll No to search: ")
for s in students:
if s["roll"] == roll:
print("Roll:", s["roll"], "Name:", s["name"], "Marks:", s["marks"])
return
print("Student not found")
def update_student():
roll = input("Enter Roll No to update: ")
for s in students:
if s["roll"] == roll:
s["name"] = input("Enter new name: ")
s["marks"] = input("Enter new marks: ")
print("Student updated")
return
print("Student not found")
def delete_student():
roll = input("Enter Roll No to delete: ")
for s in students:
if s["roll"] == roll:
students.remove(s)
print("Student deleted")
return
print("Student not found")
while True:
print("1.Add 2.Display 3.Search 4.Update 5.Delete 6.Exit")
choice = input("Enter choice: ")
if choice == "1":
add_student()
elif choice == "2":
display_students()
elif choice == "3":
search_student()
elif choice == "4":
update_student()
elif choice == "5":
delete_student()
elif choice == "6":
break
else:
print("Invalid choice")
9) CSV File – Calculate Average Marks
ReplyDeletefile = open("marks.csv", "r")
lines = file.readlines()
file.close()
total = 0
count = 0
for i in range(1, len(lines)):
data = lines[i].strip().split(",")
marks = int(data[1])
total = total + marks
count = count + 1
average = total / count
out = open("average.txt", "w")
out.write("Average Marks = " + str(average))
out.close()
print("Average calculated and saved in average.txt")
10) Student Management System using MongoDB
ReplyDeletefrom pymongo import MongoClient
client = MongoClient("mongodb://localhost:27017/")
db = client["MCA"]
collection = db["student"]
print("Connected to MongoDB")
def add_student():
roll = input("Enter Roll No: ")
name = input("Enter Name: ")
marks = input("Enter Marks: ")
collection.insert_one({"id": roll, "name": name, "marks": marks})
print("Student added")
def display_students():
data = collection.find({}, {"_id": 0})
found = False
for s in data:
print("Roll:", s["id"], "Name:", s["name"], "Marks:", s["marks"])
found = True
if not found:
print("No records found")
def search_student():
roll = input("Enter Roll No to search: ")
s = collection.find_one({"id": roll}, {"_id": 0})
if s:
print("Roll:", s["id"], "Name:", s["name"], "Marks:", s["marks"])
else:
print("Student not found")
def update_student():
roll = input("Enter Roll No to update: ")
name = input("Enter new name: ")
marks = input("Enter new marks: ")
result = collection.update_one({"id": roll}, {"$set": {"name": name, "marks": marks}})
if result.matched_count:
print("Student updated")
else:
print("Student not found")
def delete_student():
roll = input("Enter Roll No to delete: ")
result = collection.delete_one({"id": roll})
if result.deleted_count:
print("Student deleted")
else:
print("Student not found")
while True:
print("1.Add 2.Display 3.Search 4.Update 5.Delete 6.Exit")
choice = input("Enter choice: ")
if choice == "1":
add_student()
elif choice == "2":
display_students()
elif choice == "3":
search_student()
elif choice == "4":
update_student()
elif choice == "5":
delete_student()
elif choice == "6":
break
else:
print("Invalid choice")