2001SCTestQuestions

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

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

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

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

View Full Document
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
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 )

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

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

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online