Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

M206 M206 Sample Questions

Fall 2004
Prepared by: Amal Naji & Amal Abdullah

Q1: Select the best answer for the following statements:

1. In an account object, balance and creditLimit could be:


a) Attributes
b) Methods
c) State
d) a) and b) are correct
2. What answer (s) will be returned from evaluating the following expression series:
kermit right.
gribbit left.
kermit colour
a) kermit
b) gribbit
c) Kermit's colour
d) All the above
3. Which of the following expression (s) result in a message answer that can act as a reference to an object?
a) frog1
b) account1 balance
c) 'frog'
d) All the above
4. The accessor method whose purpose is to return the value of an instance variable is called:
a) Return method
b) Implemented method
c) Getter method
d) Setter method
5. The result of the message expression: 3 plus: 8 - 1 is:
a) 5
b) 8
c) 10
d) 11
6. If the state of frog1 is colour red and position 6. What will be the answer returned from
evaluating the message expression: frog1 Green colour
a) Red
b) Green
c) frog1
d) An instance of class Frog colour: Green, position:6
7. Software usability is one of the important concerns of developers.
a) True
b) False
8. A message that does not involve a argument is called unary message.
a) True
b) False
9. FirstClass is an application software that represnts a program.
a) True
b) False
10. my car is a correct variable name.
a) True
b) False

Answer the following questions:

1. Write a new method for the Frog class called positionDoubled that returns a number that is double its
current position. For example, sending the message positionDoubled to a frog object in position 3
should give the answer 6 (i.e. 3 * 2)

Note: Don't forget to write an initial comment for your method.


positionDoubled
"Return doubled the current position of the receiver"
^(self position *2)
2. Indicate the receiver, message selector and argument (if any) of the following messages:

1. account1 transfer:500 to: account2


Receiver: account1
Message selector: transfer: to:
Argument(s): 500, account2
2. 'My ', 'friend'
Receiver: 'My'
Message selector: ,
Argument(s): 'friend'

3. hoverFrog1 Up
Receiver: hoverFrog1
Message selector: Up
Argument(s): has no argument
3. Define the following terms:

1. Visibility: A key principle of HCI that states all controls should be visible and provide feedback to indicate
the control is responding to the user’s actions.
2. Domain Model: The domain model can be thought of as an underlying computer program (the actual
engine) that carries out the abstract functions of the system.
4. Write the message answer results from evaluating the following expressions:
Expression Message answer
10 10
gribbit position: 10 gribbit after changing its state.
'frog' asUppercase 'FROG'
account1 overLimit: 250 account1 after changing its state.
5. Draw object-interaction diagram the represents the following expressions:

var1 := gribbit position.


var2 := var1 + 5.
kermit position: var2.
gribbit colour: Blue

You might also like