2003FCTestAnswers

2003FCTestAnswers - CompSci 101 S1 C THE UNIVERSITY OF...

Info iconThis preview shows pages 1–6. 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

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 S1 C THE UNIVERSITY OF AUCKLAND FIRST SEMESTER, 2003 COMPUTER SCIENCE Principles of Programming TERMS TEST (Time allowed: 60 MINUTES) Surname: SOLUTIONS Forenames: Student ID number: Login name (UPI): INSTRUCTIONS: Attempt ALL questions - write your answers in the box provided Calculators are NOT permitted LAB GROUP: Please circle the ONE lab group session below to which you belong When your test is marked, it will be handed back during the lab you specify below Mon 9-11 Tue 9-11 Wed 9-11 Thu 9-11 Fri 9-11 Mon 11-1 Tue 11-1 Wed 11-1 Thu 11-1 Fri 11-1 Mon 1-3 Tue 1-3 Wed 1-3 Thu 1-3 Fri 1-3 Mon 3-5 Tue 3-5 Wed 3-5 Thu 3-5 Wed 5-7 Question/Answer Sheet - Page 2 - CompSci 101 S1 C SURNAME: ...................................................... FORENAMES: ........................................................... CONTINUED RESULTS: For examiner to complete (DO NOT FILL IN): Question Mark Question Mark 1 (/20) 5 (/10) 2 (/10) 6 (/15) 3 (/10) 7 (/10) 4 (/15) 8 (/10) TOTAL: (/100) Question/Answer Sheet - Page 3 - CompSci 101 S1 C SURNAME: ...................................................... FORENAMES: ........................................................... CONTINUED Question 1 (20 marks) a) What is printed by the following? System.out.println( 3 + 5.3 ); 8.3 (1 mark) b) What is printed by the following? System.out.println( 3 / 2 + 1.0 ); 2.0 (1 mark) c) What is printed by the following? System.out.println( 1.0 * 3 / 2 ); 1.5 (1 mark) d) What is printed by the following? int a = 9; double b = 1.5; b = a; System.out.println( b ); 9.0 (1 mark) Question/Answer Sheet - Page 4 - CompSci 101 S1 C SURNAME: ...................................................... FORENAMES: ........................................................... CONTINUED e) What is printed by the following? int a = 3; int b = 2; a = b; b = a; System.out.println( a + b ); 4 (1 mark) f) What is printed by the following? System.out.println( 3.5 + (int)3.5 ); 6.5 (1 mark) g) What is printed by the following? System.out.println( (double)3 + 2/3 ); 3.0 (1 mark) h) What is printed by the following? System.out.println( 20 % 2 ); 0 (1 mark) Question/Answer Sheet - Page 5 - CompSci 101 S1 C SURNAME: ...................................................... FORENAMES: ..............................................................
View Full Document

Page1 / 15

2003FCTestAnswers - CompSci 101 S1 C 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