COE318 \u2013 Fall 2011 Midterm - Ryerson University Department of Electrical Computer Engineering COE318\/BME506 Oct 17 2011 Midterm Name Student number

COE318 u2013 Fall 2011 Midterm - Ryerson University...

This preview shows page 1 - 4 out of 5 pages.

1 Ryerson University Department of Electrical & Computer Engineering COE318/BME506 Midterm Oct. 17, 2011 Name:________________________ Student number:________ Time: 60 minutes Closed book. No questions. _________________________________________________________ Q1. What is printed by the following program? (15 marks) public class CallTest { public static void main(String[] args) { int n = 8; int[] a = new int[] {5, 6, 7}; modify(n, a); System.out.println(n + " " + a[0]+ " " + a[1] + " " + a[2]); } static void modify(int x, int[] y) { x++; y[1] = x; } } Solution:
Image of page 1
2 Q2. What is the output when the following is executed? (15 marks)
Image of page 2
3 Solution:
Image of page 3
Image of page 4

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture