2007S2TestQuestions

2007S2TestQuestions - CompSci 101 THE UNIVERSITY OF...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: CompSci 101 THE UNIVERSITY OF AUCKLAND CONTINUED SECOND SEMESTER, 2007 Campus: City 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 No calculators are permitted Surname: Forenames: Student ID number: Login name: Question/Answer Sheet - Page 2 - CompSci 101 S2 C SURNAME: ...................................................... FORENAMES: ........................................................... CONTINUED CompSci 101 Test Results Question Marks Out of Question 1 10 Question 2 5 Question 3 5 Question 4 10 Question 5 20 Question 6 10 TOTAL 60 Question/Answer Sheet - Page 2 - CompSci 101 S2 C SURNAME: ...................................................... FORENAMES: ........................................................... CONTINUED CompSci 101 Test Results Question Marks Out of Question 1 10 Question 2 5 Question 3 5 Question 4 10 Question 5 20 Question 6 10 TOTAL 60 Question/Answer Sheet - Page 3 - CompSci 101 S2 C SURNAME: ...................................................... FORENAMES: ........................................................... CONTINUED Question 1 (10 marks) What is displayed by each of the following pieces of Java program? a) System.out.println("\"quote"); (1 mark) b) System.out.println("X" + (2 + 3)); (1 mark) c) int value = 13; System.out.println(value < 6); (1 mark) d) int i = 5; int numbers = {4, 2, -7, 5, 1, 6, 3}; System.out.println (numbers[i]); (1 mark) e) String name = "banana split"; System.out.println(name.indexOf('n')); (1 mark) f) String name = "facile"; System.out.println(name.substring(1, 3)); (1 mark) g) String name = "peasy"; System.out.println(name.substring(1)); (1 mark) h) int x = 5, y = 4; System.out.println(Math.max(x, y)); (1 mark) Question/Answer Sheet - Page 4 - CompSci 101 S2 C SURNAME: ...................................................... FORENAMES: ..............................................................
View Full Document

Page1 / 13

2007S2TestQuestions - CompSci 101 THE UNIVERSITY OF...

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

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