ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 10 Weeks Ago, 5 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 26 May 2017 My Price 8.00

Write the syntax

Q1. 

Q1.  Write the syntax for

  • declaring an array holding 10 String values
  • declaring an ArrayList  holding String values.       [1 Points]

 

 

 

Q2. Use a for loop to fill an Arraylist with the square of the numbers 1 to 10. The output should be ( 1, 4, 9, 16, ..100): [3 Points]

 

Q3. Rewrite the following loops, using the "for each" construct. Here data is an array of double values. [1 point]

for (int i = 0; i < data.length; i++)
        sum = sum + data[i];
 

 

 

Q4. Write preconditions for the following methods. Do not implement the methods. [3 point]

a. public static double sqrt(double x)

b. public static String romanNumeral(int n)

c.

public static String weekday(int day)

 

 

 

 

Q5. Define class cohesion and class coupling.  [1 Points]

 

Q6. What is a static method ? What is a static variable ? Explain and provide examples.  [2 Points]

 

Q7. What is an Immutable Class ? [1 Point]

 

Q8. Draw a memory diagram that shows why the following method can't swap two BankAccount objects. [3 point]

public static void falseSwap(BankAccount a, BankAccount b)

{

    BankAccount temp = a;

    a = b;

    b = temp;

}

  • declaring an array holding 10 String values
  • declaring an ArrayList  holding String values.       [1 Points]

 

 

 

Q2. Use a for loop to fill an Arraylist with the square of the numbers 1 to 10. The output should be ( 1, 4, 9, 16, ..100): [3 Points]

 

Q3. Rewrite the following loops, using the "for each" construct. Here data is an array of double values. [1 point]

for (int i = 0; i < data.length; i++)
        sum = sum + data[i];
 

 

 

Q4. Write preconditions for the following methods. Do not implement the methods. [3 point]

a. public static double sqrt(double x)

b. public static String romanNumeral(int n)

c.

public static String weekday(int day)

 

 

 

 

Q5. Define class cohesion and class coupling.  [1 Points]

 

Q6. What is a static method ? What is a static variable ? Explain and provide examples.  [2 Points]

 

Q7. What is an Immutable Class ? [1 Point]

 

Q8. Draw a memory diagram that shows why the following method can't swap two BankAccount objects. [3 point]

public static void falseSwap(BankAccount a, BankAccount b)

{

    BankAccount temp = a;

    a = b;

    b = temp;

}

Answers

(11)
Status NEW Posted 26 May 2017 01:05 AM My Price 8.00

-----------

Not Rated(0)