Faculty of Information Technology Department of Software Engineering Quz1

advertisement
Faculty of Information Technology
Department of Software Engineering
Quz1
Lecturer
Module
Section
: Dr. Ali Fouad
: Advanced Object Oriented Programming
: 1
Circle the correct answer to each of the following:
1. Which can you use to determine whether an object is an instance of a class?
a. isinstance
b. isclass
c. isobject
d. isinheritance
e. None of the above
ANS: A
2. What is the special name given to the method that returns a string containing the
object’s state?
a. __state__
b. __obj__
c. __str__
d. __init__
e. None of the above
ANS: C
3. When a method is called, what does Python make to reference the specific object that
the method is supposed to operate on?
a. State variable
b. self parameter
c. object data
d. init procedure
e. None of the above
ANS: B
1
4. Which list will be referenced by the variable number after the execution of the
following code?
number = range(0, 9, 2)
a. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
b. [1, 3, 5, 7, 9]
c. [2, 4, 6, 8]
d. Invalid code
e. None of the above
ANS: E
5. What method can be used to place an item in the list at a specific index?
a. append
b. Index
c. Insert
d. Add
e. None of the above
ANS: C
2
Download