Short Answer Type

Advertisement

List four characteristics of Object Oriented programming.


Encapsulation – Encapsulation is capturing data and keeping it safely and securely from outside interfaces.

Inheritance- This is the process by which a class can be derived from a base class with all features of the base class and some of its own. This increases code reusability.

Polymorphism- This is the ability to exist in various forms. For example, an operator can be overloaded so as to add two integer numbers and two floats.

Abstraction- The ability to represent data at a very conceptual level without any details.
70 Views

Advertisement

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

STRING= ''WELCOME
NOTE''
for S in range[0,8]:
print STRING(S)
print S+STRING
74 Views

Find and write the output of the following python code:

class INVENTORY:
def __init__(self,C=101,N='Pad',Q=100): #constructor
     self.Code=C
     self.IName=N
     self.Qty=int(Q);
def Procure(self,Q):
     self.Qty = self.Qty + Q
def Issue(self,Q):
     self.Qty -= Q
def Status(self):
print self.Code,':',self.IName,'#',self.Qty
I1=INVENTORY()
I2=INVENTORY(105,'Thumb Pin',50)
I3=INVENTORY(102,'U Clip')
I1.Procure(25)
I2.Issue(15)
I3.Procure(50)
I1.Status()
I3.Status()
I2.Status()
88 Views

Find and write the output of the following python code:

TXT = ['20','50','30','40']
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
	T = TXT[CNT]
	TOTAL = float (T) + C
	print
68 Views

Multiple Choice Questions

Janish Khanna 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 different applications running on it. 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 Virus

  • Spam Mail

  • Computer Bacteria

  • Computer Bacteria

122 Views

Advertisement

Short Answer Type

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
NAV = ['LEFT','FRONT','RIGHT','BACK];
NUM = random.randint(1,3)
NAVG = ''
for C in range(NUM,1,-1):
	NAVG = NAVG+NAV[I]
	print NAVG
(i)BACKRIGHT (ii)BACKRIGHTFRONT
(iii) BACK (iv) LEFTFRONTRIGHT
67 Views

Multiple Choice Questions

Ms. Raveena Sen is an IT expert and a freelancer. She recently used her skills to access the Admin password for the network server of Super Dooper Technology Ltd. and provided confidential data of the organization to its CEO, informing him about the vulnerability of their network security. Out of the following options (i) to (iv), which one most appropriately defines Ms.Sen?
Justify the reason for your chosen option:

  • Hacker

  • Cracker

  • Operator

  • Operator

117 Views

Short Answer Type

class Exam:
	Regno=1
	Marks=75
	def __init__(self,r,m): #function 1
		self.Regno=r
		self.Marks=m
	def Assign(self,r,m): #function 2
		Regno = r
		Marks = m
	def Check(self): #function 3
		print self.Regno, self.Marks
		print Regno, Marks

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

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

64 Views

Multiple Choice Questions

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

  • 4thSum

  • Total

  • Number#

  • Number#

184 Views

Advertisement

Short Answer Type

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

69 Views