KEMBAR78
Sec B | PDF | Parameter (Computer Programming) | Table (Database)
0% found this document useful (0 votes)
76 views47 pages

Sec B

The document consists of a series of programming and database-related questions, including tasks to correct Python code, predict outputs, and explain concepts like primary keys and foreign keys. It also includes questions on computer networking terminology and differences between technologies like HTML and XML. The questions are structured for an examination format, covering various topics in computer science and programming.

Uploaded by

amandeep11092006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views47 pages

Sec B

The document consists of a series of programming and database-related questions, including tasks to correct Python code, predict outputs, and explain concepts like primary keys and foreign keys. It also includes questions on computer networking terminology and differences between technologies like HTML and XML. The questions are structured for an examination format, covering various topics in computer science and programming.

Uploaded by

amandeep11092006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 47

SEC-B

19 Differentiate between Circuit Switching and Packet Switching. 2


OR
Write one similarity and one point of difference between HTML and XML
20 Rewrite the following code in python after removing all syntax error(s) and underline 2
each correction made by you in the code.
D = dict[ ]
c=1
while c < 5:
k = input(“Name: “)
v = int(input(“Age: “)
D(k) = v
print(popitem())
for a,b in D.item:
print(a, b)
21 Write the output of the following code: 2
L1=[100,900,300,400,500]
START=1
SUM=0
for C in range (START, 4):
SUM=SUM+L1[C]
print(C,":",SUM)
SUM=SUM+L1[0]*10
print(SUM)
22 (a) Given is a Python string declaration: 1
st = ‘AMPLIFY&AMPLITUTE’
Write the output of : print(st.count(‘PLI’,2,12))
1
(b) Write the output of the code given below:
D = {‘A’:’AJAY’ , ‘GRADE’:’A’}
print(list(D.values()))
23 Expand the following terms: 2
(i) PPP (ii) SMTP (iii) VoIP (iv) TCP/IP
24 Explain the following: 2
(i) Primary Key (ii) Foreign Key
25 Define constraint in context with Relational Database Management System. Explain any two 2
constraints of MySQL.

SECTION B
19 Expand the following terms related to Computer Networks: 1+1=2
(i) a. SMTP b. POP

(ii) Out of the following, which is the fastest wired and wireless medium
of transmission?
Infrared, coaxial cable, optical fiber, microwave, Ethernet cable
OR

(i) Differentiate between web server and web browser.


(ii) Give one advantages and two disadvantages of star topology.
20 The code given below accepts a number as an argument and returns the reverse number. 2
Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.

Def oddtoeven(L)
For i in range(len(L)):
if(L[i]%2 !=0):
L[i] = L[i]*2
print(L)
21 Write a function count (city) in Python, that takes the dictionary, PLACES as an 2
argument and displays the names (in lowercase) of the places whose names are less than
7 characters.
For example, Consider the following dictionary

City ={1:"Delhi",2:"London",3:"Kolkata",4:"NewYork",5:"Moscow"}
The output should be: “Delhi”, ”London”, ”Moscow”
OR
Write a function, Words_Length(STRING), that takes a string as an argument and
returns a tuple containing length of each word of a string.For example, if the string is
"this too shall pass", the tuple will have (4, 3, 5,4)

[4]
22 Predict the output of the following code: 2

23 Predict the output of the Python code given below: 1+1=2

OR
Predict the output of the Python code given below:

24 Ms. Shweta has just created a table named “Employee” containing columns Empno, 2
Ename,Department and Salary.

After creating the table, she realized that she has forgotten to apply primary key
constraint in Empno column. Help her in writing an SQL command toadd a
primary key constraint to Empno column to the table Employee.
OR
Angel has created table School with column sid,Student_name,DOB,Fee,City. Later
she realized that she has forgotten to apply primary key in sid, also she wants to
change the column name from sid to student_id. Help her to change the column
name to student_id from sid and also apply primary key in it.
[5]
25 Predict the output of the following code: 2

SECTION B
19. Ravi has written a function to print Fibonacci series for first 10 element. His code is
havingerrors.Rewritethecorrectcodeandunderlinethecorrectionsmade.Someinitial elements
(2)
ofFibonacci series are:

deffibonacci()
first=0
second=1
print((“first no. is “, first)
print(“secondno.is,second)
for a in range (1,9):
third=first+second
print(third)
first,second=second,third
fibonacci()

20. What possible outputs (s) are expected to be displayed on screen at the time of (2)
executionoftheprogramfromthefollowingcode?Alsospecifythemaximumvalues that can
be assigned to each of the variables FROM and TO.

import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
forKinrange(FROM,TO+1):
print(AR[K],end=”#“ )

(i)10#40#70# (ii)30#40#50# (iii)50#60#70# (iv)40#50#70#


21. (a) Given is a Python string declaration: (1)
myexam="Russia Ukrain"
Write the output of :
print(myexam[-2:2:-2])
(b) Write the output of the code given below:
D1={"sname":"Aman","age":26} (1)
D1['age']=27
D1['address']="Delhi"
print(D1.items())

22. Explaintheuseof‘ForeignKey’inaRelationalDatabase.Giveanexampletosupportyour answer. (2)

23. (a) Writethe fullforms ofthefollowing: (1)


(i)POP (ii)HTTPS (1)
(b) WritetwopointsofdifferencebetweenCircuit SwitchingandPacketSwitching
24. PredicttheoutputofthePythoncodegivenbelow: value (2)
= 50
defdisplay(N):
globalvalue
value =
25ifN
%7==0:
value=value+N
else:
value=value-N
print(value, end="#")
display(20)print(value)

OR
defDisplay(str):
m=""
foriinrange(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
Display('Fun@World2.0')
25. Considerthefollowingtwocommandswithreferencetoatable,namedStudents, having a (2)
column named Section:
(a) Selectcount(Section)from Students;
(b) Selectcount(*)fromStudents;
Ifthesetwo commandsareproducingdifferentresults,
(i) What may bethe possible reason?
(ii) Whichcommand,(a)or(b),mightbegivinghighervalue?
OR
Nametheaggregatefunctionswhichworkonlywithnumericdata,andthosethatwork with
any type of data.

SECTION B
19. Ravi has written a function to print Fibonacci series for first 10 element. His code is
havingerrors.Rewritethecorrectcodeandunderlinethecorrectionsmade.Someinitial elements
(2)
ofFibonacci series are:

deffibonacci()
first=0
second=1
print((“first no. is “, first)
print(“secondno.is,second)
for a in range (1,9):
third=first+second
print(third)
first,second=second,third
fibonacci()

20. What possible outputs (s) are expected to be displayed on screen at the time of (2)
executionoftheprogramfromthefollowingcode?Alsospecifythemaximumvalues that can
be assigned to each of the variables FROM and TO.

import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
forKinrange(FROM,TO+1):
print(AR[K],end=”#“ )

(i)10#40#70# (ii)30#40#50# (iii)50#60#70# (iv)40#50#70#

21. (c) GivenisaPythonstringdeclaration: (1)


myexam="RussiaUkrain"
Write the output of :
print(myexam[-2:2:-2])

(d) Writetheoutputofthecodegivenbelow: (1)


D1={"sname":"Aman","age":26}
D1['age']=27
D1['address']="Delhi"
print(D1.items())

22. Explaintheuseof‘ForeignKey’inaRelationalDatabase.Giveanexampletosupportyour answer. (2)


23. (c) Writethe fullforms ofthefollowing: (1)
(i)POP (ii)HTTPS (1)
(d) WritetwopointsofdifferencebetweenCircuit SwitchingandPacketSwitching
24. PredicttheoutputofthePythoncodegivenbelow: value (2)
= 50
defdisplay(N):
globalvalue
value =
25ifN
%7==0:
value=value+N
else:
value=value-N
print(value, end="#")
display(20)print(value)

OR
defDisplay(str):
m=""
foriinrange(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
Display('Fun@World2.0')
25. Considerthefollowingtwocommandswithreferencetoatable,namedStudents, having a (2)
column named Section:
(c) Selectcount(Section)from Students;
(d) Selectcount(*)fromStudents;
Ifthesetwo commandsareproducingdifferentresults,
(i) What may bethe possible reason?
(ii) Whichcommand,(a)or(b),mightbegivinghighervalue?
OR
Nametheaggregatefunctionswhichworkonlywithnumericdata,andthosethatwork with
any type of data.

SECTION B
Q19. 1+1
(i) Expand the following terms: =2
SMTP , FTP

(ii) Give one difference between XML and HTML.


OR
(i) Write short note on TELNET

(ii) Name the following


Two commonly used web browsers
Q20. a) Rishaan has written a code to input a number and check whether it is even or odd number. His (2)
code is having errors. Observe the following code carefully and rewrite it after removing all
syntax and logical errors. Underline all the corrections made.
Def
checkNumber(N
): status = N%2
return
#main-code
num=int( input(“ Enter a number to check :))
k=checkNumber(num)
if k = 0:
print(“This is EVEN number”)
else:
print(“This is ODD number”)
Q21. a) Write a function countNow(CITY) in Python, that takes the dictionary, CITY as an argument (2)
and displays the names (in uppercase) of the CITY whose names are longer than 5
characters.
For example, Consider the following dictionary
CITY={1:"Delhi",2:"Guwahati",3:"Ajmer",4:"Jaipur",5:"Udaipu
r”}
The output should be:
GUWAHA
TI JAIPUR
UDAIPUR
OR
a) Write a Python code to accept a word /String a mixed case and pass it to a function the
function should count the number of vowels present in the given string and return the
number of vowels to the main program.
Sample Input : computer science
Sample output : No of vowels = 6
Q22. Predict the output of the Python code given below: (2)
def Swap (a,b ) :
if a>b:
print(“changed ”,end=“”)
return b,a
else:
print(“unchanged ”,end=“”)
return a,b
data=[11,22,16,50,30]
for i in range (4,0,-1):
print(Swap(data[i],data[i-1]))
Q23. Choose the best option for the possible output of the following code (2)
import random
L1=[random.randint(0,10) for x in range(3)]
print(L1)
(a) [0,0,7] (b) [9,1,7] (c) [10,10,10] (d) All are possible

OR
import random num1=int(random.random()
+0.5)
What will be the minimum and maximum possible values of variable num1

Q24. Ms. Tejasvi has just created a table named “Student” containing columns sname, Class and Mark. (2)
After creating the table, she realized that she has forgotten to add a primary key column in the
table. Help her in writing an SQL command to add a primary key column StuId of integer type to
the table Student.
Thereafter, write the command to insert the following record in the table:
StuId- 1299
Sname- Shweta
Class: XII
Mark: 98
Q25. Predict the output of the following code: (2)
value = 50
def display(N):
global value
value = 25
if N%7==0:
value = value +
N else:
value = value -
N print(value,
end="#") display(20)
print(value)
OR
Predict the output of the Python code given below:
a=20
def call():
global a
b=20
a=a+b
return a
print(a)
call()
print(a)
SECTION B
19. i) Expand the following terms: SMTP, URL 2
ii) Difference between HTML and XML
OR
i) What is Band width?
ii) Define baud rate?
20. Rewrite the program after correcting all the errors and underline each correction. 2
n=int(input("Enter number:"))
temp==n rev=0
While(n>0)
dig=n%10
rev=rev*10+di
g n=n//10
if(temp==rev):
print(The number is a palindrome!)
else:
print("The number isn't a palindrome!")

