Question: 1. A software engineer is designing a new program. He decides to first define all the classes that he needs, and how they will interact

1. A software engineer is designing a new program. He decides to first define all the classes that he needs, and how they will interact with each other. He then defines what methods will be needed in each class. Later, he writes those methods. This design process is an example of:

I. top-down design II. bottom-up design III. object-oriented programming

Question 1 options:

1)

I and II only

2)

I and III only

3)

II and III only

4)

I, II, and III

5)

II only

2. What is output by the following code fragment?

String[] fruits = { "apple", "banana", "peach", "strawberry" }; String str = "a"; for (String item : fruits) { str += item.substring(1, 2); } System.out.println(str);

Question 2 options:

1)

aabps

2)

aapbapest

3)

apaet

4)

appaneatr

5)

appbaeast

3. Consider the following code segment. What would be the expected output?

int i = 10; while (i >= 0) { if ((i % 3) >= 1) { System.out.print(i + " "); } i -= 2; }

Question 3 options:

1)

10 9 8 7

2)

10 8 6 4 2

3)

10 8 4 2

4)

10 8 5 4 2

5)

10 8 5 4

4. Assume that the following code exists inside a method of MyClass, and that this code compiles without errors: int result = book.getYearPublished(); where book is an object of the Book class.

Which of the following is nottrue about the getYearPublished method?

I. It is a mutator method. II. It is a public method in the Book class. III. It returns a String.

Question 4 options:

1)

I only

2)

II only

3)

III only

4)

I and II only

5)

I and III only

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!