Python Programming Quiz – 7th Week Quiz Solution 2020
Important Notes:-
Hello Dosto Please Subscribe Our Youtube channel Because Copyright Problem In this post ( python / css / Al / nptel ) So please i humble Request Subscribe Our channel or social Networks ( than we are all are connect To each and every person ) These are Our youtube channel My Youtube Channel .. only 321 subscribe in my youtube channel .( channel ko subscribe kar lo kyuki kabhi bhi website band ho sakti hai sar post 2019 se ho rhe hai or answer sare senior ke dwara batye hue hai ) . youtube channel ko jaldi se share karo tak jada subscribe ho jaye to copyright ka koi problem na ho .. thanks
Q.1. Naming convention of module of a python file is ?
Answer :- (a) All names should be lower case.
Reason:- Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.
Q.2.The following code is saved in a file mod.py (using python 3.X version):
def print_hello():
print (“Hello”)
Now consider the following interaction on Python console, assuming mod.py
is in the current directory where the console is invoked:
>>> import hello
>>> print_hello()
What wiil the output of the code ?
Answer:- (b)."HELLO" WILL BE PRINTED ( WITHOUT QUOTES ).
Reason:- A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended.
[3] What is the output of the following python code?
class hello:
def __init__(self,a=”Visit Prutor.ai website”):
self.a=a
def display(self):
print(self.a)
obj=hello()
obj.display()
(a): The program has an error because constructor can’t have default arguments
(b): Nothing is displayed
(c): “Visit Prutor.ai website” is displayed
(d): The program has an error because display function doesn’t have parameters
Answer:- (c) “Visit Prutor.ai website” is displayed.
Reason:- Python is an object oriented programming language. Almost everything in Python is an object, with its properties and methods. A Class is like an object constructor, or a "blueprint" for creating objects.
[4] What is the output of the following python code?
class test:
def __init__(self,x" "):
self.x=x
def 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 at least one argument is required while creating an object
(d): Error as display function requires additional argument.
Answer:- (c) Error as at least one argument is required while creating an object.
Reason:- The JavaScript exception "more arguments needed" occurs when ... The Object.
[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
Answer: (b) Creating an instance of class.
Reason:- To instantiate is to create such an instance by, for example, defining one particular variation of object within a class, giving it a name, and locating it in some physical place. 1) In object-oriented programming, some writers say that you instantiate a class to create an object, a concrete instance of the class
5 Comments
Bhai 1 din ke liye hi quiz open hua tha mera bhi nhi ho paya aur ab jitna bhi quiz hoga 1 din ke liye hi open hoga.
ReplyDeletePlease note that the new quizzes will be open only for 1 day from now on
ReplyDeleteThe schedule is available with the SPOC (single point of contact) of your colleges / your teachers for KNC301 or KNC302
Ye AKTU ke taraf se notice aaya hai.
Week 8 quiz when will be uploaded?
ReplyDeletePython week 8 quiz solutions please upload
ReplyDeleteyes sir plz upload
Delete