



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Exam; Class: Intro to Computer Program II; Subject: Computer Science; University: University of Texas - San Antonio; Term: Spring 2009;
Typology: Exams
1 / 6
This page cannot be seen from the preview
Don't miss anything!
Name
This is a closed book exam. Answer all questions on these sheets.
b) Write a public method, binarySearch , that uses a binary search to find a position in an array of double of a given double. Return -1 if it is not found. Assume the array is sorted in increasing order.
(10 points) Write a method that takes an array of Rectangle as a parameter. For each element of the array in which its length is smaller that its width, interchange the length and the width. You may assume that the Rectangle class has the usual accessor and mutator methods.
(8 points) Write a method that takes a two-dimensional array of ints as a parameter and returns the average of the elements of the array. Return 0 if the array has no elements.