100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COMP 249 Object-Oriented Programming II (COMP 249) Sample midterm examination (Concordia University) CA$18.03   Add to cart

Exam (elaborations)

COMP 249 Object-Oriented Programming II (COMP 249) Sample midterm examination (Concordia University)

 20 views  0 purchase

COMP 249 Object-Oriented Programming II (COMP 249) Sample midterm examination (Concordia University)

Preview 3 out of 17  pages

  • March 6, 2024
  • 17
  • 2023/2024
  • Exam (elaborations)
  • Unknown
  • comp 249
All documents for this subject (2)
avatar-seller
smartzone
lOMoARcPSD|10754654




COMP 249 Object-Oriented Programming II (COMP 249) Sample midterm examination
(Concordia University)

, lOMoARcPSD|10754654




Programming Methodology II Sample midterm examination comp249


1) One-dimension arrays.

 What is the output of the following
code? int[] numbers = new int[10];
for(int i=0; i < numbers.length; ++i)
numbers[i] = i * 2;
for(int i=0; i < numbers.length; ++i)
System.out.print(numbers[i] / 2 + "
");
System.out.println();

 Answer : 0 1 2 3 4 5 6 7 8 9

2) Two-dimension arrays

 Show the output produced by the following java code.
int i, j, k, temp; // i and j are indices for the rows and
columns int [ ] [ ] A = { {5, 16, 7, 23, 15,} // 2-dimension array
{31, 12, 22, 4, 19,}
{41, 21, 14, 37, 8 } };


for (i = 0; i < A.length; i++)
{
for (j = 0; j < A[i].length - 1; j++)
{
k = j + 1;
while (k < 5)
{
if (A[i] [k] < A[i] [j])
{
temp = A[i] [k];
A[[i] [k] = A[i] [j];
A[i] [j] = temp;
}
k = k + 1;
}
System.out.print(“ “ + array[i] [j]);
}
System.out.println(“\n”);

, lOMoARcPSD|10754654




Programming Methodology II Sample midterm examination comp249

}

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 smartzone. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

67232 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
CA$18.03
  • (0)
  Add to cart