{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Exam1Fall06key - 1 CSC216 Fall 2006 Exam 1 Key Student Name...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSC216 Fall 2006 Exam 1 Key Student Name ____________________________________________________ This exam is closed book and closed notes. There are 105 points (5 points extra credit). Good luck! Part 1 Java Basics Circle the correct answer(s). (5 points) 1. Which of the following statements about variables in Java programs is true? Section 4: A,B, and C Section 5: A and C (5 points) 2. Section 4: for (int i = 0; i < 10;i++) { data[i] = i*i; } Section 5: for (int i = 0; i< 10; i++) { data[i] = (i+1) * (i+1); } (5 points) 3 . Provide the output for the following method. Section 4 **** **** **** Section 5 000000 111111 222222 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
(5 points) 4. Section 4 public int getMin ( ) { int min = a[0]; for (int i = 1; i< a.length ; i++) { if ( a[i] < min) min = a[i]; } return min; } Section 5 was getMax() so replace min with max and replace < with > Part 2 Design Concepts (same for sections 4 and 5) (4 points) 5. Below is a list of some of the methods in the String class. Identify each method as an accessor or a mutator. Simply put an A by any method that is an accessor and M by any method that is a mutator : All are accessors (5 points) 6. Is this set of methods cohesive ? ___yes__ Why or why not? Single concept (5 points) 7.Explain what coupling is and discuss coupling for project 1. The classes were the PointOfSaleGUI, ListOfItems , StoreItem and LogFile. Read the book for a discussion of coupling… (10 points) 8. Design a cohesive class for a library patron. Patrons can check out and return books. A patron can also tell us if she has checked out a specific Book.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern