Unit 7: Lesson 5 - Fast Start

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Assuming all variables are declared correctly, which of the following code segments correctly swaps the values x and y? I.x = y;y = x; II.int tmp = x;y = x;x = tmp; III.int tmp = x;x = y;y = tmp;

III only

Which of the following can be used to initialize a variable of the Integer class type? Select all that apply.

Integer a = new Integer(3); Integer a = 3;

Consider the following code: public boolean mystery(int[] a) {boolean flag = true;for (int i = 1; i < a.length; i++) {if (a[i] < a[i - 1]) {flag = false;break;}}return flag;} What does mystery(int[]) do?

Tests if the array is in ascending order.


Ensembles d'études connexes

Enlightenment Ideas in the Declaration of Independence

View Set

Introduction à la biologie cellulaire et à la biochimie -Fasel

View Set

Chapter 5 - nursing process and critical thinking

View Set

Chapter 2: The Economics of Poverty and Discrimination - Inequality

View Set

Chapter 30: The Child with Integumentary Dysfunction

View Set

ch 27 face/neck injuries practice

View Set

Organizational Behavior Exam 2 Review

View Set

Wife of Bath's Tale, only answered questions i thought were important

View Set

Chapter 03 - Peripherals and Expansion

View Set

Normal Curve: Chapter 13 Personality

View Set

Med Surg II - Chapt 66 - Management of Pts with Neurologic Dysfunction

View Set