2004S1TestQuestions

2004S1TestQuestions - CompSci 101 THE UNIVERSITY OF...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
CompSci 101 THE UNIVERSITY OF AUCKLAND CONTINUED SEMESTER ONE, 2004 Campus: City and Tamaki COMPUTER SCIENCE TEST Principles of Programming (Time allowed: 75 MINUTES) NOTE: Attempt ALL questions Write your answers in the space provided There is space at the back for answers that overflow the allotted space Calculators are NOT permitted Surname: Forenames: Student ID number: Login name: Lab Time: Please circle the ONE lab session below to which you belong. Your marked test will be returned to you in the lab session that you circle below. CITY STUDENTS: Mon 9-11 Mon 11-1 Mon 1-3 Mon 3-5 Tue 11-1 Tue 1-3 Tue 3-5 Wed 9-11 Wed 11-1 Wed 1-3 Wed 3-5 Wed 5-7 Thu 11-1 Thu 1-3 Fri 11-1 Fri 1-3 TAMAKI STUDENTS: Mon 11:30-1:30 Tue 9:30-11:30 Tue 1:30-3:30 Wed 11:30-1:30
Background image of page 1

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

View Full DocumentRight Arrow Icon
Question/Answer Sheet - Page 2 - CompSci 101 SURNAME: . ..................................................... FORENAMES: . .......................................................... CONTINUED To be filled in by examiner: Question Marks Out of Question 1 (output) 20 Question 2 (identifiers) 10 Question 3 (errors) 10 Question 4 (complete application) 15 Question 5 (classes) 15 Question 6 (booleans) 10 Question 7 (booleans) 10 Question 8 (equality) 5 Question 9 (loops) 5 TOTAL 100 This is worth 15% of your final grade
Background image of page 2
Question/Answer Sheet - Page 3 - CompSci 101 SURNAME: . ..................................................... FORENAMES: . .......................................................... CONTINUED Question 1 (20 marks) a) What is printed by the following? System.out.println("5" + 5 + 9); (1 mark) b) What is printed by the following? System.out.println(6 + 3 + "8"); (1 mark) c) What is printed by the following? System.out.println((int) 5.3); (1 mark) d) What is printed by the following? System.out.println("\"n\\\n\""); (2 marks)
Background image of page 3

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

View Full DocumentRight Arrow Icon
Question/Answer Sheet - Page 4 - CompSci 101 SURNAME: . ..................................................... FORENAMES: . .......................................................... CONTINUED e) What is printed by the following? System.out.println(5 + 9 % 2 * (10 / 4) - 6); (2 marks) f) What is printed by the following? System.out.println(5 / 2.0 * 3 / 5); (1 mark) g) What is printed by the following? String string01 = "food looks good"; System.out.println(string01.indexOf("oo",4)); (2 marks) h) What is printed by the following? System.out.println(Math.pow(Math.max(4,3), 2)); (2 marks)
Background image of page 4
Question/Answer Sheet - Page 5 - CompSci 101 SURNAME: . ..................................................... FORENAMES: . .......................................................... CONTINUED i) What is printed by the following? System.out.print((int)3.14159 + "\nis the"); System.out.print("value of pi."); (2 marks) j) What is printed by the following? String string02 = "abcdefghij";
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 20

2004S1TestQuestions - CompSci 101 THE UNIVERSITY OF...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online