Sample Midterm CSC 201
Sample Midterm CSC 201
Instructions:
Problem 1- 20 points For the given problem below determine how many times
the body of the loop is executed.
System.out.println(“B”+4+5);
}
}
Problem 3: 20 points
Please answer the following questions in the space provided.
Problem 4: 20 points
Write a program to calculate the sum of the array elements assuming that the array is an
integer array.
Problem 5: 20 points
Write a method called ‘sort()’ to sort the elements of an array of floats and call that
method from your main method. Any sorting technique can be used to perform the
sorting operation.(Hint: Bubble Sort algorithm).
Problem 6: 10 points
Write a Java method to accept two input strings from the user and concatenate the two
strings. Your method should return a String which is concatenation of user inputs.