21. Predict output of the following code fragment – 2


L=[12,23,18,9,17]
for i in range(len(L)):
if(L[i]%3==0):
L[i]=0
else:
L[i]=1
print(L)
OR
Write the output of the code given below:
book_dict = {"title": "You can win", “copies”:15}
book_dict['author'] = “Shiv Khera”
book_dict['genre'] = "Motivation"
print(book_dict.items())

22. Mr. Avinash wants to create a table in MySQL for Employee (eid (Primary Key), 2
ename, salary)
OR
Write any two differences between DELETE and DROP commands
23. Write a python statement for each of the following tasks using built-in functions/ 2
methods only:
i)To add list of elements L2=[11,12,14] to existing list L1=[10,15].
ii)To make the elements in sorted manner.
OR
A list named stu_percentage stores the percentage of students of a class. Write
python command to import the required module and display the most common
percentage from the given list.
24. Find output generated by the following code: 2
string="aabbcc"
count=3
while
True:
if string[0]=='a':
string=string[2:]
elif string[-
1]=='b':
string=string[:2]
else:
count+=1
break
print(string)
print(count)
25. Find output generated by the following code: 2
def Compy(N1,N2=10):
return N1 > N2
NUM= [10,23,14,54,32]
for VAR in range (4,0,-1):
A=NUM[VAR]
B=NUM[VAR-1]
if VAR > len(NUM)//2:
print(Compy(A,B),'#', end=' ')
else:
print(Compy(B),'%',end=' ')

