class Test: rollno=1 marks=75 def __init__(self,r,m): #functio

Subject

Computer and Communication Technology

Class

CBSE Class 12

Pre Boards

Practice to excel and get familiar with the paper pattern and the type of questions. Check you answers with answer keys provided.

Sample Papers

Download the PDF Sample Papers Free for off line practice and view the Solutions online.
Advertisement

 Multiple Choice QuestionsMultiple Choice Questions

1.

Which of the following can be used as valid variable identifier(s) in Python?

  • total

  • 7Salute

  • Que$tion

  • Que$tion

224 Views

2.

Amit used a pen drive to copy files from his friend’s laptop to his office computer. Soon his office computer started abnormal functioning. Sometimes it would restart by itself and sometimes it would stop functioning totally. Which of the following options out of (i) to (iv), would have caused the malfunctioning of the computer. Justify the reason for your chosen option:

  • Computer Worm

  • Computer Virus

  • Computer Bacteria

  • Computer Bacteria

105 Views

3.

Jai is an IT expert and a freelancer. He recently used his skills to access the Administrator password for the network server of Megatech Corpn Ltd. and provided confidential data of the organization to its Director, informing him about the vulnerability of their network security. Out of the following options (i) to (iv), which one most appropriately defines Jai. Justify the reason for your chosen option:

  • Hacker

  • Cracker

  • Operator

  • Operator

106 Views

 Multiple Choice QuestionsShort Answer Type

4.

Name the Python Library modules which need to be imported to invoke the following functions:
(i) ceil()
(ii) randint()

75 Views

Advertisement
5.

Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

TEXT= 'GREAT
DAY'
for T in range[0,7]:
print TEXT(T)
print T+TEXT
84 Views

6.

Find and write the output of the following Python code:

STR = ['90','10','30','40']
COUNT = 3
SUM = 0
for I in [1,2,5,4]:
	S = STR[COUNT]
	SUM = float (S)+I
	print SUM
	COUNT-=1
83 Views

7.
Find and write the output of the following Python code :
class ITEM:
	def __init__(self,I=101,N='Pen',Q=10): #constructor
		self.Ino=I
		self.IName=N
		self.Qty=int(Q);

	def Buy(self,Q):
		self.Qty = self.Qty + Q

	def Sell(self,Q):
		self.Qty -= Q

	def ShowStock(self):
		print self.Ino,':',self.IName,'#',self.Qty

I1=ITEM()
I2=ITEM(100,'Eraser',100)
I3=ITEM(102,'Sharpener')
I1.Buy(10)
I2.Sell(25)
I3.Buy(75)
I3.ShowStock()
I1.ShowStock()
I2.ShowStock()
75 Views

8.

What is the possible outcome(s) executed from the following code? Also, specify the maximum and minimum values that can be assigned to variable N.

import random
SIDES=['EAST','WEST','NORTH','SOUTH'];
N=random.randint(1,3)
OUT=''
for I in range(N,1,-1):
	OUT=OUT+SIDES[I]
	print OUT
SOUTHNORTH SOUTHNORTHWEST
SOUTH EASTWESTNORTH
85 Views

Advertisement
9.

List four characteristics of Object Oriented programming.

92 Views

Advertisement

10.
class Test:
	rollno=1
	marks=75
	def __init__(self,r,m): #function 1
		self.rollno=r
		self.marks=m
	def assign(self,r,m):     #function 2
		rollno = r
		marks = m
	def check(self):          #function 3
		print self.rollno,self.marks
		print rollno,marks

(i) In the above class definition, both the functions - function 1 as well as function 2 have a similar definition. How are they different in execution?

(ii) Write statements to execute function 1 and function 2.


i) Function 1 is the constructor which gets executed automatically as soon as the object of the class is created. Function 2 is a member function which has to be called to assign the values to rollno and marks.

ii) Function 1 E1=Test(1,95) # Any values in the parameter
    Function 2 E1.assign(1,95) # Any values in the parameter

72 Views

Advertisement
Advertisement