Set 1
Set 1
3.Which of the following is correct to retrieve any character at index 'i' in string 's'? [1]
value = 50
def display(N):
global value
value = 25
if N%7==0:
value = value +
N else:
value = value - N
Page 1
------- _i
r -I
print(value, end="#")
display(20)
print(value)
a) 5#50# b) 50#50
c) 50#5 d) 50#30
5. Signals generated by an operating system to send it over phone line must be further
[1] converted into a/an
6. To read the next line of the file from a file object infi, we use
[1]
a) infi.read() b) infi.readlines() d)
c) infi.readline() infi.read(all)
d) None of these
8. Which of the following sublanguages of SQL is used to define the structure of the
[1]
relation, deleting relations and relating schemas?
a) readcharacters( ) b) read( )
c) readchar( ) d) readall( )
Page 2
def add (num1,
num2): sum =
num1 + num2
r -
sum = add(20,
30) print(sum)
a) None b) Null
c) 50 d) 0
a) 4 b) 3
c) 1 d) 2
14._The process of converting a data type into another data type is known
as_____________________________________________________________________________. [1]
a) expression b) type conversion
c) operator d) comparison
Page
3
--
r 1
1
a) Both A and R are true and R is b) Both A and R are true but R is
the correct explanation of A. not the correct explanation of A.
18. Assertion (A): CSV stands for comma-separated values, which is defined
as a simple [1] file format that uses specific structuring to arrange tabular data.
Reason (R): The csv module is used to handle the CSV files to read/write
and get data from specified columns.
a) Both A and R are true and R is b) Both A and R are true but R is
the correct explanation of A. not the correct explanation of A.
Section B
19. Answer:
OR
i. What are the basic methods of checking errors in the data being [2]
transmitted over networks?
20. Write Python code to create a table location with the following fields
[2]
id d of the location
bidycode code of the building
room type of rooms
capacity capacity of the room
21.Rewrite the following code in python after removing all syntax error(s).
[2]
Underline each correction done in the code.
30 = To
for K in range(0,To)
IF k%4== 0:
print (K * 4)
Page 4
Else:
print (K + 3)
OR
What is the output of the following?
True = False
while True:
print(True)
break
23. Differentiate between a logical error and syntax error. Also, give suitable examples of [2]
each in Python.
OR
As immutable types cannot be changed in place then the following code should raise an
error which modifies an int (an immutable type) variable. But it produces no error. Why?
A = 22
A += 2
24. Consider a binary file Employee.dat containing details such as empno:ename:salary [2]
(separator ':'). Write a Python function to display details of those employees who
are earning between 20000 and 40000. (Both values inclusive)
OR
A text file(say an.txt) contains alphanumeric text. Write a program that reads this text
file and prints only the numbers or digits from the file.
25. Write a function that takes a positive integer and returns the one's position digit of [2]
the integer.
Page 5