0% found this document useful (0 votes)
9 views5 pages

Understanding Candidate Keys in Databases

The document contains a series of questions and answers related to programming, networking, and database concepts. It includes sections on coding errors, comparisons between LAN and MAN, and explanations of HTML and XML. Additionally, it covers database keys, functions, and operations in Python, along with examples of data manipulation and file handling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

Understanding Candidate Keys in Databases

The document contains a series of questions and answers related to programming, networking, and database concepts. It includes sections on coding errors, comparisons between LAN and MAN, and explanations of HTML and XML. Additionally, it covers database keys, functions, and operations in Python, along with examples of data manipulation and file handling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Section –A

1. c) while
2. c)bool
3. b) 4
4. a) True
5. c) alter
6. b) r+
7. b) drop
8. c) candidate key
9. a) -a-ssistance
10. c) Statement 3
11. c) file-object
12. c) A table with a Primary Key column cannot have an alternate key.
13. a) FTP
14. c) 4.0
15. d) sum()
16. c) cursor
17. a) Both A and R are true and R is the correct explanation for A
18. d) A is False R is True

Section –B
19. Errors:
n=int(input("Enter a positive integer: "))
---
f=1
------
for i in range(1,n+1):
-----------
f*=i
print(f)

20. LAN vs MAN


LAN MAN
Full Form Local Area Network Metropolitan Area Network
Upto 10km upto 50km
Faster Moderate Speed
Design is Very easy Design is Difficult than LAN
Covers short distance like office Cover large area such as town, cities
building or campus

HTML XML
Full Form Hyper Text Markup Language eXtensible Markup Language
Commands Predefined As per need of user
Functions Designs web page layout Provides structural information
Meaning Fixed Can be changed

21. a) exam="Russia Ukraine"


print(exam[::2])
b) {age:26}Aman
22. A table can have multiple candidate keys and but only one primary key.
A table can have more than one column with unique [Link] there are Multiple primary keys
they are known as composite primary keys but it is still treated as a single primary key

23. a) i) VoIP – Voice over Internet Protocol


ii) SMTP Simple Mail Transfer Protocol
b) Wireless or Unguided Media Radiowaves
24. 34@53@[13, 24]
OR
[4,7]
25. count(*) avg(score)
5 45
26

1991991
99
1996-11-15
b) ALTER TABLE EMPLOYEE
ADD FOREIGN KEY (PROJECT) REFERENCES PROJECTS(PID);

27
28

29. def AdjustList(l):


N=len(l)
for i in range(N//2):
l[i],l[N-1-i]=l[N-1-i],L[i]

print(l)
30
status=[]
def Push_Element(visitors):
for i in visitors:
if i[4]>=15 and i[4]<=20:
[Link](i[3])
def Pop_Element():
m_c=0; f_c=0
while status!=[]:
x= [Link]())
print(x)
if x=='M':
m_c+=1
if x=='F':
f_c+=1

else:
return "Done"
print("Males:",m_c)
print("FeMales:",f_c)

32. a)7@[3, 4]
8@[8]
b) i) crsr=[Link]()
ii) querry=”update student set clas=clas+1”
iii) [Link]()

33Text file User friendly


Binary file Machine friendly
import pickle
f=open('[Link]',"ab")
while True:
eventid=int(input("Enter eventid:"))
description=input("Enter description")
venue=input("Enter venue:")
guests=int(input("Enter guests:"))
cost=float(input("Enter cost:"))
l=[eventid,description,venue,guests,cost]
[Link](l,f)
ch=input(“Continue y/n”)
if ch in ‘Nn’:
break
def COUNTR():
f=open('[Link]','rb')
c=0
sum_guest=0
sum_cost=0
try:
while True:
L=[Link](f)
c+=1
sum_guest+=L[3]
sum_cost=sum_cost+L[4]
avg_cost=sum_cost/c
avg_guest=sum_guest/c
print("Average Cost:",avg_cost)
print("Average Guest:",avg_guest)
ADD()
COUNTR()
34. i) import remove,rename
ii) [Link],”w”
iii) [Link](line)
iv) remove(“[Link]”)
35. i) He creates Projects table first because PID is primary key and project is foreign key
referenced with PID for employee table.
ii) We need no. of rows and columns to compute degree and cardinality of any table which is not
specified over here. Suppose we consider project table has 3 rows and employee table has five
rows then cartesian products will be as follows:
no. of rows = 3 x 5 = 15
no. of columns = 4 + 6 = 10
Hence, Degree of cartesian product is 10.
iii) create table employee
(EID char(4) primary key,
name varchar(20),
DOB date not null,
DOJ date not null,
Salary integer,
Project char(5) references projects(PID));
iv) alter table employee add column gender char(1);

You might also like