2008S1ExamQuestionsV1

The getdatestring method is passed three parameters

This preview shows page 26 - 31 out of 31 pages.

The getDateString() method is passed three parameters: an int : the day of the month a String : the name of the month an int : the year If you complete the method correctly, the output of the following method calls: String dateString = getDateString(15, "May", 2008); System.out.println(dateString); dateString = getDateString(10, "September", 1995); System.out.println(dateString); would be: May 15, '08 Sep 1, '95 Note: you can assume that the year is always a four digit integer and you can assume that the name of the month always contains at least three characters.
Image of page 26

Subscribe to view the full document.

VERSION 18832768 - 27 - COMPSCI 101 Question and Answer Booklet ID .......................................... CONTINUED Complete the getDateString() method in the space provided below: private getDateString( ) { (6 marks)
Image of page 27
VERSION 18832768 - 28 - COMPSCI 101 Question and Answer Booklet ID .......................................... CONTINUED Question 29 (6 marks) Complete the output that is printed when the following code is executed. public void start() { int a = 3; int [] b = {1, 2, 3}; int [] c = {1, 2, 3}; change(a, b, c); System.out.println("1: " + a); System.out.println("2: " + b[2]); System.out.println("3: " + c[2]); } private void change(int w, int [] x, int [] y) { int [] v = {1, 2, 4}; w = 4; x[2] = 4; y = v; } 1: 2: 3: (6 marks)
Image of page 28

Subscribe to view the full document.

VERSION 18832768 - 29 - COMPSCI 101 Question and Answer Booklet ID .......................................... CONTINUED OVERFLOW PAGE (If you have used this page, please indicate clearly under the relevant question that you have overflowed to this page)
Image of page 29
VERSION 18832768 - 30 - COMPSCI 101 Question and Answer Booklet ID .......................................... OVERFLOW PAGE (If you have used this page, please indicate clearly under the relevant question that you have overflowed to this page)
Image of page 30

Subscribe to view the full document.

OVERFLOW PAGE (If you have used this page, please indicate clearly under the relevant question that you have overflowed to this page) CONTINUED
Image of page 31
You've reached the end of this preview.

{[ 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