Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

Find all solutions. cosh z = -1

Answered: 1 week ago