SECTIONB
19. (i) Expand the following terms 1+1=2
IMAP DNS
(ii)Write two points of difference between Switch and Router.
OR
(i) Define the term bandwidth with respect to networks
(ii)Write two points of difference between Web Server and Web Browser
20. The code given below accepts a number as an argument and checks whether the given number is perfect 2
number or not. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.

21. Write a function countNow (DAYS) in Python, that takes the dictionary, DAYS as an argument and 2
displays the names (in lowercase) of the days whose names are longer than 7 characters. For example,
Consider the following dictionary
DAYS={1:"MONDAY",2:"TUESDAY",3:"WEDNESDAY",4:"THURSDAY",5:"FRIDAY",6:”
SATURDAY”,7:”SUNDAY”}
The output should be:
wednesday
thursday
saturday
OR
Write a function, lenWords(STRING), that takes a string as an argument and returns a list
containing length of each word of a string.
For example, if the string is "we are writing preboard exams ", the list
will have [2, 3, 7, 8, 5]
22. Predict the output of the following code: 2

23. Write the Python statement for each of the following tasks using BUILT-IN functions / 1+1=2
methods only:
(i) To update dictionary d1 with dictionary d2
(ii)To convert only starting letter in string named, message into uppercase letter.
OR
A list named studentMarks stores marks of students of a class. Write the Python comm and to
import the required module and (using built-in function) to display average value from the
given list.
24. Mr. Raja has just created a table named “Employee” containing columns Ename, Department 2
and Salary. After creating the table, he realized that he has forgotten to add a primary key column in
the table. Help him in writing an SQL command to add aprimary key column EmpId of integer type
to the table Employee. Thereafter, write the command to insert the following record in the table:
EmpId- 999 ,Ename- Shweta ,Department: Production, Salary: 26900
OR
A music store MySports is considering to maintain their inventory using SQL to store the data. The
detail is as follow:
Table: SPORTS
SCODE SPORTNAME NOOFPLAYERS COACHNAME
S001 CRICKET 21 RAHUL DRAVID
S002 FOOTBALL 25 ROSHAN LAL
S003 HOCKEY 40 SRADAR SINGH
S004 CRICKET 19 CHETAN SHARMA
S005 ARCHERY 12 LIMBARAM
S006 SHOTTING 17 DEEPIKA KUMARI

Write an SQL statement to modify the no of players to 60 whose SCode is “S006”

25. Find and write the output of the following Python code: 2
खंड / SECTION-B
19. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.
Num=int(rawinput("Number greater than 10 :")) sum=0
for i in range(10,Num,3)
sum+=1
if i%2=0:
print(i*2)
else: print(i*3)
print(sum)

20. Write one advantage and one disadvantage of packet switching


OR
Which language is the most suitable language to create web pages?
21. (a) Given is a Python string :
X=”Kendriya Vidyalaya sangathan”
Write the output of: print(X[4:9]*2)
(b) Write the output of the python program code given below:
hello = {empname: "Ishan", address: ”New Delhi”, salary: 10000} hello[salary]
= 15000
hello[address] = "Delhi"
print(hello.keys())
22. Explain the use of GROUP BY clause in a Relational Database Management
System. Give example to support your answer.
23. (a) Write the full forms of the following:
(i)POP3 (ii) VoIP
(b) Define RJ-45?
24. Predict the output of the Python code given below:

OR
Predict the output of the Python code given below:
a=tuple()
a=a + tuple(‘Python’)
print(a) print(len(a))
b=(10,20,30)
print(len(b))

25. Differentiate Where and Having clause in SQL with example.


OR
Define aggregate function and give example.

SECTION - B
19 i) Expand the following :
a) SMTP b) VoIP
ii) Give one disadvantage of Star topology
1+1=2
OR
i) What is a web browser ?
ii) Define the term MAC Address
20 Rewrite the following code in Python after removing all syntax error(s) and
underline each correction done in the code .
30 = num
for k in range(0,num)
2
IF k%4==0 :
print(k*4)
Else:
print(k+3)
21 Write a function letter_count(lst) that takes a list of string and returns a
dictionary where the keys are the letters from lst and the values are the number
of times that letter appears in the lst.
For example: if the passed list, lst is :
lst=list(“apple”)
2
Then it should return a dictionary as {‘a’:1,’p’:2,’l’:1,’e’:1}
OR
Write a function max_length( ) ,that takes a list of string as argument and
display the longest string from the list.
22 Predict the output of the following code:

lst=[2,4,6,8,10]
for i in range(1,5):
2
lst[i-1]=lst[i]
for i in range(0,5):
print(lst[i],end=' ')

