Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
Python : ome Commonly asked Function/Objects Vs. header files (CBSE 12th Exam)
Concept Notes and Resources

An introduction presentation about JAVA as a programming language, its evolution and its primary concepts.

Let us understand few points about C++ as a programming language.

Options for C++ development either on a desktop/laptop or directly on the internet. are explained here.

Various tokens or basic building blocks defined in c++ are explained here.

Concept of keywords in a language and keywords as per c++11 standard are explained here.

Identifiers can be names given by the user/programmer or names other than keywords in the library files.

This video explains the types of c++ operators based on number operands and purpose.

Some rules related to C++ identifiers are as follows: Can be arbitrarily long alpha numeric (letters and numbers) sequence. The first character must be a letter. As an exception _ (underscore) is considered as a letter. Upper and lower case letters considered different All characters in the name are considered significant. C++ Keywords can not […]

There are many built-in functions in C++ which can be used by a programmer as needed. To allow a build-in function or usage of some pre-fixed declarations C++ provides a concept of header files. Header file primarily contains the function prototypes of built-in functions so that its type checking can be performed and related library […]

As C++ follows the Object Oriented Programming paradigm, it does implement the concepts of Abstraction and Encapsulation. These are interrelated concepts. First let us define them. Abstraction Abstraction is a concept where we talk about showing only the necessary part to the outside world and hide the details of implementation. Abstraction can be done for […]

Enumeration is basically a way to represent a possible list of number values for a variable in friendly names or symbol forms. For e.g. if  you have to represent rainbow colours with 0 to 6 you can always write them more meaningfully as enum rainbow { RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO, VIOLET }; This […]

As the name signifies, pre-processor directives are instructions given to compiler which it has to run before main code compilation will begin. You must be frequently seeing #include as the top of most C++ program codes. It is nothing but a pre-processor directive to tell compiler that definitions of certain classes, function and objects have […]

Let us begin with understanding of the word polymorphism. The word has a greek origin from words polus/polloi and morphe. ‘Poly’ means ‘many’ and ‘Morph’ means forms. So when any entity has many forms according to its context of use, we may call it polymorphism. This nomenclature is frequently used in biological studies. For e.g. […]

Life is continued journey for one big reason that living beings are able to create new creatures of their own types by passing many attributes of them. This is called Inheritance.   Since Object Oriented Languages boast of modelling the real life and real problems, so they need to implement this feature called inheritance. Infacts […]

Salient Features: SIMPLE AS BASIC: Python is a sort of modern day BASIC language. BEGINNER TO ADVANCED: It is right for beginners and it is truly all purpose in modern times. Language for console applications, GUI applications, scientific applications and web applications. INTERPRETED: It is an interpreted language. This means that line by line error […]

Copy constructor is often quite confusing even for the geeks. Consider a situation of scores of many participants in a game to be initialized to same values but to be kept at different locations. In this case the moment we initialize score of one participant we would like that other participants are simply created based […]

Exception is a type of runtime error while execution of program which user can possibly handle (catch) and report with a suitable message or take some other planned action.   for e.g. divide by zero (Arithmetic exceptions), array out of bound (ArrayIndexOutOfBoundsException), file not found (FileNotFoundException)   Exception can be handled by using the try […]

Concept Learning Code Sheets
Simple Print Variations #6732 

Some simple variations to print() function

Solved Problems
B01A #6088 

Differentiate between Syntax Error and Run-Time Error? Also, write a suitable example in Python to illustrate both.

Differentiate between Syntax Error and Run-Time Error? Also, write a suitable example in ...
B01A-2018 #6095 

Name the Python Library modules which need to be imported to invoke the following functions:

(i) sin() (ii) search ()

Name the Python Library modules which need to be imported to invoke the following functio ...
B01C #6099 

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

Val = int(rawinput("Value:"))
Adder = 0

for C in range(1,Val,3)
    Adder+=C
    if C%2=0:
        Print C*10
    Else:
        print C*
print Adder
Rewrite the following code in python after removing all syntax error(s). Underline each co ...
B01D #6101 

Find and write the output of the following python code:

Data  = ["P",20,"R",10,"S",30]
Times = 0
Alpha = ""
Add   = 0
for C in range(1,6,2):
    Times= Times + C
    Alpha= Alpha + Data[C-1]+"$"
    Add = Add + Data[C]
    print Times,Add,Alpha
