Pructor Python Quiz 7 by anupmaurya June 12, 2021 written by anupmaurya 0 minutes read 338 Welcome to your Pructor Python Quiz 7 Naming convention of a module of a python file is ? a) All names should be lower case b) Under score can be used c) Should be short d) All of the above None The following code is saved in a file hello.py (using python 3.X version): def print_hello(): print ('Hello') Now consider the following interaction on Python console, assuming hello.py is in the current directory where the console is invoked: >>> import hello>>> hello.print_hello() What will be the output of the code? a) hello is a keyword in python , so it will produce error b) 'Hello' will be printed( without quotes) c) Nothing will be printed d) We can not import a .py file None What will be the output of following python code? class hello:def init(self,a='Visit Prutor.ai website'): self.a=adef display(self): return 0obj=hello()print( obj.display() ) a) The program has an error because constructor can’t have default arguments b) 0 c)'Visit Prutor.ai website' is displayed d) The program has an error because display function doesn’t have parameters None What will be the output of following python code? class test:def init(self,x=''): self.x=xdef display(self): print(self.x)obj=test()obj.display() a) Executes normally and doesn’t display anything b) Displays 0, which is the automatic default value c) Error as display function requires additional argument d) None of the above None What does Instantiation mean in terms of Object Oriented Programming? a) Deleting an instance of class b) Creating an instance of class c) Copying an instance of class d) Modifying an instance of class None Time's up 0 FacebookTwitterPinterestEmail anupmaurya "Hi there, My name is Anup Maurya. I have a passion for programming and previously worked at TCS, one of the best global IT services and consulting companies, as a System Administrator. I also enjoy graphic design. It's a pleasure to have you here." previous post Pructor Python Quiz 1 next post Prutor Python Quiz 3 Leave a Comment Cancel Reply