Your Name:
2.1. When the Welcome program is run, the first statement to be executed is? (a) the constructor (b) System.out.println("Welcome to Java!"); (c) new Welcome(); (d) the main method
2.2 To change the colour of drawing to green, we use (a) setcolour(green) (b) setcolor(green) (c) g.setColor(Color.green) (d) setColor(Color.green)
2.3 A comment that begins with // must end with (a) // (b) the end of a line (c) */ (d) }
2.4 The following can be used as identifiers in a Java program: (a) out, println and args (b) only out and println (c) only println and args (d) none of them
2.5 To insert a new line between the printing of two values using println, we need (a) + "n" + (b) newline() (c) "\n" (d) + "\n" +
2.6 To add 10 to points, we would use: (a) points + 10 (b) points += 10 (c) points =+ 10 (d) points ++ 10
2.7 The purpose of a constructor is to: (a) create space for objects (b) create space and initialize objects (c) initialize objects (d) run the program
2.8 Access to Curio.name will cause a compilation error because (a) name is not defined in Curio (b) name must be accessed via a Curio object (c) name should have parentheses after it (d) Curio should be spelt with a small c
2.9 If newArriveMins has the value 310, what will the formula for computing the 24 hour clock time in Example 2.6 give: (a) 510 (b) 610 (c) 505 (d) 516
2.10 For the Curio class, the instantiation Baskets = new Curios ("Masks", 30, 80); will cause a compilation error because: (a) the first parameter must be "Baskets" (b) Baskets has a capital letter (c) Baskets is not a class (d) the parameters do not match that of the Curio class
javagently third edition, © 2001 All rights reserved, J. Bishop home | examples | downloads | discussion | preface | contents | errata | quiz | answers | faq | books | material | message | users