SAMPLE PAPER-II Class XII (Computer Science) QP With MS & BP
SAMPLE PAPER-II Class XII (Computer Science) QP With MS & BP
(a) Carefully observe the following python code and answer the 2
questions that follow:
ans Names declared with global keyword have to be referred at the file
level. This is because the global statement indicates that the particular
variable lives in the global scope. If no global statement is being
used, the variable with the local scope is accessed. Hence, in the
above code the statement succeeding the statement global x
informs python to increment the global variable x Hence the output is
6 i.e 5+1 which is also the value for global x. When x is reassigned
with the value 3 the local x hides the global x and hence 3 is printed.
ans a. random()
b. math()
c Rewrite the following code after removing the syntactical errors (if 2
any). Underline each correction.
ans x= input("Enter a number")
if (x%2 == 0):
for i in range(2*x):
print i
else:
print "#"
d Observe the following Python code carefully and obtain the output, 2
which will appear on the screen after execution of it.
ans EA3n
Ans i. print I
ii. The statement 2 is giving an error because Systemdate is a
private variable and hence cannot be printed outside the class.
C Define a class PRODUCT in Python with the following specifications 4
Data members:
Pid – A string to store productid.
Margin is negative
Member Functions:
● A constructor function to initialize All the data members with
Margin Remarks
<0 ( negative) Loss
>0(positive) Profit
method.
b Kritika was asked to accept a list of even numbers but she did not put 2
the relevant condition while accepting the list of numbers. You are
required to write a user defined function oddtoeven(L) that accepts the
List L as an argument and convert all the odd numbers into even by
multiplying them by 2 .
ans
c Aastha wants to create a program that accepts a string and display the 4
characters in the reverse order in the same line using a Stack. She
has created the following code , help her by completing the
definitions on the basis of requirements given below :
class mystack:
def init (self):
self.mystr= # Accept a string
self.mylist = # Convert mystr to a list
# Write code to display while removing element from the stack.
def display(self):
:
:
ans
ans
4 a Observe the following code and answer the questions that follow: 2
File = open("Mydata","a")
______________________ #Blank1
File.close()
ii. Fill the Blank 1 with statement to write “ABC” in the file “Mydata”
ii. File.write("ABC")
b A text file “Quotes.Txt” has the following data written in it: 2
Living a life you can be proud of
Spending your time with people and activities that are important to you
Standing up for things that are right even when it’s hard
Write a user defined function to display the total number of words present a file.
Ans
c Consider the following class declaration and answer the question that 3
follows:
Anuj has been asked to display all the students who have scored less
than 40 for Remedial Classes.
Write a user defined function to display all those students who have
scored less than 40 from the binary file “Student.dat” assuming it
stores all the object of the class Student mentioned above.
Ans
Club
Member_id Member_Name Address Age Fee
Sale
Watchid Qty_Sold Quarter
W001 10 1
W003 5 1
W002 20 2
W003 10 2
W001 15 3
W002 20 3
W005 10 3
W003 15 4
i. To display all the details of those watches whose name ends with
‘Time’
ii. To display watch’s name and price of those watches which have price
range in between 5000-15000.
iv. To display watch name and their quantity sold in first quarter.
max(price) min(qty_store)
25000 100
vi.
quarter sum(qty_sold)
1 15
2 30
3 45
4 15
vii.
watch_name price type
HighFashion 7000 Unisex
Viii
Ans The use of a digital certificate to sign documents. ... So, technically speaking
the difference between adigital signature and digital certificate is that
acertificate binds a digital signature to an entity, whereas a digital signature is
to ensure that a data/information remain secure from the point it was issued.
c What do you mean by web browser and web server? 2
ans Wi-Fi is the name of a popular wireless networking technology that uses radio
waves to provide wireless high-speed Internet and network connections.
ans A firewall is software used to maintain the security of a private network. Firewalls
block unauthorized access to or from private networks and are often employed to
prevent unauthorized Web users or illicit software from gaining access to private
networks connected to the Internet. A firewall may be implemented using
hardware, software, or a combination of both.
(e) Daniel has to share the data among various computers of his two 1
offices branches situated in the same city. Name the network (out of
LAN, WAN, PAN and MAN) which is being formed in this process.
Ans MAN
2
(f) Rehaana Medicos Center has set up its new center in Dubai. It has
four buildings as shown in the diagram given below:
25
Accounts
25
Research Lab 100
Store 15
Packaging Unit 60
ans
i)
ii) Suitable place /building to house server of thisThe most organization
would be building Research Lab, as this building contains the maximum
number of computers.
iiii.a) For layout1, since the cabling distance between Accounts to Store is
quite large, so a repeater would ideally be needed along their path to
avoid loss of signals during the course of data flow in this route. For
layout2, since the cabling distance between Store to Research Lab is
quite large, so a repeater would ideally be placed.
(iv) Firewall