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

CS Paper Half Yearly

Uploaded by

atharvtiwari6780
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)
13 views10 pages

CS Paper Half Yearly

Uploaded by

atharvtiwari6780
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

WpekanandSchod

#logk, Anand Vihar, Delhi


HALF YEARLY EXAMINATION
SEBSION : 2024-25

OMPUn sctENCE (083)


Time CLASS XII

GeneralAIlotted:
Instruetlons:
3
Moura
SBNCE sREAM Max. Marks : 70

Attempt
Al1 all the
only. programming questions are answered using Python Language
There are 32
questionn to be

The paper ia queations in all


divided into 4
aaross 11 pages.
Section A oonsists nactions
carries 1 Marks of 20 questions (1 to 20). Each question
Section B consista
carries 2 Marks of 10 questions (21 to 30). Each question
Section consists of 5
carries 3 Marks questions (31 to 35) . Each question
Section D Consists of 3
carries 5 Marks questions (36 to 38). Each question
Marks have been mentioned against each question.

Section -A (1 Mark)
1. Which of the following is a valid
for keywOrd in Python?
b, For
C. IN
Elif

2. Consider thestatements given below and then


output from the given options: choose the correct
string"#OBSeExam-04"
print (string [-2:2:-3] )
2a
b. 2a@

1/10
C. 28a
a28 following?
ofthe
3. What is the output
X |'ab', 'cd')
for i in x:
i.upper ()
print (x)
['ab' 'cd')
('AB', 'CD' ]
C. (None, None)
mentioned
d. None of the

4. Which of the following


the foll
owing
statement(s)would give
code. error duri
eXecution of
79)
tup = (20,30,40,50,80,
print (tup) #Statement I
#Statement2
9rint (tup (3] +50)
3
Print (max (tup)) #Statement
#Statement 4
tup (4] =80
a. Statenent 1
Statement 2
C. Statement 3
d. Statemnent 4

5 Which module is imported for MOLhi3 WIth Dinary files in Python?


PICKLE
b. load
C. dump
d. pickle

6. Which of the following is not a Compon.ent of the random


module in
Python?
a. randrange )
b. random ()
randint ()
None of the above

7 Multiple values can be returned from a user defined function:


¥. Yes
b No
Sometimes
d. None of the above

8. Fill in the blank:


is a standard network protocol used for the transfer of

2/10
b,
#les Irom one host to
TP ne over aTCP-based network.
C.
PPP
d. Telnet
SMTP

Q9. to
Q14. Are REASONINGbased questions.
Mark thet
a.
c À
Both AcOrrect
b. Both Aand R
is and R are
True but are
ASchoiSERtruecTeION as:
and R
and
the
correct
explanation for for

correct
explanation

d. A is R istrue and R 19Js not the


false but Ris False
True statement match
call
Assertion
the number(A) : If in the
function
defined in
the
function

and the gunents


called positional
as arguments.
definition, such arguments are order 0f arquments
the argument list first
Reasoning (R) - During
Contains
function call, itional
posi
argument (s).
default argumernt (s) followed by the
creates a
file
Assertion (A) : Python OVerwrites an existingmode.
non-existing file when We Open a file with 'w'
operations
Reason (R) : at mode is for writing
used only
calls,.
to function
1 Assertion (A): Keyword arguments
in a
are related
function call, the
Reasoning (R) : When you use Keyword arguments
parameter name.
caller identifies the arguments by the
of interconnected
collection
Assertion (A) : The internet
medium such
is a
as fiber optic
Computer linked by transmission
networks,
wireless connections, etC.
Cables, transmission wires, or web pages
a collection of websites
Reason (R) : World Wide Web is to local computers
through the
stored in web servers and connected
internet.
statement, you
If a fi le is opened using the "with"
Assertion (A) : handling.
and eXceptiors need
get better syntax opened using the "with" statement, it
is
Reason(R): When a file close() function.
using the
not be closed the
aggregate function Avg() calculates
In SQL, the result.
Assertion (A): set of
values and produces a single
value on a functions are used to perform Some
average The aggregate
Min (), Max (), Sum (), etc.
Reason (R) : arithmetic tasks such as
fundamental

3/10
screen at the
displayed on
15. What possible output (s) are expected to be code?
time of execution of the program from the following
import random
A= (25,35,45,55,65,75,85)
X -random. randint (1,3)
Y=random. randint (2, 4)
for i in range (X, Y+1) :
print (A[i],end="@")

