Maximum Marks: 70: (Theory) DATE: 05-12-22 Questions Compulsory
Maximum Marks: 70: (Theory) DATE: 05-12-22 Questions Compulsory
Maximum Marks: 70: (Theory) DATE: 05-12-22 Questions Compulsory
State the reason for the following statement: Keys of dictionaries must be immutable.
Suppose that L is the list [100, [200,300], 400, 500. [600,700,800], 900]. What does 1
each of the following expressions evaluate to?
(a) L[1]I1]+ LI-2]1-2 (b) 400' in L[2:3]
Which, function is used to read data as a list of strings from a text file? 1
a) readlines() (b) readline() (c) read() (d) reader()
An attribute which was initially a candidate key but is not a primary key is known as
Which of the following keywords will you use in the following query to display all the
values of the column dept name?
SELECT dept name FROM Company
(a) Distinct (b) From (c) All (d)*
A1
Ao. VFill the blank with the
correct keyword
INSERT INTO Employees.
(a) MULT_VALUES (E01, XYZ', 32);
(b) VALUES (c) VALUUE (d) VAL
To read and
write into binary files, module of Python is used.
To display the resultset in
descending sort order, the
following clause is used:
(a) ORDER BY DESC
(b) ORDER BY (c) DESC ORDER (d) ORDER DESC
1 3 The is a network device that connects
dissimilar networks.
14 Evaluate the
following expressions:
(True and False) or False and
not True
15.Duplication of data is known
Data
as 1
(a) integrity (b) Data redundancy (c) Data duplication (d) Data difference
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation forA
(c) A is True but R is False
(d) A is False but R is True
SECTION B
the corrections. 2
correct code and underline
Write the
Find the error(s), if any.
Def Tot(Number):
Sum1 == 0
Number+1):
for C in Range(1,
Sum1 += C
return Sum1
print (Tot(3))
print (Tt[6])
A 2
20(a) Write one
difference between SMTP and FTP. 2
(b) What is the difference
between Star Topology and Bus Topology?
)Consider the following code:
=
2
Mp input("Please enter string:") a
for i in
range(2):
if Inp[-1] == 'z':
Inp = Inp[0:3] + ' c
break
elif 'a' in Inp:
Inp Inp[0] +'bb'
else **
= +
Inp Inp
print(Inp)
What will be the output produced if the input is 'zyxba'?
else
fruit[index] = 'Red'
print (fruit)
2
22. Define the terms: (i) attribute (ii) cardinality
2
VolP (i) SMS
(a) Write the full form of (i)
What is the use of an IP address?
b)
2
code fragment?
Predict the output of the following
(24. \(a)
def check (n1=1, n2=2)
n1 n 1 + n 2
n2 + 1
print(n1, n2)
check(n2=20, n1=10)
check(3)
OR
code?
of the following
What will be the output
(b)
t= 10
time=5, r=1.5):
def interest(prn,
global t
t 20
* *
t r
calc prn
return calc
print(interest(20,2,4))
Lprint(interest(20))
A3 12
a
(a) What is the difference between
SELECT statement? WHERE clause and a HAVING clause of SQL 2
OR
Table: DEPT
DCODE DEPARTMENT CITY
D01 MEDIA DELHI
D02 MARKETING DELHI
Table : wORKER
eeaWrite the syntax of the SQL command used to delete all records of the table
SYDENT, but not the table itself.
SQL s t a t e m e n t s .
Give the output offollowing WHERE AvgMark>75
FROM STUDENT
MIN(AvgMark) Name LIKE
SELECT Student WHERE
Grade FROM
SELECT Name, FROM STUDENT;
COUNT(DISTINCT Stream)
SELECT WHERE Stipend>450 or Class="12A
* Student
KSELECT FROM 3
which is a
two lists, L_even
from the u s e r and prints which
that takes a string which is a list ofwords
even-numbered
length andL_odd elements. For
has more
Write a program have
which the list which
list of words Also, display should display,
odd-numbered length. then it
have kind and courteous",
"We should be L_odd".
string is "Greater =
example, if the "courteous",
"be", "kind"], ["and',
(We", "should",
A5
30 ach node of a STACK
i) Pin code of a contains the following
Write functions to city, (ii) Name ofinformation
-implement city. 3
(a) PUSH() To ask the
of the
following
user to enter theoperations in above stack
city starts with either 'a' data and push the
or 'A'. node in the stack if the
6) POP) - To remove a node name
Condition also. from the stack
and display. Check for the
underflow
OR
Write a function in
details of an Python, Push(Account)
where Account is a
names of those Account dictionary containing the
accounts in {AccountName:AccountType).
the stack whose The function should
stack along with the
count of Account type is push the
For pushed into the stack. "Savings". Display the
example: If the dictionaryelements
contains the
"Def":"Current", data: following
display Abc Jkl Mno. The "Ghi":"Current", "Jkl":"Savings",
count of Account=("Abc":"Savings",
"Mno": "Savings"). The stack
elements should be should
displayed as 3.
SECTIOND
31. UNIVERSITY OF
its There are 4
in Allahabad is
different wings.CORRESPONDENCE
Home Science(H). wings named as setting up the network
between 5
Journalism(J), Science(S), Arts(A) and
Distance between various wingS:
Wing A to Wing S 100 m
Number of Computers
Wing A 150
Wing A to Wing J 200 m
Wing S 10
Wing A to Wing H 400 m
Wing J
Wing S to Wing H 300 m
Wing H 50
Wing S to Wing H 100 m
Wing J to Wing H 450 m
metal = "silver"
6
choice =
"I like" + metal
return choice
print("I like" + metal)
print(myfunc()"2)
(b) Fill the statements
below
as ms
import mysql.connectorgiven
def sql_data():
con1=ms.comnect(host="localhost",user="root",
mycur- #Statement 1
password="", database="school")
book_id=int(input("Enter Book id : "))
book_name=input("Enter name:: ")
price=float(input("Enter Price: "))
q="INSERT INTO Library VALUES({}.00.format(book_id, book_name, price)
#Statement 2
print("Data Added successfully")
#Statement 3
con1.close()
OR
print(m)
3
(6) Fillthe statements given below. Assume that MySql is installed on the machine
named localhost, it's userid and password are root and "pwd" respectively and the name
of the database is Sports.
import mysql.connector as ms
def sql_data():
con1 mysql.connect(_ ) #Statement1
mycur =
#Statement 2
print("Details of Tennis and Swimming are: ")
mycur.exxecute("SELECT * F R O M G a m e W H E R E G N a m e in [ " T e n n i s " , "Swimming"|
data= #Statement 3
for record in data:
print(record)
print()
con1.close()
F3. (a) Is the binary file processed faster than a textfile? Il yes, justifyyour answer.
(b) A binary file "Flights.dat" has structure FlightNo, FlightName, PilotiD, TicketPrice
A 7
(i) Write a user defined function
Flight.dat. CreateFile() to input data for a record and add to 4
(i) Write a function
parameter and
AvgCalc(FlightName)
the
in Python which accepts the
Flight name as
a
displays average TicketPrice of the flight.
OR
What are .csv files? How are they different from .txt files?
(b) A CSV file "Shop.csv" has structure [ItemNo, ItemName, Qty, ItemPrice].
i) Write a user defined function AppendData() to
the user. append data for a record taken from 4
ii) Write a function Search(ltemName, ItemPrice) in Python which accepts the ltem
name and Item price as a parameter and displays the records containing either the
mentioned Item name or Item price.
SECTION E
34 Ram has a table named 'Topics' in the database 'Book' containing the following 4
attributes - Topicld (Integer, PRIMARY KEY), TopicName(String), CreatedOn(Date,
NOT NULL).
(a) Insert a row with the data - 10, 'Recursion', 2018-03-02.
(b) Modify the table to add a field Pages Integer whose default value must be 1.
(c) as 6.
(i) Update the specific record added above to make the Pages
(ii) Delete all records created after 2022-05-06";
(C)
(i) What is a Foreign Key? which has been obtained by
and 3 attributes, while Table3
(ii) If Table1 has 5 tuples Table1 and Table2 has 20 tuples and 9 attributes,
between
Product
the Cartesian
the degree and cardinality of Table2?
what can said about
4
a task to write a python code to perform the
has recently been given functions/modules:
A programmer user defined
35. operations with
the help of two
following CSV file
called Hotel.csv in append mode containing
t o create a CSVfile
a. CSVOpen() RoomType and RoomPrice
-
HotelName, the
information of called Hotel.csv where
records from the CSVfile
to display the
b. CSVRead()
HotelName starts with 'R'.
field
the code:
blanks to complete
Fill in the
import CSV
#Statement-1
def CSVOpen(): csvf:
',newline=") as
with open('Hotel.csv''_
Cw.writerow(['Hilton', 'Executive',28000])
JViul-
def CSVRead():
try:
with open(Hotel.csv',r) as csvf:
cr #Statement-3
for r in cr:
if #Statement-4
print(r)
except
print('File Not Found')
CSVOpen()
CSVRead()