0% found this document useful (0 votes)
28 views10 pages

SQP 08 - QP

This document is a preboard examination paper for Class XII Computer Science (083) for the session 2022-23, consisting of five sections with varying types of questions. The paper includes multiple-choice questions, short answer questions, long answer questions, and programming tasks primarily focused on Python and SQL. It covers topics such as data types, control structures, database commands, and functions, along with practical coding exercises.

Uploaded by

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

SQP 08 - QP

This document is a preboard examination paper for Class XII Computer Science (083) for the session 2022-23, consisting of five sections with varying types of questions. The paper includes multiple-choice questions, short answer questions, long answer questions, and programming tasks primarily focused on Python and SQL. It covers topics such as data types, control structures, database commands, and functions, along with practical coding exercises.

Uploaded by

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

Class:XIISession:2022-23

ComputerScience(083)
PREBOARD-1(Theory)

MaximumMarks:70 TimeAllowed:3hours
GeneralInstructions:
1. This question paper contains fivesections,Section AtoE.
2. Allquestions arecompulsory.
3. Section Ahas 18 questions carrying 01 mark each.
4. Section B has 07 VeryShort Answertype questions carrying 02 marks each.
5. Section Chas 05 Short Answer typequestions carrying 03 marks each.
6. Section Dhas 03 Long Answertype questionscarrying 05 marks each.
7. Section Ehas 02 questions carrying 04 markseach. Internal choice is given in Q34 for
part c only.
8. Allprogramming questions aretobe answered using Python Language only.
SECTIONA

1. Assign a tuplecontaining anInteger? 1

2. Which of the following is valid identifier? 1

a) Serial_no. b) total-Marks c) _Percentaged) Hundred$

3. Add a pair of parentheses toeach expressionso that itevaluates toTrue. 1

a) 2 + 3 == 4 +5 ==7 b) 0 ==1 == 2

4. What willbetheoutputof following expressions: 1

a) 2**3**2 b) (2**3)**2

5. Consider thefollowing programand predict the output: 1

num1 = input("Entera numberand I'll triple it: ") #num1=8

num1 = num1 *3

print(num1)

6. Which of the following is used toread n characters from afile object“ f1” . 1

a)f1.read(n) b)f1(2) c)f1(read,2) d) allof the above

7. Name DDL command from following. 1

a) drop b)select c) insert d)update

8. What is thedefaultdateformatof Mysql. 1

a)’ dd-mm-yy’ b)’ d-m-y ‘ c) ‘ yyyy-mm-dd’ d) None

9. Which of the following statement(s) would givean error afterexecuting thefollowing 1


code?
S="Lucknowis theCapital of UP"#Statement 1

print(S) #Statement2

S[4]= '$’ #Statement 3

S="Thank you" #Statement 4

S=S +"Thank you" #Statement 5

(a) Statement3 (b) Statement 4 (c) Statement 5 (d) Statement 4 and 5

10. _________ isan attribute,whosevalues areUnique and not null. 1

(a) Primary Key (b) Foreign Key (c) CandidateKey (d) AlternateKey

11. Which of the following statements correctly explain the function of seek() method? 1

a. tells the currentposition withinthefile.

b. determines if you canmovethefileposition or not.

c. indicates thatthenext read or writeoccurs from thatposition in a file.

d. movesthecurrentfileposition to agiven specified position.

12. What is break statement in the context of flowof control in the python programming. 1

13. SMTP stands for___________________________. 1

14. What willbetheoutputof this code 1

>>>L1=[8,11,20]

>>>L1*3

15. Write command toviewtable structure. 1

16. Name any twoRDBMSsoftware. 1

Q17 and 18 areASSERTIONAND REASONING based questions. Mark thecorrect


choiceas

(a) Both Aand R are trueand Ris the correctexplanation forA

(b) BothA and Raretrue and Ris not thecorrect explanation for A

(c) AisTruebutR is False

(d) AisFalsebutR is True

17. Assertion(A): Function is defined as a set of statements writtenunder a specific name 1


in the python code

Reason(R): The complete block (set of statements) is used at different instances in


theprogram as and when required, referring the function name. It is a common code to
executefor different values(arguments),provided to a function.

18. Assertion(A): DBMS is an application packagewhich arranges the data in orderly 1


mannerin a tabularform.

Reason(R): Itis an interfacebetweendatabaseand theuser. It allows theusers to


access and perform various operations on stored data using sometools.

