PREBOARD2
PREBOARD2
PREBOARD2
SECTION – A
Q1 (a) If A = “Python” and B = list(A), then identify invalid python statements: 1
(i) A[0] = ‘p’ (ii) B[0] = ‘p’ (iii) A[0] = len(A) (iv) B[0] = len(B)
Ans. (i) and (iii)
(1 Mark for correct answer)
(b) Write the type of tokens for the following: 1
(i) pop (ii) break
Ans. (i) Identifier (ii) keyword
(½ Mark for each correct answer)
(c) Which python library module requires to be imported to invoke the function: 1
(i) cos( ) (ii) xticks( )
Ans. (i) math (ii) pyplot or matplotlib.pyplot
(½ Mark for each correct answer)
(d) Rewrite the following code in python after removing all the syntax errors. 2
Underline each correction done in the code.
250 = Number
WHILE Number<=1000:
if Number=>750
print(Number)
Number=Number+100
else
print(Number*2)
a,b = runme()
print(a, ‘#’, b)
runme(a,b)
Ans. 3 $ 3
3#3
6$4
(1 Mark for each correct line of output)
(g) Select the possible output(s) of the following code from the given option. 2
Also, specify the maximum and minimum value that can be assigned to
variable NUM.
import random
cities = [‘Agra’, ‘Delhi’, ‘Chennai’, ‘Bhopal’]
NUM = random.randint(1,2)+1
for city in cities:
for I in range(1,NUM):
print(city, end=‘’)
print(‘\n’)
OR
(1 Mark for correctly plotting the line chart with correct xticks)
xticks)
( ½ Mark for correct line style)
( ½ Mark for correct markers)
(h) Write a function in python to count the number of lines in a text file 2
‘readme.txt’, that contain the word ‘happy’ anywhere in them.
OR
Write a function Biggest( ) in python to read a text file ‘readme.txt’ and
then return the word that has the maximum length.
Ans. def count():
f = open(‘readme.txt’, ‘r’)
lines = f.readlines()
c=0
for line in lines:
if ‘happy’ in line:
c+=1
print(“Total number of such lines: ”, c)
f.close()
(i) Write a recursive function Fib(n) in python to find and return the nth 3
Fibonacci number. Specify the base case by writing a comment in front of it.
Call the function in a loop to print the Fibonacci series up to that number.
OR
Write a recursive function BSearch(Arr, Beg, End, item) to search for the
item element in the list Arr having Beg and End as its lower bound and
upper bound index respectively. Invoke the function in main program.
Ans. def Fib(n):
if n==0: #First Base case
return 0
elif n==1: #Second Base case
return 1
else:
return Fib(n-1)+Fib(n-2)
OR
def BSearch(Arr,Beg,End,item):
if Beg>End:
return -999 #Base Case 1 for Search Unsuccessful
Mid = (Beg+End)//2
if item == Arr[Mid]: #Base case 2
return Mid
elif item < Arr[Mid]:
return BSearch(Arr, Beg, Mid-1, item)
else:
return BSearch(Arr, Mid+1, End,item)
Arr = [ 2, 3, 4, 10, 40 ]
X =int(input('Enter element to be searched'))
result = BSearch(Arr,0,len(Arr)-1,X)
if result != -999:
print("Element located at index ", result)
else:
print("Element not found!")
def Pop(Books):
if Books==[]:
print(“Undeflow! Stack is empty”)
else:
elem = Books.pop()
print(“Popped Book : ”, elem)
def DeQueue(Tickets):
if Tickets==[]:
print(“Undeflow! Queue is empty”)
else:
elem = Tickets.pop(0)
print(“Popped Ticket : ”, elem)
SECTION – B
(COMPUTER NETWORKS)
Q3 (a) In Amplitude Modulation, _________ of the carrier wave is changed as per 1
_________ of the modulating signal.
Ans. amplitude, amplitude
(1 Mark for correct answer)
(b) The term ‘Internet of things’ means: 1
(i) The intelligent connection of people, things and data over Internet
(ii) Things (Smart Devices) taking control of the Internet and the World
(iii) Both of these
Ans. (i) The intelligent connection of people, things and data over Internet
(1 Mark for correct answer)
(c) What is the main difference between a hub and a switch? 1
Ans. Hub broadcasts to all devices whereas switch sends to the designated
recipients only. (Switch is intelligent device.)
(1 Mark for correct answer)
(d) A network in which nodes can act as both servers sharing resources and 1
clients using the resources is called _____ to _____ network.
Ans. Peer to Peer
(1 Mark for correct answer)
(e) Expand the following abbreviations related to Computer Networks: 2
(i) URL (ii) LTE (iii) GSM (iii) MAC
Ans. (i) Uniform Recourse Locator
(ii) Long Term Evolution
(iii) Global System for Mobile or Groupe Spécial Mobile
(iv) Media Access Control
( ½ Mark for each correct expansion)
(f) What do you mean by collision in wireless networks? Name a technique 2
which is used to avoid collision in wireless networks.
Ans. Collision: If two or more nodes try to occupy a communication channel at
the same time for transmitting data. In wireless networks we cannot detect a
collision and for error free transmissions we have to avoid collisions.
CSMA (Carrier Sense Multiple Access) is a technique which can be used to
avoid collision in wireless networks.
Block A Block C
Block B Block D
Block E
SECTION – C
(DATA MANAGEMENT)
Q4 (a) Which data type of MySQL doesn’t use same number of bytes as defined in 1
table structure and the consumption of bytes depends upon user data?
Ans. VARCHAR
(1 Mark for correct answer)
(b) Write a query in MySQL to change the data type of the column named 1
‘price’ from int to decimal. The table name is ‘Products’.
Ans. ALTER TABLE Products MODIFY price DECIMAL;
(1 Mark for correct answer)
(c) Give any two examples of MySQL aggregate functions. How many rows are 1
returned as result when an aggregate function is used on a table without a
group by clause?
Ans. Examples of aggregate functions: SUM, AVG, COUNT, MAX, MIN
No. of rows returned: 1 Row
( ½ mark for any 2 correct examples)
( ½ mark for correct answer on number of rows returned)
(d) Which of the following strings will match the pattern “_a%singh%a_’ 1
(i) paras singh raj
(ii) parasingha
(iii) Paaras Singh harraj
(iv) passinggha raj
Ans. (i) and (iii)
(1 Mark for correct answer)
(e) Classify the following as DDL or DML commands: 2
(i) INSERT (ii) DELETE (iii) DROP (iv) UPDATE
OR
What is the difference between HAVING and WHERE clause? If both of
clauses are there in a query, then which one is executed first?
(ii)
City SUM(Salary)
London 30500
Delhi 4500
Paris 17000
Lyon 12000
Seattle 8500
(iii)
MIN(DoJ)
1994-05-06
Ans. (i) SELECT City, AVG(Salary) from EMPLOYEE group by city ORDER
BY city;
(ii) SELECT Gender, SUM(Salary) from EMPLOYEE GROUP BY Gender;
(iii) UPDATE EMPLOYEE SET Salary= Salry+1500 WHERE Gender=’M’
and City IN (“London”, “Paris”);
(iv) SELECT AVG(Salary) FROM EMPLOYEE WHERE DoJ<1995-01-01;
(1 Mark for every correct query)
SECTION – D
(SOCIET, LAW AND ETHICS)
Q5 (a) Which act of Indian constitution relates to cybercrimes? 1
************