QUESTION 15
What is the __str__ method used for?
| a. |
It is used to determine if a class attribute is a string. |
|
| b. |
It is used to initiate string values during instantiation. |
|
| c. |
It builds and returns a string representation of an object's state. |
|
| d. |
It converts a string attribute within a class. |
1 points
QUESTION 16
What method is known as a class's constructor, because it is run automatically when a user instantiates the class?
| a. |
__start__ |
|
| b. |
__init__ |
|
| c. |
__build__ |
|
| d. |
__main__ |
1 points
QUESTION 17
Unlike other object-oriented languages, Python does not support polymorphic methods.
True
False
1 points
QUESTION 18
What concept within object-oriented programming involves the restriction of the manipulation of an object's state by external users to a set of method calls?
| a. |
polymorphism |
|
| b. |
data encapsulation |
|
| c. |
inheritance |
|
| d. |
data modeling |
1 points
QUESTION 19
The str method is a good example of a polymorphic method that appears throughout Python's system of classes.
True
False
1 points
QUESTION 20
The attributes of an object are represented as what type of variables?
| a. |
self variables |
|
| b. |
instance variables |
|
| c. |
substance variables |
|
| d. |
state variables |
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Question 15:
Answer :c.It builds and returns a string representation of an object's state.
Explanation :In python __str()__ method returns string representation of object.
***********************************
Question 16:
Answer :b.__init__
Explanation :In python __init__ is invoked automatically when we create a new object.
***********************************
Question 17:
Answer :False
Explanation :Python supports polymorphism.
***********************************
Question 18:
Answer :b.data encapsulation
Explanation :data encapsulation in python involves the restriction of the manipulation of an object's state by external users to a set of method calls.
***********************************
Question 19:
Answer :False
Explanation :The str method is not a example of a polymorphic method that appears throughout Python's system of classes.
***********************************
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
QUESTION 15 What is the __str__ method used for? a. It is used to determine if...
Lab 10C - Creating a new class This assignment assumes that you have read and understood the following documents: http://www.annedawson.net/Python3_Intro_OOP.pdf http://www.annedawson.net/Python3_Prog_OOP.pdf and that you're familiar with the following example programs: http://www.annedawson.net/python3programs.html 13-01.py, 13-02.py, 13-03.py, 13-04.py Instructions: Complete as much as you can in the time allowed. Write a Python class named "Car" that has the following data attributes (please create your own variable names for these attributes using the recommended naming conventions): - year (for the car's year of manufacture)...
QUESTION 13 A constructor is the same as any other method definition EXCEPT for what? A constructor includes an optional argument list. A constructor includes an optional access modifier, usually public. A constructor includes a return type. A constructor places arguments within parentheses (). 2 points QUESTION 14 Using the asterisk wildcard (e.g. import com.packageName.*) will include all of the classes within packageName, even if they aren’t used. True False 2 points QUESTION 15 The Random class gives...
JAVA QUESTION 1 The value returned by a value-returning method can be saved for further calculation in the program. True False QUESTION 2 To use a predefined method you must know the code in the body of the method. True False QUESTION 3 A formal parameter is a variable declared in the method heading (ie. it's signature). True False QUESTION 4 A local identifier is an identifier that is declared within a method or block and that is visible only...
number 4 in c++ please
square method not mentioned
no
sauare method was given. can thus be solved without a specific
square mthod?
Laboratory work 12 Investigation of using classes for describing class data-members Task 1. Study class members definition in C++ and CH. 2. Study class and members access modifiers in C++ and Ce 3. Study mechanisms creation, 4. Write programs in C++ and C which demonstrate use cases of class according to variant of creation, usage, and destruction...
QUESTION 1 Each class must be declared in its own .java file True or False? QUESTION 2 The keyword this must always be explicitly used when referring to an object's instance variables and methods from within one of its non-static methods. True or False? QUESTION 3 When used in a class' main method the this keyword references the object representing the class itself. True or False? QUESTION 4 Accessor methods that test whether a condition is true or false are...
1 An instance variable refers to a data value that a is owned by an particular instance of a class and no other b is shared in common and can be accessed by all instances of a given class 2 The name used to refer the current instance of a class within the class definition is a this b other c self 3 The purpose of the __init__ method in a class definition is to a build and return a...
1. (TCO 7) Which of the following statements are true? (Points : 5) Interfaces contain one and only one implemented method, a constructor. Interfaces are defined inside an abstract class. All methods defined in an interface must be implemented when used by another class. A true object-oriented design must contain as least one interface. Question 2. 2. (TCO 7) In an object-oriented program, methods with no implementation might be found in an _____ and/or a(n) ______....
%%%%Python Question%%% Work from the template acrostic.py, which you can find on the ELMS page for this assignment. • In the Generator class, write an __init__() method with two parameters: self and the path to a text file containing one word per line. This method should read the words from the file, strip off leading and trailing whitespace, and store them in a dictionary where each key is a lower-case letter and each corresponding value is a list of words...
Need help finishing this code # Description : The Pet class contains fields for name, pet # type,and age. The age field is the age now # or age of pet when it passed away. (These # are all dogs I have had.) There is a static or # class variable called number_pets that # tracks how many instances have been created. # The constructor will fill all fields and add # one to the number_pets variable. # The special...
QUESTION 31 The tkinter command _____ kicks off the GUI event loop. goloop() doloop() mainloop() loopDloop() 2.5 points QUESTION 32 Which of the following statements about superclasses and subclasses is true? A subclass is not connected to a super class in any way A superclass inherits from a subclass. A superclass extends a subclass. A subclass extends a superclass. 2.5 points QUESTION 33 Pickled objects can be loaded into a program from a file using the function ____....