100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COSC 110 Exam Questions and Answers Graded A+ $7.99   Add to cart

Exam (elaborations)

COSC 110 Exam Questions and Answers Graded A+

 4 views  0 purchase
  • Course
  • COSC 110
  • Institution
  • COSC 110

COSC 110 Exam Questions and Answers Graded A+ What would be the results of the following code? int[] x = { 55, 33, 88, 22, 99, 11, 44, 66, 77}; int a = 10; if(x[a] > x[5]) a = 5; else a = 8; - Answers a = 5 What would be the results after the following code was executed? int[] x...

[Show more]

Preview 2 out of 6  pages

  • October 23, 2024
  • 6
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • COSC 110
  • COSC 110
avatar-seller
TutorJosh
COSC 110 Exam Questions and Answers Graded A+

What would be the results of the following code?

int[] x = { 55, 33, 88, 22, 99,

11, 44, 66, 77};

int a = 10;

if(x[a] > x[5])

a = 5;

else

a = 8; - Answers a = 5

What would be the results after the following code was executed?

int[] x = {23, 55, 83, 19};

int[] y = {36, 78, 12, 24};

for (int a = 0; a < x.length; a++)

{

x[a] = y[a];

y[a] = x[a];

} - Answers x[] = {36, 78, 12, 24} and y[] = {36, 78, 12, 24}

Which of the following is a valid declaration for a ragged array? - Answers C. int [][] array1 = new int [5]
[];

What is the value of scores [1][3] in the following array?

int [][] scores = { {88, 80, 79, 92}, {75, 84, 93, 80}

{98, 95, 92, 94}, {91, 84, 88, 96} }; - Answers 80

What is the value of scores [3][2] in the following array?

int [][] scores = { {88, 80, 79, 92}, {75, 84, 93, 80}

{98, 95, 92, 94}, {91, 84, 88, 96} }; - Answers 88

What is the value of scores [1][1] in the following array?

, int [][] scores = { {88, 80, 79, 92}, {75, 84, 93, 80}

{98, 95, 92, 94}, {91, 84, 88, 96} }; - Answers 84

What is the value of scores [3][3] in the following array?

int [][] scores = { {88, 80, 79, 92}, {75, 84, 93, 80}

{98, 95, 92, 94}, {91, 84, 88, 96} }; - Answers 96

What is the output of the following code?

int[][] array2 = { {1, 2}, {3, 4}, {5, 6} };

int sum = 0;

for (int i = 0; i < array2.length; i++)

sum += array2 [i][0];

System.out.println(sum); - Answers 9

Given the following array declaration:

int[][] triangleArray = {

{1, 2, 3, 4, 5},

{6, 7, 8, 9},

{10, 11, 12},

{13, 14},

{15},

};

What is the value of the following triangleArray [1][1]? - Answers 7

Given the following array declaration:

int[][] triangleArray = {

{1, 2, 3, 4, 5},

{6, 7, 8, 9},

{10, 11, 12},

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller TutorJosh. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $7.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

85169 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.99
  • (0)
  Add to cart