23 Consider the following list of elements and write Python statement to print the
output of each question.
elements=['apple',200,300,'red','blue','grapes'] 2
i) print(elements[3:5])
ii) print(elements[::-1])
SECTION B

Each Question Carry 2 marks

11. Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the
code.
2
30=Value

for VAL in range(0,Value) If val


%4==0:

print (VAL*4) Elseif val


%5==0: print (VAL+3)
else print(VAL+10)

12. Write two points of difference between Bus Topology and Tree Topology. 2
OR
Write two points of difference between Packet Switching and Circuit Switching techniques?

13. (a) Given is a Python string declaration: 2


s=”Up Above The World So High”

Write the output of:


print(s[::-4])

(b)Write the output of the code given below:


D={‘month’:’DECEMBER’,’exam’:’PREBOARD1’} D[‘month’]=’JANUARY’

D[‘EXAM’]=’PRE2’

print(D.items())

14. Differentiate between CHAR(N) and VARCHAR(N). 2

15. (a) Expand the following abbreviations: 2


i)POP ii)HTTPS
(b) What is a URL?

16. Differentiate between WHERE and HAVING with appropriate examples. 2


OR
Differentiate between COUNT() AND COUNT(*) with appropriate examples.
SECTION -B
19 Finderrorinthefollowingcode(ifany)andcorrectcodebyrewritingcodeand underlinethe correction;‐ 2

x=int(“Entervalueofx:”) for
in range [0,10]:
if x=y
print( x +y)
else:
print(x‐y)

20 (a) 2
Findoutputgeneratedbythefollowingcode:

Str="Computer"
Str= Str[-4:]
print(Str*2)

OR
Considerthefollowinglines ofcodes inPython andwritetheappropriateoutput:

student={'rollno':1001,'name':'Akshay','age':17}
student['name']= “Abhay”
print(student)

21 What do you mean by Foreign key? How it is related with Referential Integrity? 2

22 Findoutputgeneratedbythefollowingcode: 2
string="aabbcc"
count=3
whileTrue:
if string[0]=='a':
string=string[2:]
elifstring[-1]=='b':
string=string[:2]
else:
count+=1
break
print(string)
print(count)

23 Expandthefollowingterms: 2
i. NIC
ii. TCP/IP
iii. POP
iv. SMTP
24 Writeoneadvantageandonedisadvantageofeach –STARTopologyandTreeTopology OR 2

WhatdoyoumeanbyGuided Media?Nameanythreeguided media?

25 DifferentiatebetweenDDLandDML? OR 2

WritethemaindifferencebetweenINSERTandUPDATECommandsinSQL

SECTION - B
19 Find error in the following code(if any) and correct code by rewriting code and underline 2
the correction;‐
s = [11, 13, 15]
for n in len(s):
tot = tot + s(n)
print(tot)
20 Find output generated by the following code: 2

txt = "fun with python"


print(txt.find("th",7,14))
21 Give an example to show how referential integrity is enforced by using foreign key. 2

22 Find output generated by the following code: 2


text = 'ABCD'
number = '1357'
i = 0
s =''
while i < len(text):
s = s + text[i] + number[len(number)-i-1]
i = i + 1
print(s)
23 Expand the following terms: 2
i. PPP
ii. HTTP
iii. POP
iv. FTP

24 Write 2 advantages of Star topology. 2


OR
Name any 4 unguided media.
25 Give difference between DROP and DELETE command in SQL 2
OR
Write the main difference between HAVING and WHERE clause in SQL

SECTION-B

19 (a) Write the full forms of the following:(i) TCP/IP(ii) VoIP 2


(b) What is the use of FTP?
OR
Writeanyonepointofdifferencebetween:

a) CircuitSwitchingandPacketSwitching.
b) Co-axialcableandFiber–opticcable.

20 Preetyhaswrittenacodetoaddtwonumbers.Hercodeishavingerrors. Rewrite 2
the corrected code and underline the corrections made.
defsum(arg1,arg2):
total=arg1+arg2;
print(”Total:”,total)
returntotal;
sum(10,20)
21 PredicttheoutputofthePythoncodegivenbelow: List1 2
= list("Examination")
List2=List1[1:-1]
new_list = []
fori inList2:
j=List2.index(i)
if j%2==0:
List1.remove(i)
print(List1)

22 Writeafunctionchange(L),whereListhelistofelementspassedasargument to the 2
function. The function arranges odd numbers and even numbers separately in
two lists and displays them.
Forexample:
IfL=[10, 20, 30,40, 12,11,13,15]
Thenfunctionwillcreate anddisplaytwo lists:
Listofeven elements:[10,20, 30,40, 12]
Listofoddelements:[11,13,15]
OR
WriteafunctionINDEX_LIST(S),whereSisastring.Thefunctionreturnsa list
named ‘indexList’ that stores the indices of all vowels of S.
Forexample:IfSis"Computer",thenindexListshouldbe[1,4,6]

23 WritethePythonstatementforeachofthefollowingtasksusingBUILTIN 2
functions/methods only :
(i) Toinsert an element150 at theSecond position,inthelist L1.
(ii) Toconvert astringnamed,messageinuppercase.
OR
WritethePythoncommandtoimporttherequiredmoduleand(usingbuilt-in function)
find out the factorial of a given no i.e 5.
24 An organization SoftSolutions is considering to maintain their employees 2
recordsusingSQLtostorethedata.Asadatabase administrator,Murthyhas decided
that :
• Nameofthe table-HRDATA
• TheattributesofHRDATAareasfollows:
ECode– Numeric
EName–characterofsize30 Desig
– Character of size 15 Remn –
numeric
NowhelpMurthytocreatetableandinsertonerecord(80008,Arjun,Admin, 55000)
into the table.
OR
CityHospitalisconsideringtomaintaintheirinventoryusingSQLtostorethe data. As
a database administer, Ritika has decided that :
• Nameofthedatabase -CH
• Nameofthe table-CHStore
• TheattributesofCHStoreareasfollows:
ItemNo- numeric
ItemName–characterofsize20
Scode - numeric
Quantity– numeric
Now Ritika wants to remove the column Quantity from the table CHStore .
And she also wants to display the structure of the table CHStore, i.e, name of
theattributesandtheirrespectivedatatypesthatshehasusedinthetable.Help her to
writethe correct command .

