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:
|
| ||
|
| ||
|
| ||
|
| ||
|
|
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:
|
| ||
|
| ||
|
| ||
|
| ||
|
|
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:
|
| ||
|
| ||
|
| ||
|
| ||
|
|
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:
|
| ||
|
| ||
|
| ||
|
| ||
|
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started