Programming Prutor Python Quiz 8 by Techarge June 8, 2021 written by Techarge 0 comment 431 views Use these online Prutor Python Quiz as a fun way for you to check your learning progress and to test your skills. Welcome to your Prutor Python Quiz 8 1. In python, a class is created by keyword, and to create of the class, we will have to use constructor of class. a) def, file b) class, object c) self, .py file d) None of these 1 out of 5 2. What will be the output of the following python code? class Roll: def init(self, id): self.id = id id = 231 return idval = Roll(321)print (val.id) a) TypeError b) 231 c) 321 d) None of these 2 out of 5 3. What will be the output of following python code? class X: def init(self): self.a = 10 self._b = 20 self.b = 20 def getB(self): return self.bx = X()x._b = 60print(x.getB()) a) 20 b) 60 c) Error d) Program runs but does not print anything 3 out of 5 4. Private method in python starts with _____ while protected methods starts with _________. a) #, @ b) double underscore, single underscore c) single underscore,double underscore d) None of these 4 out of 5 5. What will be the output of the following code. Code is saved in a file named 'code.py' : f = open('file.txt') f.readlines() print(f.name) print ( f.closed ) f.close() print ( f.closed ) a) Error b) code.py False True c) code.py True False d) file.txt False True 5 out of 5 Time is Up! Time's up Have you found this platform useful ? Don't forget to share with your love one's ! PYTHON TUTORIAL JAVA TUTORIAL Learn PythonPrutor Python QuizPython Quiz Share 4 FacebookTwitterLinkedinRedditWhatsappTelegramEmail Techarge previous post Prutor Python Quiz 7 next post Prutor Python Quiz 9 You may also like Git & Github 2021 Cheat Sheet Git & Github 2021 Cheat Sheet Extracting a piece of String in python Python Roadmap 2022 Top 8 Programming Languages That Will Rule in 2022 Easy ways to convert an XML file into JSON Format Program to find the diagonal sum of a matrix Difference between Web Server and Web Application Difference between Web Browser and Web Server Installing and Configuring WAMP Server on Localhost