Screenshot 2024-09-18 at 10.52.42 PM
Screenshot 2024-09-18 at 10.52.42 PM
Screenshot 2024-09-18 at 10.52.42 PM
Q.6A text file "muthu.txt" is stored on a computer. Identify the correct option out of the
following options to open the file for reading. (1]
i) f-open("muthu.txt") ii) f=open("muthu.txt",'r)
ii) f=open("muthu.txt",'rb') iv) f=open("muthu.txt",'r+b')
a) (i),(ii)and (iv) b) (i) and (iv) e) (i) and (ii) d) (i),(ii) and (ii)
Q,7 Which SQL command is used to view structure of the table student? ):tibe hd in [1]
Q.8 The SELECT Statement when combined with clause, returns records
without repetition. (1]
(a) DESCRIBE (b) UNIQUE (c) DISTINCT (d) NULL
Q.9 Which of the following is an immutable data type in Python?
a) Lists b)Integer e)Dictionary d) Allthe above
Q.10 Write the output of the following code: (1]
d={ 'name':'rohan', dob': "2002-03-11','Marks' :98')
dl={ 'name': 'raj')
dl=d. copy ()
print ("d1 :", dl)
a) d1:('name': 'rohan, 'dob': '2002-03-11", Marks': '98')
D) d1= ('name': 'rohan 'dob', '2002-03-11', 'Marks':"987
C) {'name': 'rohan', 'dob':'2002-03-11', 'Marks': "98|
a) (d1:{name': 'rohan', dob': "2002-03-11', 'Marks': '98))
Ql1 What is the possible output of the program given below: (1]
import random
X = random.
random ()
print (int (x) )
a) 0 b) 1 c) 0.2 d) -0.1
Q.12 Avariable declared outside all the functions in a pvthon
statements which are True in the context of the variable. program, then mention te
[1)
1. This variable wil have
global scope.
2.This variable willnot be
accessible from anywhere in the prog.
3. This variable will have a large
lifetime than local variable.
4. This variable will be
referred as Local variable.
a) Only 182 b) Only 1 c) Only 18&3 d) Only 3
Q.13 In F-open("MyFile.txt"),name of fileobject is (1]
a.open b.MyFile.txt e.F d.F=open()
0.14 In which format does the readlines( )
function give the output? [1]
a. Integer type b. list type C. string type d. tuple type
Q.15 Afunction in python begins with which
keyword? (1]
a) void b) return c) int d def
Q.16 If column "Salary" contains the data set {15000,
the output after the execution of the given
25000, 10000, 15000}, what will be
query?
SELECT SUM(DISTINCT SALARY) FROM EMPLOYEE;
a)65000 b) 25000 c) 35000 d) 50000
a.17 Which SQL function is used to count the number of
rows in a SQL query? [1]
a) COUNT () b) NUMBER () c)SUM () d coUNT (*)
Q.18 SQL applies conditions on the groups through
clause after groups have been
formed.
(1])
a) Group by b)With c) Where d) Having
0.19 and 20 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 Aand R are true and R is not the correct explanation for A
(c) Ais True but Ris False
(d) A isfalse but Ris True
Q.19 Assertion (A): CSV (Comma Separated Values) is a file format for data storage which
looks like a text file.
[1
Reason (R): The information is organized with one record on each line and each field is
separated by comma.
Q 20 Assertion (A) In Python, retun statement isused toexit from afunc ion
Reasoning(R). The fetun statement passes back an expression to the (aller
SECTION N
Q21 How ae teN files dt dtfercot roon thn linary iles?
Q2?What is detault augumentIxplain with exanple
OR
What is lobal scope of varialble?(xplainwitlh exanple
Q.*1 Piedict the output of the Python code given below.
tuplel- (|1,22, , 44, 53 , 6.)
list| iat (L uplel)
lew list ||
lor i in listl:
if i82e -0:
new list.append(1)
new tuple tuple(new list)
print (new tuple)
syntactical
carefully and rewrite it after removing all
Q.24 Observe the following Python code very [2]
errors with each correction underlined.
import math
DEF exe cmain ():
") )
X=int (input ( "Enter a number:
if fabs (x) = X:
positive number")
print ("You entered a
else:
x -1
print "Number made positive: ", X
execmain ()
not. His code is
number and check whether it is prime or
Q.25 Rao has written a code to input a [2]
and underline the corrections made.
having errors. Rewrite the correct code
de f prime () :
:: ")
n=int (input ("Enter number to check
for i in range (2, n//2):
if n&i=0:
print ("Number is not prime \n")
break
elif:
print ("Number is prime \n)
following code? Also, specify the
0.26 What are the possible outcome(s) executed from the [2]
SEL.
maximum and minimum values that can be assigned to variable
import random
SEL=random. randint (0, 3)
ANIMAL = ["DEER", "Monkey", "COW", "Kangaroo"];
for A in ANIMAL:
SEI)
tor AA in range (1.
print (A, end =)
print ()
()
DEERDER
MOeEYMONKEY
VONKEVMONKEY
KANGAYOWANGAOOKANGARO0
COWCOIW DEHAA0VKEVCOVW (0W
KANGAROONANAO KANGAR00
|2|
Q27 Predict the output ot the code given below
8"Wolcome'cn"
nle(s)
print (m)
0.31 Write a function in python showthe() to read the text file "hello.txt" and find out how many
lines begin with the word "The" or "THE", (3]
OR
Write a function in python, vowelCount() that count and displays the number of vowels in the text
file name "student.txt".
a.32Write a Program in Python that defines and calls the following user defined functions: (3]
i) ADDO- loaccopt and add data of an omployeo ta a (V filo
list with tield elements as emnpld, nane and mobilo to 'rocotdcsv 1ach record conists of a
storo cmployee id, employoe narne arnd
employee salary respectively.
()COUNTRO -To count the number of records preseot in the C5v le named 'record csv
Q33A binary tle "salary.DAT" has structure lomoloee ld. emolovee name, alaryl. Write a function
countrec) in Python that would read content of the file "salary DAr" and display the detals of thorn
employee whose salary is above 20000. (3|
OR
Atile sports.dat contains information in following format (event, participant). Write a progran that
would read the contents from file and copy only those records from sports.dat where the event
name is "Athletics" in new file named Athletics.dat
Q.34 Write a function ShowNum() to accept a list as parameter and returns the sum of all the even
numbers in the list. (3)
OR
Write afunction SQUARE LIST(L), where Lis the list of elements passed as argument to the function.
The function returns another list named 'newlist' that stores the square of all elements of L
For example: IfL contains [12,4,0,11]
The newList will have -[144,16,0,12 1]
(3)
Q.35 Give the output of the following SQL queries based on CABHUB table.
Table: CABHUB ir
ColourCapadtyCharges
VcodeVehicleName Mal 15
100 Innova Toyota WHITE
4 14
Suzuki BLUE
102 SX4 35
Mercedes RED
104 CClass 14
WHITE 3
105 A-Star Suzuki
3 1
Tata SILVER
108 Indigo
Q38 Consider the tollowint tables SCHOOL and ADMIN and answer the questions 4|
Tables ACCLSORIS
No Name
A01 Mother Bostd 12000 01
Ilard Disk S000
A03 Keyboard S02
Table: SHOP
A04 Mouse 01
Id SNane Area A05 Mother IBoard 13000
S01 ABC omputronlcs CP AO06 Keyboard 400
SO02 All Inlotech Media GK II A07 LCD 6O00
SO03 Tech Shop CP TO8 LCD 5800 SO5
S004 Gecks Tecno Soft Nehru Place TO9 Mouse 390
So05 Hitech Tch Store Nehru Place T10 Hard Disk 4300 S03
3. What willbe the suitable code for blank space in line marked as Staternent-3.
4. Which statement Arun should use at blank space in line marked as Statement4 to close
the file.