100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Exam Computer science with correct answers $4.49   Add to cart

Exam (elaborations)

Exam Computer science with correct answers

 13 views  0 purchase
  • Course
  • Institution
  • Book

Computer science exam review with complete solutions

Preview 4 out of 106  pages

  • July 30, 2024
  • 106
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
SAMPLE QUESTION PAPER (SOLVED)
CLASS XII
COMPUTER SCIENCE (083)
TIME: 3 hrs M.M: 70
1. (a) Differentiate between mutable and immutable objects in Python language with example. (2)
Ans. Every variable in Python holds an instance of an object. There are two types of objects in Python,
i.e., Mutable and Immutable objects. Whenever an object is instantiated, it is assigned a unique
object id. The type of the object is defined at the runtime and it can’t be changed afterwards.
However, its state can be changed if it is a mutable object.
For example, int, float, bool, string, unicode, tuple are immutable objects in Python. In simple words, an
immutable object can’t be changed after it is created. Lists, dictionaries and sets are mutable types.
(b) Identify and write the name of the module to which the following functions belong: (1)
(i) ceil() (ii) findall()
Ans. (i) ceil() – math module (ii) findall() – re module
(c) Observe the following Python code very carefully and rewrite it after removing all syntactical errors
with each correction underlined. (2)
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
execmain()
Ans. Corrected code:
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)
execmain()
(d) Find the output of the following: (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)
Ans. Output is:
1 : 900
1900
2 : 2200
3200
3 : 3600
4600

, (e) Write the output of the following Python program code: (3)
def ChangeList():
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)
ChangeList()
Ans. Output is:
[11,10,9,8,7,4]
(f) Study the following program and select the possible output(s) from the options (i) to (iv) following it.
Also, write the maximum and the minimum values that can be assigned to the variable Y. (2)
import random
X= random.random()
Y= random.randint(0,4)
print(int(X),":",Y+int(X))
(i) 0 : 0 (ii) 1 : 6
(iii) 2 : 4 (iv) 0 : 3
Ans. (i) and (iv) are the possible outputs. Minimum value that can be assigned is – Y = 0. Maximum value
that can be assigned is – Y = 3
2. (a) Explain operator overloading with the help of an example. (2)
Ans. Operator overloading is a feature in Python that allows the same operator to have a different meaning
according to the context. It signifies giving extended meaning beyond the predefined operational
meaning. For example, operator + is used to add two integers as well as join two strings and merge
two lists.
For example,
>>print(44 + 2)
46
# concatenate two strings
print("Python"+"Programming")
PythonProgramming
# Product of two numbers
print(5 * 5)
25
# Repeat the String
print("Hello"*3)
HelloHelloHello
(b) Find the output of following: (2)
colors = ["violet", "indigo", "blue", "green", "yellow", "orange", "red"]
del color[4]
colors.remove("blue")
colors.pop(3)
print(colors)
Ans. Output is:
['violet', 'indigo', 'green', 'red']

, (c) Find the output of the following: (2)
str = "Pythonforbeginners is easytolearn"
str2 = "easy"
print("The first occurrence of str2 is at : ", end="")
print(str.find( str2, 4))
print("The last occurrence of str2 is at : ", end="")
print(str.rfind( str2, 4))
Ans. Output is:
The first occurrence of str2 is at : 22
The last occurrence of str2 is at : 22
3. (a) Write the definition of a function Reverse(X) in Python to display the elements in reverse order such
that each displayed element is twice of the original element (element *2) of the List X in the following
manner: (2)
Example:
If List X contains 7 integers as follows:
X[0] X[1] X[2] X[3] X[4] X[5] X[6]
4 8 7 5 6 2 10
After executing the function, the array content should be displayed as follows:
If List
Ans.
20 4 12 10 14 16 8
def Reverse(X):
for i in range(len(X)-1,-1,-1):
print(X[i]*2)
(b) Consider the following unsorted list: 95 79 19 43 52 3. Write the passes of bubble sort for sorting
the list in ascending order till the 3rd iteration. (3)
Ans. [79, 19, 43, 52, 3, 95]
[19, 43, 52, 3, 79, 95]
[19, 43, 3, 52, 79, 95]
(c) Write a user-defined function to generate odd numbers between a and b (including b). (3)
Note: a and b are received as an argument by the function.
Ans. def generateodd(a,b):
for i in range(a, b+1):
if(i%2 != 0):
print(i)
(d) Observe the following code and answer the questions that follow: (1)
File = open("Mydata","a") _____________________ #Blank1
File.close()
(i) What type (Text/Binary) of file is Mydata?
(ii) Fill in Blank 1 with a statement to write “ABC” in the file “Mydata”.
Ans. (i) Text File
(ii) File.write("ABC")
4. (a) Write any one advantage and one disadvantage of Coaxial cable. (1)
Ans. Advantages:
• It is less susceptible to noise or interference (EMI or RFI) as compared to twisted pair cable.
• It supports high bandwidth signal transmission as compared to twisted pair.
• It is easy to wire and easy to expand due to its flexibility.

, Disadvantages:
• It is bulky.
• It is expensive to install for longer distances due to its thickness and stiffness.
(b) Riana Medicos Centre has set up its new centre in Dubai. It has four buildings as shown in the diagram
given below: (4)



Research
Accounts
Lab




Packaging
Store
Unit

Distances between various buildings are as follows:
Accounts to Research Lab 55 m
Accounts to Store 150 m
Store to Packaging Unit 160 m
Packaging Unit to Research Lab 60 m
Accounts to Packaging Unit 125 m
Store to Research Lab 180 m
Number of computers:
Accounts 25
Research Lab 100
Store 15
Packaging Unit 60
As a network expert, provide the best possible answer for the following queries:
(i) Suggest the type of network established between the buildings.
Ans. LAN (Local Area Network)
(ii) Suggest the most suitable place (i.e., building) to house the server of this organization.
Ans. Research Lab as it has the maximum number of computers.
(iii) Suggest the placement of the following devices with justification: (a) Repeater (b) Hub/Switch
Ans. (a) Repeater: It should be placed between Accounts and Packaging Unit, Accounts to Research
Lab, Store to Research Lab and Accounts to Packaging Unit.
(b) Switch should be placed in each of the buildings for better traffic management.
(iv) Suggest a system (hardware/software) to prevent unauthorized access to or from the network.
Ans. Firewall.
(c) Expand the following: (2)
(i) VoIP
Ans. Voice over Internet Protocol
(ii) SMTP
Ans. Simple Mail Transfer Protocol
(iii) TDMA
Ans. Time Division Multiple Access
(iv) TCP/IP
Ans. Transmission Control Protocol/Internet Protocol

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Knowledgekings. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $4.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

62555 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$4.49
  • (0)
  Add to cart