35@45@85@
35@45@55@
C. 65@75@25@
d. None of the above

to store
16. Aishwarya is running her own boutigue business. She wants
data through
data of all orders permanently and tast processing of appropriate
her boutique Software. Suggest her to choose the
technique among the following:
She can use Python Dictionaries with Text files.
She can use Python Dictionaries With Binary file concepts.
She can use Python Lists without the Binary files concept
d. She can use Python Dictionaries without the Binary file concept.

17 Which of the following function headers is correct?


a. def fun (a = 5, b =4, c)
b. def fun (a = 5, b, c =4)
def fun (a, b = 5, c = 4)
d. def fun (a, b, c = 4, d

18. What will be the output of the given below Code


assuming there is no
content already in the file data.txt:
x=open ("data.txt", "w+")
x.write ("cqmputerscience")
X.seek (2)
y=x.read ()
print (y[l:3])
x.close ()

b. pu
C. ut

d. None of these
Write
given beltheow maxiin utm} and the variable REM which is
he Ënimum value of

import=
REM random fol owi ng Code:

rdeletedtuples,andom.rcreated
Anshi6ka has
and
been
andrange
by later
a
she
(2,
Rel
30,6)
may

ation named T which


added 3 more tuples
6

consists
and 2
8 attributes
attributes have
her then what will be its degree and cardinali ty?
SECTION - B (2 Marks).
21.
b.
Expand
RJ45 the following: X4=2
WiFi
NSENet
TelNet
22
What is a

23.
dictionary in Python? Give a suitable example. 2

Sumit is
trying to
Passed to the writeand a hprogrram to find the factorial of a number
function hag
not
WOrking and producing errors.written the following code but 1t s
Help Sumit tO COrrect this and
Cewr1te the corrected code. Al sO
Def fact (num): underline the corrections nade.
factorial = 1
if num <0:
print ("Sorry, factorial not possible for
else num == 0 : negative numbers")
print ("The factorial of 0 is 1")
else: (4) e
for i in range (1,num + 1) :
f = f*i
print ("The factorial of",num, "is"factorial)
24. What is the output of the below program?
g=0
2

def funl (x, y):


global g
g=xty
return g

def fun2 (m, n) :


global g
g=m-n

5/10
return g
k=funl (2,3)
print (k)
fun2 (k, 7)
print (g)
argument with
Write a difference between actual argument and formal 2
an example.
Explain with a
What do you understand by the soope of a variable? 2
suitable example.
2
How is MAN different from a WAN?

2
Write the output of the following Fython program code:
def out () :
tup= (10,28, 35, 45, 39, 85)
li-list (tup)
new li-[]
for i in li:
if i%5==0:
new_ li.append(i)
nt=tuple (new li)
print (nt)
out ()

Write 2 benefits of user defined functions 2

30. Find and write the output of tne tollowing python code: 2
def changestring (s) :
k=len (s)
Im="n

for i in range (0, k) :


if s(i].islower():
m=mts [it1] .upper()
elif s[i].isalpha () :
m=m+s [i-1].lower ()
else:
m=m+ @
print (m)

6/10
changestring (('VivEK9InTe @vEve e1Ce
EcTIONC(3 Mazks)
ae an argument
a string
3X. Write
and
a
returnsfunction Wordslen (string),
a tuple
that takes
cont;aining the length of each WOrd of a string.
pre board exam", the
For example, if the "computer science
li is
Tuple will have

Write a function
(8,in7,33,5,4) .
read a text file, Alpna.txt
and display
3
those lines which Pythonwi
begin tothe
n
wOrd 'You
.

structure (Admission number,


A binary file "STUDENT..DAT" has
() in Python that would
Name, Percentage). function countrec details of
read contents of Write
the fileà "STUDENT.dat" and display the number
AlsO display the
those students
whose is above 75.
of studentS SCOrlng above 58. percer.tage 3

3
Predict the output of the b+hon code given beloW:
def change (A=15, B=10) :
A=A+B

B=A//B
print (A, "#", B)
return B

X=150
Y=100

X=change (x, Y)
print (X, "$",Y)
Y-change (X)
print (X, "$", Y)

35./Answer the following questions:


What do vou understand about GROUP BY in sQL? Explain the use of
2
HAVING clauses with GROUP BY.
Someone wants to delete the Con coachname from table SPORTS. Which
tollowing:
cohand will he use from the
1
SPORTJ7
Á) DELETE Coachnane FROM
SPORT;
ii) ALTER Coachname FROM
COaChname :
iii/ALTER TABLE SPORTS DROP
SPORI3;
DELETE Coachname FROM

SECTION D(5 Marks)

7/10
a Csv file.
36. Sedlch for a name in
ANSHU is writing a program to
pr ogrammer,
"MYFILE.CSv". She has written the TolloOwing code. As a 5
help her to successfullv execute the given task.
import # Statementl
fopen ("MYFILE. csv" # Statement2
data (f) # Statenent 3
nm = input ("Enter name to be searched: ")
for rec in data:
if rec [0) nm:
print (rec)
f. (0 # Statement 4
Name the module he should import in Statement 1,
In which mode, ANSHU should open the file to search the data in the
file in statement 2?
F11l in the blank in Statement 3 to read the data from the file.
Fill in the blank in Statement 4to close the file.
What is pickling?
37. Consider the table COMPANY and CUSTOMER given below:
COMPANY
CID NAME cITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY MADRAS MOBILE
666 DELL DELHI | LAPTOP

CUSTOMER
CUSTID NAME PRICE oTy ciD
101 ROHANSHARMA 70,000 20 222
102 DEEPAKKUMAR 50,000- 10 666
333
103 MOHANKUMAR 30,000 111
104 SAHIL BANSAL 35,000 333)
105 NEHA SONI 25,000 444
106 SONAL AGGARWAL|20,000 5 333)
107 ARUN SINGH 50,000 15 666)
Based on the given tables, write sQL queries for the following:
5% of
Increase the PRICE by those customers whose
than 5.
quantity is more
n4onl av CITY and count Total number oI each CITY whose count is more
than 2. 1
C. Display company name, Customer name and quantity from the tables. 1
Determine the output of the following SQL commands : 1+1=2
i. SELECT CID, MIN (PRICE), MAX (PRICE) FROM CUSTOMER

