Q. What is the output of the below code:
my_str = "Python"
for i in range(len(my_str)):
new_Str = my_str[i].upper()
print (new_Str)
Q. Inheritance can be best described as:
Q. In the sense of object oriented programming, classes which are inherited from a base class, i.e subclasses belong to a subtype - True or False?
Q. Overriding refers to the act of using the method of derived class in contrast to using the same exact method which is defined in the parent class.
Q. What is the output of the below code:
class Base(object):
def first(self):
print("Second method called")
def second(self):
print("First method called")
ob = Base()
Base.first(ob)
Q. What kind of inheritance is demonstrated in the code below:
class four():
method
class one(four):
methods
class two(four):
methods
class three(one, two):
methods
Q. What is the output of the below code:
for i in range(1, 101):
if int(i*0.05)==i*0.05:
print(i)
Q. What is the output of the below code:
my_dict = {}
my_dict.fromkeys([0, 2, 1, 4], "Sample_key")
Q. What is the output of the below code:
int_tuple_1 = '10', '24'
int_tuple_2 = ('36', '49')
print(int_tuple_1 + int_tuple_2)
Q. What is the output of the below code:
import collections
my_dict = collections.defaultdict(lambda : 10)
print(my_dict['a'])
my_dict = collections.defaultdict(str)
print(my_dict['Z'])