Java Methods, Arrays, and Object-Oriented Programming Concepts Review

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

16 Terms

1
New cards

What are the benefits of using a method?

Reuse code, Reduce complexity, Easy to maintain

2
New cards

What keyword can be used as a return type for a method that does not return any value?

void

3
New cards

What is the output of the call nPrint('a', 4)?

invalid call

4
New cards

Which method header correctly returns the price of a product?

public static double getPrice(double basePrice, double taxRate)

5
New cards

Which method header tests whether a number is even and returns true if it is?

public static boolean isEven(int number)

6
New cards

What is the value of k after invoking nPrint("A message", k) with k initialized to 2?

2

7
New cards

What happens when an array is passed to a method in Java?

The reference to the original array is passed — no new array is created.

<p>The reference to the original array is passed — no new array is created.</p>
8
New cards

What is the content of the list after the first iteration of the Selection Sort method with list {3.1, 3.1, 2.5, 6.4, 2.1}?

{2.1, 3.1, 2.5, 6.4, 3.1}

9
New cards

What is the output of the following code: System.out.print(matrix[i][1] + " ") in a 4x4 matrix?

2 5 9 13

10
New cards

What is the maximum element found in the 2D array {{1, 2}, {3, 4}}?

4

<p>4</p>
11
New cards

What does UML stand for in Object-Oriented Programming?

Unified Modeling Language

12
New cards

What is a constructor in Object-Oriented Programming?

A special kind of method that is invoked to create an object.

13
New cards

What is the state of an object in Object-Oriented Programming?

Also known as property or attribute, represented by data fields with their current values.

14
New cards

What defines the behavior of an object in Object-Oriented Programming?

Methods.

15
New cards

What is a class in Object-Oriented Programming?

A template, blueprint, or contract that defines what an object's data fields and methods will be.

16
New cards

What is an object in Object-Oriented Programming?

An instance of a class.