8/10
GROUP BY CID
1i.
SELECT
WHERE E.E.CNID=D.
AME,HAVI
CIDQTYhr AND cOMPANY. PRODUCTNAME=""TV" AND OTY5:
COUNT(*)>1;
FROM COMPANY F, CUSTOMER D

38. INFOTECH
knowledge comnunity aimed to
standard ofHubskills
India andis knowledge in the society. It is Lplift the
set p a
pl ainingj Lo
S ttaining centeS in multiple towns and villages pan India
with
its cities. They have Created
model
As a
OI head
hei offices
network with a
ln the
city, a
nearest town and 3 viIlages as qive.
netwOrk
solution for
suggest the best network re lated

mind the their consultant,


d1stance issuesl
You have
problems
to
raised in (i) to (v) keeping in
various locations
and given parameters.

between
XCITY YHUB
Head Office
VILLAGÀ1 VIELAGE3

YTOWN

VILLAGE

Shortest distance between various locations:


VILLAGE 1To YTOWN 2 KM
VILLAGE 2 To YTOWN 1.2 KM
VILLAGE 3 To YTOWN 3 KM
VILLAGE 1To VILLAGE 2 3.5 KM

VILLAGE 1To VILLAGE 3 4.5 KM

VILLAGE 2 To VILLAGE 3 3.5 KM


30 KM
CITY Head office to YHUB
locations are as follows:
Number of computers instalieu a varl0us
YTOWN 100
VILLAGE 1 10
VILLAGE 2 15
15
VILLAGE 3
CITY OFFICE 5

Note:
" In Villages, there are community centers, in which one room has been
this organl2ation to
given as a training center tofinancial install computers.
" The
organization has got Support from the government and tOp
IT Companies.
Suggest the most appropriate l0cation of the SERVER in the YHUB (out
of the 4 locations), to get the best and effective connectivity .
austify your answer.
j Draw the cable layout (l0cation tO location) to efficiently connect
Various locations within the YHUB.
Aii) Which hardware device will you suggest connecting all the computers
Within each location of YHUB?
Which server/protocol will be most helpful to conduct live
interaction of Experts from Head office and people at YHUB locations?
Suggest the best wired medium to efficiently Connect various
locations within the YHUB.

*** *:

You might also like