1.
In the __ normal form, a composite attribute is converted to individual attributes.
Second NF
First NF
Third NF
None of the above.
2.
The primary key must be
Unique
Not null
Both Unique and Not null
Either Unique or Not null
3.
To remove Partial dependency, what we can do:
We can divide the table, remove the attribute which is causing partial dependency.
We delete the table.
We remove all data.
None of the above.
4.
Which statements is correct about 3NF:
I. It is in 2NF
II. It should not be in 2NF
III.It doesn't have Transitive Dependency.
IV. It should have Transitive Dependency.
Only I
Only II
I & III
III & IV
5.
Which join is equivalent to Cartesian Product?
INNER JOIN
OUTER JOIN
CROSS JOIN
NATURAL JOIN
6.
Identify the below methods which is used for transactions :
Read()
Write()
Both A & B
None of the Above
7.
Which statements is correct about 2NF:
I. It should not be in 1NF
II. It should be in 1NF
III. It should have partial dependency.
IV. It should not have partial dependency.
Only I
II & III
II & IV
Only II
8.
Identify the following two operations of atomicity is involved:
Abort
Commit
Both A&B
None of the above
9.
Functional Dependencies are the types of constraints that are based on__
Table
Key
Data
None of the above
10.
Consider the relations
student(Rno, Branch, Name) - Primary key: 'Rno'
enroll(Rno, Cno, Cname) - Primary key: 'Rno, Cno'
Let the number of tuples in student and enroll relations are 120 and 8 respectively. Then find the
manimum and maximum number of rows in the result of student natural join is ____?
0,960
8,120
8,960
8,8
--------------------------------------------------------------------------------------------------------
PROGRAMMING
1.
Problem statement
You are going to make a new namebook, which contains unique usernames for each person who
registers for it. Whenever a new user wants to register, the user sends his name to you and you write
the name in the namebook. If such a name is not present you write the name in the namebook and
send a response "OK" back to the user. If the name already exists in the namebook, you make a new
username using the following method:
Smallest postitive number is appened to the user's name to get a new unique username, in this case
you return the generated username as teh response to the user.
Given n names you have to generate the correct responses for them.
Input Format
The first line contains number n (1 ≤ n ≤ 10^5). The following n lines contain the requests to the system.
Each request is a non-empty line, and consists of not more than 32 characters, which are all lowercase
Latin letters
Constaints
(1 ≤ n ≤ 10^5)
Output Format
Print n lines, which are system responses to the requests: OK in case of successful registration, or a
prompt with a new name, if the requested name is already taken.
PYTHON CODE :
s={}
for _ in range(int(input())):r=input();print(r+str(s[r])if s.setdefault(r,0)else'OK');s[r]+=1
2.
Problem statement
Given 2 strings S1 and S2, work on the strings such that both string has the same number of
characters.To adjust the length reduce number of exceeding characters from longer string.
Input Format
Take two strings as an input.
Constraints
1<=length of strings<=100
Output Format
Print concatenation of both the string with reduced number of exceeding characters from longer string.
In output s1 will come before s2
PYTHON CODE :
a,b=input().split()
if(len(a)>len(b)):
print(a[:len(b)],end="")
print(b)
elif(len(b)>len(a)):
print(a,end="")
print(b[:len(a)])
else:
print(a+b)
3.
Problem statement
You are given with two arrays. Your task is to merge the array such that first array is in ascending order
and second one in descending order.
Input Format
First line contains two integer ‘n’ and ‘m’. ‘n’ denotes length of array 1 and ‘m’ of array 2.Next line
contains n space separated numbers and third line contains ‘m’ space separated numbers
Constraints
1>=n<=100
Output Format
Print a single array in desired order
PYTHON CODE :
n,m=map(int,input().split())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
a1.sort()
a2.sort(reverse=True)
a1=a1+a2
print(*a1)
Post a Comment