2001SCTestQuestions

2001SCTestQuestions - COMPSCI 101 TEST THE UNIVERSITY OF...

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

View Full Document Right Arrow Icon
COMPSCI 101 TEST CONTINUED THE UNIVERSITY OF AUCKLAND SECOND SEMESTER, 2001 Campus: City/Tamaki COMPUTER SCIENCE TEST Principles of Programming (Time allowed: ONE hour and 15 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 Login (UPI) Lab Day and Time Section Marks Out of SECTION A 20 SECTION B 30 SECTION C 10 Total 60
Background image of page 1

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

View Full DocumentRight Arrow Icon
Candidate's Name:___________________ 2 COMPSCI 101 TEST CONTINUED SECTION A 1. Examine each of the following Java statements carefully. For each of the statements, tick the appropriate box to indicate either that the statement is correct, or if it contains any errors, then indicate the category of error (Syntax, Runtime or Logic). If the statement contains an error, then correct the error by writing a correct version of the statement below the original. (Note that there may be more than one way to correct an error - any sensible correction will fine) (a) int i = 34; Correct Syntax Error Runtime Error Logic Error (b) i n ti=3 . 0+5 ; Correct Syntax Error Runtime Error Logic Error (c) double customer2345 = 87.754; Correct Syntax Error Runtime Error Logic Error (d) double 2ndAverage = 9.08; Correct Syntax Error Runtime Error Logic Error (e) doubled=4 5 Correct Syntax Error Runtime Error Logic Error
Background image of page 2
Candidate's Name:___________________ 3 COMPSCI 101 TEST CONTINUED (g) Strings=9 8 ; Correct Syntax Error Runtime Error Logic Error (h) String u == "hello" + "world"; Correct Syntax Error Runtime Error Logic Error (i) System.out.println(3+4+"is the sum of 3 and 4"); Correct Syntax Error Runtime Error Logic Error (j) System.out.println("(3 + 4)*7="+( 3+4 )*7 )
Background image of page 3

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

View Full DocumentRight Arrow Icon
Candidate's Name:___________________ 4 COMPSCI 101 TEST CONTINUED 2. What is the output of the following application? public class Q2{
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 14

2001SCTestQuestions - COMPSCI 101 TEST 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