25 PredicttheoutputofthePythoncodegivenbelow: def 2
Diff(N1,N2):
if N1>N2:
returnN1-N2
else:
return N2-N1
NUM=[10,23, 14,54,32]
for CNT in range(4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B), “#”,end=”“)

Section – B
Q19. Manish has designed a Python program to calculate factorial of a number passed as argument, (2)
but he is getting errors while executing the code. Rewrite his code after removing errors and
underline each correction.
def factorial():
fact=1
while N>0:
fact=*N
N=N-1
print(“Factorial’ ,fact)
#main( )
Factorial(5)
Q20. Differentiate between Star Topology and Bus Topology. Write two points of difference. (2)
OR
Write two point of difference between Bridge and Gateway.
Q21. (a) Write the output of when Python string declaration is given as follows: - (1)
Mystr=”I love technology while growing up”
print(Mystr[1:len(Mystr):2])
(1)
(b) Write the output of the code given below:
Student_details = {"name": "aditya", "age":
16} New=Student_details.copy()
New['address'] = "Mumbai"
print(Student_details);
print(New)

Q22. Explain the Relational Database Management System terminologies- Degree and Attribute of a (2)
relation. Give example to support your answer.
Q23. (a) Write the full forms of the following: - (i) FTP (ii) POP (2)
(b) What is MAC address?

Q24. Predict the output of the Python code given (2)


below:
def modify(L):
for C in range(len(L)):
if C%2==1:
L[C]*=2
else:
L[C]//=2

#Main
N=[5,13,47,9]
modify(N)
23

Page 3 of 12 | KVS –Lucknow Region | Session 2023-24


print(N)
OR

24

Page 3 of 12 | KVS –Lucknow Region | Session 2023-24


Predict the output of the Python code given below:
T=(1,2,3,4,5,6,7,8,9)
T1=T[2:8:2]
T2=T[-2:-8:-2]
T3=T1+T2
print(T3[::-1])
Q25. Differentiate between WHERE and HAVING clause used in MySQL with appropriate
example.
OR
Explain the use of GROUP BY clause in MySQL with an appropriate example.

SECTION B ( 14 Marks)
19. (a) 18 Gbps is equal to how many bits per second? 2
(b) Write any two differences between twisted pair cable and coaxial cable.
OR
(a) What do you mean by a modem?
(b) Write the purpose of a router.

20. Sunita has written certain code to work with tuples. He is getting some errors. Find the errors: 2
t1=(10,20,30, 40,50,60,70,80)
t2=(90,100,110, 120)
t3=t1*t2
Print (t5
[0:12:3])
t1[2]=100
21. Write a function dispTop(SCORES) in Python, that takes a dictionary SCORES as an 2
argument and returns the names in uppercase of those players who scored more than 50 as a
list.

For example, Consider the following dictionary which is passed as an argument:


SCORES = { “ayan”:56, "Smile” :43, "Pritam”:18, “rehan”:90, “kush”:0}
Then the function should return an output list as : [AYAN , REHAN]
OR

Write a function ARRNG(string) which accepts a string arguments and returns a


string containing all letters arranged in alphabetical order , removing any duplicate
occurrence of a letter.
for example : if an string agrument “corporate” is passed then function returns an
output string as “aceoprt”

25

Page 3 of 12 | KVS –Lucknow Region | Session 2023-24


22. What will be the output of the following code? 2

Data = ["P", 20, "R", 10, "S", 30]


Times = 0 Alpha = " “
Add = 0
for C in range (1, 6, 2) :
Times = Times + C
Alpha = Alpha + Data [C-1]+"$"
Add = Add + Data [C]
print (Times, Add, Alpha)

23. Write the Python statement for each of the following tasks using BUILT- 2
IN functions/methods only:
(a) To display only the last two keys of the dictionary named D
(b) To display the elements of the list Lst from index -10 to -4 in reverse order.
OR
Write the output of the following code snippet:
tup = ('cold',)
n=4
for i in range(int(n)):
if i % 2 == 0:
tup = (tup,'cold')
else:
if i > 1:
continue
tup = (tup , 'hot')
print(tup)

24. Differentiate between ‘WHERE’ clause and ‘HAVING’ clause in MySQL with appropriate 2
example.
OR

Differentiate between DELETE and DROP keywords used in MySQL,giving suitable


example for each
25. A table, shop has been created in a database with the following fields: 2
Shop No, Shopname , Type , Category , Location
Give the SQL command to display the structure of the table.
Then after write a query to remove the record whose Shop_No is 255 and is of category
"Electronics".
OR
Which declaration of data type doesn't use the same number of bytes for every record and
consumption of bytes depends on the input data? Which declaration of data type will consume
the same number of byte declared and is right padded"?

26

Page 3 of 12 | KVS –Lucknow Region | Session 2023-24


SECTION B
19 (i) Expand the following terms: 1+1=2
XML, SMTP
(ii) Give the difference between XML and
HTML. OR
(i) Define the term baud with respect to networks.
(ii) How is http different from https?
20 The following Python code is supposed to print the largest word in a sentence but 2
there are few errors. Rewrite the code after removing syntax and logical errors and
underline each corrections made.
Str=input("Enter a sentence")
word=split()
print(word)
maxlen=0
largest="" for
i in word:
l=len(i)
if(l>maxlen)
largest=l
print(largest)
21 Write a function countwords( ) that read a file ‘python.txt’ and display the total 2
number of words which begins by uppercase character.

Example:

Suppose the file have following text:

‘Python is a powerful, user friendly and platform independent Language’

Output of function should be : 2

OR

