stud
bud
Sign up
Log in
Home
Library
Explore
SAT
More
Python Programming 10 Flashcards | StudBud
Explore
/
Python Programming 10
Python Programming 10
21 terms
·
StudBud Administration
An introduction to software development using Python
Flashcards
21 cards
F
Practice quiz
P
Host live
L
Questions
21
Answers
1
Which method would you override to add some code which runs when ever a new object is created?
__finish__
__str__
__init__
__pos__
2
What would be the output produced by the function call MyFun(6.0)?
6.0
Type error
12
0
3
Which of the following outputs will the expression above evaluate to?
Error
1000
30
3333
4
Consider the following code in Python:
False because x and y have different types
True because the values of x and y are the same
True because y is already an int
False because x and y contain different values
5
Looking at the Python code above, which of the following statements is certainly true?
variable x contains an object
Special is a class with only two methods
x is not the name of a class
x.go() must be called before x.start()
6
The result of the expression above will be:
168
85
90
55
7
The result of running the operation above using the Python interpreter would be?
True
False
Error
(0, 0, 0)
8
See diagram:
The + operator does not work on strings
x has not been defined yet
x is already defined as an integer
print only works within a function
9
Which of the following statements about MyFun is
Not True
MyFun(9,5) would return 14
MyFun("Flip","Flop") would return "FlipFlop"
MyFun("A",chr(65)) would cause an error
MyFun(ord("0"),1) would return 49
10
When the function call howmany(5) is made how times with the method roll be called?
25
15
10
Impossible to tell
11
Defining a class, overloading the __lt__ method lets you apply which symbol to that class?
<
>=
>
=<
12
As a result of looking at the code about what can we say for certain about MyFun?
Passing MyFun a string will cause an error
MyFun only works on integers
MyFun always returns 7
MyFun is a fruitful function
13
See diagram:
No brackets after the function name when you called it
0x011CF970 is 261408739 in hexadecimal format
You should have put brackets around the sum (23456 + 789123)
myNewFunction is a Class and you must create an Object first
14
Using the Python interpreter, which of the following results would be returned?
Error
6
2
3
15
Which of the following statements is
True
about Object Oriented concepts?
A Method is another name for an Attribute
An Object is an instance of a Class
Inheritance requires code to be copied to another class
Encapsulation requires the separation of data and code
16
Consider the following code in Python:
False
True
Error
5
17
One feature of the OO approach enables data and code to be defined in the same module. This is:
Inheritance
Encapsulation
Polymorphism
Dynamic typing
18
Which of the following statements about software development is False?
Objects are also sometimes referred to as a Classes
In Class, Attributes and Methods are recorded separately
In activity modelling Actions are also referred to as Tasks
In Usecase modelling Processes are modelled in like Services
19
In Object Oriented programming an Attribute is best described as:
A variable attached to a class
A function attached to an object
A variable which contains a class
A class which is never created as an object
20
Which of the following is
Not
a key feature of Object Orientation:
Inheritance
Polymorphism
Encapsulation
Transparency
21
What would be the output produced by the function call MyFun(int(6.5-4))
"Fellow"
Type error
"Mellow"
"Yellow"