89.4k views
19 votes
If the user does NOT click the button what color will "topButton" be when this program finishes running?

OOOO

A red

B. blue

C. green

D. orange

1 Answer

5 votes

Answer:

Blue

Step-by-step explanation:

See attachment for missing code snippet.

The actions to be executed are on lines 1, 2, 4 and 5. These actions are:

1. Set background to red

2. Set background to blue

4. Set background to green

5. Set background to orange

Instructions at line 4 and 5 will be executed if the user clicks the button.

From the question, we understand that the user does not click the button.

This implies that the instructions at 4 and 5 will be ignored.

So, we are left with:

1. Set background to red

2. Set background to blue

1. The background colour of the button will be set to red

2. The background colour of the button will be set to blue, overwriting the instruction at (1).

Hence:

B. blue is correct

If the user does NOT click the button what color will "topButton" be when-example-1
User Fabio Espinosa
by
4.8k points