Pructor Python Quiz 7 by anupmaurya June 12, 2021 written by anupmaurya 0 comment 76 views Welcome to your Pructor Python Quiz 7 1. 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 1 out of 5 2. 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 2 out of 5 3. 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 3 out of 5 4. 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 4 out of 5 5. 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 5 out of 5 Time is Up! Time's up Share 0 FacebookTwitterLinkedinRedditWhatsappTelegramEmail anupmaurya Hey there, My name is Anup Maurya. I was born with love with programming and works at TCS. One of best global (IT) services and consulting company as System Administrator . I also love graphics designing. It's my pleasure to have you here. previous post Pructor Python Quiz 1 next post Prutor Python Quiz 3 Leave a Comment Cancel Reply Save my name, email, and website in this browser for the next time I comment. * By using this form you agree with the storage and handling of your data by this website.