Computer Answer2 Pre-Board
Computer Answer2 Pre-Board
Computer Answer2 Pre-Board
Solution
Section A
1. (b) False
Explanation: False
2. (c) SELECT city, temperature FROM weather ORDER BY temperature;
Explanation: The ORDER BY keyword sorts the records in ascending order by default.
3. (a) fetchtwo( )
Explanation: The built-in functions min(), max (), divmod(), ord(), any(), all() etc. throw an error when no arguments
are passed to them. However there are some built-in functions like float(), complex() etc. which do not throw an error.
5. (a) 0000
Explanation: A list is getting added in list l1 which will be counted as one item for the list.
To practice more questions & prepare well for exams, download myCBSEguide App. It provides complete study
material for CBSE, NCERT, JEE (main), NEET-UG and NDA exams. Teachers can use Examin8 App to create similar
papers with their own name and logo.
8. (b) Fixed, variable
Explanation: Char has a specific length which has to be filled by either letters or spaces whereas Varchar changes its
length accordingly .
9. (b) file
Explanation: File is a named entity stored in storage drive that contains stream of data.
10. (a) he
Explanation: str[:2] prints only the values at index 0 and 1 (as 2 is exclusive) of string and hence the answer is “he”.
11. (c) Job scheduling
Explanation: Pickling
13. (b) Carrier Sense Multiple Access/Collision Avoidance
Explanation: Carrier-sense multiple access with collision avoidance (CSMA/CA) in computer networking, is a network
multiple access method in which carrier sensing is used.
14. (a) shallow copy
Explanation: VB Script and Java Script are examples of client-side scripting languages. Rest all are server-side scripting
languages.
16. (d) Bus
Explanation: Bus
17. (c) A is true but R is false.
Explanation: Series is a one-dimensional labeled array capable of holding any data type (integers, strings, floating-point
numbers, Python objects, etc.). The axis labels are collectively referred to as the index. if data is an array, an index must
be the same length as the data.
18. (b) Both A and R are true but R is not the correct explanation of A.
Explanation: In append mode, python creates a new file with the specified name if no such file exists. It appends the
content to the file if the file already exists with the specified name. In write mode, python creates a new file with the
specified name if no such file exists. It overwrites the existing file.
Section B
19. In a computer network, collision is a specific condition that occurs when two or more nodes on a network transmit data
at the same time. For example, if two computers on an Ethernet network send data at the same moment, the data will
"collide" and not finish transmitting. In case of a collision, the data gets garbled and cannot be read. Also, it may hamper
the overall performance of the network as collisions often lead to more retransmissions which clog the network and
deteriorate the overall performance of the network.
20. [1, 2, 3]
OR
final = ""
for i in range (len (str1)):
if (i% 2==0):
cursor = db.cursor()
check_value = (100, 3)
try:
db.commit ()
except:
db.rollback()
db.close()
22. Answer:
i. The connect( ) function can be used to connect with a database from within Python.
ii. No, You need to download separate DB-API for each database you need to access. It defines a standard interface for
Python database access modules.
23. Option (i) and (iv) are possible.
(i) If Value of PICKER is 2 (iv) If Value of PICKER is 3
BLUE BLUEBLUE
PINK PINKPINK
GREEN GREENGREEN
RED REDRED
PICKER can have a maximum value of 3 and a minimum value of 0.
d4 = {}
d4.update(i)
print(d4)
OR
i. ho
ii. ‘o’
iii. n Program
iv. IndexError
25. def display_car():
car_file = open('car.txt','r')
cars = file.readlines()
car_file.close()
mileage = (int)(temp[2])
print(car)
display_car()
OR
lines = file_obj.readlines()
lastline = len(lines) - 1
t1 = "a", 1
t3 = t2, "d", 2
t = (t3, "e", 3)
ii. i. Item assignment not possible for tuples as tuples are immutable types.
ii. No error.
iii. Error, Item being assigned to an invalid index (index out of range).
iv. Item assignment not possible for strings as strings are immutable types.
27. i. NAME JOINYEAR
Avisha 2009
ii. MIN(JOINYEAR)
2009
iii. AVG(FEE)
31666.666
OR
return False
else:
if str1[i] != str2[i]:
return False
else:
return True
if stringCompare(first_string, second_string):
else:
count = 0
Words = LINE.split()
for W in Words:
if W == " India":
count = count+1
print(count)
file.close()
30. The differences between a local variable and a global variable are as given below :
Local Variable Global Variable
1. It is a variable which is declared within a function or within a 1. It is a variable which is declared outside all the
block functions
2. It is accessible only within a function/block in which it is 2. It is accessible throughout the program
declared
3. Local variables are created when the function has started 3. Global variable is created as execution starts
execution and are lost when the function terminates. and is lost when the program ends.
For example, in the following code, x, xCubed are global variables and n and cn are local variables.
def cube(n):
cn = n * n * n
return cn
x = 10
xCubed = cube(x)
OR
top = 0
def isEmpty ( ):
global top
return top == 0
def push(x):
global stack,top
return
stack[top]= x
top += 1
def pop( ):
global stack,top
if isEmpty( ):
return
else:
top -= 1
return stack[top]
for i in string:
push(i)
x = pop( )
32. Answer (i) & (ii) OR (iii) & (iv)
i. def Readfile():
i=open("Employee.dat", "rb+")
x=i.readline()
while(x):
l=x.split(':')
if (20000>=float(1[2])<=40000):
print(x)
x=i.readline()
ii. The above code raises an error as there has been no file object defined/created by the name s2, which is directly used
in line 3. Therefore, the code will not give any output.
iii. import pickle
pickle.dump(ingredients, fout)
iv. file_obj = open("contacts.txt", "r")
line = file.read( )
info = line.split(',')
file_obj.close( )
33. i. SELECT GCODE, Description FROM GARMENT ORDER BY GCODE DESC ;
ii. SELECT * FROM GARMENT WHERE READY DATE BETWEEN '08-DEC-07' AND '16-JUN-08' ;
iii. SELECT AVG(Price) FROM GARMENT WHERE FCODE = 'F03' ;
iv. SELECT FCODE, MAX(Price), MIN(Price) FROM GARMENT GROUP BY FCODE ;
OR
25000 100
2 30
3 45
4 15
OR
Optical Fibre
35. i. i. SELECT Acodes, ActivityName FROM ACTIVITY ORDER BY ACode DESC;
ii. SELECT SUM(PrizeMoney) FROM ACTIVITY GROUP BY Stadium;
ii. i. SELECT Name, Acode FROM COACH ORDER BY Acode;
ii. SELECT * FROM ACTIVITY WHERE SchduleDate < '01-Jan-2004' ORDER BY ParticipantsNum;
iii. i. 3
ii. 12-Dec-2003 19-Mar-2004