Question
1. What is the output and why ? class Sales: def __init__(self, id): self.id = id id = 100 val = Sales(500) print (val.id) a.
1. What is the output and why ?
class Sales: def __init__(self, id): self.id = id id = 100 val = Sales(500) print (val.id)
a. the result will be "500" because id is declared as an instance variable
b. Nothing will be printed
c. the script will result error
d. the result will be "500, because id is declared as a class variable
2. The variable defined on line 3 is an example of a __________ variable.
1 #!/usr/bin/python 2 import Onett 3 plater='Ness' 4 class Adventure(Onett): 5 __score=0
a. local
b. global
c. private
d. public
3. Without a visibility modifier, class and instance variables are declared as;
a. private
b. public
c. global
d. protected
4. In an object-oriented inheritance model child classes are derived from parent classes and inherit ???
a. class variables
b. class function
c. methods and functions
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started