27

Page 3 of 12 | KVS –Lucknow Region | Session 2023-24


Write a python function ALCount(), which should read each character of text file
“STORY.TXT” and then count and display the number of lines which begins from
character ’a’ and ‘l’ individually (including upper cases ‘A’ and ‘L’ too)

Example:

Suppose the file content is as below:

A python is a powerful
Language is user friendly
It is platform independent Language

Output of function should be :


A or a: 1
L or l : 1

22 Give output of the following: 2

def ChangeLst():
L=[]
L1=[]
L2=[]
for i in range(1,10):
L.append(i)
for i in range(10,1,-2):
L1.append(i)
for i in range(len(L1)):
L2.append(L1[i]+L[i])
L2.append(len(L)-len(L1))
print(L2)
ChangeLst()
23 Write the Python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
(i) To insert an element 400 at the fourth position, in the list L1.
(ii) To check whether a string named, message ends with a full stop/ period
or not.
OR
A list named employee salary stores salary of employees. Write the Python
command to import the required module and (using built-in function) to display the
most common salary value from the given list.
24 Ms. Ragini has just created a table named “Customer” containing columns Cname,
Department and Salary.
After creating the table, she realized that she has forgotten to add a primary key
column in the table. Help her in writing an SQL command to add a primary key
column Custid of integer type to the table Customer.
Thereafter, write the command to insert the following record in the table:
Custid- 555
Cname- Nandini
Department: Management
Salary- 45600
OR

28

Page 3 of 12 | KVS –Lucknow Region | Session 2023-24


Manish is working in a database named CCA, in which he has created a table named
“DANCE” containing columns danceID, Dancename, no_of_participants, and
category.
After creating the table, he realized that the attribute, category has to be deleted from
the table and a new attribute Type CCA of data type string has to be added. This
attribute TypeCCA cannot be left blank. Help Manish to write commands to complte
both the tasks.
25 Predict the output of the following code
def Alter(M,N=50):
M=M+N
N=M-N
print(M,"@",N)
return(M)
A=200
B=100
A=Alter(A,B)
print(A,"#",B)
B=Alter(B)
print(A,"@",B)
SECTION – B
19 Differentiate between Circuit Switching and Packet Switching. 2
OR
Write one similarity and one point of difference between HTML and XML
20 Rewrite the following code in python after removing all syntax error(s) and underline 2
each correction made by you in the code.
D = dict[]
c=1
while c < 5:
k = input(“Name: “)
v = int(input(“Age: “)
D(k) = v
print(popitem())
for a,b in
D.item:
print(a, b)
21 Write the output of the following code: 2
L1=[100,900,300,400,500]
START=1
SUM=0
for C in range (START, 4):
SUM=SUM+L1[C]
print(C,":",SUM)
SUM=SUM+L1[0]*10
print(SUM)

29|Page
22 (a) Given is a Python string declaration: 1
st = ‘AMPLIFY&AMPLITUTE’
Write the output of : print(st.count(‘PLI’,2,12))
1
(b) Write the output of the code given below:
D = {‘A’:’AJAY’ , ‘GRADE’:’A’}
print(list(D.values()))
23 Expand the following terms: 2
(i) PPP (ii) SMTP (iii) VoIP (iv) TCP/IP
24 Explain the following: 2
(i) Primary Key (ii) Foreign Key
25 Define constraint in context with Relational Database Management System. Explain any two 2
constraints of MySQL.

SECTIONB
19 Sameerhaswrittenapythonfunctiontocomputethe reverseofanumber. 2
. Hehashowevercommittedafewerrorsinhiscode.Rewritethecodeafter removing
errors also underline the corrections made.
definereverse(num):
rev = 0
While num > 0:
rem==num %10
rev=rev*10+rem
num = num//10
returnrev
print(reverse(1234))

20 MentiontwodifferencesbetweenaHubandaswitchinnetworking. 2
.
OR
MentiononeadvantageandonedisadvantageofStarTopology.

21 a) Whatwillbetheoutputofthefollowingstringoperation. 1
. str="PYTHON@LANGUAGE"
print(str[2:12:2])

b) Writetheoutputofthefollowingcode. 1
data = [1,2,4,5]
forxindata: x
= x + 10
print(data)

22 MentiontwodifferencesbetweenaPRIMARYKEYandaUNIQUEKEY. 2
.
30|Page
23 a) Expandthefollowingabbreviations: 1
. i) URL ii)TCP

b) Whatistheuseof VoIP? 1

24 Predicttheoutputofthefollowingpythoncode: def 2
. foo(s1,s2):
l1=[]
l2=[]
for x in s1:
l1.append(x)
for x in s2:
l2.append(x)
return l1,l2
a,b=foo("FUN",'DAY')
print(a,b)

OR
Predicttheoutputofthefollowingpythoncode: data =
[2,4,2,1,2,1,3,3,4,4]
d ={}
forxindata: if
x in d:
d[x]=d[x]+1
else:
d[x]=1
print(d)

31|Page
25 AMySQLtable,saleshave10rows.Thefollowingquerieswereexecutedon the sales 2
. table.
SELECTCOUNT(*)FROMsales;
COUNT(*)
10

SELECTCOUNT(discount)FROMsales
; COUNT(discount)
6
Writeastatementtoexplainastowhythereisadifferenceinboththe counts.
OR
WhatisthedifferencebetweenaCandidateKeyandanAlternateKey

SECTION B
19. Preety has written a code to add two numbers .Her code is having errors. Rewrite the correct code and 2
underline the corrections made.
def sum(arg1,arg2):
total=arg1+arg2;
print(”Total:”,total)
return total;
sum(10,20)
print(”Total:”,total)
20. Write two points of difference between Hub and Switch. 2
OR
Write two points of difference between Web PageL and Web site.
21. Write the output of following code and explain the difference between a*3 and (a,a,a) a=(1,2,3) 2
print(a*3)
print(a,a,a)