Find and write the output of the following python code:
Data  = ["P",20,"R",10,"S",3 ...		
B01E #6105 

Find and write the output of the following python code:

class GRAPH:
    def __init__(self,A=50,B=100):
        self.P1=A
        self.P2=B
    def Up(self,B):
        self.P2 = self.P2 - B
    def Down(self,B):
        self.P2 = self.P2 + 2*B
    def Left(self,A):
        self.P1 = self.P1 - A
    def Right(self,A):
        self.P1 = self.P1 + 2*A
    def Target(self):
        print "(",self.P1.":",self.P2,")"
G1=GRAPH(200,150)
G2=GRAPH()
G3=GRAPH(100)
G1.Left(10)
G2.Up(25)
G3.Down(75)
G1.Up(30)
G3.Right(15)
G1.Target()
G2.Target()
G3.Target()
Find and write the output of the following python code:
class GRAPH:
    def __init ...		
B01F #6107 

What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from the following code? Also specify the maximum values that can be assigned to each of the variables BEGIN and LAST.

import random
POINTS=[20,40,10,30,15];
POINTS=[30,50,20,40,45];
BEGIN=random.randint(1,3)
LAST=random.randint(2,4)
for C in range(BEGIN,LAST+1):
print POINTS[C],”#”,

(i) 20#50#30#           (ii) 20#40#45#
(iii) 50#20#40#         (iv) 30#50#20#
What possible outputs(s) are expected to be displayed on screen at the time of execution ...
B02A-2018 #6109 

What is the advantage of super() function in inheritance? Illustrate the same with the help of an example in Python.

What is the advantage of super() function in inheritance? Illustrate the same with the he ...
B02B #6116 
class Vehicle:                        #Line 1
    Type = 'Car'                      #Line 2
    def __init__(self, name):         #Line 3
        self.Name = name              #Line 4
    def Show(self):                   #Line 5
        print self.Name,Vehicle.Type  #Line 6

V1=Vehicle("BMW")                     #Line 7
V1.Show()                             #Line 8
Vehicle.Type="Bus"                    #Line 9
V2=Vehicle("VOLVO")                   #Line 10
V2.Show()                             #Line 11

(i) What is the difference between the variable in Line 2 and Line 4 in the above Python code?

(ii) Write the output of the above Python code.

class Vehicle:                        #Line 1
    Type = 'Car'                       ...		
B02C-2018 #6120 

Define a class CONTAINER in Python with following specifications

Instance Attributes
- Radius,Height   # Radius and Height of Container
- Type            # Type of Container
- Volume          # Volume of Container

Methods
- CalVolume()     # To calculate volume
                  # as per the Type of container
                  # With the formula as given below:
Type Formula to calculate Volume
1 3.14 * Radius * Height
3 3.14 * Radius * Height/3
- GetValue()       # To allow user to enter values of
                   # Radius, Height and Type.
                   # Also, this method should call
                   # CalVolume() to calculate Volume
- ShowContainer()  # To display Radius, Height, Type
                   # Volume of the Container
Define a class CONTAINER in Python with following specifications
Instance Attributes ...		
B02D #6123 

Answer the questions (i) to (iv) based on the following:

Class Top1(object):
    def __init__(self,tx): #Line 1
        self.X=tx              #Line 2
    def ChangeX(self,tx):
        self.X=self.X+tx
    def ShowX(self):
        print self.X
Class Top2(object):
    def __init__(self,ty): #Line 3
        self.Y=ty              #Line 4
    def ChangeY(self,ty):
        self.Y=self.Y+ty
    def ShowY(self):
        print self.Y,
class Bottom(Top1,Top2):
    def __init__(self,tz): #Line 5
        self.Z = tz #Line 6
        Top2.__init__(self,2*tz) #Line 7
        Top1.__init__(self,3*tz) #Line 8
    def ChangeZ(self,tz):
        self.Z=self.Z+tz
        self.ChangeY(2*tz)
        self.ChangeX(3*tz)
    def ShowZ(self):
        print self.Z,
        self.ShowY()
        self.ShowX()
    B=Bottom(1)
    B.ChangeZ(2)
    B.ShowZ()

(i) Write the type of the inheritance illustrated in the above.

(ii) Find and write the output of the above code.

(iii) What are the methods shown in Line 1, Line 3 and Line 5 are known as?

(iv) What is the difference between the statements shown in Line 6 and Line 7?

Answer the questions (i) to (iv) based on the following:
Class Top1(object):
    de ...		
B03A #6126 

Consider the following randomly ordered numbers stored in a list
786, 234, 526, 132, 345, 467,
Show the content of list after the First, Second and Third pass of the bubble sort method used for arranging in ascending order ?
Note: Show the status of all the elements after each pass very clearly underlining the changes.

Consider the following randomly ordered numbers stored in a list 786, 234, 526, 132, 345, ...
B03B-2018 #6128 

Write definition of a method ZeroEnding(SCORES) to add all those values in the list of SCORES, which are ending with zero (0) and display the sum.
For example,
If the SCORES contain [200,456,300,100,234,678]
The sum should be displayed as 600

Write definition of a method ZeroEnding(SCORES) to add all those values in the list of SCO ...
B03C-2018 #6130 

Write AddClient(Client) and DeleteCleint(Client) methods in python to add a new Client and delete a Client from a List of Client Names, considering them to act as insert and delete operations of the queue data structure.

Write AddClient(Client) and DeleteCleint(Client) methods in python to add a new Client and ...
B03D #6133 

Write definition of a Method COUNTNOW(PLACES) to find and display those place
names, in which there are more than 5 characters.
For example:
If the list PLACES contains
[“DELHI”,”LONDON”,”PARIS”,”NEW YORK”,”DUBAI”]
The following should get displayed
LONDON
NEW YORK

Write definition of a Method COUNTNOW(PLACES) to find and display those place names, in w ...
B03E #6136 

Evaluate the following Postfix notation of expression:
22,11,/,5,10,*,+,12,-

Evaluate the following Postfix notation of expression: 22,11,/,5,10,*,+,12,- ...
B04A #6139 

Write a statement in Python to open a text file STORY.TXT so that new contents can be added at the end of it.

Write a statement in Python to open a text file STORY.TXT so that new contents can be adde ...
B04B #6142 

Write a method in python to read lines from a text file INDIA.TXT, to find and display the occurrence of the word “India”.
For example:
If the content of the file is

“India is the fastest growing economy. 
India is looking for more investments around the globe.
The whole world is looking at India as a great market. 
Most of the Indians can foresee the heights that India is
capable of reaching.”

The output should be 4

Write a method in python to read lines from a text file INDIA.TXT, to find and display the ...
B04C #6144 

Considering the following definition of class MULTIPLEX, write a method in python to search and display all the content in a pickled file CINEMA.DAT, where MTYPE is matching with the value ‘Comedy’.

class MULTIPLEX:
    def __init__(self,mno,mname,mtype):
        self.MNO = mno
        self.MNAME = mname
        self.MTYPE = mtype
    def Show(self):
        print self.MNO:"*",self.MNAME,"$",self.MTYPE
Considering the following definition of class MULTIPLEX, write a method in python to sear ...
B01A-2017 #6211 

Which of the following can be used as valid variable identifier(s) in Python?
(i) 4thSum
(ii) Total
(iii) Number#
(iv) Data

Which of the following can be used as valid variable identifier(s) in Python? (i) 4thSum ...
B01B-2017 #6214 

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

Name the Python Library modules which need to be imported to invoke the following function ...
B01C-2017 #6216 

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
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
B01D-2017 #6218 

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 TOTAL
    CNT-=1
Find and write the output of the following python code:
TXT   = ["20","50","30","40" ...		
B01E-2017 #6221 

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()
Find and write the output of the following python code:
class INVENTORY:
    def __ ...		
B01F-2017 #6223 
What are 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
What are the possible outcome(s) executed from the following code? Also
specify the  ...		
B02A-2017 #6226 

List four characteristics of Object Oriented programming.

List four characteristics of Object Oriented programming. ...
B02B-2017 #6229 
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.

class Exam:
   Regno=1
   Marks=75
   def __init__(self,r,m): #function 1
        ...		
B02C-2017 #6231 

Define a class BOX in Python with following specifications

Instance Attributes
- BoxID   # Numeric value with a default value 101
- Side   # Numeric value with a default value 10
- Area   # Numeric value with a default value 0
Methods:
- ExecArea() # Method to calculate Area as
             # Side * Side
- NewBox() # Method to allow user to enter values of
           # BoxID and Side. It should also
           # Call ExecArea Method
- ViewBox() # Method to display all the Attributes
Define a class BOX in Python with following specifications
Instance Attributes
- Bo ...		
B02D-2017 #6236 

Differentiate between static and dynamic binding in Python? Give suitable examples of each.

Differentiate between static and dynamic binding in Python? Give suitable examples of eac ...
B02E-2017 #6238 

Write two methods in python using concept of Function Overloading (Polymorphism) to perform the following operations:
(i) A function having one argument as Radius, to calculate Area of Circle as 3.14#Radius#Radius
(ii) A function having two arguments as Base and Height, to calculate Area of right angled triangle as 0.5#Base#Height .

Write two methods in python using concept of Function Overloading (Polymorphism) to perfo ...
B03A-2017 #6240 

What will be the status of the following list after the First, Second and Third pass of the bubble sort method used for arranging the following elements in ascending order ?
Note: Show the status of all the elements after each pass very clearly underlining the changes.
52, 42, -10, 60, 90, 20

What will be the status of the following list after the First, Second and Third pass of t ...
B03B-2017 #6244 

Write definition of a method EvenSum(NUMBERS) to add those values in the list of NUMBERS, which are odd.

Write definition of a method EvenSum(NUMBERS) to add those values in the list of NUMBERS, ...
B03C-2017 #6246 

Write Addnew(Member) and Remove(Member) methods 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.

Write Addnew(Member) and Remove(Member) methods in python to Add a new Member and Remove ...
B03D-2017 #6249 

Write definition of a Method MSEARCH(STATES) to display all the state names
from a list of STATES, which are starting with alphabet M.
For example:
If the list STATES contains
[“MP”,”UP”,”WB”,”TN”,”MH”,”MZ”,”DL”,”BH”,”RJ”,”HR”]
The following should get displayed
MP
MH
MZ

Write definition of a Method MSEARCH(STATES) to display all the state names from a list o ...
B03E-2017 #6253 

Evaluate the following Postfix notation of expression:
4,2,*,22,5,6,+,/,-

Evaluate the following Postfix notation of expression: 4,2,*,22,5,6,+,/,- ...
B04A-2017 #6256 

Differentiate between file modes r+ and rb+ with respect to Python.

Differentiate between file modes r+ and rb+ with respect to Python. ...
B04B-2017 #6258 

Write a method in python to read lines from a text file MYNOTES.TXT, and display
those lines, which are starting with an alphabet ‘K’.

Write a method in python to read lines from a text file MYNOTES.TXT, and display those li ...
B04C-2017 #6260 

Considering the following definition of class FACTORY, write a method in Python to search and display the content in a pickled file FACTORY.DAT, where FCTID is matching with the value ‘105’.

class Factory:
    def __init__(self,FID,FNAM):
        self.FCTID = FID # FCTID Factory ID
        self.FCTNM = FNAM # FCTNM Factory Name
        self.PROD = 1000 # PROD Production
    def Display(self):
        print self.FCTID,":",self.FCTNM,":",self.PROD
Considering the following definition of class FACTORY, write a method in Python to search ...
B01A-2016 #6266 

Out of the following, find those identifiers, which can not be used for naming Variable or Functions in a Python program:
Total*Tax, While, class, switch,
3rdRow, finally, Column31, _Total

Out of the following, find those identifiers, which can not be used for naming Variable o ...
B01B-2016 #6268 

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

Name the Python Library modules which need to be imported to invoke the following functio ...
B01C-2016 #6271 

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

for Name in [Ramesh,Suraj,Priya]
    IF Name[0]='S':
        print(Name
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
B01D-2016 #6274 

Find and write the output of the following python code:

Values=[10,20,30,40]
for Val in Values:
    for I in range(1, Val%9):
        print(I,"*",end= "" )
    print()
Find and write the output of the following python code:
Values=[10,20,30,40]
for Va ...		
B01E-2016 #6277 

Find and write the output of the following python code:

class Book:
    def __init__(self,N=100,S="Python"): #constructor
        self.Bno=N
        self.BName=S
    def Assign(self, N,S):
        self.Bno= self.Bno + N
        self.BName= S + self.BName
    def ShowVal(self):
        print(self.Bno,"#",self.BName)
s=Book()
t=Book(200)
u=Book(300,"Made Easy")
s.ShowVal()
t.ShowVal()
u.ShowVal()
s.Assign(5, "Made ")
t.Assign(15,"Easy ")
u.Assign(25,"Made Easy")
s.ShowVal()
t.ShowVal()
u.ShowVal()
Find and write the output of the following python code:
class Book:
    def __init_ ...		
B01F-2016 #6280 

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

import random
PICKER=random.randint(0,3)
COLOR=["BLUE","PINK","GREEN","RED"];
for I in COLOR:
    for J in range(1,PICKER):
        print(I,end="")
    print()
(i) (ii) (iii) (iv)
BLUE
PINK
GREEN
RED
BLUE
BLUEPINK
BLUEPINKGREEN
BLUEPINKGREENRED
PINK
PINKGREEN
GREENRED
BLUEBLUE
PINKPINK
GREENGREEN
REDRED
What are the possible outcome(s) executed from the following code? Also specify the maxim ...
B02A #6284 

What is the difference between Multilevel and Multiple inheritance? Give suitable examples to illustrate both.

What is the difference between Multilevel and Multiple inheritance? Give suitable examples ...
B03B-2016 #6288 
What will be the output of the following python code considering the following set
of inputs?
AMAR
THREE
A123
1200
Also, explain the try and except used in the code.
Start=0
while True:
    try:
        Number=int(raw_input(“Enter Number”))
        break
    except ValueError:
    Start=Start+2
    print(“Reenter an integer”)
print(Start)
What will be the output of the following python code considering the following set
o ...		
B02C-2016 #6290 

Write a class CITY in Python with following specifications

Instance Attributes
-Ccode     # Numeric value
-CName     # String value
-Pop       # Numeric value for Population
-KM        # Numeric value
-Density   # Numeric value for Population Density
Methods:
-DenCal()  # Method to calculate Density as Pop/KM
-Record()  # Method to allow user to enter values
           Ccode,CName,Pop,KM and call DenCal() method
-View()    # Method to display all the members
           also display a message ”Highly Populated City”
           if the Density is more than 10000
Write a class CITY in Python with following specifications
Instance Attributes
-Cco ...		
B02D-2016 #6294 

How do we implement abstract method in python? Give an example for the same.

How do we implement abstract method in python? Give an example for the same. ...
B02E #6297 

What is the significance of super() method? Give an example for the same.

What is the significance of super() method? Give an example for the same. ...
B03A-2016 #6301 

What will be the status of the following list after the First, Second and Third pass of the selection sort method used for arranging the following elements in descending order?
Note: Show the status of all the elements after each pass very clearly underlining the changes.
12, 14, 54, 64, 90, 24

What will be the status of the following list after the First, Second and Third pass of t ...
B03B-2016 #6308 

For a given list of values in descending order, write a method in python to search for a value with the help of Binary Search method. The method should return position of the value and should return ‐1 if the value not present in the list.

For a given list of values in descending order, write a method in python to search for a v ...
B03C-2016 #6310 

Write Insert(City) and Delete(City) methods in python to add City and Remove City considering them to act as Insert and Delete operations of the data structure Queue.

Write Insert(City) and Delete(City) methods in python to add City and Remove City conside ...
B03D-2016 #6313 

Write a method in python to find and display the prime numbers between 2 to N. Pass N as argument to the method.

Write a method in python to find and display the prime numbers between 2 to N. Pass N as ...
B03E-2016 #6316 

Evaluate the following postfix notation of expression. Show status of stack after every operation.
12,2,/,34,20,-,+,5,+

Evaluate the following postfix notation of expression. Show status of stack after every o ...
B04A-2016 #6323 

Write a statement in Python to perform the following operations:
● To open a text file “MYPET.TXT” in write mode
● To open a text file “MYPET.TXT” in read mode

Write a statement in Python to perform the following operations: ● To open a text file ...
B04B-2016 #6325 

Write a method in python to write multiple line of text contents into a text file daynote.txt line.

Write a method in python to write multiple line of text contents into a text file daynote. ...
B04C-2016 #6327 

Consider the following definition of class Employee, write a method in python to search and display the content in a pickled file emp.dat, where Empno is matching with ‘A0005’.

class Employee:
    def __init__(self,E,NM):
        self.Empno=E
        self.EName=NM
    def Display(self):
        print(self.Empno,"-",self.EName)
Consider the following definition of class Employee, write a method in python to search a ...
B01A-2015 #6334 

How is __init( ) __different from __del ( )__ ?

How is __init( ) __different from __del ( )__ ? ...
B01B-2015 #6337 

Name the function/method required to
(i) check if a string contains only alphabets
(ii) give the total length of the list.

Name the function/method required to (i) check if a string contains only alphabets (ii) ...
B01C-2015 #6340 

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

def Sum(Count) #Method to find sum
    S=0
    for I in Range(1,Count+1):
        S+=I
    RETURN S
print Sum[2] #Function Call
print Sum[5]
Rewrite the following code in python after removing all syntax error(s). Underline each co ...
B01D-2015 #6342 

Find and write the output of the following python code :

for Name in ['John','Garima','Seema','Karan']:
    print Name
    if Name[0]== 'S':
        break
else :
    print 'Completed!'
print 'Weldone!'
Find and write the output of the following python code :
for Name in ['John','Garima ...		
B01E-2015 #6345 

Find and write the output of the following python code:

class Emp:
    def __init__(self,code,nm): #constructor
        self.Code=code
        self.Name=nm
    def Manip (self) :
        self.Code=self.Code+10
        self.Name='Karan'
    def Show(self,line):
        print self.Code,self.Name,line
s=Emp(25,'Mamta')
s.Show(1)
s.Manip()
s.Show(2)
print s.Code+len(s.Name)
Find and write the output of the following python code:
class Emp:
    def __init__ ...		
B01F-2015 #6347 

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

TEXT="CBSEONLINE"
COUNT=random.randint(0,3)
C=9

while TEXT[C]!='L':
    print TEXT[C]+TEXT[COUNT]+'*',
    COUNT=COUNT+1
    C=C1
(i)         (ii)        (iii)        (iv)
EC*NB*IS*   NS*IE*LO*   ES*NE*IO*    LE*NO*ON*
What are the possible outcome(s) executed from the following code? Also specify the maxim ...
B02A-2015 #6349 

Illustrate the concept inheritance with the help of a python code

Illustrate the concept inheritance with the help of a python code ...
B02B-2015 #6352 

What will be the output of the following python code ? Explain the try and except used in the code.

A=0
B=6
print 'One'
try:
    print 'Two'
    X=B/A
    Print 'Three'
except ZeroDivisionError:
    print B*2
    print 'Four'
except:
    print B*3
    print 'Five'
What will be the output of the following python code ? Explain the try and except used in ...
B02C-2015 #6355 

Write a class PHOTO in Python with following specifications:
Instance Attributes

-Pno       # Numeric value
-Category  # String value
-Exhibit   # Exhibition Gallery with String value
Methods:
-FixExhibit()  # A method to assign Exhibition
               # Gallery as per Category as
               # shown in the following table
Category Exhibit
Antique Zaveri
Modern Johnsen
Classic Terenida
Register()  # A function to allow user
            # to enter values of Pno, Category
            # and call FixExhibit() method
ViewAll{)   # A function to display all the data
            # members
Write a class PHOTO in Python with following specifications: Instance Attributes
-P ...		
B02D-2015 #6357 

What is operator overloading with methods? Illustrate with the help of an example using a python code.

What is operator overloading with methods? Illustrate with the help of an example using a ...
B02E-2015 #6359 

Write a method in python to display the elements of list twice, if
it is a number and display the element terminated with ‘*’ if it is
not a number.
For example, if the content of list is as follows :
MyList=[‘RAMAN’,’21’,’YOGRAJ’, ‘3’, ‘TARA’]
The output should be
RAMAN*
2121
YOGRAJ*
33
TARA*

Write a method in python to display the elements of list twice, if it is a number and dis ...
B03A-2015 #6362 

What will be the status of the following list after fourth pass of bubble sort and fourth pass of selection sort used for arranging the following elements in descending order ?
34,6,12,3,45,25

What will be the status of the following list after fourth pass of bubble sort and fourth ...
B03B-2015 #6364 

Write a method in python to search for a value in a given list (assuming that the elements in list are in ascending order) with the help of Binary Search method. The method should return -1, if the value not present else it should return position of the value present in the list.

Write a method in python to search for a value in a given list (assuming that the element ...
B03C-2015 #6369 

Write PUSH (Names) and POP (Names) methods in python to add Names and Remove names considering them to act as Push and Pop operations of Stack.

Write PUSH (Names) and POP (Names) methods in python to add Names and Remove names consid ...
B03D-2015 #6372 

Write a method in python to find and display the composite numbers between 2 to N. Pass N as argument to the method.

Write a method in python to find and display the composite numbers between 2 to N. Pass N ...
B03E-2015 #6375 

Evaluate the following postfix notation of expression. Show status of stack after every operation.
34,23,+,4,5,*,-

Evaluate the following postfix notation of expression. Show status of stack after every o ...
B04A-2015 #6378 

Differentiate between the following:
(i) f = open (‘diary. txt’, ‘a’)
(ii) f = open (‘diary. txt’, ‘w’)

Differentiate between the following: (i) f = open ('diary. txt', 'a') (ii) f = open ('di ...
B04B-2015 #6380 

Write a method in python to read the content from a text file story.txt line by line and display the same on screen.

Write a method in python to read the content from a text file story.txt line by line and d ...
B04C-2015 #6382 

Consider the following definition of class Student. Write a method in python to write the content in a pickled file student.dat

class Student:
    def_init_(self,A,N} :
        self.Admno=A
        self.Name=N
    def Show(self}:
        print (self.Admno, "#" , self.Name}
Consider the following definition of class Student. Write a method in python to write the ...
B01A-2017D #6389 

Which of the following can be used as valid variable identifier(s) in Python
(i) total
(ii) 7Salute
(iii) Que$tion
(iv) global

Which of the following can be used as valid variable identifier(s) in Python (i) total ( ...
B01B-2017D #6392 

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

Name the Python Library modules which need to be imported to invoke the following functio ...
B01C-2017D #6394 

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
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
B01D-2017D #6397 

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
Find and write the output of the following Python code:
STR = ["90","10","30","40"]
 ...		
B01E-2017 #6400 

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()
Find and write the output of the following python code:
class ITEM:
    def __init_ ...		
B01F-2017 #6402 

What are 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
(i) SOUTHNORTH   (ii) SOUTHNORTHWEST
(iii) SOUTH      (iv) EASTWESTNORTH
What are the possible outcome(s) executed from the following code? Also specify the maxim ...
B02A-2017D #6404 

List four characteristics of Object Oriented programming.

List four characteristics of Object Oriented programming. ...
B02B-2017D #6407 
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 = n
        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 similar definition. How are they different in execution?
(ii) Write statements to execute function 1 and function 2.

class Test:
    rollno=1
    marks=75
    def __init__(self,r,m): #function 1
    ...		
B02C-2017D #6409 

Define a class RING in Python with following specifications

Instance Attributes
- RingID  # Numeric value with a default value 101
- Radius  # Numeric value with a default value 10
- Area    # Numeric value
Methods:
- AreaCal()  # Method to calculate Area as
             # 3.14*Radius*Radius
- NewRing()  # Method to allow user to enter values of
             # RingID and Radius. It should also
             # Call AreaCal Method
- ViewRing() # Method to display all the Attributes
Define a class RING in Python with following specifications
Instance Attribu ...		
B02D-2017D #6411 

Differentiate between static and dynamic binding in Python? Give suitable examples of each.

Differentiate between static and dynamic binding in Python? Give suitable examples of eac ...
B02E #6414 

Write two methods in Python using concept of Function Overloading (Polymorphism) to perform the following operations:
(i) A function having one argument as side, to calculate Area of Square as side*side
(ii) A function having two arguments as Length and Breadth, to calculate Area of Rectangle as Length*Breadth.

Write two methods in Python using concept of Function Overloading (Polymorphism) to perfor ...
B03A-2017D #6416 

What will be the status of the following list after the First, Second and Third pass of the bubble sort method used for arranging the following elements in descending order ?
Note: Show the status of all the elements after each pass very clearly underlining the changes.
152, 104, -100, 604, 190, 204

What will be the status of the following list after the First, Second and Third pass of t ...
B03B-2017D #6420 

Write definition of a method OddSum(NUMBERS) to add those values in the list of NUMBERS, which are odd.

Write definition of a method OddSum(NUMBERS) to add those values in the list of NUMBERS, w ...
B03C-2017D #6422 

Write Addnew(Book) and Remove(Book) methods in Python to Add a new Book and Remove a Book from a List of Books, considering them to act as PUSH and POP operations of the data structure Stack.

Write Addnew(Book) and Remove(Book) methods in Python to Add a new Book and Remove a Book ...
B03D-2017D #6427 

Write definition of a Method AFIND(CITIES) to display all the city names from a list of CITIES, which are starting with alphabet A.
For example:
If the list CITIES contains
[“AHMEDABAD”,”CHENNAI”,”NEW DELHI”,”AMRITSAR”,”AGRA”]
The following should get displayed
AHEMDABAD
AMRITSAR
AGRA

Write definition of a Method AFIND(CITIES) to display all the city names from a list of C ...
B03E-2017D #6429 

Evaluate the following Postfix notation of expression:
2,3,*,24,2,6,+,/,-

Evaluate the following Postfix notation of expression: 2,3,*,24,2,6,+,/,- ...
B04A-2017 #6433 

Differentiate between file modes r+ and w+ with respect to Python.

Differentiate between file modes r+ and w+ with respect to Python. ...
B04B-2017D #6435 

Write a method in Python to read lines from a text file DIARY.TXT, and display those lines, which are starting with an alphabet ‘P’.

Write a method in Python to read lines from a text file DIARY.TXT, and display those line ...
B04C-2017D #6437 

Considering the following definition of class COMPANY, write a method in Python to search and display the content in a pickled file COMPANY.DAT, where CompID is matching with the value ‘1005’.

class Company:
    def __init__(self,CID,NAM):
        self.CompID = CID #CompID Company ID
        self.CName = NAM #CName Company Name
        self.Turnover = 1000
    def Display(self):
        print self.CompID,":",self.CName,":",self.Turnover
Considering the following definition of class COMPANY, write a method in Python to search ...
B01A-2016D #6443 

Out of the following, find those identifiers, which can not be used for naming Variable or Functions in a Python program:

_Cost, Price*Qty, float, Switch,
Address One, Delete, Number12, do

Out of the following, find those identifiers, which can not be used for naming Variable o ...
B01B-2016D #6446 

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

Name the Python Library modules which need to be imported to invoke the following functio ...
B01C-2016D #6449 

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

for Name in [Amar, Shveta, Parag]
    IF Name[0]='S':
        print(Name)
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
B01D-2016D #6451 

Find and write the output of the following python code:

Numbers=[9,18,27,36]
for Num in Numbers:
    for N in range(1, Num%8):
        print(N,"#",end= "" )
    print()
Find and write the output of the following python code:
Numbers=[9,18,27,36]
for Nu ...		
B01E-2016D #6453 

Find and write the output of the following python code:

class Notes:
    def __init__(self,N=100,Nt="CBSE"): #constructor
        self.Nno=N
        self.NName=Nt
    def Allocate(self, N,Nt):
        self.Nno= self.Bno + N
        self.NName= Nt + self.NName
    def Show(self):
        print(self.Nno,"#",self.NName)
s=Notes()
t=Notes(200)
u=Notes(300,"Made Easy")
s.Show()
t.Show()
u.Show()
s.Allocate(4, "Made ")
t.Allocate(10,"Easy ")
u.Allocate(25,"Made Easy")
s.Show()
t.Show()
u.Show()
Find and write the output of the following python code:
class Notes:
    def __init ...		
B01F-2016D #6456 

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

import random
PICK=random.randint(0,3)
CITY=["DELHI","MUMBAI","CHENNAI","KOLKATA"];
for I in CITY:
    for J in range(1,PICK):
        print(I,end="")
    print()
(i) (ii)
DELHIDELHI
MUMBAIMUMBAI
CHENNAICHENNAI
KOLKATAKOLKATA
DELHI
DELHIMUMBAI
DELHIMUMBAICHENNAI
(iii) (iv)
DELHI
MUMBAI
CHENNAI
KOLKATA
DELHI
MUMBAIMUMBAI
KOLKATAKOLKATAKOLKATA
What are the possible outcome(s) executed from the following code? Also specify the maximu ...
B02A-2016D #6461 

What is the difference between Multilevel and Multiple inheritance? Give suitable examples to illustrate both.

What is the difference between Multilevel and Multiple inheritance? Give suitable examples ...
B02B-2016D #6466 

What will be the output of the following python code considering the following set of inputs?
JAYA
My 3 books
PICK2
2120
Also, explain the try and except used in the code.

Counter=0
while True:
    try:
        Number=int(raw_input("Give a Number"))
        break
    except ValueError:
        Counter=Counter+2
        print("Reenter Number")
        print(Counter)
What will be the output of the following python code considering the following set of inpu ...
B02C-2016D #6468 

Write a class CITY in Python with following specifications

Instance Attributes
- Code # Numeric value
- Name # String value
- Pop # Numeric value for Population
- KM # Numeric value
- Density # Numeric value for Population Density
Methods:
- CalDen() # Method to calculate Density as Pop/KM
- Record() # Method to allow user to enter values 
           Code,Name,Pop,KM and call CalDen() method 
- See() # Method to display all the members also display
        a message "Highly Populated Area"
        if the Density is more than 12000.
Write a class CITY in Python with following specifications
Instance Attribut ...		
B02D-2016D #6472 

How do we implement abstract method in python? Give an example for the same.

How do we implement abstract method in python? Give an example for the same. ...
B02E-2016D #6475 

What is the significance of super() method? Give an example for the same.

What is the significance of super() method? Give an example for the same. ...
B03A-2016D #6478 

What will be the status of the following list after the First, Second and Third pass of the insertion sort method used for arranging the following elements in descending order?
22, 24, 64, 34, 80, 43
Note: Show the status of all the elements after each pass very clearly underlining the changes.

What will be the status of the following list after the First, Second and Third pass of t ...
B03B-2016D #6481 

For a given list of values in descending order, write a method in python to search for a value with the help of Binary Search method. The method should return position of the value and should return ]1 if the value not present in the list.

For a given list of values in descending order, write a method in python to search for a v ...
B03C-2016D #6483 

Write Insert(Place) and Delete(Place) methods in python to add Place and Remove Place considering them to act as Insert and Delete operations of the data structure Queue.

Write Insert(Place) and Delete(Place) methods in python to add Place and Remove Place cons ...
B03D-2016D #6486 

Write a method in python to find and display the prime numbers between 2 to N. Pass N as argument to the method.

Write a method in python to find and display the prime numbers between 2 to N. Pass N as a ...
B03E-2016D #6489 

Evaluate the following postfix notation of expression. Show status of stack after every operation.
22,11,/,14,10,-,+,5,-

Evaluate the following postfix notation of expression. Show status of stack after every o ...
B04A-2016D #6493 

Write a statement in Python to perform the following operations:

  • To open a text file gBOOK.TXTh in read mode
  • To open a text file gBOOK.TXTh in write mode
Write a statement in Python to perform the following operations:
  • To open a te ...
B04B-2016D #6495 

Write a method in python to write multiple line of text contents into a text file myfile.txt line.

Write a method in python to write multiple line of text contents into a text file myfile. ...
B04C-2016D #6498 

Consider the following definition of class Staff, write a method in python to search and display the content in a pickled file staff.dat, where Staffcode is matching with ‘S0105’.

class Staff:
    def __init__(self,S,SNM):
        self.Staffcode=S
        self.Name=SNM
    def Show(self):
        print(self.Staffcode," ",
        self.Name)
Consider the following definition of class Staff, write a method in python to search and ...
B01A-2015D #6505 

How is _init( ) _different from _del ( ) _ ?

How is _init( ) _different from _del ( ) _ ? ...
B01B-2015D #6507 

Name the function/method required to
(i) check if a string contains only uppercase letters
(ii) gives the total length of the list.

Name the function/method required to (i) check if a string contains only uppercase letter ...
B01C-2015D #6509 

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

def Tot(Number) #Method to find Total
    Sum=0
    for C in Range (l, Number+l):
        Sum+=C
RETURN Sum

print Tot[3]    #Function Calls
print Tot[6]
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
B01D-2015D #6511 

Find and write the output of the following python code :

for Name in ['Jayes', 'Ramya', 'Taruna','Suraj']:
    print Name
    if Name[0]== 'T':
        break
    else :
        print 'Finished!'
    print 'Got it!'
Find and write the output of the following python code :
for Name in ['Jayes', 'Ramy ...		
B01E-2015D #6514 

Find and write the output of the following python code:

class Worker :
    def_init_(self,id,name): #constructor
        self.ID=id
        self.NAME=name
    def Change (self) :
        self.ID=self.ID+10
        self.NAME='Harish'
    def Display(self,ROW) :
        print self.ID,self.NAME,ROW
w=Worker(55,'Fardeen')
w.Display(l)
w.Change( )
w.Display(2)
print w.ID+len(w.NAME)
Find and write the output of the following python code:
class Worker :
    def_init ...		
B01F-2015D #6516 

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

STRING="CBSEONLINE"
NUMBER=random.randint(0,3)
N=9
while STRING[N]!='L':
    print STRING[N]+STRING[NUMBER]+'#',
    NUMBER=NUMBER + 1
    N=Nl
(i)         (ii)        (iii)       (iv)
ES#NE#IO#   LE#NO#ON#   NS#IE#LO#   EC#NB#IS#
What are the possible outcome(s) executed from the following code? Also specify the maxim ...
B02A-2015D #6518 

Illustrate the concept inheritance with the help of a python code

Illustrate the concept inheritance with the help of a python code ...
B02B-2015D #6522 

What will be the output of the following python code ? Explain the try and except used in the code.

U=0
V=6
print 'First'
try:
    print 'Second'
    M=V/U
    print 'Third',M
    except ZeroDivisionError :
        print V*3
        print 'Fourth'
    except:
        print V*4
        print 'Fifth'
What will be the output of the following python code ? Explain the try and except used in ...
B02C-2015D #6525 

Write a class PICTURE in Python with following specifications: Instance Attributes

- Category # String value
- Location # Exhibition Location with String value
Methods:
- FixLocation() # A method to assign Exhibition
                # Location as per Category as
                # shown in the following table
Category Location
Classic Amina
Modern Jim Plaq
Antique Ustad Khan

– Enter() # A function to allow user to enter values # Pno, Category and call FixLocation() method – SeeAll() # A function to display all the data members

Write a class PICTURE in Python with following specifications: Instance Attributes
 ...		
B02D-2015D #6527 

What is operator overloading with methods? Illustrate with the help of an example using a python code.

What is operator overloading with methods? Illustrate with the help of an example using a ...
B02E-2015D #6530 

Write a method in python to display the elements of list thrice if it is a number and display the element terminated with ‘#’ if it is not a number.

For example, if the content of list is as follows:
ThisList=['41','DROND','GIRIRAJ','13','ZARA']
414141
DROND#
GIRlRAJ#
131313
ZARA#
Write a method in python to display the elements of list thrice if it is a number and dis ...
B03A-2015D #6533 

What will be the status of the following list after fourth pass of bubble sort and fourth pass of selection sort used for arranging the following elements in descending order ?
14, 10, -12, 9, 15, 35

What will be the status of the following list after fourth pass of bubble sort and fourth ...
B03B-2015D #6536 

Write a method in python to search for a value in a given list (assuming that the elements in list are in ascending order) with the help of Binary Search method. The method should return ]1 if the value not present else it should return position of the value present in the list.

Write a method in python to search for a value in a given list (assuming that the element ...
B03C-2015D #6539 

Write PUSH (Books) and POP (Books) methods in python to add Books and remove Books considering them to act as Push and Pop operations of Stack.

Write PUSH (Books) and POP (Books) methods in python to add Books and remove Books conside ...
B03D-2015D #6542 

Write a method in python to find and display the prime numbers between 2 to N. Pass N as argument to the method.

Write a method in python to find and display the prime numbers between 2 to N. Pass N as ...
B03E-2015D #6546 

Evaluate the following postfix notation of expression. Show status of stack after every operation.
84,62,-,14,3, *,+

Evaluate the following postfix notation of expression. Show status of stack after every o ...
B04A-2015D #6548 

Differentiate between the following:
(i) f = open (‘diary. txt’, ‘r’)
(ii) f = open (‘diary. txt’, ‘w’)

Differentiate between the following: (i) f = open ('diary. txt', 'r') (ii) f = open ('di ...
B04B-2015D #6550 

Write a method in python to read the content from a text file diary.txt line by line and display the same on screen.

Write a method in python to read the content from a text file diary.txt line by line and ...
B04C-2015D #6552 

Consider the following definition of class Member, write a method in python to write the content in a pickled file member.dat

class Member:
    def_init_(self,Mno,N) :
    self.Memno=Mno
    self.Name=N
def Show(self):
    Display (self.Memno, "#" , self.Name)
Consider the following definition of class Member, write a method in python to write the ...
B01A-2019S #7085 

Write the names of any four data types available in Python.

Write the names of any four data types available in Python. ...
B01B-2019S #7087 

Name the Python Library modules which need to be imported to invoke the following Function:

(i) sqrt()

(ii) start()

Name the Python Library modules which need to be imported to invoke the following Function ...
B01C-2019S #7089 

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

250 = Number
WHILE Number<=1000:
  if Number=>750:
    print Number
    Number=Number+100
  else
    print Number*2
    Number=Number+50

 

Rewrite the following code in python after removing all syntax error(s). Underline each co ...
B01D-2019S #7092 

Find and write the output of the following python code :

Msg1="WeLcOME"
Msg2="GUeSTs"
Msg3=""
for I in range(0, len(Msg2)+1):
  if Msg1[I]>="A" and Msg1[I]<="M":
    Msg3=Msg3+Msg1[I]
  elif Msg1[I]>="N" and Msg1[I]<="Z":
    Msg3=Msg3+Msg2[I]
  else:
    Msg3=Msg3+"*"
print Msg3

 

Find and write the output of the following python code :
Msg1="WeLcOME"
Msg2="GUeST ...		
B01E-2019S #7094 

Find and write the output of the following python code :

def Changer (P,Q=10) :
  P=P/Q
  Q=P%Q
  print P, "#", Q
  return P
A=200
B=20
A=Changer(A,B)
print A, "$",B
B=Changer(B)
print A, "$", B
A=Changer(A)
print A, "$" , B

Find and write the output of the following python code :
def Changer (P,Q=10) :
  P ...		
B01F-2019S #7096 

What possible output(s) are expected to be displayed on screen at the time of execution of the program from the following code ? Also specify the minimum values that can be assigned to each of the variables BEGIN and LAST.

import random
VALUES=[10,20,30,40,50,60,70,80]
BEGIN=random.randint(1,3)
LAST=random.randint(BEGIN,4)

for I in range(BEGIN, LAST+1):
print VALUES[I],"-",
(1) 30 – 40 – 50 – (ii) 10 – 20 – 30 – 40 –
(iii) 30 – 40 – 50 – 60 – (iv) 30 – 40 – 50 – 60 – 70 –
What possible output(s) are expected to be displayed on screen at the time of execution of ...
B02A-2019S #7098 

Write four features of object oriented programming.

Write four features of object oriented programming. ...
B02B-2019S-C1 #7101 
class Box:                       #Line 1
  L=10                           #Line 2
  TYpe="HARD"                    #Line 3
  def __init__(self, T, TL=30):  #Line 4
    self.Type = T                #Line 5
    self.L  = TL                 #Line 6
  def Disp(self):                #Line 7
     print self.Type, Box.Type   #Line 8
     print self.L,Box.L          #Line 9
B1=Box("SOFT",20)                #Line 10
B1.Disp()                        #Line 11
Box.Type="FLEXI"                 #Line 12
B2=Box("HARD")                   #Line 13
B2.Disp()                        #Line 14

Write the output of the above Python code.

class Box:                       #Line 1
  L=10                           #Line 2
  ...		
B02B-2019S-C2 #7107 
class Target:                    #Line 1
  def __init__(self):            #Line 2
    self.X = 20                  #Line 3
    self.Y = 20                  #Line 4
  def Disp(self):                #Line 5
    print self.X,self.Y          #Line 6
  def __del__(self):             #Line 7
     print "Target Moved"        #Line 8
def One():                       #Line 9
  T=Target()                     #Line 10
  T.Disp()                       #Line 11
One()                            #Line 12

(i) Write are the methods/functions mentioned in Line 2 and Line 7 specifically known as ?

(ii) Mention the line number of the statement, which will call and execute the method/function shown in Line 2.

class Target:                    #Line 1
  def __init__(self):            #Line 2
  ...		
B02C-2019S #7109 

Define a class House in Python with the following specifications:

Instance Attributes

-Hno              #House Number

-Nor              # Number of Rooms

-Type           # Type of the House

Methods/function

-AssignType()    # To assign Type of House

# based on Number of Rooms as follows :

 

Nor Type
<=2 LIG
==3 MIG
>3 HIG

– Enter()     # To allow user to enter value of

# Hno and Nor. Also, this method should

# call Assigntype() to assign Type

– # To display Hno, Nor and Type.

Define a class House in Python with the following specifications: Instance Attributes ...
B02D-2019S-C1 #7114 

Answer the questions(i) to (iii) based on the following:

class Furniture(object) :             #Line 1
  def __init__(self,Q) :                   #Line 2
    self.Qty = Q 
  def GetMore(self,TQ) :                   #Line 3
    self.Qty =self.Qty+TQ
  def FRDisp(self):                        #Line 4
    print self.Qty

class Fixture(object):                     #Line 5
  def __init__(self,TQ):                   #Line 6
    self.Qty=TQ
  def GetMore (self, TQ):                  #Line 7
    self.Qty = self.Qty_TQ
  def FXDisp(self):                        #Line 8
    print self .Qty
Class Flat (Furniture, Fixture):           #Line 9
  def __init__(self, fno):                 #Line 10
    self,Fno=fno
    Q=0
    if self.Fno<100:
    Q=10
    else:
    Q=20
    Furniture.__init__(self, Q):            #Line 11
    Fixture.__init__(self,Q):               #Line 12
  def More(self,Q):                         #Line 13
    Furniture.GetMore(self,Q
    Fixture.GetMore(self,Q)
  def FLDisp(self):                         #Line 14
    print self.Fno,
    Furniture.FRDisp(Self)
    Fixture.FXDisp(self)
    Fl=FLAT(101)                            #Line 15

(i) Write the type of the inheritance illustrated in the above.
(ii) Find and write the output of the above code.
(iii) What is the difference between the statements shOwn in Line 11 and Line ?

Answer the questions(i) to (iii) based on the following:
class Furniture(object) :  ...		
B02D-2019S-21 #7120 

Define inheritance, Show brief pyth0n example of single Level, Multiplier and m Multilevel Inheritance.

Define inheritance, Show brief pyth0n example of single Level, Multiplier and m Multilevel ...
B03A-2019S-C1 #7126 

Consider the following randomly ordered numbers stored in a list:
106, 104, 106, 102, 105, 10
Show the content of list after the First, Second and Third pass of the Selection sort method used for arranging in ascending order.
Note : Show the status of all the elements after each pass very clearly encircling the changes.

Consider the following randomly ordered numbers stored in a list: 106, 104, 106, 102, 105 ...
B03A-2019S-C2 #7128 

Consider the following randomly ordered numbers stored in a list:

106, 104, 106, 102, 105, 107

Show the content of list after the First, Second and Thired pass of the bubble sort method used for arranging in descending order.

 

 

Consider the following randomly ordered numbers stored in a list: 106, 104, 106, 102, 1 ...
B03B-2019S-C1 #7130 

Write definition of a method/function AddOddEven(VALUES) to display sum of odd and even values separately from the list of Values.

For example:

If the VALUES contain [15,26,37,10,22,13]

The function should display

Even Sum:58

Odd Sum:65

Write definition of a method/function AddOddEven(VALUES) to display sum of odd and even va ...
B03B-2019S-C2 #7132 

Write definition of a method/function HowMany(ID,Val) to count and display number of times the values of Val is present in the list ID.

For Example:

If the ID contains [115, 122, 137, 110, 122, 113] and Val contains 122

The function should display

122 found 2 Times

Write definition of a method/function HowMany(ID,Val) to count and displa ...
B03C-2019S-C1 #7134 

Write QueueUp(Client) and QueueDel(Client) methods/functions in Python to add a new Client and delete a Client from a List of Client names, considering them to act as insert and delete operations of the Queue data Structure.

Write QueueUp(Client) and QueueDel(Client) methods/funct ...
B03C-2019S-C2 #7137 

Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Boo and delete a Book from a List of Book titles, considering them to act as push and pop operations of the Stack data structure.

Write PushOn(Book) and Pop(Book) methods/functions in Py ...
B03D-2019S-C1 #7139 

Write a python method/function Swapper(Numbers) to swap the first half of the content of a list Numbers with second half of the content Numbers and display the swapped values.

Note: Assuming that the list has even number of values in it.

For example: if the list Numbers contains

[35, 67, 89, 23, 12, 45]

After swapping the list content should be displayed as

[23, 12, 45, 35, 67, 89]

Write a python method/function Swapper(Numbers) to swap the first half of ...
B03D-2019S-C2 #7141 

Write a python method/function Count3and7(N) to find and display the count of all those numbers which are between 1 and N,

which are either divisible by 3 or by 7.

For example :

If the value of N is 15

The sum should be displayed as 7

(as 3,6,7,9,12,14,15 in between 1 to 15 are either divisible by 3 or 7)

Write a python method/function Count3and7(N) to find and display the coun ...
B03E-2019S-C1 #7143 

Evalute the following Postfix expression, showing the stack contents:

 250,45,9,/,5,+,20,*,-

Evalute the following Postfix expression, showing the stack contents:  250,45, ...
B03E-2019S-C2 #7145 

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion:

A + B * C ^ D – E

Convert the following Infix expression to its equivalent Postfix expression, showing the s ...
B04A-2019S-C1 #7148 

Write a statement in Python to open a text file WRITEUP.TXT so that new content can be written in it .

Write a statement in Python to open a text file WRITEUP.TXT so that new c ...
B04A-2019S-C2 #7150 

Write a statement in Python to open a text file README.TXT so that existing content can be read from it.

Write a statement in Python to open a text file README.TXT so that existi ...
B04B-2019S-C1 #7152 

Write a method/function ISTOUPCOUNT() in python to read contents from a text file WRITER>TXT, to count and display the occurrence of the word “IS” or “TO” or “UP”.

For example:

If the content of the file is

IT IS UP TO US TO TAKE CARE OF OUR SURROUNDING. IT IS NOT POSSIBLE ONLY FOR THE GOVERNMENT TO TAKE RESPONSIBILITY

The method/function should display

Count of IS TO and UP is 6

Write a method/function ISTOUPCOUNT() in python to read contents from a t ...
B04B-2019S-C2 #7154 

Write a method/function AEDISP() in python to read lines from a text file WRITER.TXT, and display those lines, which are starting either with A or starting with E.

Write a method/function AEDISP() in python to read lines from a text file WRITER.TXT, and ...
B04C-2019S-C1 #7156 

Considering the following definition of class STOCK, write a method/function COSTLY() in pyhton to search and display Name and Price from a pickled file STOCK.DAT, where Price of the items are more than 1000.

class Stock:
  def __init__(self, N, P):
    self.Name=N
    self.Price=P
  def Show(self) :
    print self.Name, "@", self.Price
Considering the following definition of class STOCK, write a method/function COSTLY() in p ...
B04C-2019S-C2 #7158 

Considering the following definition of class DOCTORS, write a method/function SPLDOCS() in python to search and display all the content from a pickled file DOCS.DAT, where Specialisation of DOCTORS is “CARDIOLOGY”.

class DOCTORS:
def __init__(self,N,S):
  self.Name=N
  self.Specialisation=S
def Disp(self):
  print self.Name, "#", self.Specialication

 

Considering the following definition of class DOCTORS, write a method/function SPLDOCS() i ...
Exam Questions
CBSE12A-2018-B01A  B01A #6088 

Differentiate between Syntax Error and Run-Time Error? Also, write a suitable example in Python to illustrate both.

Differentiate between Syntax Error and Run-Time Error? Also, write a suitable example in ...
CBSE12A-2018-B01A  B01A-2018 #6095 

Name the Python Library modules which need to be imported to invoke the following functions:

(i) sin() (ii) search ()

Name the Python Library modules which need to be imported to invoke the following functio ...
CBSE12A-2018-B01C  B01C #6099 

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

Val = int(rawinput("Value:"))
Adder = 0

for C in range(1,Val,3)
    Adder+=C
    if C%2=0:
        Print C*10
    Else:
        print C*
print Adder
Rewrite the following code in python after removing all syntax error(s). Underline each co ...
CBSE12A-2018-B01D  B01D #6101 

Find and write the output of the following python code:

Data  = ["P",20,"R",10,"S",30]
Times = 0
Alpha = ""
Add   = 0
for C in range(1,6,2):
    Times= Times + C
    Alpha= Alpha + Data[C-1]+"$"
    Add = Add + Data[C]
    print Times,Add,Alpha
Find and write the output of the following python code:
Data  = ["P",20,"R",10,"S",3 ...		
CBSE12A-2018-B01E  B01E #6105 

Find and write the output of the following python code:

class GRAPH:
    def __init__(self,A=50,B=100):
        self.P1=A
        self.P2=B
    def Up(self,B):
        self.P2 = self.P2 - B
    def Down(self,B):
        self.P2 = self.P2 + 2*B
    def Left(self,A):
        self.P1 = self.P1 - A
    def Right(self,A):
        self.P1 = self.P1 + 2*A
    def Target(self):
        print "(",self.P1.":",self.P2,")"
G1=GRAPH(200,150)
G2=GRAPH()
G3=GRAPH(100)
G1.Left(10)
G2.Up(25)
G3.Down(75)
G1.Up(30)
G3.Right(15)
G1.Target()
G2.Target()
G3.Target()
Find and write the output of the following python code:
class GRAPH:
    def __init ...		
CBSE12A-2018-B01F  B01F #6107 

What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from the following code? Also specify the maximum values that can be assigned to each of the variables BEGIN and LAST.

import random
POINTS=[20,40,10,30,15];
POINTS=[30,50,20,40,45];
BEGIN=random.randint(1,3)
LAST=random.randint(2,4)
for C in range(BEGIN,LAST+1):
print POINTS[C],”#”,

(i) 20#50#30#           (ii) 20#40#45#
(iii) 50#20#40#         (iv) 30#50#20#
What possible outputs(s) are expected to be displayed on screen at the time of execution ...
CBSE12A-2018-B02A  B02A-2018 #6109 

What is the advantage of super() function in inheritance? Illustrate the same with the help of an example in Python.

What is the advantage of super() function in inheritance? Illustrate the same with the he ...
CBSE12A-2018-B02B  B02B #6116 
class Vehicle:                        #Line 1
    Type = 'Car'                      #Line 2
    def __init__(self, name):         #Line 3
        self.Name = name              #Line 4
    def Show(self):                   #Line 5
        print self.Name,Vehicle.Type  #Line 6

V1=Vehicle("BMW")                     #Line 7
V1.Show()                             #Line 8
Vehicle.Type="Bus"                    #Line 9
V2=Vehicle("VOLVO")                   #Line 10
V2.Show()                             #Line 11

(i) What is the difference between the variable in Line 2 and Line 4 in the above Python code?

(ii) Write the output of the above Python code.

class Vehicle:                        #Line 1
    Type = 'Car'                       ...		
CBSE12A-2018-B02C  B02C-2018 #6120 

Define a class CONTAINER in Python with following specifications

Instance Attributes
- Radius,Height   # Radius and Height of Container
- Type            # Type of Container
- Volume          # Volume of Container

Methods
- CalVolume()     # To calculate volume
                  # as per the Type of container
                  # With the formula as given below:
Type Formula to calculate Volume
1 3.14 * Radius * Height
3 3.14 * Radius * Height/3
- GetValue()       # To allow user to enter values of
                   # Radius, Height and Type.
                   # Also, this method should call
                   # CalVolume() to calculate Volume
- ShowContainer()  # To display Radius, Height, Type
                   # Volume of the Container
Define a class CONTAINER in Python with following specifications
Instance Attributes ...		
CBSE12A-2018-B02D  B02D #6123 

Answer the questions (i) to (iv) based on the following:

Class Top1(object):
    def __init__(self,tx): #Line 1
        self.X=tx              #Line 2
    def ChangeX(self,tx):
        self.X=self.X+tx
    def ShowX(self):
        print self.X
Class Top2(object):
    def __init__(self,ty): #Line 3
        self.Y=ty              #Line 4
    def ChangeY(self,ty):
        self.Y=self.Y+ty
    def ShowY(self):
        print self.Y,
class Bottom(Top1,Top2):
    def __init__(self,tz): #Line 5
        self.Z = tz #Line 6
        Top2.__init__(self,2*tz) #Line 7
        Top1.__init__(self,3*tz) #Line 8
    def ChangeZ(self,tz):
        self.Z=self.Z+tz
        self.ChangeY(2*tz)
        self.ChangeX(3*tz)
    def ShowZ(self):
        print self.Z,
        self.ShowY()
        self.ShowX()
    B=Bottom(1)
    B.ChangeZ(2)
    B.ShowZ()

(i) Write the type of the inheritance illustrated in the above.

(ii) Find and write the output of the above code.

(iii) What are the methods shown in Line 1, Line 3 and Line 5 are known as?

(iv) What is the difference between the statements shown in Line 6 and Line 7?

Answer the questions (i) to (iv) based on the following:
Class Top1(object):
    de ...		
CBSE12A-2018-B03A  B03A #6126 

Consider the following randomly ordered numbers stored in a list
786, 234, 526, 132, 345, 467,
Show the content of list after the First, Second and Third pass of the bubble sort method used for arranging in ascending order ?
Note: Show the status of all the elements after each pass very clearly underlining the changes.

Consider the following randomly ordered numbers stored in a list 786, 234, 526, 132, 345, ...
CBSE12A-2018-B03B  B03B-2018 #6128 

Write definition of a method ZeroEnding(SCORES) to add all those values in the list of SCORES, which are ending with zero (0) and display the sum.
For example,
If the SCORES contain [200,456,300,100,234,678]
The sum should be displayed as 600

Write definition of a method ZeroEnding(SCORES) to add all those values in the list of SCO ...
CBSE12A-2018-B03C  B03C-2018 #6130 

Write AddClient(Client) and DeleteCleint(Client) methods in python to add a new Client and delete a Client from a List of Client Names, considering them to act as insert and delete operations of the queue data structure.

Write AddClient(Client) and DeleteCleint(Client) methods in python to add a new Client and ...
CBSE12A-2018-B03D  B03D #6133 

Write definition of a Method COUNTNOW(PLACES) to find and display those place
names, in which there are more than 5 characters.
For example:
If the list PLACES contains
[“DELHI”,”LONDON”,”PARIS”,”NEW YORK”,”DUBAI”]
The following should get displayed
LONDON
NEW YORK

Write definition of a Method COUNTNOW(PLACES) to find and display those place names, in w ...
CBSE12A-2018-B03E  B03E #6136 

Evaluate the following Postfix notation of expression:
22,11,/,5,10,*,+,12,-

Evaluate the following Postfix notation of expression: 22,11,/,5,10,*,+,12,- ...
CBSE12A-2018-B04A  B04A #6139 

Write a statement in Python to open a text file STORY.TXT so that new contents can be added at the end of it.

Write a statement in Python to open a text file STORY.TXT so that new contents can be adde ...
CBSE12A-2018-B04B  B04B #6142 

Write a method in python to read lines from a text file INDIA.TXT, to find and display the occurrence of the word “India”.
For example:
If the content of the file is

“India is the fastest growing economy. 
India is looking for more investments around the globe.
The whole world is looking at India as a great market. 
Most of the Indians can foresee the heights that India is
capable of reaching.”

The output should be 4

Write a method in python to read lines from a text file INDIA.TXT, to find and display the ...
CBSE12A-2018-B04C  B04C #6144 

Considering the following definition of class MULTIPLEX, write a method in python to search and display all the content in a pickled file CINEMA.DAT, where MTYPE is matching with the value ‘Comedy’.

class MULTIPLEX:
    def __init__(self,mno,mname,mtype):
        self.MNO = mno
        self.MNAME = mname
        self.MTYPE = mtype
    def Show(self):
        print self.MNO:"*",self.MNAME,"$",self.MTYPE
Considering the following definition of class MULTIPLEX, write a method in python to sear ...
CBSE12A-2017-B01A  B01A-2017 #6211 

Which of the following can be used as valid variable identifier(s) in Python?
(i) 4thSum
(ii) Total
(iii) Number#
(iv) Data

Which of the following can be used as valid variable identifier(s) in Python? (i) 4thSum ...
CBSE12A-2017-B01B  B01B-2017 #6214 

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

Name the Python Library modules which need to be imported to invoke the following function ...
CBSE12A-2017-B01C  B01C-2017 #6216 

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
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
CBSE12A-2017-B01D  B01D-2017 #6218 

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 TOTAL
    CNT-=1
Find and write the output of the following python code:
TXT   = ["20","50","30","40" ...		
CBSE12A-2017-B01E  B01E-2017 #6221 

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()
Find and write the output of the following python code:
class INVENTORY:
    def __ ...		
CBSE12A-2017-B01F  B01F-2017 #6223 
What are 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
What are the possible outcome(s) executed from the following code? Also
specify the  ...		
CBSE12A-2017-B02A  B02A-2017 #6226 

List four characteristics of Object Oriented programming.

List four characteristics of Object Oriented programming. ...
CBSE12A-2017-B02B  B02B-2017 #6229 
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.

class Exam:
   Regno=1
   Marks=75
   def __init__(self,r,m): #function 1
        ...		
CBSE12A-2017-B02C  B02C-2017 #6231 

Define a class BOX in Python with following specifications

Instance Attributes
- BoxID   # Numeric value with a default value 101
- Side   # Numeric value with a default value 10
- Area   # Numeric value with a default value 0
Methods:
- ExecArea() # Method to calculate Area as
             # Side * Side
- NewBox() # Method to allow user to enter values of
           # BoxID and Side. It should also
           # Call ExecArea Method
- ViewBox() # Method to display all the Attributes
Define a class BOX in Python with following specifications
Instance Attributes
- Bo ...		
CBSE12A-2017-B02D  B02D-2017 #6236 

Differentiate between static and dynamic binding in Python? Give suitable examples of each.

Differentiate between static and dynamic binding in Python? Give suitable examples of eac ...
CBSE12A-2017-B02E  B02E-2017 #6238 

Write two methods in python using concept of Function Overloading (Polymorphism) to perform the following operations:
(i) A function having one argument as Radius, to calculate Area of Circle as 3.14#Radius#Radius
(ii) A function having two arguments as Base and Height, to calculate Area of right angled triangle as 0.5#Base#Height .

Write two methods in python using concept of Function Overloading (Polymorphism) to perfo ...
CBSE12A-2017-B03A  B03A-2017 #6240 

What will be the status of the following list after the First, Second and Third pass of the bubble sort method used for arranging the following elements in ascending order ?
Note: Show the status of all the elements after each pass very clearly underlining the changes.
52, 42, -10, 60, 90, 20

What will be the status of the following list after the First, Second and Third pass of t ...
CBSE12A-2017-B03B  B03B-2017 #6244 

Write definition of a method EvenSum(NUMBERS) to add those values in the list of NUMBERS, which are odd.

Write definition of a method EvenSum(NUMBERS) to add those values in the list of NUMBERS, ...
CBSE12A-2017-B03C  B03C-2017 #6246 

Write Addnew(Member) and Remove(Member) methods 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.

Write Addnew(Member) and Remove(Member) methods in python to Add a new Member and Remove ...
CBSE12A-2017-B03D  B03D-2017 #6249 

Write definition of a Method MSEARCH(STATES) to display all the state names
from a list of STATES, which are starting with alphabet M.
For example:
If the list STATES contains
[“MP”,”UP”,”WB”,”TN”,”MH”,”MZ”,”DL”,”BH”,”RJ”,”HR”]
The following should get displayed
MP
MH
MZ

Write definition of a Method MSEARCH(STATES) to display all the state names from a list o ...
CBSE12A-2017-B03E  B03E-2017 #6253 

Evaluate the following Postfix notation of expression:
4,2,*,22,5,6,+,/,-

Evaluate the following Postfix notation of expression: 4,2,*,22,5,6,+,/,- ...
CBSE12A-2017-B04A  B04A-2017 #6256 

Differentiate between file modes r+ and rb+ with respect to Python.

Differentiate between file modes r+ and rb+ with respect to Python. ...
CBSE12A-2017-B04B  B04B-2017 #6258 

Write a method in python to read lines from a text file MYNOTES.TXT, and display
those lines, which are starting with an alphabet ‘K’.

Write a method in python to read lines from a text file MYNOTES.TXT, and display those li ...
CBSE12A-2017-B04C  B04C-2017 #6260 

Considering the following definition of class FACTORY, write a method in Python to search and display the content in a pickled file FACTORY.DAT, where FCTID is matching with the value ‘105’.

class Factory:
    def __init__(self,FID,FNAM):
        self.FCTID = FID # FCTID Factory ID
        self.FCTNM = FNAM # FCTNM Factory Name
        self.PROD = 1000 # PROD Production
    def Display(self):
        print self.FCTID,":",self.FCTNM,":",self.PROD
Considering the following definition of class FACTORY, write a method in Python to search ...
CBSE12A-2016-B01A  B01A-2016 #6266 

Out of the following, find those identifiers, which can not be used for naming Variable or Functions in a Python program:
Total*Tax, While, class, switch,
3rdRow, finally, Column31, _Total

Out of the following, find those identifiers, which can not be used for naming Variable o ...
CBSE12A-2016-B01B  B01B-2016 #6268 

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

Name the Python Library modules which need to be imported to invoke the following functio ...
CBSE12A-2016-B01C  B01C-2016 #6271 

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

for Name in [Ramesh,Suraj,Priya]
    IF Name[0]='S':
        print(Name
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
CBSE12A-2016-B01D  B01D-2016 #6274 

Find and write the output of the following python code:

Values=[10,20,30,40]
for Val in Values:
    for I in range(1, Val%9):
        print(I,"*",end= "" )
    print()
Find and write the output of the following python code:
Values=[10,20,30,40]
for Va ...		
CBSE12A-2016-B01E  B01E-2016 #6277 

Find and write the output of the following python code:

class Book:
    def __init__(self,N=100,S="Python"): #constructor
        self.Bno=N
        self.BName=S
    def Assign(self, N,S):
        self.Bno= self.Bno + N
        self.BName= S + self.BName
    def ShowVal(self):
        print(self.Bno,"#",self.BName)
s=Book()
t=Book(200)
u=Book(300,"Made Easy")
s.ShowVal()
t.ShowVal()
u.ShowVal()
s.Assign(5, "Made ")
t.Assign(15,"Easy ")
u.Assign(25,"Made Easy")
s.ShowVal()
t.ShowVal()
u.ShowVal()
Find and write the output of the following python code:
class Book:
    def __init_ ...		
CBSE12A-2016-B01F  B01F-2016 #6280 

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

import random
PICKER=random.randint(0,3)
COLOR=["BLUE","PINK","GREEN","RED"];
for I in COLOR:
    for J in range(1,PICKER):
        print(I,end="")
    print()
(i) (ii) (iii) (iv)
BLUE
PINK
GREEN
RED
BLUE
BLUEPINK
BLUEPINKGREEN
BLUEPINKGREENRED
PINK
PINKGREEN
GREENRED
BLUEBLUE
PINKPINK
GREENGREEN
REDRED
What are the possible outcome(s) executed from the following code? Also specify the maxim ...
CBSE12A-2016-B02A  B02A #6284 

What is the difference between Multilevel and Multiple inheritance? Give suitable examples to illustrate both.

What is the difference between Multilevel and Multiple inheritance? Give suitable examples ...
CBSE12A-2016-B02B  B03B-2016 #6288 
What will be the output of the following python code considering the following set
of inputs?
AMAR
THREE
A123
1200
Also, explain the try and except used in the code.
Start=0
while True:
    try:
        Number=int(raw_input(“Enter Number”))
        break
    except ValueError:
    Start=Start+2
    print(“Reenter an integer”)
print(Start)
What will be the output of the following python code considering the following set
o ...		
CBSE12A-2016-B02C  B02C-2016 #6290 

Write a class CITY in Python with following specifications

Instance Attributes
-Ccode     # Numeric value
-CName     # String value
-Pop       # Numeric value for Population
-KM        # Numeric value
-Density   # Numeric value for Population Density
Methods:
-DenCal()  # Method to calculate Density as Pop/KM
-Record()  # Method to allow user to enter values
           Ccode,CName,Pop,KM and call DenCal() method
-View()    # Method to display all the members
           also display a message ”Highly Populated City”
           if the Density is more than 10000
Write a class CITY in Python with following specifications
Instance Attributes
-Cco ...		
CBSE12A-2016-B02D  B02D-2016 #6294 

How do we implement abstract method in python? Give an example for the same.

How do we implement abstract method in python? Give an example for the same. ...
CBSE12A-2016-B02E  B02E #6297 

What is the significance of super() method? Give an example for the same.

What is the significance of super() method? Give an example for the same. ...
CBSE12A-2016-B03A  B03A-2016 #6301 

What will be the status of the following list after the First, Second and Third pass of the selection sort method used for arranging the following elements in descending order?
Note: Show the status of all the elements after each pass very clearly underlining the changes.
12, 14, 54, 64, 90, 24

What will be the status of the following list after the First, Second and Third pass of t ...
CBSE12A-2016-B03B  B03B-2016 #6308 

For a given list of values in descending order, write a method in python to search for a value with the help of Binary Search method. The method should return position of the value and should return ‐1 if the value not present in the list.

For a given list of values in descending order, write a method in python to search for a v ...
CBSE12A-2016-B03C  B03C-2016 #6310 

Write Insert(City) and Delete(City) methods in python to add City and Remove City considering them to act as Insert and Delete operations of the data structure Queue.

Write Insert(City) and Delete(City) methods in python to add City and Remove City conside ...
CBSE12A-2016-B03D  B03D-2016 #6313 

Write a method in python to find and display the prime numbers between 2 to N. Pass N as argument to the method.

Write a method in python to find and display the prime numbers between 2 to N. Pass N as ...
CBSE12A-2016-B03E  B03E-2016 #6316 

Evaluate the following postfix notation of expression. Show status of stack after every operation.
12,2,/,34,20,-,+,5,+

Evaluate the following postfix notation of expression. Show status of stack after every o ...
CBSE12A-2016-B04A  B04A-2016 #6323 

Write a statement in Python to perform the following operations:
● To open a text file “MYPET.TXT” in write mode
● To open a text file “MYPET.TXT” in read mode

Write a statement in Python to perform the following operations: ● To open a text file ...
CBSE12A-2016-B04B  B04B-2016 #6325 

Write a method in python to write multiple line of text contents into a text file daynote.txt line.

Write a method in python to write multiple line of text contents into a text file daynote. ...
CBSE12A-2016-B04C  B04C-2016 #6327 

Consider the following definition of class Employee, write a method in python to search and display the content in a pickled file emp.dat, where Empno is matching with ‘A0005’.

class Employee:
    def __init__(self,E,NM):
        self.Empno=E
        self.EName=NM
    def Display(self):
        print(self.Empno,"-",self.EName)
Consider the following definition of class Employee, write a method in python to search a ...
CBSE12A-2015-B01B  B01B-2015 #6337 

Name the function/method required to
(i) check if a string contains only alphabets
(ii) give the total length of the list.

Name the function/method required to (i) check if a string contains only alphabets (ii) ...
CBSE12A-2015-B01C  B01C-2015 #6340 

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

def Sum(Count) #Method to find sum
    S=0
    for I in Range(1,Count+1):
        S+=I
    RETURN S
print Sum[2] #Function Call
print Sum[5]
Rewrite the following code in python after removing all syntax error(s). Underline each co ...
CBSE12A-2015-B01D  B01D-2015 #6342 

Find and write the output of the following python code :

for Name in ['John','Garima','Seema','Karan']:
    print Name
    if Name[0]== 'S':
        break
else :
    print 'Completed!'
print 'Weldone!'
Find and write the output of the following python code :
for Name in ['John','Garima ...		
CBSE12A-2015-B01E  B01E-2015 #6345 

Find and write the output of the following python code:

class Emp:
    def __init__(self,code,nm): #constructor
        self.Code=code
        self.Name=nm
    def Manip (self) :
        self.Code=self.Code+10
        self.Name='Karan'
    def Show(self,line):
        print self.Code,self.Name,line
s=Emp(25,'Mamta')
s.Show(1)
s.Manip()
s.Show(2)
print s.Code+len(s.Name)
Find and write the output of the following python code:
class Emp:
    def __init__ ...		
CBSE12A-2015-B01F  B01F-2015 #6347 

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

TEXT="CBSEONLINE"
COUNT=random.randint(0,3)
C=9

while TEXT[C]!='L':
    print TEXT[C]+TEXT[COUNT]+'*',
    COUNT=COUNT+1
    C=C1
(i)         (ii)        (iii)        (iv)
EC*NB*IS*   NS*IE*LO*   ES*NE*IO*    LE*NO*ON*
What are the possible outcome(s) executed from the following code? Also specify the maxim ...
CBSE12A-2015-B02A  B02A-2015 #6349 

Illustrate the concept inheritance with the help of a python code

Illustrate the concept inheritance with the help of a python code ...
CBSE12A-2015-B02B  B02B-2015 #6352 

What will be the output of the following python code ? Explain the try and except used in the code.

A=0
B=6
print 'One'
try:
    print 'Two'
    X=B/A
    Print 'Three'
except ZeroDivisionError:
    print B*2
    print 'Four'
except:
    print B*3
    print 'Five'
What will be the output of the following python code ? Explain the try and except used in ...
CBSE12A-2015-B02C  B02C-2015 #6355 

Write a class PHOTO in Python with following specifications:
Instance Attributes

-Pno       # Numeric value
-Category  # String value
-Exhibit   # Exhibition Gallery with String value
Methods:
-FixExhibit()  # A method to assign Exhibition
               # Gallery as per Category as
               # shown in the following table
Category Exhibit
Antique Zaveri
Modern Johnsen
Classic Terenida
Register()  # A function to allow user
            # to enter values of Pno, Category
            # and call FixExhibit() method
ViewAll{)   # A function to display all the data
            # members
Write a class PHOTO in Python with following specifications: Instance Attributes
-P ...		
CBSE12A-2015-B02D  B02D-2015 #6357 

What is operator overloading with methods? Illustrate with the help of an example using a python code.

What is operator overloading with methods? Illustrate with the help of an example using a ...
CBSE12A-2015-B02E  B02E-2015 #6359 

Write a method in python to display the elements of list twice, if
it is a number and display the element terminated with ‘*’ if it is
not a number.
For example, if the content of list is as follows :
MyList=[‘RAMAN’,’21’,’YOGRAJ’, ‘3’, ‘TARA’]
The output should be
RAMAN*
2121
YOGRAJ*
33
TARA*

Write a method in python to display the elements of list twice, if it is a number and dis ...
CBSE12A-2015-B03A  B03A-2015 #6362 

What will be the status of the following list after fourth pass of bubble sort and fourth pass of selection sort used for arranging the following elements in descending order ?
34,6,12,3,45,25

What will be the status of the following list after fourth pass of bubble sort and fourth ...
CBSE12A-2015-B03B  B03B-2015 #6364 

Write a method in python to search for a value in a given list (assuming that the elements in list are in ascending order) with the help of Binary Search method. The method should return -1, if the value not present else it should return position of the value present in the list.

Write a method in python to search for a value in a given list (assuming that the element ...
CBSE12A-2015-B03C  B03C-2015 #6369 

Write PUSH (Names) and POP (Names) methods in python to add Names and Remove names considering them to act as Push and Pop operations of Stack.

Write PUSH (Names) and POP (Names) methods in python to add Names and Remove names consid ...
CBSE12A-2015-B03D  B03D-2015 #6372 

Write a method in python to find and display the composite numbers between 2 to N. Pass N as argument to the method.

Write a method in python to find and display the composite numbers between 2 to N. Pass N ...
CBSE12A-2015-B03E  B03E-2015 #6375 

Evaluate the following postfix notation of expression. Show status of stack after every operation.
34,23,+,4,5,*,-

Evaluate the following postfix notation of expression. Show status of stack after every o ...
CBSE12A-2015-B04A  B04A-2015 #6378 

Differentiate between the following:
(i) f = open (‘diary. txt’, ‘a’)
(ii) f = open (‘diary. txt’, ‘w’)

Differentiate between the following: (i) f = open ('diary. txt', 'a') (ii) f = open ('di ...
CBSE12A-2015-B04B  B04B-2015 #6380 

Write a method in python to read the content from a text file story.txt line by line and display the same on screen.

Write a method in python to read the content from a text file story.txt line by line and d ...
CBSE12A-2015-B04C  B04C-2015 #6382 

Consider the following definition of class Student. Write a method in python to write the content in a pickled file student.dat

class Student:
    def_init_(self,A,N} :
        self.Admno=A
        self.Name=N
    def Show(self}:
        print (self.Admno, "#" , self.Name}
Consider the following definition of class Student. Write a method in python to write the ...
CBSE12D-2017-B01A  B01A-2017D #6389 

Which of the following can be used as valid variable identifier(s) in Python
(i) total
(ii) 7Salute
(iii) Que$tion
(iv) global

Which of the following can be used as valid variable identifier(s) in Python (i) total ( ...
CBSE12D-2017-B01B  B01B-2017D #6392 

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

Name the Python Library modules which need to be imported to invoke the following functio ...
CBSE12D-2017-B01C  B01C-2017D #6394 

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
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
CBSE12D-2017-B01D  B01D-2017D #6397 

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
Find and write the output of the following Python code:
STR = ["90","10","30","40"]
 ...		
CBSE12D-2017-B01E  B01E-2017 #6400 

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()
Find and write the output of the following python code:
class ITEM:
    def __init_ ...		
CBSE12D-2017-B01F  B01F-2017 #6402 

What are 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
(i) SOUTHNORTH   (ii) SOUTHNORTHWEST
(iii) SOUTH      (iv) EASTWESTNORTH
What are the possible outcome(s) executed from the following code? Also specify the maxim ...
CBSE12D-2017-B02A  B02A-2017D #6404 

List four characteristics of Object Oriented programming.

List four characteristics of Object Oriented programming. ...
CBSE12D-2017-B02B  B02B-2017D #6407 
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 = n
        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 similar definition. How are they different in execution?
(ii) Write statements to execute function 1 and function 2.

class Test:
    rollno=1
    marks=75
    def __init__(self,r,m): #function 1
    ...		
CBSE12D-2017-B02C  B02C-2017D #6409 

Define a class RING in Python with following specifications

Instance Attributes
- RingID  # Numeric value with a default value 101
- Radius  # Numeric value with a default value 10
- Area    # Numeric value
Methods:
- AreaCal()  # Method to calculate Area as
             # 3.14*Radius*Radius
- NewRing()  # Method to allow user to enter values of
             # RingID and Radius. It should also
             # Call AreaCal Method
- ViewRing() # Method to display all the Attributes
Define a class RING in Python with following specifications
Instance Attribu ...		
CBSE12D-2017-B02D  B02D-2017D #6411 

Differentiate between static and dynamic binding in Python? Give suitable examples of each.

Differentiate between static and dynamic binding in Python? Give suitable examples of eac ...
CBSE12D-2017-B02E  B02E #6414 

Write two methods in Python using concept of Function Overloading (Polymorphism) to perform the following operations:
(i) A function having one argument as side, to calculate Area of Square as side*side
(ii) A function having two arguments as Length and Breadth, to calculate Area of Rectangle as Length*Breadth.

Write two methods in Python using concept of Function Overloading (Polymorphism) to perfor ...
CBSE12D-2017-B03A  B03A-2017D #6416 

What will be the status of the following list after the First, Second and Third pass of the bubble sort method used for arranging the following elements in descending order ?
Note: Show the status of all the elements after each pass very clearly underlining the changes.
152, 104, -100, 604, 190, 204

What will be the status of the following list after the First, Second and Third pass of t ...
CBSE12D-2017-B03B  B03B-2017D #6420 

Write definition of a method OddSum(NUMBERS) to add those values in the list of NUMBERS, which are odd.

Write definition of a method OddSum(NUMBERS) to add those values in the list of NUMBERS, w ...
CBSE12D-2017-B03C  B03C-2017D #6422 

Write Addnew(Book) and Remove(Book) methods in Python to Add a new Book and Remove a Book from a List of Books, considering them to act as PUSH and POP operations of the data structure Stack.

Write Addnew(Book) and Remove(Book) methods in Python to Add a new Book and Remove a Book ...
CBSE12D-2017-B03D  B03D-2017D #6427 

Write definition of a Method AFIND(CITIES) to display all the city names from a list of CITIES, which are starting with alphabet A.
For example:
If the list CITIES contains
[“AHMEDABAD”,”CHENNAI”,”NEW DELHI”,”AMRITSAR”,”AGRA”]
The following should get displayed
AHEMDABAD
AMRITSAR
AGRA

Write definition of a Method AFIND(CITIES) to display all the city names from a list of C ...
CBSE12D-2017-B03E  B03E-2017D #6429 

Evaluate the following Postfix notation of expression:
2,3,*,24,2,6,+,/,-

Evaluate the following Postfix notation of expression: 2,3,*,24,2,6,+,/,- ...
CBSE12D-2017-B04A  B04A-2017 #6433 

Differentiate between file modes r+ and w+ with respect to Python.

Differentiate between file modes r+ and w+ with respect to Python. ...
CBSE12D-2017-B04B  B04B-2017D #6435 

Write a method in Python to read lines from a text file DIARY.TXT, and display those lines, which are starting with an alphabet ‘P’.

Write a method in Python to read lines from a text file DIARY.TXT, and display those line ...
CBSE12D-2017-B04C  B04C-2017D #6437 

Considering the following definition of class COMPANY, write a method in Python to search and display the content in a pickled file COMPANY.DAT, where CompID is matching with the value ‘1005’.

class Company:
    def __init__(self,CID,NAM):
        self.CompID = CID #CompID Company ID
        self.CName = NAM #CName Company Name
        self.Turnover = 1000
    def Display(self):
        print self.CompID,":",self.CName,":",self.Turnover
Considering the following definition of class COMPANY, write a method in Python to search ...
CBSE12D-2016-B01A  B01A-2016D #6443 

Out of the following, find those identifiers, which can not be used for naming Variable or Functions in a Python program:

_Cost, Price*Qty, float, Switch,
Address One, Delete, Number12, do

Out of the following, find those identifiers, which can not be used for naming Variable o ...
CBSE12D-2016-B01B  B01B-2016D #6446 

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

Name the Python Library modules which need to be imported to invoke the following functio ...
CBSE12D-2016-B01C  B01C-2016D #6449 

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

for Name in [Amar, Shveta, Parag]
    IF Name[0]='S':
        print(Name)
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
CBSE12D-2016-B01D  B01D-2016D #6451 

Find and write the output of the following python code:

Numbers=[9,18,27,36]
for Num in Numbers:
    for N in range(1, Num%8):
        print(N,"#",end= "" )
    print()
Find and write the output of the following python code:
Numbers=[9,18,27,36]
for Nu ...		
CBSE12D-2016-B01E  B01E-2016D #6453 

Find and write the output of the following python code:

class Notes:
    def __init__(self,N=100,Nt="CBSE"): #constructor
        self.Nno=N
        self.NName=Nt
    def Allocate(self, N,Nt):
        self.Nno= self.Bno + N
        self.NName= Nt + self.NName
    def Show(self):
        print(self.Nno,"#",self.NName)
s=Notes()
t=Notes(200)
u=Notes(300,"Made Easy")
s.Show()
t.Show()
u.Show()
s.Allocate(4, "Made ")
t.Allocate(10,"Easy ")
u.Allocate(25,"Made Easy")
s.Show()
t.Show()
u.Show()
Find and write the output of the following python code:
class Notes:
    def __init ...		
CBSE12D-2016-B01F  B01F-2016D #6456 

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

import random
PICK=random.randint(0,3)
CITY=["DELHI","MUMBAI","CHENNAI","KOLKATA"];
for I in CITY:
    for J in range(1,PICK):
        print(I,end="")
    print()
(i) (ii)
DELHIDELHI
MUMBAIMUMBAI
CHENNAICHENNAI
KOLKATAKOLKATA
DELHI
DELHIMUMBAI
DELHIMUMBAICHENNAI
(iii) (iv)
DELHI
MUMBAI
CHENNAI
KOLKATA
DELHI
MUMBAIMUMBAI
KOLKATAKOLKATAKOLKATA
What are the possible outcome(s) executed from the following code? Also specify the maximu ...
CBSE12D-2016-B02A  B02A-2016D #6461 

What is the difference between Multilevel and Multiple inheritance? Give suitable examples to illustrate both.

What is the difference between Multilevel and Multiple inheritance? Give suitable examples ...
CBSE12D-2016-B02B  B02B-2016D #6466 

What will be the output of the following python code considering the following set of inputs?
JAYA
My 3 books
PICK2
2120
Also, explain the try and except used in the code.

Counter=0
while True:
    try:
        Number=int(raw_input("Give a Number"))
        break
    except ValueError:
        Counter=Counter+2
        print("Reenter Number")
        print(Counter)
What will be the output of the following python code considering the following set of inpu ...
CBSE12D-2016-B02C  B02C-2016D #6468 

Write a class CITY in Python with following specifications

Instance Attributes
- Code # Numeric value
- Name # String value
- Pop # Numeric value for Population
- KM # Numeric value
- Density # Numeric value for Population Density
Methods:
- CalDen() # Method to calculate Density as Pop/KM
- Record() # Method to allow user to enter values 
           Code,Name,Pop,KM and call CalDen() method 
- See() # Method to display all the members also display
        a message "Highly Populated Area"
        if the Density is more than 12000.
Write a class CITY in Python with following specifications
Instance Attribut ...		
CBSE12D-2016-B02D  B02D-2016D #6472 

How do we implement abstract method in python? Give an example for the same.

How do we implement abstract method in python? Give an example for the same. ...
CBSE12D-2016-B02E  B02E-2016D #6475 

What is the significance of super() method? Give an example for the same.

What is the significance of super() method? Give an example for the same. ...
CBSE12D-2016-B03A  B03A-2016D #6478 

What will be the status of the following list after the First, Second and Third pass of the insertion sort method used for arranging the following elements in descending order?
22, 24, 64, 34, 80, 43
Note: Show the status of all the elements after each pass very clearly underlining the changes.

What will be the status of the following list after the First, Second and Third pass of t ...
CBSE12D-2016-B03B  B03B-2016D #6481 

For a given list of values in descending order, write a method in python to search for a value with the help of Binary Search method. The method should return position of the value and should return ]1 if the value not present in the list.

For a given list of values in descending order, write a method in python to search for a v ...
CBSE12D-2016-B03C  B03C-2016D #6483 

Write Insert(Place) and Delete(Place) methods in python to add Place and Remove Place considering them to act as Insert and Delete operations of the data structure Queue.

Write Insert(Place) and Delete(Place) methods in python to add Place and Remove Place cons ...
CBSE12D-2016-B03D  B03D-2016D #6486 

Write a method in python to find and display the prime numbers between 2 to N. Pass N as argument to the method.

Write a method in python to find and display the prime numbers between 2 to N. Pass N as a ...
CBSE12D-2016-B03E  B03E-2016D #6489 

Evaluate the following postfix notation of expression. Show status of stack after every operation.
22,11,/,14,10,-,+,5,-

Evaluate the following postfix notation of expression. Show status of stack after every o ...
CBSE12D-2016-B04A  B04A-2016D #6493 

Write a statement in Python to perform the following operations:

  • To open a text file gBOOK.TXTh in read mode
  • To open a text file gBOOK.TXTh in write mode
Write a statement in Python to perform the following operations:
  • To open a te ...
CBSE12D-2016-B04B  B04B-2016D #6495 

Write a method in python to write multiple line of text contents into a text file myfile.txt line.

Write a method in python to write multiple line of text contents into a text file myfile. ...
CBSE12D-2016-B04C  B04C-2016D #6498 

Consider the following definition of class Staff, write a method in python to search and display the content in a pickled file staff.dat, where Staffcode is matching with ‘S0105’.

class Staff:
    def __init__(self,S,SNM):
        self.Staffcode=S
        self.Name=SNM
    def Show(self):
        print(self.Staffcode," ",
        self.Name)
Consider the following definition of class Staff, write a method in python to search and ...
CBSE12D-2015-B01B  B01B-2015D #6507 

Name the function/method required to
(i) check if a string contains only uppercase letters
(ii) gives the total length of the list.

Name the function/method required to (i) check if a string contains only uppercase letter ...
CBSE12D-2015-B01C  B01C-2015D #6509 

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

def Tot(Number) #Method to find Total
    Sum=0
    for C in Range (l, Number+l):
        Sum+=C
RETURN Sum

print Tot[3]    #Function Calls
print Tot[6]
Rewrite the following code in python after removing all syntax error(s). Underline each c ...
CBSE12D-2015-B01D  B01D-2015D #6511 

Find and write the output of the following python code :

for Name in ['Jayes', 'Ramya', 'Taruna','Suraj']:
    print Name
    if Name[0]== 'T':
        break
    else :
        print 'Finished!'
    print 'Got it!'
Find and write the output of the following python code :
for Name in ['Jayes', 'Ramy ...		
CBSE12D-2015-B01E  B01E-2015D #6514 

Find and write the output of the following python code:

class Worker :
    def_init_(self,id,name): #constructor
        self.ID=id
        self.NAME=name
    def Change (self) :
        self.ID=self.ID+10
        self.NAME='Harish'
    def Display(self,ROW) :
        print self.ID,self.NAME,ROW
w=Worker(55,'Fardeen')
w.Display(l)
w.Change( )
w.Display(2)
print w.ID+len(w.NAME)
Find and write the output of the following python code:
class Worker :
    def_init ...		
CBSE12D-2015-B01F  B01F-2015D #6516 

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

STRING="CBSEONLINE"
NUMBER=random.randint(0,3)
N=9
while STRING[N]!='L':
    print STRING[N]+STRING[NUMBER]+'#',
    NUMBER=NUMBER + 1
    N=Nl
(i)         (ii)        (iii)       (iv)
ES#NE#IO#   LE#NO#ON#   NS#IE#LO#   EC#NB#IS#
What are the possible outcome(s) executed from the following code? Also specify the maxim ...
CBSE12D-2015-B02A  B02A-2015D #6518 

Illustrate the concept inheritance with the help of a python code

Illustrate the concept inheritance with the help of a python code ...
CBSE12D-2015-B02B  B02B-2015D #6522 

What will be the output of the following python code ? Explain the try and except used in the code.

U=0
V=6
print 'First'
try:
    print 'Second'
    M=V/U
    print 'Third',M
    except ZeroDivisionError :
        print V*3
        print 'Fourth'
    except:
        print V*4
        print 'Fifth'
What will be the output of the following python code ? Explain the try and except used in ...
CBSE12D-2015-B02C  B02C-2015D #6525 

Write a class PICTURE in Python with following specifications: Instance Attributes

- Category # String value
- Location # Exhibition Location with String value
Methods:
- FixLocation() # A method to assign Exhibition
                # Location as per Category as
                # shown in the following table
Category Location
Classic Amina
Modern Jim Plaq
Antique Ustad Khan

– Enter() # A function to allow user to enter values # Pno, Category and call FixLocation() method – SeeAll() # A function to display all the data members

Write a class PICTURE in Python with following specifications: Instance Attributes
 ...		
CBSE12D-2015-B02D  B02D-2015D #6527 

What is operator overloading with methods? Illustrate with the help of an example using a python code.

What is operator overloading with methods? Illustrate with the help of an example using a ...
CBSE12D-2015-B02E  B02E-2015D #6530 

Write a method in python to display the elements of list thrice if it is a number and display the element terminated with ‘#’ if it is not a number.

For example, if the content of list is as follows:
ThisList=['41','DROND','GIRIRAJ','13','ZARA']
414141
DROND#
GIRlRAJ#
131313
ZARA#
Write a method in python to display the elements of list thrice if it is a number and dis ...
CBSE12D-2015-B03A  B03A-2015D #6533 

What will be the status of the following list after fourth pass of bubble sort and fourth pass of selection sort used for arranging the following elements in descending order ?
14, 10, -12, 9, 15, 35

What will be the status of the following list after fourth pass of bubble sort and fourth ...
CBSE12D-2015-B03B  B03B-2015D #6536 

Write a method in python to search for a value in a given list (assuming that the elements in list are in ascending order) with the help of Binary Search method. The method should return ]1 if the value not present else it should return position of the value present in the list.

Write a method in python to search for a value in a given list (assuming that the element ...
CBSE12D-2015-B03C  B03C-2015D #6539 

Write PUSH (Books) and POP (Books) methods in python to add Books and remove Books considering them to act as Push and Pop operations of Stack.

Write PUSH (Books) and POP (Books) methods in python to add Books and remove Books conside ...
CBSE12D-2015-B03D  B03D-2015D #6542 

Write a method in python to find and display the prime numbers between 2 to N. Pass N as argument to the method.

Write a method in python to find and display the prime numbers between 2 to N. Pass N as ...
CBSE12D-2015-B03E  B03E-2015D #6546 

Evaluate the following postfix notation of expression. Show status of stack after every operation.
84,62,-,14,3, *,+

Evaluate the following postfix notation of expression. Show status of stack after every o ...
CBSE12D-2015-B04A  B04A-2015D #6548 

Differentiate between the following:
(i) f = open (‘diary. txt’, ‘r’)
(ii) f = open (‘diary. txt’, ‘w’)

Differentiate between the following: (i) f = open ('diary. txt', 'r') (ii) f = open ('di ...
CBSE12D-2015-B04B  B04B-2015D #6550 

Write a method in python to read the content from a text file diary.txt line by line and display the same on screen.

Write a method in python to read the content from a text file diary.txt line by line and ...
CBSE12D-2015-B04C  B04C-2015D #6552 

Consider the following definition of class Member, write a method in python to write the content in a pickled file member.dat

class Member:
    def_init_(self,Mno,N) :
    self.Memno=Mno
    self.Name=N
def Show(self):
    Display (self.Memno, "#" , self.Name)
Consider the following definition of class Member, write a method in python to write the ...
CBSE12A-2019-B01A  B01A-2019S #7085 

Write the names of any four data types available in Python.

Write the names of any four data types available in Python. ...
CBSE12A-2019-B01B  B01B-2019S #7087 

Name the Python Library modules which need to be imported to invoke the following Function:

(i) sqrt()

(ii) start()

Name the Python Library modules which need to be imported to invoke the following Function ...
CBSE12A-2019-B01C  B01C-2019S #7089 

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

250 = Number
WHILE Number<=1000:
  if Number=>750:
    print Number
    Number=Number+100
  else
    print Number*2
    Number=Number+50

 

Rewrite the following code in python after removing all syntax error(s). Underline each co ...
CBSE12A-2019-B01D  B01D-2019S #7092 

Find and write the output of the following python code :

Msg1="WeLcOME"
Msg2="GUeSTs"
Msg3=""
for I in range(0, len(Msg2)+1):
  if Msg1[I]>="A" and Msg1[I]<="M":
    Msg3=Msg3+Msg1[I]
  elif Msg1[I]>="N" and Msg1[I]<="Z":
    Msg3=Msg3+Msg2[I]
  else:
    Msg3=Msg3+"*"
print Msg3

 

Find and write the output of the following python code :
Msg1="WeLcOME"
Msg2="GUeST ...		
CBSE12A-2019-B01E  B01E-2019S #7094 

Find and write the output of the following python code :

def Changer (P,Q=10) :
  P=P/Q
  Q=P%Q
  print P, "#", Q
  return P
A=200
B=20
A=Changer(A,B)
print A, "$",B
B=Changer(B)
print A, "$", B
A=Changer(A)
print A, "$" , B

Find and write the output of the following python code :
def Changer (P,Q=10) :
  P ...		
CBSE12A-2019-B01F  B01F-2019S #7096 

What possible output(s) are expected to be displayed on screen at the time of execution of the program from the following code ? Also specify the minimum values that can be assigned to each of the variables BEGIN and LAST.

import random
VALUES=[10,20,30,40,50,60,70,80]
BEGIN=random.randint(1,3)
LAST=random.randint(BEGIN,4)

for I in range(BEGIN, LAST+1):
print VALUES[I],"-",
(1) 30 – 40 – 50 – (ii) 10 – 20 – 30 – 40 –
(iii) 30 – 40 – 50 – 60 – (iv) 30 – 40 – 50 – 60 – 70 –
What possible output(s) are expected to be displayed on screen at the time of execution of ...
CBSE12A-2019-B02B-C1  B02B-2019S-C1 #7101 
class Box:                       #Line 1
  L=10                           #Line 2
  TYpe="HARD"                    #Line 3
  def __init__(self, T, TL=30):  #Line 4
    self.Type = T                #Line 5
    self.L  = TL                 #Line 6
  def Disp(self):                #Line 7
     print self.Type, Box.Type   #Line 8
     print self.L,Box.L          #Line 9
B1=Box("SOFT",20)                #Line 10
B1.Disp()                        #Line 11
Box.Type="FLEXI"                 #Line 12
B2=Box("HARD")                   #Line 13
B2.Disp()                        #Line 14

Write the output of the above Python code.

class Box:                       #Line 1
  L=10                           #Line 2
  ...		
CBSE12A-2019-B02B-C2  B02B-2019S-C2 #7107 
class Target:                    #Line 1
  def __init__(self):            #Line 2
    self.X = 20                  #Line 3
    self.Y = 20                  #Line 4
  def Disp(self):                #Line 5
    print self.X,self.Y          #Line 6
  def __del__(self):             #Line 7
     print "Target Moved"        #Line 8
def One():                       #Line 9
  T=Target()                     #Line 10
  T.Disp()                       #Line 11
One()                            #Line 12

(i) Write are the methods/functions mentioned in Line 2 and Line 7 specifically known as ?

(ii) Mention the line number of the statement, which will call and execute the method/function shown in Line 2.

class Target:                    #Line 1
  def __init__(self):            #Line 2
  ...		
CBSE12A-2019-B02C  B02C-2019S #7109 

Define a class House in Python with the following specifications:

Instance Attributes

-Hno              #House Number

-Nor              # Number of Rooms

-Type           # Type of the House

Methods/function

-AssignType()    # To assign Type of House

# based on Number of Rooms as follows :

 

Nor Type
<=2 LIG
==3 MIG
>3 HIG

– Enter()     # To allow user to enter value of

# Hno and Nor. Also, this method should

# call Assigntype() to assign Type

– # To display Hno, Nor and Type.

Define a class House in Python with the following specifications: Instance Attributes ...
CBSE12A-2019-B02D-C1  B02D-2019S-C1 #7114 

Answer the questions(i) to (iii) based on the following:

class Furniture(object) :             #Line 1
  def __init__(self,Q) :                   #Line 2
    self.Qty = Q 
  def GetMore(self,TQ) :                   #Line 3
    self.Qty =self.Qty+TQ
  def FRDisp(self):                        #Line 4
    print self.Qty

class Fixture(object):                     #Line 5
  def __init__(self,TQ):                   #Line 6
    self.Qty=TQ
  def GetMore (self, TQ):                  #Line 7
    self.Qty = self.Qty_TQ
  def FXDisp(self):                        #Line 8
    print self .Qty
Class Flat (Furniture, Fixture):           #Line 9
  def __init__(self, fno):                 #Line 10
    self,Fno=fno
    Q=0
    if self.Fno<100:
    Q=10
    else:
    Q=20
    Furniture.__init__(self, Q):            #Line 11
    Fixture.__init__(self,Q):               #Line 12
  def More(self,Q):                         #Line 13
    Furniture.GetMore(self,Q
    Fixture.GetMore(self,Q)
  def FLDisp(self):                         #Line 14
    print self.Fno,
    Furniture.FRDisp(Self)
    Fixture.FXDisp(self)
    Fl=FLAT(101)                            #Line 15

(i) Write the type of the inheritance illustrated in the above.
(ii) Find and write the output of the above code.
(iii) What is the difference between the statements shOwn in Line 11 and Line ?

Answer the questions(i) to (iii) based on the following:
class Furniture(object) :  ...		
CBSE12A-2019-B02DC2  B02D-2019S-21 #7120 

Define inheritance, Show brief pyth0n example of single Level, Multiplier and m Multilevel Inheritance.

Define inheritance, Show brief pyth0n example of single Level, Multiplier and m Multilevel ...
CBSE12A-2019-B03A-C1  B03A-2019S-C1 #7126 

Consider the following randomly ordered numbers stored in a list:
106, 104, 106, 102, 105, 10
Show the content of list after the First, Second and Third pass of the Selection sort method used for arranging in ascending order.
Note : Show the status of all the elements after each pass very clearly encircling the changes.

Consider the following randomly ordered numbers stored in a list: 106, 104, 106, 102, 105 ...
CBSE12A-2019-B03A-C2  B03A-2019S-C2 #7128 

Consider the following randomly ordered numbers stored in a list:

106, 104, 106, 102, 105, 107

Show the content of list after the First, Second and Thired pass of the bubble sort method used for arranging in descending order.

 

 

Consider the following randomly ordered numbers stored in a list: 106, 104, 106, 102, 1 ...
CBSE12A-2019-B03B-C1  B03B-2019S-C1 #7130 

Write definition of a method/function AddOddEven(VALUES) to display sum of odd and even values separately from the list of Values.

For example:

If the VALUES contain [15,26,37,10,22,13]

The function should display

Even Sum:58

Odd Sum:65

Write definition of a method/function AddOddEven(VALUES) to display sum of odd and even va ...
CBSE12A-2019-B03B-C2  B03B-2019S-C2 #7132 

Write definition of a method/function HowMany(ID,Val) to count and display number of times the values of Val is present in the list ID.

For Example:

If the ID contains [115, 122, 137, 110, 122, 113] and Val contains 122

The function should display

122 found 2 Times

Write definition of a method/function HowMany(ID,Val) to count and displa ...
CBSE12A-2019-B03C-C1   B03C-2019S-C1 #7134 

Write QueueUp(Client) and QueueDel(Client) methods/functions in Python to add a new Client and delete a Client from a List of Client names, considering them to act as insert and delete operations of the Queue data Structure.

Write QueueUp(Client) and QueueDel(Client) methods/funct ...
CBSE12A-2019-B03C-C2  B03C-2019S-C2 #7137 

Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Boo and delete a Book from a List of Book titles, considering them to act as push and pop operations of the Stack data structure.

Write PushOn(Book) and Pop(Book) methods/functions in Py ...
CBSE12A-2019-B03D-C1  B03D-2019S-C1 #7139 

Write a python method/function Swapper(Numbers) to swap the first half of the content of a list Numbers with second half of the content Numbers and display the swapped values.

Note: Assuming that the list has even number of values in it.

For example: if the list Numbers contains

[35, 67, 89, 23, 12, 45]

After swapping the list content should be displayed as

[23, 12, 45, 35, 67, 89]

Write a python method/function Swapper(Numbers) to swap the first half of ...
CBSE12A-2019-B03D-C2  B03D-2019S-C2 #7141 

Write a python method/function Count3and7(N) to find and display the count of all those numbers which are between 1 and N,

which are either divisible by 3 or by 7.

For example :

If the value of N is 15

The sum should be displayed as 7

(as 3,6,7,9,12,14,15 in between 1 to 15 are either divisible by 3 or 7)

Write a python method/function Count3and7(N) to find and display the coun ...
CBSE12A-2019-B03E-C1  B03E-2019S-C1 #7143 

Evalute the following Postfix expression, showing the stack contents:

 250,45,9,/,5,+,20,*,-

Evalute the following Postfix expression, showing the stack contents:  250,45, ...
CBSE12A-2019-B03E-C2  B03E-2019S-C2 #7145 

Convert the following Infix expression to its equivalent Postfix expression, showing the stack contents for each step of conversion:

A + B * C ^ D – E

Convert the following Infix expression to its equivalent Postfix expression, showing the s ...
CBSE12A-2019-B04A-C1  B04A-2019S-C1 #7148 

Write a statement in Python to open a text file WRITEUP.TXT so that new content can be written in it .

Write a statement in Python to open a text file WRITEUP.TXT so that new c ...
CBSE12A-2019-B04A-C2  B04A-2019S-C2 #7150 

Write a statement in Python to open a text file README.TXT so that existing content can be read from it.

Write a statement in Python to open a text file README.TXT so that existi ...
CBSE12A-2019-B04B-C1  B04B-2019S-C1 #7152 

Write a method/function ISTOUPCOUNT() in python to read contents from a text file WRITER>TXT, to count and display the occurrence of the word “IS” or “TO” or “UP”.

For example:

If the content of the file is

IT IS UP TO US TO TAKE CARE OF OUR SURROUNDING. IT IS NOT POSSIBLE ONLY FOR THE GOVERNMENT TO TAKE RESPONSIBILITY

The method/function should display

Count of IS TO and UP is 6

Write a method/function ISTOUPCOUNT() in python to read contents from a t ...
CBSE12A-2019-B04B-C2  B04B-2019S-C2 #7154 

Write a method/function AEDISP() in python to read lines from a text file WRITER.TXT, and display those lines, which are starting either with A or starting with E.

Write a method/function AEDISP() in python to read lines from a text file WRITER.TXT, and ...
CBSE12A-2019-B04C-C1  B04C-2019S-C1 #7156 

Considering the following definition of class STOCK, write a method/function COSTLY() in pyhton to search and display Name and Price from a pickled file STOCK.DAT, where Price of the items are more than 1000.

class Stock:
  def __init__(self, N, P):
    self.Name=N
    self.Price=P
  def Show(self) :
    print self.Name, "@", self.Price
Considering the following definition of class STOCK, write a method/function COSTLY() in p ...
CBSE12A-2019-B04C-C2  B04C-2019S-C2 #7158 

Considering the following definition of class DOCTORS, write a method/function SPLDOCS() in python to search and display all the content from a pickled file DOCS.DAT, where Specialisation of DOCTORS is “CARDIOLOGY”.

class DOCTORS:
def __init__(self,N,S):
  self.Name=N
  self.Specialisation=S
def Disp(self):
  print self.Name, "#", self.Specialication

 

Considering the following definition of class DOCTORS, write a method/function SPLDOCS() i ...
Practice Problem

Some good examples to practice short answer questions on operators in c++ ...

Quizzes

Concept Notes:33  Code Sheets:2  Solved Problems:160  Exam Questions:160  Practice Problems:4  Quizzes:48