XII CS PractisePaper 5
XII CS PractisePaper 5
(1) Following set of commands are executed in shell, what will be the output?
>>>str="hello"
>>>str[:2]
(2) What is the output of the following?
x = "abcdef"
while i in x:
print(i, end=" ")
(3) What is the output when following code is executed?
>>> str1 = 'hello'
>>> str2 = ','
>>> str3 = 'world'
>>> str1[-1:]
(4) Process of removing errors is called _______? a) Error Free b) Debugging c) Syntax Error d) Exception
(5) Command to add 5 to the third position in list1? a) list1.insert(3, 5) b) list1.insert(2, 5) c) list1.add(3, 5) d) list1.append(3, 5)
(7) Code to open a file c:\scores.txt for reading? a) infile = open(“c:\scores.txt”, “r”) b) infile = open(“c:\\scores.txt”, “r”)
c) infile = open(file = “c:\scores.txt”, “r”) d) infile = open(file = “c:\\scores.txt”, “r”)
(8) The readlines( ) method returns ..? a) str b) a list of lines c) a list of single characters d) a list of integers
(9) What is the output of the code shown below? a) „Sanfoundry\n‟ b) „Sanfoundry‟ c) „Sanfoundry10‟ d) Error
import sys
sys.stdin.readline()
Sanfoundry
(10) Which of the following is equivalent to random.randint(3, 6)? a) random.choice([3, 6]) b) random.randrange(3, 6)
c) 3 + random.randrange(3) d) 3 + random.randrange(4)
(11) Observe the following code and answer the questions that follow:
File = open("Mydata","a")
_____________________ #Blank 1
File.close()
(a) What type of file is Mydata (Text/Binary)?
(b) Fill in Blank 1 with a statement to write “ABC” in the file “Mydata”.
(12) Write any one advantage and one disadvantage of Coaxial cable
(13) The following is a 32-bit binary number usually represented as 4 decimal values, each representing 8 bits, in the range 0 to
255 (known as octets) separated by decimal points e.g. 140.179.220.200 . What is it?
(15) Name the Python Library modules which need to be imported to invoke the following functions: (a) floor() (b) randn()
Part B: All questions carry 2 marks. 10x2=20
(16) Carefully observe the code and give the output.
def example(a):
a = a + '2'
a = a*2
return a
>>>example("hello")
(20) A normal queue is implemented using an array of size MAX_SIZE. Write it‟s Overflow and Underflow conditions.
(21) Differentiate between mutable and immutable objects in Python language with example.
(22) Expand the following: (a) VoIP (b) SMTP (c) CSMA (d) TCP/IP
(23) Write the specific purpose of functions used in plotting: (a) plot() (b) legend()
As a network expert, provide the best possible answer for the following queries:
(a) Suggest the type of network established between the buildings.
(b) Suggest the most suitable place (i.e., building) to house the server of this organization.
(c) Suggest the placement of the following devices with justification: (a) Repeater (b) Hub/Switch
(d) Suggest a system (hardware/software) to prevent unauthorized access to or from the network.
(33) Evaluate the following Postfix expression: 20 , 10 , - , 15 , 3 , / , + , 5 , *
(34) Write Addnew(Member) and Remove(Member) methods/functions in Python to Add a new Member and Remove a
Member from a list of Members, considering them to act as INSERT and DELETE operations of the data structure Queue.
(35) WAP to print Fibonacci Series upto „n‟ no. of terms using Recursion.