22 Differentiate between DDL and DML with one Example each. 2


23 (a) Write the full forms of the following: 2
(i) SMTP (ii) PPP
(b) What is the use of TELNET?
24 What do you understand the default argument in function? Which function parameter must be given default 2
argument if it is used? Give example of function header to illustrate default argument
OR
Ravi a python programmer is working on a project, for some requirement, he has to define a function with
name CalculateInterest(), he defined it as:
def CalculateInterest (Principal, Rate=.06,Time): # code
But this code is not working, Can you help Ravi to identify the error in the above function and what is the
solution.

32|Page
25 Write the output of the queries (a) to (d) based on the table 2

(a) SELECT min(Population) FROM country;


(b) SELECT max(SurfaceArea) FROM country Where Lifeexpectancy <50;
(c) SELECT avg(LifeExpectancy) FROM country Where CName Like "%G%";
(d) SELECT Count(Distinct Continent) FROM country;
OR
(a) Identify the candidate key(s) from the table Country.
(b) Consider the table CAPITAL given below:

Which field will be considered as the foreign key if the tables


COUNTRY and CAPITAL are related in a database?

SECTIONB

1 Ravihaswritten afunctiontoprint Fibonacciseriesforfirst10 elements. His codeis having 2


errors.Rewritethecorrectcodeandunderlinethecorrectionsmade.someinitialelementsof
Fibonacci series are:

deffibonacci()
first=0
second=1
print((“first no. is “, first)
print(“secondno.is,second)
for a in range (1,9):
third=first+second
print(third)
first,second=second,third
fibonacci()
2 GivedifferencebetweenVideoConferencingand Chatting 2
OR
WritetwopointsofdifferencebetweenMessageSwitchingandPacket Switching

3 (a)Givenis aPython string declaration: 1


str="malayalam"
Writetheoutputofprint(str[ ::-1])

33|Page
(b) Write the output of the code given below:
Employee1={'name':'John','salary':10000,'age':24}
Employee2={'name':'Divya','salary':54000,'dept':'Sales'} 1

Employee1.update(Employee2)
print(Employee1)

4 Explain the use of „Primary key‟ in a Relational Database Management System. Give example to 2
support your answer.
5 (a)Writethefull forms ofthefollowing: 2
(i)GSM (ii)XML

(b)What is the useofModem?

34|Page
24 (a)Predicttheoutput ofthePythoncode givenbelow: 2

def
D
i
s
p
l
a
y
(
s
t
r
)
:

m
=
"
"
foriin
r
a
n
g
e(
0,
le
n(
st
r)
):
if(
st
r[
i].
is
u
p
p
er
()
):
m
=m+
str[i]
.lowe
r()
elif
str[i]
.islo

35|Page
wer(
):
m=m+str[i].upper()
else:
if i%2==0:
m
=
m
+
s
t
r
[
i
-
1
]

e
l
s
e
:
m=m+"#"
print(
m)
Display('F
un@Worl
d2.0')

OR
(b)Predicttheoutput ofthePythoncode givenbelow:

Whatis theoutputof thefollowingPythoncode


x=”h
ello
worl
d”
print
(x[:2
],x[:-
2],x[
-2:])
print
(x[6]

36|Page
,x[2:
4])

print(x[2:-3],x[-4:-2])
25 DifferentiatebetweenWHEREandHAVINGclauseinMySql. 2
OR
WhatdoyouunderstandbythetermsDegree,cardinalityofaRelation?Explainwithan example.

SECTIONB
19 Aarti has written a code to input an integer and check whether it is 2
evenorodd.Thecodehaserrors.Rewritethecodeafterremovingall the syntactical
errors, underlining each correction:
checkvaldef():
x=input("Enteranumber") if x
% 2 == 0
print(x,"iseven") else;

37|Page
print(x,"isodd")
20 Whatisthedifferencebetweenhubandswitch?Whichismore preferable in a large 2
network of computers and why?
OR
DifferentiatebetweenWANandMAN.AlsogiveanexampleofWAN.
21 (a)GivenisaPythonstringdeclaration: 2
str="Kendriya Vidyalaya Sangathan" Write
the output of: print(str[9:17])
(b)Writetheoutputofthecodegivenbelow: lst1 = [10,
15, 20, 25, 30]
lst1.insert(3, 4)
lst1.insert(2,3) print
(lst1[-5])
22 WhatareconstraintsinSQL?Givetwo examples. 2
23 (a)Writethefullformsofthe following: 2
(i)TCP(ii)VPN
(b)WhatistheuseofFTP?
24 PredicttheoutputofthePythoncodegivenbelow: value = 50 2
def display(N):
globalvalue
value = 25if
N%7==0:
value=value+N else:
value=value-N print(value,
end="#") display(20)
print(value)
OR
PredicttheoutputofthePythoncodegivenbelow: a=20
def call():
globala
b=20
a=a+b
returna
print(a)
call()
print(a)

25 WhatareaggregatefunctionsinMySql?Givetheirnamesalongwith their use. 2


OR
ListvariousDDLandDMLcommandsavailableinMySql

SECTION-B

38|Page
19 Observe the following Python code very carefully and rewrite it after removing 2
all syntactical errors with each correction underlined.
DEF execmain():
x = input("Enter a number:")
if (abs(x)== x)
print("You entered a positive number")
else:
x=*1
print("Number made positive:" x )
20 Write two differences between Coaxial and Fiber transmission media. 2
OR
Write components of data communication.

21 (a) Given is a Python string declaration: 1+1 =2


message="Bring it on!!!"
Write the output of: print(message[::-2])
(b) Write the output of the code given below:
book_dict = {"title": "You can win", “copies”:15}
book_dict['author'] = “Shiv Khera” book_dict['genre']
= "Motivation" print(book_dict.items())

22 How many candidate key and primary key a table can have? Can we declare 2
combination of fields as a primary key?
23 (a) Write the full forms of the following: 1+1=2
(i) FTP (ii) MAC
(b) What is the use of TELNET?

39|Page
24 Predict the output of the Python code given below: 2
def Swap (a,b ) :
if a>b:
print(“changed ”,end=“”)
return b,a
else:
print(“unchanged ”,end=“”)
return a,b
data=[11,22,16,50,30]
for i in range (4,0,-1):
print(Swap(data[i],data[i-1]))
OR
Predict the output of the Python code given below: P
= (10, 20, 30, 40, 50 ,60,70,80,90)
Q =list(P)
R = []
for i in Q:
if i%3==0:
R.append(i)
R = tuple(R)
print(R)
25 Differentiate between DDL and DML commands with suitable example. 2
OR
What is the difference between WHERE and HAVING clause of SQL
statement?

SECTION B

Each Question Carry 2 marks

1. Rewrite the following code in python after removing all syntax error(s). Underline each correction done
in the code.
2
30=Value

for VAL in range(0,Value)


If val%4==0:

print (VAL*4)
Elseif val%5==0:
print (VAL+3)
else
print(VAL+10)

2. Write two points of difference between Bus Topology and Tree Topology. 2
OR
Write two points of difference between Packet Switching and Circuit Switching techniques?

3. (a) Given is a Python string declaration: 2


s=”Up Above The World So High”

Write the output of:


40|Page
print(s[::-4])

(b)Write the output of the code given below:


D={‘month’:’DECEMBER’,’exam’:’PREBOARD1’}
D[‘month’]=’JANUARY’

D[‘EXAM’]=’PRE2’

print(D.items())

4. Differentiate between CHAR(N) and VARCHAR(N). 2

5. (a) Expand the following abbreviations: 2


i)POP ii)HTTPS
(b) What is a URL?

