D. 13 E. 34 System.out.print(1); x = 5; } else System.out.print(2); if( x == 5 ) System.out.print(3); }else System.out.print(4); B Question 9 public class Book{ What is output by the line marked in the client line 1 private final int numPages; code to the right? private boolean haveRead; A. 100 false B. false C. 0 0 public Book(int pages){ D. 100 true E. true numPages = pages; } B Question 10 public String toString(){ What is output by the line marked in the client line 2 return numPages + " " + haveRead; code to the } } A. true B. false C. 0 ////////////////////////////////////////// D. 1 E. null // client code Book b1 = new Book(100); System.out.print(b1); // line 1 Book b2 = new Book(100); System.out.print(b1.equals(b2)); // line 2 B Question 11 What is output by the code to the right? int ax = 40; int bx = 64; A. 64 64 B. 0 64 C. 104 64 int cx = ax | bx | bx; System.out.print(cx + " " + bx); D. E. 127 64 128 0 B Question 12 What is output by the code to the double st = -3.4; A. -3.0 B. -2.4 C. -2.0 Math.ceil(st) ); D. E. 0.0 3.0 D Question 13 What is output by the code to the right? A. RedGreenBlueTeal B. RedGreen BlueTeal C. RedGreen\tBlueTeal
System.out.print(1); x = 5; } else System.out.print(2); if( x == 5 ) System.out.print(3); }else System.out.print(4); D. 13 E. 34 Question 9 B public class Book{ private final int numPages; private boolean haveRead; public Book(int pages){ numPages = pages; } public String toString(){ return numPages + " " + haveRead; } } ////////////////////////////////////////// // client code Book b1 = new Book(100); System.out.print(b1); // line 1 Book b2 = new Book(100); System.out.print(b1.equals(b2)); // line 2 What is output by the line marked line 1 in the client code to the right? A. 100 false B. false C. 0 0 D. 100 true E. true Question 10 B What is output by the line marked line 2 in the client code to the A. true B. false C. 0 D. 1 E. null Question 11 B int ax = 40; int bx = 64; int cx = ax | bx | bx; System.out.print(cx + " " + bx); What is output by the code to the right? A. 64 64 B. 0 64 C. 104 64 D. 127 64 E. 128 0 Question 12 B double st = -3.4; Math.ceil(st) ); What is output by the code to the A. -3.0 B. -2.4 C. -2.0 D. 0.0 E. 3.0 Question 13 D What is output by the code to the right? A. RedGreenBlueTeal B. RedGreen BlueTeal C. RedGreen\tBlueTeal
UTCS_INV.docx