SECTIONB

19. Rewritethefollowing codein python after removing all syntaxerror(s). Underlineeach 2


correction donein the code.

30=n

fori in range(0,n)

IF i%4==0:

print (i*4)

Else:

print (i+4)

20. Write twopointsof differencebetween hub and switch. 2

OR

Differentiate Bus and Startopology

21. (a) Given is aPython string declaration: 2

Str1="##NEET Examination 2023##"

Write the output of: print(Str1[::-1])

(b) Writetheoutputof the codegivenbelow:

D1 ={"sname":"Aman", "age": 26}

D1['age'] =27

D1['address'] = "Delhi"

print(D1.items())

22. DefineTupleand Attributewith appropriateexample. 2

23. Name twotop level domain names with theirarea of application. 2

24. What possible outputs(s) are expected to be displayed on screen at the time of 2
execution of the program from thefollowing code? Also specify the maximum values
thatcanbeassigned toeach of thevariables FROM and TO.
importrandom

AR=[20,30,40,50,60,70]

FROM=random.randint(1,3)

TO=random.randint(2,4)

for K in range(FROM,TO+1):

print(AR[K],end=” #“ )

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

OR

What will be the output of thefollowing code?

def my_func(var1=100,var2=200):

var1+=10

var2 = var2 -10

return var1+var2

print(my_func(50),my_func())

25. Differentiatebetween char(n) and varchar(n) datatypes with respect todatabases. 2

OR

Consider thetable,student given below:

(a) Identify the degreeand cardinality of the table.

(b) Which field should bemade the primary key? Justify your answer.

SECTIONC

26. Meera has tocreatea databasenamed MYEARTHin MYSQL. Shenow needs tocreate 3
a tablenamed CITY in the database to store the records of variouscitiesacross the
globe. The tableCITY has the following structure:

Table: CITY

FIELDNAME DATATYPE REMARKS


CITYCODE CHAR(5) PrimaryKey

CITYNAME CHAR(30)

SIZE INTEGER(3)

AVGTEMP INTEGER

POLLUTIONRATE INTEGER

POPULATION INTEGER

Help hertocomplete the task bysuggesting appropriateSQLcommands.

27. Supposecontent of 'Myfile.txt' is 3

Humpty Dumpty sat on a wall

Humpty Dumpty had agreat fall

All the king's horses and all the king'smen

Couldn'tputHumpty togetheragain

Write apython function named RECORD to calculatetotalnumberof characters in


‘ Myfile.txt’

OR

Writea python function named CLRECORDtocalculate total numberof linesin


‘ Myfile.txt’

28. Write SQLCommand for the following. 3

a) Command used toviewthelistof tables in a database?

b) Command used toadd column in a database?

c) Command used to delete column from adatabase?

29. Write afunction in Python Convert() toreplaces elements having even values with its 3
half and elements having odd valueswith twice its valuein a list.

eg:if thelistcontains3,4,5,16,9 then

rearranged list as 6,2,10,8, 18

30. Write afunction in Python PUSH_IN(L), whereLis a list of numbers. Fromthislist,push 3


allnumbers which aremultipleof 3 intoa stack which is implemented by using another
list.

OR

Write afunction in Python POP(Arr),where Arris a stack implemented by a list of


numbers. Thefunction returns thevalue deleted fromthestack.

SECTIOND

31. Acompany ABCEnterprises has four blocks of buildings as shown: 5

B1 B2

B3 B4

Centretocenterdistancebetweenvariousblocks: Numberofcomputersineachblock: Co
B3 TO B1 50 M B1 150 mp
uter
B1 TO B2 60 M B2 15 sin

B2 TO B4 25 M B3 15 eac
h
B4 TO B3 170 M B4 25 blo
ck
B3 TO B2 125 M
are
B1 TO B4 90 M net
wor
ked but blocks are not networked. Thecompany has now decided toconnectthe
blocks also.

(i) Suggest the mostappropriatetopology for theconnectionsbetween the


blocks.

(ii) Thecompany wants internet accessibility in alltheblocks. The suitable

and cost-effectivetechnology for that would be?

(iii) Which devices will yousuggestforconnecting allthecomputers with in eachof


theirblocks.

(iv) Thecompany is planning to link itshead office situated in New Delhi with the
offices in hilly areas. Suggest a way to connect iteconomically.

(v) Suggest the mostappropriatelocation of theserver,toget the best