6. Predict the output of the Python code given below: 2


L=[4,6,7,1,6,9,4]

def fun(L):
for i in range(len(L)): if(L[i]
%3==0 and L[i]%2==0):

L[i]=L[i]+1
print(L)

return(L)

print(L)
k=fun()
print(k)

OR
Predict the output of the Python code given below:
T = (9,18,27,36,45,54)

L=list(T)
L1 = []

for i in L:

if i%6==0:

L1.append(i)
T1 = tuple(L1)

print(T1)

41|Page
7. Differentiate between WHERE and HAVING with appropriate examples. 2
OR
Differentiate between COUNT() AND COUNT(*) with appropriate examples.

Section – B
Q19. Vivek has written a code to input a number and check whether it is even or odd number. His code (2)
is having errors. Rewrite the correct code and underline the corrections made.
Def checkNumber(N):
status = N%2
return
#main-code
num=int( input(“ Enter a number to check :))
k=checkNumber(num)
if k = 0:
print(“This is EVEN number”)
else:
print(“This is ODD number”)

Q20. Write two points of difference between Bus topology and star topology. (2)
OR
Write two points of difference between XML and HTML.

Q21. (A) Given is a Python string declaration: (2)


message='FirstPreBoardExam@2022-23'
Write the output of: print(message[ : : -3].upper())

(B) Write the output of the code given below:


d1={'rno':25, 'name':'dipanshu'}
d2={'name':'himanshu', 'age':30,'dept':'mechanical'}
d2.update(d1)
print(d2.keys())

Q22. Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give example to (2)

42|Page
support your answer.

Q23. (A) Write the full forms of the following: (2)


(i) HTTP (ii) FTP
(B) What is the use of TELNET?

Q24. Predict the output of the Python code given below: (2)
data=["L",20,"M",40,"N",60]
times=0
alpha=""
add=0

for c in range(1,6,2):
times = times + c
alpha = alpha + data [c-1] + "@"
add = add + data[c]
print (times, add, alpha)

OR

Predict the output of the Python code given below:


L=[1,2,3,4,5]
Lst=[]
for i in range(len(L)):
if i%2==1:
t=(L[i],L[i]**2)
Lst.append(t)
print(Lst)

Q25. Differentiate between order by and group by clause in SQL with appropriate example. (2)

OR

43|Page
Categorize the following commands as DDL or DML:
INSERT, UPDATE, ALTER, DROP

SECTION B
19. Mohit has written a code to input a positive integer and display its factorial. His code is (2)
having errors. Rewrite the correct code and underline the corrections made. (factorial of
a number n is the product 1x2x3. . .n)
n=int(input("Enter a positive integer: ")
f=0
for i in
range(n):
f*=i
print(f)
20. Write two points of difference between LAN and MAN. (2)

OR

Write two points of difference between HTML and XML.

44|Page
21. (a) Write a Python statement to display alternate characters of a string, named (1)
my_exam. For example, if my_exam="Russia Ukraine"
The statement should display Rsi kan

(b) Write the output of the code given (1)


below: d1 = {"name": "Aman", "age":
26}
d2 =
d1.pop('name')
print(d1, d2)
22. Can a table in an RDBMS have multiple candidate keys? Can it have multiplePrimary (2)
keys? Give an example to support your answer.

23. (a) Write the full forms of the following: (i) VoIP (ii) IMAP (1)
(b) Name the communication medium which is used for WiFi. (1)

24. Predict the output of the Python code given below: (2)
def Alpha(N1):
while
N1:
a=N1.pop()
if a%5>2: print(a,end='@')else: break
NUM=[13,24,12,53,34]
Alpha(NUM); print(NUM)
OR
Predict the output of the Python code given below:
T1 = tuple("Amsterdam")
T2, new_list = T1[1:-1], []for i in
T2: if i in 'aeiou':
j=T1.index(i)
new_list+=[j]
print(new_list)
25. If a column score in a table match has five entries, viz. 30,65,NULL,40,NULL,then (2)
what will be the output of the following query?
Select count(*), avg(score) from match;
OR
Write two differences between HAVING and WHERE clauses in SQL.

45|Page
46|Page
47|Page

You might also like