OOP Biweekly Test#1 - BS3.3

Is this your test? Login to manage it. If not, you can make a test just like it.

This is a non-interactive preview of the quiz content.

1.
1 point
What does Moore's law predict?
2.
1 point
A precondition is a
3.
1 point
A class is a
4.
1 point
A contract is a

(Check all that apply)
5.
1 point
Assume, you have a feature defined as below:

my_feature (x: INTEGER) -- Line 01
require -- Line 02
validity_check: x >10 -- Line 03
do -- Line 04

end -- Line 05

What will happen if you remove line #02?
6.
1 point
With respect to Design by Contract, when may a contract be violated?
7.
1 point
Assume we have feature 'f (x : INTEGER)' that requires the argument x to be a non-negative number.

How can be classified precondition 'pre1'?

f (x: INTEGER)

require
pre1: x > -10
8.
1 point
Assume we have feature 'f : INTEGER' that ensures returning a non-negative number.

How can be classified the postcondition 'post1' ?

f: INTEGER

ensure
post1: Result > -10
9.
1 point
Which of the following statements are true about deferred classes? (select all that apply)
10.
1 point
A key for establishing loop’s correctness is
11.
1 point
If you were asked to design and implement two classes representing geometric figures - Circle and Ellipse, how would you use inheritance?

Check all that apply.
12.
1 point
The precondition of a redefined feature can only stay the same or be strengthened
13.
1 point
A class invariant in an descendant class can only stay the same or be strengthened
14.
1 point
If you want to keep an inherited precondition, postcondition or class invariant, all you need to do is:
15.
1 point
What are the pillars of OOP?
16.
1 point
Assuming that PUBLIC_TRANSPORT class is descendant from TRANSPORT class.

t : TRANSPORT

tram : PUBLIC_TRANSPORT

t := tram

Which of the following statements are correct after the assignment, (select all that apply)
17.
1 point
What is the basic type property in Eiffel?
18.
1 point
Assume a program with three classes: A, B and C.

class
A
feature
do_work
do
print("A")
end
end

class B
inherit A redefine do_work end
feature
do_work
do
print("B")
end
end

class
C
create make
feature
make
local
a:A
b:B
do
create a
create b

a:=b

a.do_work
b.do_work
end
end

What would be the output of the program?
19.
1 point
Assume a program with three classes: A, B and C.

class
A
feature
do_work (a:B)
do
print("A")
end
end

class B
inherit A redefine do_work end
feature
do_work(b:A)
do
print("B")
end
end


class C
create make
feature
make

local
a:A
b:B
do
create a
create b

a.do_work(b)
b.do_work(b)
end

end