0% 0 votes, 0 avg 23 1234567891011121314151617181920 This quiz randomly generates 20 questions as asked in AP Computer Science A (AP CSA) - Programming in Java. Congratulations! AP Computer Science A (AP CSA) - Programming in Java This quiz randomly generates 20 questions (in 30 mins) as asked in AP Computer Science A (AP CSA) - Programming in Java. 1 / 20 Question It sums the elements of arr. It sums the products 10*arr[0] + 10*arr[1] +. + 10*arr[arr. length-1]. It builds an integer of the form d1 d2 d3...dn, where d1 = arr[0], d2=arr[1],..., dn = arr[arr.length-1]. It builds an integer of the form d1 d2 d3...dn, where d1 = arr[arr.length-1], d2 = arr[arr. length-2],..., dn = arr[0]. It converts the elements of arr to base-10. 2 / 20 Question The sentinel gets processed. The last non sentinel value entered in the list fails to get processed. A poor choice of SENTINEL value causes the loop to terminate before all values have been processed. Running the program with this code causes a compile-time error. Entering the SENTINEL value as the first value causes a run-time error. 3 / 20 What is the output? Answer = 0 Invalid calculation Compilation fails only at line n1. Compilation fails only at line n2. Compilation fails at line n1 and line2. // ans is initialized in the try-catch block, can not be seen outside the block 4 / 20 What value is stored in result if -5 0 13 -1 12 5 / 20 Refer to the code: Consider the implementation of a writeDeck method that is added to the Deck class. I only II only Ill only I and Ill only II and III only 6 / 20 Number systems with different bases such as binary (base-2) and decimal (base-10) are all used to view and represent digital data. Which of the following is NOT true about representing digital data? At one of the lowest levels of abstraction, all digital data can be represented in binary using only combinations of the digits zero and one. The same value (number) can have a different representation depending on the number system used to represent it. Groups of bits can be used to represent abstractions, including but not limited to numbers and characters. Some large numbers cannot be represented in binary and can only be represented in decimal. 7 / 20 What will the output be? 3 2.5 7 6.5 0 0.0 Compilation fails 8 / 20 What is the output? box nbo nb An exception is thrown at the run time. 9 / 20 What is the output? Nothing is printed An Exception is thrown Compile Error May 15, 2004 10 / 20 What is the output? An exception is thrown at runtime. 07-31-2014 2014-07-31 2014-09-30 11 / 20 Consider this inheritance hierarchy, in which Novel and Textbook are subclasses of Book. The Textbook class can have private instance variables that are neither in Book nor Novel. Each of the classes-Book, Novel, and Textbook-can have a method computeShelfLife, whose code in Book and Novel is identical, but differ- ent from the code in Textbook. If the Book class has private instance variables myTitle and myAuthor, then Novel and Textbook inherit them but cannot directly access them. Both Novel and Textbook inherit the constructors in Book. If the Book class has a private method called readFile, this method may not be accessed in either the Novel or Textbook classes. Constructors are never inherited. If a subclass has no constructor, the default constructor for the superclass is generated. If the superclass does not have a default constructor, a compile-time error will occur. 12 / 20 What is the output ? 3 6 9 3 6 12 3 6 18 3 12 18 3 12 36 13 / 20 Question a[i] == max a[i] != max a[i] ‹ max | | a[i] › max true false 14 / 20 The boolean expression !A && B || C is equivalent to !A && (B II C) ((!A) && B) II C (!A) && (B II C) !(A && B) II C !(A && B II C) 15 / 20 What is the output? An exception is thrown at runtime. 07-31-2014 2014-07-31 2014-09-30 16 / 20 Question An ArithmeticException will be thrown. A syntax error will occur. statement1, but not statement2, will be executed. statement2, but not statement1, will be executed. Neither statementl nor statement2 will be executed; control will pass to the first statement following the if statement. 17 / 20 Two students have developed a protocol in which they send 4-bit messages to each other. They decide to modify their protocol to start sending 8-bit messages instead. How many more values can be represented in an 8-bit message than a 4-bit message? 21 = 2 times as many values 22 = 4 times as many values 23 = 8 times as many values 24 = 16 times as many values 18 / 20 Question I only II only III only II and III only I, II and III 19 / 20 What is the output? 1:2:3:4:5: 1:2:3: Compilation fails An ArrayOutOfBoundsException is thrown at runtime 20 / 20 What is the output? A B B A A Null Pointer Exception is thrown at runtime. A 0 B 1 Your score is 0% Restart quiz