国外大学JAVA考试题2010SSExamAnswers.pdfVIP

  • 9
  • 0
  • 约2.78万字
  • 约 25页
  • 2015-09-26 发布于北京
  • 举报
国外大学JAVA考试题2010SSExamAnswers

Question/Answer Sheet CompSci101 THE UNIVERSITY OF AUCKLAND SUMMER SEMESTER, 2010 Campus: City COMPUTER SCIENCE Principles of Programming (Time Allowed: TWO hours) NOTE: You must answer all questions in this exam. No calculators are permitted Answer in the space provided in this booklet. There is space at the back for answers that overflow the allotted space. Surname Forenames Student ID Login (UPI) Q1 Q4 Q7 Q10 (/10) (/9) (/8) (/10) Q2 Q5 Q8 Total (/10) (/10) (/12) Q3 Q6 Q9 /100 (/10) (/15) (/6) Question/Answer Sheet - Page 2 - CompSci 101 ID: Question 1 (10 marks) a) What is the output when the following code is executed? String result = 1 + 1 + + + 6 / 5 + 1 + 8 / (2 + 1); System.out.println(result); 2 + 1 1 2 (2 marks) b) Give ALL the possible outputs when the following code is executed? int random = (int) (Math.random() * 4 + 3); System.out.println(random); 3, 4, 5, 6

文档评论(0)

1亿VIP精品文档

相关文档