Question
in python 1.The only operator that cannot be overloaded is the subscript operator. True False 2.Which of the following is not true about unit testing
in python
1.The only operator that cannot be overloaded is the subscript operator.
True
False
2.Which of the following is not true about unit testing
The purpose of unit testing is to validate that each unit of the software performs as designed | ||
Unit testing increases confidence in changing/ maintaining code | ||
With unit testing development of software is slower. | ||
Unit testing leads to code that is easier to reuse |
3.A class can define the behavior for the < operator
True
False
4.By default calling the str function on a custom object will
print a description of that object | ||
print the name of the object | ||
print the name of the class | ||
print the memory address of that object |
5.
The method name for non-integer division is
__div__ | ||
__truediv__ | ||
/ | ||
// |
6.
What does operator overloading mean?
The ability to alter how arithmetic operators work with integers. | ||
The ability to have operators work with instances of programmer defined classes=. | ||
The ability to alter the rules of precedence. | ||
The ability to alter create new operators. |
7.
In white-box testing we do not need to know anything about the internal structure, design, or implementation of the software being tested.
True
False
8.
By default, if you use the + operator on two user-defined objects
a new object will be created | ||
the two object will be added | ||
the two objects will be combined | ||
an error will occur |
9.
Assuming that the __add__ operator is implemented for two objects, x and y, then x+y is equivalent to
add(x,y) | ||
__add__(x,y) | ||
x.__add__(y) | ||
y.__add__(x) |
10.
Typically, a definition of the __add__ method should:
Change the left operand | ||
Return an new instance of the right operand type | ||
Change the right operand | ||
Return an new instance of the left operand type |
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