PP Mid II QB Objective Final
PP Mid II QB Objective Final
MODULE-III
1 What is setattr() used for? B
a)To access the attribute of the object b)To set an attribute
c)To check if an attribute exists or not
d)To delete an attribute
9 Why does the name of local variables start with an underscore discouraged? C
a)To identify the variable b)It confuses the interpreter
c)It indicates a private variable of a class d)None of these
11 Which of the following statements can be used to check, whether an object “obj” is an instance of class A or C
not?
a)obj.isinstance(A) b)A.isinstance(obj) c)isinstance(obj, A) d)isinstance(A, obj)
def display(self):
return self.__b
obj = Demo()
print(obj.a)
a)The program has an error because there isn’t any function to return self.a
b)The program has an error because b is private and display(self) is returning a private member
c)The program runs fine and 1 is printed
d)The program has an error as you can’t name a class member using __b
13 What will be the output of the following Python code? class Demo: D
def __init__(self):
self.a = 1
self.__b = 1
def display(self):
return self.__b
obj = Demo()
print(obj.__b)
a)The program has an error because there isn’t any function to return self.a
b)The program has an error because b is private and display(self) is returning a private member
c)The program runs fine and 1 is printed
d)The program has an error because b is private and hence can’t be printed
14 Methods of a class that provide access to private members of the class are called as ______ and ______ A
a)getters/setters b)__repr__/__str__ c)user-defined functions/in-built functions d)__init__/__del__
name.id_no = id_no
name.age = age
teac = Teacher(5, 25)
Which of the following statements is incorrect regarding this program?"
a) A constructor has been given in this program
b)id_no and age are called the parameters
c)The "teac" is the reference variable for the object Teacher(5, 25)
d)None of the these
a) Current buffer state, with changing b) Current buffer state, without changing
c) Previous buffer state, with changing d) Previous buffer state, without changing
61 Multithreading is a mechanism for splitting up a program into several parallel activities called _________ D
a) 1 b) 2 c) 3 d) 4
66 A
Multithreading is also called as ____________
a) Concurrency b) Simultaneity c) Crosscurrent d) Recurrent
73 Given a function that does not return any value, What value is thrown by default when executed in shell D
a) Int b)Bool c)Void d)none
74 A method used to force one thread to wait for another thread to finish. A
a) join() b) connect() c) combine() d) concat()
125 Which of the following command are used to install the tkinter? A
A)Pip install Tkinter B)pip install python tkinter C)pip install tkinter python D)None of these