connectivity formaximumnumberof computers.
32. a) What willbetheoutputof following code: 2+3

def ChangeVal(M,N):

for i in range(N):

if M[i]%5 == 0:

M[i]//=5

if M[i]%3 == 0:

M[i]//=3

L= [25,8,75,12]

ChangeVal(L,4)

for i in L:

print(i,end="#")

b) Differentiatebetween Selection and Projection operations incontext of a Relational


Database. Also, illustratethedifferencewith onesupporting example of each.

OR

a)Find and write the output of thefollowing Python code:

def Call(P=40,Q=20):

P=P+Q

Q=P– Q

print(P,'@',Q)

return P

R=200

S=100

R=Call(R,S)

print(R,'@',S)

S=Call(S)

print(R,'@',S)

b) Differentiatedomain and attribute?Explain with appropriateexample?

33. What is thefull formof csv? Which applications are used toread/edit thesefiles? 5
Writea Program inPython thatdefines and calls the following user defined functions:

(i) ADDR() – To acceptand add data of a studenttoa CSV file‘ record.csv’ . Each
record consists of a list with field elementsas rollno, nameand mobiletostoreroll
number name and mobileno of studentrespectively.

(ii)COUNTR() – Tocount the number of records present intheCSVfile named


‘ record.csv’ .

OR

Give any onepoint of differencebetween a textfileand a csvfile.

Writea Program inPython thatdefines and calls the following user defined functions:

(i) add() – Toacceptand add data of an employee’ s furnituredetailtoa CSVfile


‘ abc.csv’ . Each record consists of alist with field elementsas fid,fnameand fprice
tostorefurnitureid, furniturename and furniturepricerespectively.

(ii) search()-Todisplay therecords of the furniturewhosepriceis morethan5000.

SectionE

34. Write SQLcommands for the following questions (i) to (iv) based on the relations 1+1
Teacher and Posting given below(assumenoconstraint isadded tothetable): +2

Table: Teacher

T_ID Name Age Department Date_of_join Salary Gender

1 Jugal 34 Computer Sc 10/01/2017 12000 M

2 Sharmila 31 History 24/03/2008 20000 F

3 Sandeep 32 Mathematics 12/12/2016 30000 M

4 Sangeeta 35 History 01/07/2015 40000 F

5 Rakesh 42 Mathematics 05/09/2007 25000 M

6 Shyam 50 History 27/06/2008 30000 M

7 ShivOm 44 Computer Sc 25/02/2017 21000 M

8 Shalakha 33 Mathematics 31/07/2018 20000 F

Table: Posting

P_ID Department Place

1 History Agra
2 Mathematics Raipur

3 ComputerScience Delhi

a)Toadd primary keyin Teacher(T_ID)

b)To add new attribute named P_IDtoTeacher table.

c)To add foreign key to newly created column P_ID in TeacherTable assuming that

whosevalues arereferred from P_ID column of posting table.

OR(option for partc) only)

c)To changedata typeof placecolumn of posting tablefromchar tovarchar.

35. Sumit is a Python programmer. He has written a code and created a binary file 1+1
record.dat with employeeid, ename and salary. The file contains 10 records. He now +2
has to update a record based on the employee id entered by the user and update the
salary. The updated record is then to be written in the file temp.dat. The records which
are not to be updated also have to be written to the file temp.dat. If the employee id is
not found, an appropriate message should to be displayed. As a Python expert, help
himtocompletethefollowing code based on therequirementgiven above:

import_______#Statement 1

def update_data():

rec={}

fin=open("record.dat","rb")

fout=open("_____________") #Statement2

found=False

eid=int(input("Enter employee id to updatetheir 14 salary ::"))

while True:

try:

rec=______________#Statement 3

if rec["Employee id"]==eid:

found=True

rec["Salary"]=int(input("Enternewsalary :: "))

pickle.____________ #Statement 4
else:

pickle.dump(rec,fout)

except:

break

if found==True:

print("Thesalary of employee id ",eid,"has beenupdated.")

else:

print("Noemployeewith such id is not found")

fin.close()

fout.close()

(i) Which module should beimported in theprogram? (Statement 1)

(ii) Write the correctstatement required to open a temporary file named temp.dat.
(Statement2)

(iii) Which statement should Aman fill in Statement 3 toread the data from the
binary file,record.datand in Statement 4 towritetheupdated datain thefile,
temp.dat?

You might also like