Short Answer Type

Advertisement

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




Static Binding

Dynamic Binding

Time of binding

happens during compilation

binding happens at run time

Actual object

Actual object is not used for binding

Actual object is used for binding

Example

Method overloading

Method overriding

Methods of binding

Private, static and final methods show static binding. Because they cannot be overridden.

Other than private, static and final methods show dynamic binding. Because they can be overridden.

Class

Type class

Object class

 
121 Views

Advertisement

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

86 Views

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

99 Views

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

73 Views

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.

104 Views

Advertisement

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

79 Views

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.

76 Views

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’.

102 Views

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

91 Views

Advertisement

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

106 Views