You are on page 1of 182
more Cros Bg Signs section 1-5 oracle java programming MONDAY, OCTOBER 18,2018 ABOUTME ara rosa karre jawa oracle java programming midterm and section 1-5 OD ry comet tie java programming Section 1 (@rawer all questions in this section) 40. The function of Garbage Colecton in ava is: Mark for Revaw BLOG ARCHIVE (Points ¥ 201800) ¥ ober (1) kame jaws crcl jova programing ‘The JVM uses GC to clear the program output ritmo. unused Java fles onthe system. Memory occupied by objects with na reference is automaticaly reclaimed for reuse. (*) ‘Asa Java programmer, we have to cal the GC function specifically in order to manage the Java Momery. 1. Which ofthe following statements is NOT tre ofthe Java programming language? Mark for Review (1) Points ‘Al source coda is written in plaintext fies with the extension java, «ava source code les are compiled into lass files bythe javac command, ‘The javae command can be used to run a Java aplication. (*) {A clas fle contains platform independent bytecode. Correct Correct 2, Which ofthe following statements descrive the Java programming language? Mark for Review (1) Points Java is a highevel programming language. ‘The Java programming language includes a garbage collecton feature. Java is an objec oriented programming language. Al ofthe above (*) Correct Correct 3. Givon the java snippet below: public class Foot int public vod testFoa( inty=100; > ) \Which ofthe folowing statements is TRUE? Mark for Review (Points Compile error, asthe variable xfs not inialzed Variable x resides inthe stack area, and variable y resides in the heap of the JVM. Variable x resides inthe heap araa, and variable y rasides inthe 3 ofthe JVM () Variable x stays inthe heap area, and variable y resides inthe method area ofthe JVM Correct Correct 4. Which ofthe fellowing converts a human-readable fils into @ platformndependent code fle in Java?’ Mark for Reviow (1) Points JRE 40k javac command (*) Java command Iroomect Incortect, Rter to Section 1 Lesson 1 5. Java allows the same Java program to be executed on multiple operating systems. Mark for Review (1) Points True (7) False Correct Correct 6. Which of the folowing statements describe Java technology? Mark or Review (1) Points leis a programming language Iti a development environment It a deployment environment. A ofthe above (*) Incorect Incorrect. Refer to Section 1 Lesson 1. 7. During runtime, the Java platform loads classes dynamically as required. Mark for Review (1) Points| True) Correct Correct 8. One of the primary goals o the Java platform s fo provide an interpreted, just time environment. Mark fr Review (1) Points| True (1 False Incorteet Ineottect. Refer to Section 1 Lesson 1. 9. Given the folowing output from the Minor GC: [GC [DetNew: 4032K->68K(4032K),0.0429742 secs] 9350K:>7748K(32704K), 0.0431096 secs] Which of the folowing statements Is TRUE? Mark for Roviow (1) Points Entire heap is 83504: ‘Young Generation usage decreased by 3968k. (*) Tho pause time spentin Young Generation is 0.0431086 The size of Eden space is 4082%. Incorect Incorrect. Refer to Section 1 Lesson 2. 19. Given the folowing code snippet: String st = new Sting(Hello) ‘The “Hallo” String Iiteral wil be located in which memory area in the JVM during runtime? Mark for Reviow (1) Points Inthe Heap area ofthe run-ime data area in the JVM, In the Method area ofthe eurtime data area in the JVM. In the Stack area of te eun-time data area in the JVM. In the constant pool area of the run-time data area inthe JVM. (7) Incorect Incortect. Rafer to Section 1 Lesson 2. 11. Given the folowing code snippet: String ar = new Sting Hell) “The st variable willbe located in which memory area inthe JVM during runtime? Mark for Review (1) Points ‘tril stayin the heap area ofthe runime data area in te JVM stl stayin the mothod area ofthe run-time data area in tho JVW, sir wil stay inthe stack area ofthe eunime data area inthe SVM. (*) ‘sii stay inthe heap area ofthe constant poo! run-sime data area in the JVM Incorvet Incortect. Refer to Section 1 Lesson 2. 12. Inwhich area of heap memory are newly ceated objects stored? Mark for Review (1 Points Survivor Space 0 Survivor Space 4 Eden *) Tenured Incorect Incorrect. Refer to Section 1 Lesson 2. 13. Which of te fllowing allows the programmer to destroy an object referenced by x? Mark for Review (1) Points removal) xfinatze() xaolete(), Only the garbage collection system can destroy an object. *) Correct Correct 14. Which of folowing statements describes Parallel ané Serial Garbage collacion? Mark for Review (1) Points |A Sera garbage collector uses muliple threads to manage heap space. [A Parallel garbage colector uses multiple threads to manage heap space. (") [A Parallel garbage collector uses multiple treads to manage stack space, ‘A Sera garbage collector uses multiple treads fo manage stack space Incoreet Incortect. Refer to Section 1 Lesson 2. 15. Which ofthe following statements is NOT (1) Points| RUE for the JVM heap? Mark for Reviow «Java Developer can explicitly allocate and deallocate the Heap Memory (*) ‘The Heap can be managed by the Garbage Collecior ‘The Heap can be shared among all Java threads. Cass instance and arrays are allocated in the Heap Memory. Correct Correct 1. Given the java snippet botow: public class Foo int public void testFoo( inty=100; > ) Which of the folowing statements is TRUE? Mark or Review (1) Points Compile error, asthe variable xfs not inialized. Variable x resides inthe stack area, and variable y resides in the heap of the JVM. Variable x resides inthe heap aroa, and variable y resides inthe stack of the JVM (*) method area of the JVM. Variable x stays inthe heap area, and variable y resides int Correct Correct 2, Which ofthe fllowing statements deserive the Java programming language? Mark for Review (Points Java is a highevel programming language ‘The Java programming language indludes a garbage colecton feature Java isan objec oriented programming language. All ofthe above (*) Correct Correct 3, During runtime, the Java platform loads classes dynamically as required. Mark for Review (1) Points| True (1 False Correct Correct 4. Which of the fllowing statements is NOT TRUE about the JVM? Mark for Review (1 Points ‘Tho JVM isa virtual Machine that acs as an intormeciary layer between the Java Application and the Native Operating System. ‘The JVM reads byte cade fram the class fle, and generates machine code, ‘The JVM does not understans the Java language specification. ‘The JVM reads Java source code, and then translates i into byte code. (*) Inooreet Incortect. Reter to Section 1 Lesson 1. 5. Whore doos an abject of a class get stored? Mark for Reviow (1) Points| Stack area Method area Inthe fle In the database Heap area) 6. Java aliows the same Java program to be executed on multiple operating systems. Mark for Review (1) Points True (1) False Correct Correct 7. Which ofthe following converts a human-readable fil into @ platform-ndependent code fle In Java? Mark for Review (1) Points JRE 40K Javac command (1) java command Correct Correct 8. One ofthe primary goals of the Java platform s to provide an intrproted, just time environment. Mark for Review (Points True (1) False Correct Correct 8. Which of following statements describes Parallel and Serial Garbage collection? Mark for Review (1) Points |A Sera garbage collector uses muliple threads to manage heap space. [A Parallel garbage collector uses multiple threads to manage heap space. (") [A Parallel garbage collector uses multiple treads to manage stack space, ‘A Sera garbage collector uses multiple treads fo manage stack space Correct Correct 10. Given the folowing output from the Minor Gc: [GC [DetNew: 4032K->68K(4032K), 0.029742 secs] 9360K->7748K(32704K), 0.041096 secs] Which ofthe folowing statements is TRUE? Mark for Review (1 Points Entire heap is 83504. Young Goneration usage decreased by 3968k. (*) ‘The pause me spentin Young Generation is 0.0431086 ‘The size of Eden space is 4032. Correct Correct 11, Which ofthe fllowing statement (1) Points NOT TRUE for the JVM heap? Mark for Review «Java Developer can explicitly allocate and deallocate the Heap Memory. (*) ‘The Hoap can be managad by the Garbage Colector. ‘Toe Heap can be shared among all Java threads, Cass instance and arrays are allocated in the Heap Memory. Correct Correct 12, Given the folowing code snippet String st-= new Sting(Hello", ‘The “Hello” String literal wil be located in which memory area inthe JVM during runtime? Mark for Review (1) Points In the Heap area ofthe run-ime data area in the JVM, Inthe Method area of the runtime data area inthe JVM. Inthe Stack area ofthe run-time data area in the JVM. Inthe constant pool area ofthe run-ime data areain tho JVM. (*) Incoreet Incorrect. Reter to Section 1 Lesson 2. 18. Given the following output from the Minor GC: [GC [DetNew: 4052K->64K(4032K),0.0429742 gece] 9950K.>7748K(22704K), 0.0431096 secs] \What estimated percentage ofthe Java objec willbe promoted from Young space to Tenured space? Mark for Review (1) Points 02 oa 060) os 09 Incoreet Incortect. Refer to Section 1 Lesson 2. 14, Which ofthe fllowing allows the programmer to destroy an object referenced by x? Mar for Review (1) Points xromovell xsnatze() xeelete() (Only the garbage collection system can destroy an object. (*) Correct Correct 15. Given the folowing code snippet: String a= now Sting Hello) “The st variable willbe located in which memory area inthe JVM during runtime? Mark for Review (1) Points srw stayin the heap area ofthe run-ime data area in the JVM stl stayin the method area ofthe run-time data area inthe JVM, ‘sr wil stay inthe stack area of the runtime data area in the JVM. (+ ‘irl stay inthe heap area ofthe constant poo! run-ime data area in the JVM Correct Correct Section 2 (Answer al questions inthis section) 1. Which ofthe following commands allows a developer to see the effects of @ unning java application on momory and CPU? Mark for Review (1) Points javac visual (*) Javap Correct Correct 2. HolSpot has an HSDIS plugin to alow disassembly of code. Mark for Review (1) Points True (1) False Correct Correct 3. Which ofthe following commands is used to launch a java program? Mark for Review (1) Points| javac Ivisualvem java) javep Iroomect Incortect, Refer to Section 2 Lesson 1 4, Before wo can use the jst tool we fist have to use the js tol to obtain JVM process id rumbers. Mark for Review (1) Points True (7) False Correct Correct 5. Given the following information inte jb tol, ab paused at ne 11 9. public static void methoa 10 x=100 1) public tale void method) Code: 0:bpush 100 2:putstaic #7 Piel x1 5 return Which statement is rue? ‘Step completed: "thread-main’, Example.method!(), Ine=11 be ‘Mark fr Review (1 Points ‘The fne=11 means the jd © cules lie 11 bytecode in the method math The means the jab executed the last bytecode instruction in the method method. *) ‘The boi=5 means the jab executed Sines ofthe source code. From the bytecode, we can assume the Variable xs an instance variable, Correct Correct 6. The javac command can be used to display native cade in Java Mark for Review (1) Points True False () Incorteet Ineottect. Refer to Section 2 Lesson 1. 7. The jsat tool can be used to monitor garbage calecton information. Mark for Review (1) Points True) False 3. Which ofthe folowing structures are contained in a Java class fle? Mark for Review (1) Points ‘major_version access fags All ofthe above (*) The bytecode for a Java method is located in which structure in the Java class fle? Mark for Review (1) Points magic accoss_ags ‘method info (*) ‘major_version Wien structure inthe Java class file contains the ne rumber information forthe original source file? Mark for Review (1 Points rmethos_info(*) this class fled_info p_info \Which of the folowing commands can be used to translate Java source code into bytecode? Mark for Review (1) Points javac () jb jstat Correct Correct 8. Which ofthe following commands can be used Yo monitor slatistios? Mark for Review (1 Points 2 Java Virtual Machine jstat java java imap Ineoroet Incorect. Rter to Section 2 Lesson 1. 8, Which ofthe following statements is NOT TRUE forthe jab command? Mark fr Roviow (1) Points Jb can display the source code. Jd can set the break pont forthe program. Jb can dump the stack ofthe curent thread. |b can rack the GC activity ofthe program. (*) Incoreet Incorrect. R 10, The class fle contains the defitonitinherts from the superclass. Mark for Review (1) Points True False () Incorect Incortect. Refer to Section 2 Lesson 2. 11. Giver the folowing instance variable public void fot, Int 888888; } Which of the folowing statements is NOT TRUE? Mark for Review (1 Points The variable is a local variable ‘Tho 888888 isan integer Iteral, ter comple, th numbor will tay inthe constant pool The variable‘ and the Iteral 888888 are stored in the method info. (*) ‘The fold descriptor fr the variable is Correct Corract 12. The atirbutes_count item indicates how many attributes are contained within a methos Mark for Review (1) Points True (1 False 10, Like inthe dav Mark for Review (1) Points source code fle, one Java class fle can contain mutiple class definitions True False () Correct Correct 13. Given the folowing declaration of the method test: public state void testiSting s, nt \Which ofthe folowing isthe descriptor of the test method in he cass fle? Mark for Review (1) Points (avatlang/String:ntv (Gavallang/sting hv () Vitjavatlang/Sting:!) (Gavattang/Stingjava lang Integer) Incoreet Incottect, Refer to Section 2 Lesson 2. 14. Given the folowing class structure: public class Srape( void foot } public class Cirle extends Shapot void raw) ) Which ofthe folowing statements is TRUE? Mark for Review (1) Points ‘The foo method defnion appears in the Circle class. ‘The Circle class contains both the foo and craw method definitions ‘The fo0 method definition is only contained inthe Shape clas. (*) Ira Circle objects instantated, the constructor of Circe wil cal the constructor of Shape, Incorect Incortect. Refer to Section 2 Lesson 2. 15. Ina valid Ja (1) Points class file, the magic numbers always: Mar for Review 2 CAFEBABE (*) sate BABECAFE Iroomeet Incortect. Refer to Section 2 Lesson 2. Section 3 (Answer all questions inthis section) 1. opcode invokespecial is used fo invoke an instance intalzation method. Mark for Review (1) Points True (1) False Correct Correct 2. Bytacode isan intermediate representation ofa program, somewhere between source code ‘and machine code, Mark for Review (1) Points True (1 False Correct Correct 3, To inspect bytecode, which option Is used with the javap command to disassemble the class file? Mark for Review (1) Points =) Inooreet Ineortect. Refer to Section 3 Lesson 1. 4, Choose which apoode is used to lad an int from the local variable tothe operand stack, Mark for Review (1 Points ‘load load ¢) laload iconst Inoorect Incortect. Refer to Section 3 Lesson 1. 5, Java bytecode is generated by the javac command, Mark for Review (1) Points True (1 False Correct Correct 6. Choose which opcode is usod to push an int constant 5 onto the operand stack. Mark for Review (1) Points leonst 5 (*) aes loads laload_§ ines Iroorect Incortect. Reter to Section 3 Lesson 1. 7. class files are loaded into memory all at once, when a Java application is launched. Mark for Review (1) Points True False () Incoreet Incortect. Refer to Section 3 Lesson 2. 8. The Java developer can define a numberof adéltional or custom classloaders. Mark for Review (1) Points True (1 False Correct Correct 8, Which ofthe fllowing statements is NOT TRUE forthe Class.forNamo("HalloClass") method? (Choose three) public class Foot public void test Class forName("HolloClass) ) ‘Mark fr Review (1) Points (Choose all correct answers) ‘The frNama() method does no initialize the HelloClass. (") ‘The forName() method retums the Class object associated with the HeloClass, ‘The forNlame() method does not load the HelloClas class info the Java Runtime. (*) In this example, the Class forNamer'HelloCiass") wil use the ClassLoader which loads the Foo class, ‘The forName metho wil instantiate @ HelaClass objec. (*) Irooreet Incorect, Refer to Section 3 Lesson 2 10. The process of linking involves which ofthe folowing processes? Mack for Review (1) Points| verification preparation resokition All ofthe above (*) Incoreet Incottct, Refer to Section $ Lesson 2. 11. ln the ClassLoader hierarchy, which of the folowing isthe only class loader that does NOT have a parent? Mark for Review (1) Points custom class loader application cass loader bootstrap classloader (*) extension cass loader Incorvet Incortect. Reter to Section $ Lesson 2. 12 Which ofthe following exceptions is thvown by the loasClass() mothod of ClassLoader class? Mark for Review (1) Points lOException ‘systemException CClaseFormatError ClaseNotFoundExcestion *) Incorrect Incortect. Refer to Section 3 Lesson 2. 18, The same class cannot be loaded by the JVM more than one time. Mark for Review (1) Points True (1 False Correct Correct 14, Which of the folowing from ClassLoader wil oad the Jar, the Java cote elsges which are presentin the java." package? Mark for Review (1) Points Extension Class Loader Custom Class Loader Bootstrap Class Loader (*) Application Class Loader Incoreet Incortct. Reter to Section 3 Lesson 2. 16. The System or Application ClassLoader loads Java clases from the System Classpath ‘This classpath is sel by the CLASSPATH environment variable. Mark for Review (1 Points True False () Incorect Incortect. Refer to Section 3 Lesson 2. Section 4 (Answer al questions inthis section) 1. Whats the output rom the flowing code? Stiing s="a,0.¢ ‘Scanner se = new Scanner (): while (eehasNext)) ‘System.out print (se.nex\() +"); Mark for Review (1) Points a aber) abe Correct Correct 2, You declare a method: public void act(Student 5} \Which of faliowing arguments can be passed ino the method? (Choose Two) Mark for Review (1) Points (Choose all correct answers) ‘Type of Object lass Interface ‘Type of Student class (*) ‘Type of the subclass of Student (*) 3. Which ts (1) Points| 170 valid declarations for a fat value? (Choose Three) Mark for Review (Choose all corect answers) float f= 15) float = 2.06 ¢) float (=3.0L; float = 0x34; (*) float f= 1.0; Ircoroet Incorect. Rter to Section 4 Lesson 1. 4, Which two statements prevent a method from being overrdon? (Choose Two) Mark for Review (Points (Cho0se all correct answers) Void fal act) Final abstract void act) Static final vod act) (°) Final void act) 0 () State vale ac) 6, Wihich ofthe folowing operators are relational aperators?(Choose Two) Mark for Reviow (1) Points (Croose all coroct answers) Incoreet Incorrect. Refer to Section 4 Lesson 1. 7. Which of the following operators are logic operstors?(Choose Two) Matk for Review (1) Points (Choose all corect answers) 80) ~ 9. What is the output from the folowing code snippet? nies ‘System.out printn¢: (1) Points +); Matk for Review The code will compile and print "= j=0" (7) ‘The code will compile and prin Tho code will nt comple ‘The code will compile and prin ‘The code will compite and print i=0j=0" 2, Which statement isa syntactically correct way to declare an Array? Mark for Review (1) Points| inti int] g=(1,2.3,4.5) intittio intians () Incoreet Incorect Rel 3. Using the code below, what willbe the output @ Student objects instantiated? public class Student { public Student) { system out print suet Systom out piat(2") ) ) Mark for Review (1) Points The code will not compile. (+) Correct Correct 4, Whats the final value of result from the following code snippet iia int id = new int 3 int rosut =i result = result +|; Mark for Review (1) Points ‘The code will compil,resul has the value of 0. ‘The code will compile, result has the value of 2 ‘The code will not compile, result has the value of 2 The code will compile, result has the value of *(*) ‘An exception i thrown, Correct Correct '5. Whats the output ftom the following code? ‘system.outprint(i=); for(int =0;+<10; 44% iWi==3) break System .out print }. Mark for Reviow (1) Points 129456789 Jr012456789 Incoreet Incortect. Refer to Section 4 Lesson 1. 6, Examine the following Classos: ‘Student and TestStudent ‘What is the output from the pith statement in TestStudent? public class Student { private int studentld = 0 public Stent studentlé ) publi static nt get Student Feluin student ? ) public class TestStudont( publi state void main(String args) { ‘Student 51 Student 52 Student $3 System.outprintn(Student getStudentd); ) ) Mark for Reviow (1) Points TestStucent wil throw an exception No output. Compilation of TestStudent falls *) Inoorect Incortect. Reter to Section 4 Lesson 1 7. Which of fllowing relationships dos not use inheritance? Mark for Review (1) Points Car and Tire (*) People and Student Bank card and Grecit Cara ‘Animal and Cat Correct Correct 8. Which statements are tue?(Choose Three) Mark for Reviow (1 Points (Choose all corect answers) Since @ constructor can not retum any valu, it shoul be declared as voi. Yu can use access modifies to contol which other classes can callhe constructor. (*) ‘You can declare more than one constructor in a class declaration. (7) ‘A constructor can not be overloaded. Ina constructor, you can call a superclass constructor.) Incorect Incorrect. Refer to Section 4 Lesson 1 8, Whats the output from the following cage snippet? ‘System.out print (1 Points| +) eT Tt #j)s Mark for Review ‘The code will compile and print i= j=2" ‘The code will compile and print "=2 j=2" ‘The code does nat compile ‘The code will compile and print ‘The code will compile and print Incorteet Incottect, Refer to Section 4 Lesson 1. 10. Which wo statoments best describe dala encapsulation? (Choose Two) Mark for Reviow (1) Points| (Choose all correct answers) ‘The access modifir to member data is private (*) Momber data can be modified directly Methods provide for access and modification of data. (*) The access modifier for methods i protected Incoreet Incortect. Refer to Section 4 Lesson 1. ‘1. Whats the output from the folowing code? inty=si, do yn Diet) ‘System.out printing #*°*+y); Mark for Reviow (1) Points| 22 320) 23 a3 Inoomect Incortect, Reter to Section 4 Lesson 1. 12, The following code can be compiled, TrueFalse? byteb =1 b= 1; Matk for Reviow (1) Points True False () Incorvet Ineottect, Refer to Section 4 Lesson 1. 13, Whats the output fom the following code snippet? Inn) myarray=(1,2.3.4.5) intsum=0, for fnt x: myarray) ‘System.outprntn'su (1) Points sum); Mark for Review The code will nt compile 20 Inoomect Incortect. Refer to Section 4 Lesson 1 14, Which of folowing statments are true when you create a object rom class Onject at runtime as seen below, (Choose Th Java ang, Object obj = new java Jang. Object); Mark for Reviow (1) Points (Chooee all correct answers) Memary is located fr a new object, avaliable, () Reference obj can be reassigned to any other type of cbject.(*) ‘This Object instance wil not be created because you never defined class Object. [Annow instanceof class Object is created. (*) Incoreet Incortect. Reter to Section 4 Lesson 1. 15, Whats the output from the following code snippet? public class Tost { publi static void main(Strinol args) { System.outprintin(1 +2+ java’ + 3); ) } Mark for Reviow (1) Points The code does not compile ‘The code will compile and print "12java3" ‘The code will compile and print "java" The code will compile and print "java (*) The code will compile and print javad" Incoreet Incorect. Refer to Section 4 Lesson 1. 1. Which of folowing relationships does not use inhertance? Mark for Review (1 Points People and Student Animal and Cat Bank card and Credit Care Car and Tire) Correct Correct 2. Whats the output fam the following code? a hilt) ‘System.outprintinx #**+ y); Mark for Review (1) Points 320) 33 23 22 Incorvet Incortect. Rter to Section 4 Lesson 1. 3. Which statement is incoract regarding a constructor? Mark for Reviow (1) Points| \When no constructors defined in the class, the compiler wil create @ default constructor. ‘The default constructor initalizes the instance variables. ‘A constrictor ean not retum val, it must be declared as void. (*) ‘The default constructor isthe ne-parameter construcor. Correct Correct 4. Whats the output fam the following code snippet? for (int i= 0;1< 10; +4) ( i= 9) break > ‘System.out print); Mark for Review (1) Points ‘The eade will compile and print "123" The code does not comple. The code will compile and print "0123" ‘The code will compile and print "012" (*) Incorect Incorrect. Refer to Section 4 Lesson 1. 5. Aclass can be extended by more than one class. True or False? Mark for Review (1) Points True (7) False Correct Correct 6. What is the output from the following code snippet? String art = "java" chal) e=(7,'8, V8 ‘System .outprintn(strt.oqual(c) ‘System.out print == c), Mar for Review (1) Points ‘The cade will compile and print "rue tue" ‘The code will compile and print “false, true” Toe cade does not compile. *) The code will compile and print “tse false” The code will compile and print "vue, false™ Incorrect Incorrect. Refer to Section 4 Lesson 1 7, Whats the output from the following code snippet? ‘System.out print (1) Points| $17 =" +i); Mark for Review The code will compile and print ‘The code will compile and print ‘The code will compile and print ‘The code does not compile ‘The code will compile and prin Inooreet Ineortect, Refer to Section 4 Lesson 1 8. Which combination ofthe flowing overload the Student constructor?(Choose Two) Mark for Review (1) Points (Choose all corect answers) public Object Student(ntxint yi) public Student (*) protected int Student) public void Stuentint x, int yi public Studontfintxint yi (*) Ihooreet Incortect. Refer to Section 4 Lesson 1. 8. Which two statements are access modifier keywords in Java?(Choose Two) Mark for Review (1) Points (Choose all corect answers) abstract final protected *) public) Incorect Incorrect. Refer to Section 4 Lesson 1. 10. What i the output from the following code snippet? String srt = "java ‘Siting st2 = "java ‘System.outprntnstt equals(st2) + (1) Points| + strtequals(new Sting(hello")}, Matic for Review The cade will nt compile, ‘The cade will compile and print "rue, false”) ‘The code will compile and print false, true” ‘The code will compile and print flog false” ‘The code will compile and print "rue, us Incoreet Incortect. Refer to Section 4 Lesson 1. 11, When you instantiate a subeass, the superclass constructor will be also invoked, True or Faleo? Mark for Reviow (1) Points True (1) False Correct Correct 12. Which statements are true?(Choose Three) Mark for Review (1) Points| (Cno0se all corect answers) You can use access modifies to control which ather classes can call he constructor. (*) Sinco @ constructor can not retum any vale, it should be declared as void. Yu can declare mace than one constuetor in a class declaration, (7) ‘A constructor can not be overload. Ina constructor, you can cal a superclass constructor.) Correct Correct 13, Which ofthe following decaratons are wrong?(Choose Three) Mark for Review (1) Points| (Chooee all correct answers) abstract nal case Helo) (*) public abstract lass Student) protected private inti (1) abstract private void act) (*) Incoroet Incortect. Rter to Section 4 Lesson 1. 14, Which statement is true when run the following statement? 4. Sting str= nl 2 if (str = null) && (stlength)> 1)){ 3. System.out printn(‘great that number 1" 4, ole if(str!= null) & (sr lonath) <2))( 5. System.outprntin(ess than number 2"); 6.) Mark for Roviow (1) Points| ‘The code compiles anc wil throw an exception at ne 2 ‘The code compiles and wil throw an exception at ne 3. ‘The code compiles and wil throw an exception at ne 4 (*) ‘The code compiles anc wil throw an exception at Ine 5 Tho cade does not compile Correct Correct 15, Whats the output from the fllowing code snippet? int ity wile(e*x <8) ye ‘Systemoutprintny), Mark for Review (1) Points ‘The cade will not compile. (*) Ihooreet Ineortect, Refer to Section 4 Lesson 1. Section 5 (Answer all questions inthis section) 1. Immutable classes do alow instance variables to be changed by overtcing methods. ‘True 0° false? Mark for Review (1) Points True False () Inooraet Incortoct. Rterto Section § Lesson 2. 2. Anntertace can implement methods. ‘True or False? Mark for Review (1) Points True False () Incoreet Incortct. Refer to Section 5 Lesson 2. 2, Immutable classes can be subclassed. True 0” fls0? Mark fr Reviow (1) Points True False () Incoreet Ineottect, Refer to Section § Lesson 2. 4. Unit testing can help you isolate problem quickly. True or False? Mark fr Review (1) Points True (1 False Correct Correct 5. The main purpose of unit testing is to verity that an incvidual unt (a class, in Java) is working corectly before itis combined with other components in the system. True or false? Mark for Review (1) Points True (1) False Incorrect Incortect. Refer to Section § Lesson 4 6. Which statements tue forthe lass java. ArayList? Mark for Reviow (1) Points ‘The elements inthe collection are accessed using key, ‘The elements inthe collection are ordered. (*) ‘The elements inthe collection are immiatabl, The elements inthe collection are synchronized Incorvet Incottct, Refer to Section § Lesson 4 7. Which ofthe fllowing isthe correct way to throw cumstom ServerExcepton? Mark for Review (1) Points Utwow ServerException throws ServerException throw new ServerExcoatio()(*) raise ServerException Correct Correct 8. What symbol(s) is used to separate multiple exceptions in one catch statement? Mark for Review (Points A singe vertical bar |(*) 88. ) (equals ovals) "None, muliple exceptions cant be handled in one catch statement. Incoreet Incortect. Reter to Section § Lesson 3. 8, What's the outout from the following code snippet? class Shapot public void paint{Syslem.out.prin("Shape”)) class Creo extends Shapot public vod paint) throws Exception{ System aut prini‘Cirele") Utvow new Exception ? publi static void main(String] aros}{ trylnew Circe paint) catch(Exception eSystem.out pritin(Exception" ) } Mark for Roviow (1) Points rele Shape ShapeCircle Exception Compile fais (*) Irooreet Incortect. Refer to Section § Lesson 3. 10, Assortions are boolean statements to test and debug your programs. ‘rus or false? Mark fr Review (1) Points True (1) False Correct Correct 11. Which three types of objects can be thrown using a throw statement? (Choose Three) Mark for Review (1 Points (Choose all correct answers) Error () Event Excoption (*) Trrowable *) Object Incorect Incortect. Refer to Section § Lesson 3 12. The instanceof operator can fine subclass objects when they are passed to method which declare a superclass type parameter. ‘True of false? Mark fr Review (1 Points True (1) False Correct Correct 13. The instanceof operator allows you to determine the typeof an object True 0” false? Mark fr Review (1) Points True (1 False Correct Correct 14. Which one of the following would allow you to define the abstract class Animal. Mark for Review (Points public abstract Animal public Animal public abstract Animal extends class public abstract class Animal (*) Inoomect Incortect. Refer to Section § Lesson 1. 15. An abstract class can implement its methods. ‘True or false? Mare for Review (1) Points True (1) False 1. Immutable lasses can be subclassed, True or false? Mark for Review (1) Points True False () Correct Correct 2. Which one ofthe folowing would allow you to define an intrface for Animal? Mark for Review (1) Points public class Animal public Animal extends Interface public class Animal implements Interface () public interface Animal ( (7) Incorect Incortect. Refer to Section § Lesson 2. 8, Immutable classes do alow instance variables tobe changed by overising methods, True 0” false? Mark fr Review (1) Points True False () Correct Correct 4. The instanceot operator can find subclass objocts when they are passed to method which declare a superclass type parameter. ‘True or false? Mare fr Review (1 Points True (1) False Correct Correct 5. Which method wil force a subclass to implement it? Mark for Review (1) Points Abstract pubic void act); () Public double act Protected void at(Strng name} Static void ac(Sting name) Public native double act Correct Correct Section S (Answer all questions inthis section) 1. What do Arrays and ArrayLists have in common? | They both store data Ul. They can both be traversed in loops. I They both can be dynamically re-szed during execution ofa program. Mark fr Review (1) Points tony only Hang tt only *) ‘tan i nly None of these Incoreet Incortect, Refer to Section § Lesson 4 2. Reading grat cade is just as important fora programmer as reading great books is for a writer. Tue of false? Mark for Reviow (1) Points True (1) False Correct Correct 3. Unittesting can help you isolate problem quicky. True or False? Mark for Review (1) Points| True (1) False Correct Correct 4. What the result rom creating the folowing ty-catch block? ay 2) catch (Exception €) { 3, catch (Arthmeticexception a) { 4) Matk for Review (1) Points Compile fais st Line 3 (*) Compile fis t Line 2 The cade compiles Compile fais at Line + Incoreet Incortect. Refer to Section § Lesson 3. 5. Whats one step you must do to create your own exception? Mark for Review (1) Points (Create a new clas that implements Exception Create @ new clas that extends Exception. (*) Exceptions cannot be created. They are only bul into Java, Declare the primitve data type Exception, Correct Correct ‘Which statement added at line one allows the code to compile and run? Mine one public class Test ( publi static void main (Sting args) ( java ia Printer out = new java io-Prnteit (new java.io. OutpurStreamtiter (System out), tus} System out print "Java") ) } Mark for Reviow (1) Points No statements needed. (*) impor java io.OutputStreamiWriter Include java.io. Import javaio Printer Import java.io." Incoreet Incorrect. R 7. This is correct syntax for catching an exception ry{inputSiream = "missingtle. bet) catch(exception e ‘True or false? Mar for Review (1) Points True False () Inooreet Incorrect. Reter to Section 5 Lesson 3. 8, What is exception handling? Mark for Review (1) Points IF your program exits before you exnectt to, When a fie fais to open. [An error that occurs agains the flow of your program ‘Aconsistent way of handling various ero. (*) Incoreet Ineottect, Refer to Section § Lesson 3, 9. Virtual method invocation requires that the superclass method is defined as which ofthe following? Mark for Review (1) Points A private final method, ‘A defaut final method, [A publi final method. [A public static method. A public method. *) Incoreet Incortect. Refer to Section § Lesson 1. 10. An abstract class can implement its mothods. ‘rus or false? Mark fr Review (1) Points True (1 Fale Correct Correct 1%, Which Ine contains an compilation eror? Interface Shape 0) Interface InnerShape extends Shape() clas Circle implements Shape} clas InnerCitele extends Circle) class Rectangle implements Shapet} public class Tester publi static void main(String] args) { Cielo c= new Ciclo InnerCiele ie = new InnerCirle) Rectangle rect = new Rectangle) System out print(c instanceof InnerCirl) Systom.outprint(cinstancoof Cele); (Lino 2 System out print(ect instanceof InnerCirl); Line 3 System aut prini(ect instanceof Shape}, Line 4 ) Mark for Reviow (1) Points Line 2 Line 3.) Line 4 Line 1 Correct Correct 12, An abstract class can be instantiated. ‘True or false? Mark fr Review (1) Points True False () Incoreet Incorrect. R 13. In general, classes can be made immutable by placing final key word before the class keyword. True 0” false? Mark fr Review (1) Points False True (1) Correct Correct 25 trom other objacs of the same class. 14, The slate of an object diferent True or False? Mark for Review (1) Points True (1 False Correct Correct 15. Which one of the folowing would allow you to define an interface for Animal? Mark for Review (1) Points public interface Animal (7) public class Animal implements Interface ) public class Animal public Animal extends interface () Correct Correct ection 5 (Answer al questions inthis section) 1. Whatis exception handing? Mark for Review (1) Points If your program axis before you exec itt, A consistent way of handling various ero. (*) When a file fais to open. [An eror that occurs agains the flow of your program Correct Correct 2, Which statoments are true when you compile and run this cade. (Choose Two) public class Test public slalic Sting sayHello(Stng name) throws Excepion{ ull) hrow now Dublc static void main(String) args} sayHell("Java") 8) 8.) Mark for Review (1) Points| (Choose all correct answers) can not ergata Exception object inthe Test Class. ‘The clas Test compile line 6 contains a throws statement. puble state void main(Stingl args) throws Exception) The class Test compiles line 7's enclosed ina ty-catc block. try{ sayHello(avar) Jeateh(Excoption 0} *) Compilation succeeds Incorvet Incortect. Rter to Section § Lesson 3, 3. Assertions are optional ways to catch logic errors in code. ‘rus or false? Mar fr Review (1) Points True (1) False Correct Corract 4, Assertions are boolean statements to test and debug your programs. True or false? Mark fr Review (1) Points True (1) False Ihooreet Incottect, Refer to Section 5 Lesson 3, 5, What i the output frm the fllowing cade snippet? public static void main(String) args} ty Strings sO} "davat Systom out prints} Jeateh(Exception ) ( ‘System out printin( Exception") Jeatch(NulPointerException 6) System out print NulPointerException”) ) Mark for Review (1) Points| [NulPointerExcaption Comite fais (*) deve Exception Inoomect Incortct. Refer to Section 5 Lesson 3. 6, A.upward cast means all instance variables of the subclass are permanent lst tothe True 0” false? Mark fr Review (1) Points Tue False () Iroomeet Incortect. Refer to Section § Lesson 1. 7. The instanceof operator can find subclass objects when they are passod lo method which clare a superclass type parameter. ‘True or false? Marx fr Review (1) Points True (1) False Correct Correct 8, Adownward cast of a superclass to subclass allows you to access a subclass specialized ‘method call. True or false? Mark fr Review (1) Points True (1 False Correct Correct 8. You cant downcast an object expllly because you must use Vitual method invacation ‘rus or false? Mark fr Review (1) Points True. False () Incorect Incorrect. Refer to Section § Lesson 1. 10. Unittesting can help you isolate problem quickly. True or False? Mark for Review (Points True (1 False Correct Correct 11, Which ofthe following slatements about arrays ane ArrayLisis in Java are ue? |. An Array has a fixed length 1. Array can grow ard stink éynamvcaly as required Il, An ArrayList can store mutiple abject ypos. IV. nan ArrayList you need to know the length and the curent number of elements stored. Mark for Review (1) Points Hand I only ¢) Wand 1 only 1, ane ony Likittang iv None of these Incorect Incortect. Refer to Section § Lesson 4 12. Which statement is true forthe class java tArayList? Mark for Review (Points ‘The elements inthe collection are synchronized ‘The elements inthe collection are accessed using key, ‘The elements inthe collection are ordered. (*) ‘The elements inthe collection are immutable Incoreet Incortect, Refer to Section § Lesson 4 13. Amethad wih default access can be subclassed ‘rus or false? Mar fr Review (1) Points True False () Irooreet Incortect, Refer to Section 5 Lesson 2 14, Which two statements are equivalent to ine 27 (Choose Two) 1. publ interface Account{ 2, int accountlD=100, 3.) Mark or Reviow (1) Points| (Choose all correct answers) static int accourtO=100;() privat int account Final nt accountID=100; (+) Abstract it accountD=100; protected int accountO=100; Incorect Incortect. Refer to Section § Lesson 2. 15. Classes define and implement what? Mark for Review (1) Points [Al methods with implementations Variables and methods (*) ‘Some methods with implementations [Al method definitions without any implementations Constants and all methods wih implementations 1. Viual method invocation must be defined with the instanceof operator ‘rus or false? Mark for Review (1) Points| True False () Incorect Incorrect. Refer to Section § Lesson 1 2, An abstract class can implement is methods True or false? Mark fr Review (1) Points True (1 False Correct Correct 3. You cart downcast an object explly because you must use virtual method invocation ‘rus or false Mark fr Review (1) Points True False () Correct Correct 4, Which method wil force a subclass to implement? Mark for Review (1) Points Abstract pubic void act) () Protected void act(Sting name) Public double act State void ac(Sting name) Public native double act Correct Correct 5, Methods ean not throw exceptions. True or false? Mark for Review (1) Points True False () Incorvet Ineottect, Refer to Section § Lesson 3, 6. Inwhat order do muple catch statements execute? Mark for Review (1) Points ‘The order they are dectared in ( most specifics) (7) ‘They all execute a the same time. ‘The order they ara declared in (most general fist). None of them execute since you cannot have multiple catch statements, Incoreet Incottect, Refer to Section § Lesson 3, 7. Which statements are true when you compile and run this cade, (Choose Two) 1. publ class Test 2. publi state String sayHello(Strng name) throws Excepting 3.-iffname = nul) throw new Exception); 4, rolum "Hello" + name 5) 6, public static void main(String) args) 7. sayHell ava) 8) 8.) Mark for Review (1) Points| (Choose all correct answers) tion objectin the Test Cass. Compilation succeeds The class Test compiles line 6 contains a throws statement, public state vod main(Stringl] args) throws Exception) ‘The clas Test compile line 7 is enclosed ina ty-catch block. try{ sayHello(uavar) Jeaten(Exception 6} (*) Correct Correct 8. This is correct syntax for catching an exception ry{inputSiream = "issngfile.be) catch(exception o ‘True or false? Mar fr Review (1) Points True False () Correct Correct 8, Mutiple exceptions can be caught in one catch statement ‘True 0” false? Marx for Review (1) Points True (1) False Correct Correct 10, You can only implement one interface ina class. ‘rus or False? Mark for Review (1) Points True False () Inoomeet Incortect. Refer to Section 5 Lesson 2. 11. Immutable classes can be subclassed True or false? Mark for Review (1) Points Tue False () Correct Correct 12, Which one of the folowing would allow you to define an interface for Animal? Mark for Review (1) Points public class Animal public Animal extands Interface 0 public class Animal implements Interface ) public interface Animal ()(*) Correct Correct 13, Which of te following statements is false? Mark for Review (1) Points ‘An ArrayListhas a fixed length (*) [An ArrayList can store muliple object types [An ArrayList can grow and stink dynamically as required In an Array you need to know the length and the curent numer of elements store. Incorteet Ineottect, Refer to Section § Lesson 4 “Test: Java Programvming Migterm Exam Review your answers, feedback, and question scores below. An asterisk ("indicates a correc Section 4 (Answer all questions inthis section) 1. The function of Garbage Collection in Java is: Mark for Review (1) Points| ‘The JVM uses GC to clear the program output ‘The JVM GC deletes all unused Java les on the system. “Memory occupied by objects with no reference is automaticaly recleimed for reuse. (*) [Asa Java programmer, we have to cal the GC function specically in order to manage the Java Memory. Correct Corract 2. Which ofthe fllowing allows the programmer to destroy an object referenced by x? Mark for Review (1) Points xromovel) xfinalzo() xaelete() (Only the garbage calletion system can destroy an abject. (*) Correct Correct 3. Given the following output from the Minor GC [PSYoungGen: 9200K->1008K(9216K)] 6980K->3251K(8456K), 0.004573 eecs] [Times:user=0.03 sys=0.03, rel=0.00 secs} Which of the folowing statements is TRUE? Mark for Review (1) Points ‘The pause ime spantin GC is 0.03, ‘The size of the entire neap is 19456k (*) This is # major garbage collection process. ‘Tho 20 of the tenured space is 19458. Correct Correct 4. Java allows the same Java program to be executed on multiple operating systems. Mark for Review (1) Points True (1 False Correct Correct 5. Which ofthe following statements describe Review (1) Points Java programming language? Mark for ava is a highevel programming language ‘The Java programming language indludes a garbage colecton featur. Java isan object oriented programming language. All ofthe above (*) Correct Correct Page 1 of 10 Next Summary “Test: Java Programming Migterm Exam Review your answers, feedback, and question scores below. An asterisk (*) Indicates @ corect Section 4 (Answer al questions inthis section) 68. Given the java snippet below: public class Foot int public void testFoo( Inty=100%, > } Which ofthe folowing statements is TRUE? Mark or Review (1) Points Compile error, asthe variable xfs not inialized Variable x resides inthe stack area, and variable y resides in the heap of the JVM. Variable x resides inthe heap area, and variable y resides inthe stack of the JVM (*) Variable x stays inthe heap area, and variable y resides inthe method area ofthe JVM Correct Correct Section 2 (Answer all questions inthis section) 7. The javac command can be used to cisplay native code in Java Mark for Review (1) Points True False () Correct Correct 8, Which ofthe following commands can be used to translate Java source code into bytecode? Mark fr Review (Points java Javae () jd stat Correct Correct 8, Which of the following statements is NOT TRUE forthe jab command? Mark for Review (1) Points| jb can display the source code. |b can st the break pont forthe program |b can dump the stack of the curent thread. Jb can tack the GC activity ofthe program. *) Correct Correct 10. Like in the Java source code file, one Java class fle can contain multiple class definitions Mark for Review (1) Points True False () Correct Correct Previous Pago 2 of 10 Noxt Summary Test: Java Programming Midterm Exam Review your answers, feacback, and question scores below. An asterisk ("indicates a correct Section 2 (Answer al questions inthis section) 11. Which stricture in the Java class file contains the line number information forthe original source file? Mark for Review (1) Points methoe_info(*) this_class fled_invo p_info Correct Correct 12. The attrbutes_count item indicates how many attributes are contained within a method Mark for Review (1) Points True (1 False Correct Correct Section 3 (Answer all questions inthis section) 13, Which ofthe fllowing opcode instructions would add 2inleger variables? Mark for Review (1) Points ade act laa) Incorvet Incortect. Refer to Section 3 Lesson 1. 14. Choose which opcode is used to push an int constant § onto the operand stack. Mark for Review (Points leonst 5°) aes loads laload§ ines Correct Correct 15, opcode invokespecial s used to invoke an instance intalzation method, Mark for Review (1) Points True (1 False 18. Which of the following is NOT ajava class loader? Mark for Review (1) Points| verfication class loader (*) application cass loader bootstrap class loader extension class loader Correct Corract 17. The Java developer can define a numberof addtional or custom classloaders. Mark for Review (1) Points True (1 False Correct Correct 18, Which ofthe fllowing exceptions i thrown by the loadCiase() method of ClassLoader class? Mark for Review (1) Points OException ‘systemException CClaseFormatérror ClaseNotFoundException (*) Correct Correct Section 4 (Answer al questions inthis section) 19, Which three are valid declarations for afloat value? (Choose Three) Mark for Review (1) Points| (Choose all corect answers) float #=-15(°) float f= 0x24; (*) float f=3.0L; float #= 2.08 ¢) float #= 1.0; Correct Correct 20. What s the fina value of result rom 38 following cade snippet? ini=1 Int id = new int intresut =i rosult= result + |; Mark for Review (1) Points “The code will compile, resu has the value of 0. ‘The code will compile, result has the value of*(*) ‘The code will ot compile, result has the value of 2 ‘The code will eompila, result has the value of 2 ‘An exception is thrown Correct Correct Previous Page 4 of 10 Next Summary Test: Java Programming Midterm Exam Review your answors, feodback, and question scores bolow. An asterisk ("indicates a corroct Section 4 (answer all questions inthis section) 21. What isthe output from the following code snippet? String sr1= "java" ‘String st2=new Stingava") ‘System out print st ‘System.out print st Mark for Review (1) Points 12) 2itorn Tho cade does not compile The code will compile and print "vue false" ‘The code will compile and print “false tus" ‘The code will compile and print “alse fas" ‘The code will compile and print Correct Correct 22. What isthe output from the folowing cod snippet? inn) myoray=(1,2.3.4.8) int sumeo, for (tx: myaray) ‘System.out prntn'su (1 Points + sum); Mark for Reviow ‘The code will not compile. 20 Correct Correct 23. Examine the following Classes: ‘Student and TestStudent ‘What isthe output from the prindn statement in TestStudent? public class Studont{ privat int studenté pubic Student student ) publi static nt get Student return students ) ) public class TestStudent( publi static void main(String args) { ‘Sludent 61 = new Student) Student 62 = new Student) Studont $3 = now Studont) System.outprintn(Student getStudentd); ) } Mark for Review (1) Points "No output. Compilation of TestStudent fais (*) TestStudent wil throw an exception Correct Correct 24, Which ofthe fllowing declarations are wrang?(Choose Three) Mark for Review (1) Points| (Choose all corect answers) abstract private void act) (*) public abstract class Student) protected private inti (7) abstract final class Hello) (*) Correct Correct 25. Which ofthe following types are primitive data types? (Choose Two) Mark for Review (1 Points| (Choose all corect answers) String boolean ¢*) ouble (*) Integer Correct Correct Previous Page § of 10 Next Summary ‘Test: Java Programming Micterm Exam Review your answers, feedback, and question scores below. An asterisk "indicates a correct Section 5 (Answer all questions inthis section) 26, Immutable classes do allow instance variables to be changed by overriding methods ‘True or false? Mar for Review (1) Points True False () Correct Correct 27. You can only implement one interface in a class. True or False? Mark for Review (1) Points True False () Correct Correct 28, Interfaces define what? Mark for Review (1) Points Constants and all methods wih implementations ‘Some methods with implementations [Al method defntons without any Implementations (*) {Al methods with implementations Variables and methods Correct Correct 28. Modeling classes fr a business problem requires understanding ofthe business nol Java. ‘True or false? Mare fr Review (1) Points True False () Correct Correct 30. Classes define and implement what? Mark for Review (1) Points ‘Some methods with imolementations Constants and all methods with implementations [Al mothods with implementations |All method definitions without any implementations Variables and methods (*) Correct Correct Previous Page 6 of 10 Next Summary ‘Test: Java Programming Midterm Exam Review your answers, feedback, and question scores below. An asterisk indicates a correct Section 5 (Answer all questions inthis section) 31. Aninterace can implement mathods. rus or False? Mark for Reviow (1) Points True False () Correct Correct 32, When ine 108 executed, which method willbe called? 1 class Account ( 2 public void depostint amt, int amt) {) 3 public void depositint amt} 4) ‘5 public class CreditAccount extends Account { 6 public void deposit) () 7 public void depositint amt) 8 public stat void main(Sting args) {9 Account account = naw CredtAccaunt 10 account deposi(10}; 1) 42) Mark for Reviow (1) Points Ine? ¢) Ine tne Ine 6 Correct Correct 33, You can always upeast a subclass to an Interface provided you dont need to access any members ofthe concrete class ‘rus or false? Mark fr Review (1) Points True (7 Fale Correct Correct 34, Which two of the folowing statements are true? (Choose Two) Mark for Review (1) Points (Choose all corect answers) [An abstact class must contain absret method. [An abetract lass ean define constructor. (*) [An abstract class can create subclass and be constructed. [an abstract class must be dfined by using the abstract keyword. *) Correct Correct 35, An abstract class can implomont its methods. ‘rus or false? Mar for Review (1) Points True (7) False Correct Correct Previous Page 7 of 10 Next Summary ‘Tost: Java Programming Midterm Exam Review your answers, feedback, and question scores below. An asterisk "indicates a correct Secton 5 (Answer all questions inthis section) 38, Vial method invocation must be detined with the instanceof operator. ‘True or flee? Mark fr Review (1) Points True. False () Correct Correct 37. You cant downcast an objactexpliily because you must use vitual method invocation. ‘True or false? Mark for Review (1) Points Tue False () Correct Correct 38. Which of the following isthe comect way to throw cumstom ServerException? Mark for Review (1) Points throw ServerException throws ServerException throw new ServerException()(*) raise ServerExcepion Correct Correct 38, When wil a fray statement be executed? Mark for Review (1) Points ‘Always; no matter fan exception is throwm or not. (*) nly if an exception isnot thrown. "Never; itis there for visual purposes. (Only if mutiple exceptions are caught and thrown (Only i an exception is thrown, Incorect Incortect. Refer to Section § Lesson 3. 40. What isthe output from the following code snippet? publi static void main(String args) to String] s=null slave" System outprinth( (0) Jeatch(Exception e) ‘System out printn"Excopton") Jeateh{NulPointerExcepton e) Systom out prntn"NullPoinerExceptio"); ), Mark for Review (1) Points Exception NulPointerException Compile fils (*) Java Correct Correct Previous Page 8 of 10 Next Summary Test: Java Programming Midterm Exam Review your answors, feacback, and question scares below. An asterisk ("Indicates a correct Section 5 (answer al questions inthis section) 441. Which statements are true whan you compile and run this code.(Choose Tw) 1. public class Test{ 2. publi static String sayHello(Strng name) throws Excepting 3. iname == nul) throw new Exception) 4. rom "Hello" + name 5) 6 7. 8 8 public static void main(String] args} sayHello"Java") ) } Mark for Review (1) Points (Croose al correct answers) ‘The clas Test compiles line 7 is enclosed ina try-catch block. try{ sayHello(‘uavar) Jeateh(Exception 6} (*) Compilation succeeds can not ereate Exception object inthe Test Class The clas Test compiles i tine 6 contains a throws statement. public static void maln(Stinl) args) throws Exception (*) Correct Correct 42. The finaly clause only executes when an exception isnot caught and thrown, ‘rus or false? Mare for Review (Points True False () Correct Correct 43. Inwhat order do multiple catch statements execute? Mark for Review (1) Points ‘The order they are declared in most speci fist) (+) ‘They all execute at the same time, ‘The order they are declared in (most general fist) "None of them execute since you cannot have multiple catch statements, Correct Correct 44, Methods can no throw exceptions ‘True 0” false? Mark for Review (1) Points Tue False () Correct Correct 45. What do Arrays and ArrayLists have in common? | They both store data. 1. They can both be traversed in loops. Il, They both can be dynamically re-szed during execution ofa program. Mark fr Review (1 Points lonly Wooly Hand tl enly 1 tana I only None of these Correct Correct Previous Page 9 of 10 Next Summary ‘Test: Java Programming Midterm Exam Review your answers, feedback, and question scores below. An asterisk ("indicates a correct Section 5 (Answer all questions inthis section) 46. The main purpose of unit esting isto very that an individual unit (a class, in Java Is working corectly before itis combined with other components in the system. True or false? Mark for Review (1) Points True (1 False Correct Correct 47. Why is thelpfl for naw programmers to read pre-written code?(Choose Two) Mark for Review (1) Points (Co0se all corect answers) Its not helpful to read code writen by other programmers, Learn new programming techniques. (*) Understand code wten by other programmers. (*) Meet new programmers. Correct Correct 48. Which ofthe folowing statements i false? Mark for Review (1) Points| [An ArrayList has a fixed length (*) [An ArrayList can store multiple object types, In an Array you need to know the length and the current number of elements store. [An ArrayList can grow and strink dynamically as requires Correct Correct 49. Which of the folowing statements about unit testing isfare true |. when all unt tests succeed, you can have high confidence your code is sli 1. fa unittest fas, you donst proceed unt the code is fixed and the test succeeds, IL Unit testing can help developer find probloms early in the development cycle Mark fr Review (1) Points only ang tlenly Wana only *) None of these Correct Correct 50. Which of he following statements about arrays and ArrayLists in Java are rue? |. Aa Array has a fxed length Ui. An Asray can grow and sbink éynamicaly as required Ul, An ArrayList can store mutiple abject ypas. IV. nan ArrayList you need to know the length and the curent number of elements store. Mark for Review (1) Points lana I only land IV only Lt ane tt only Likittand iv None of these 14, Why sit helpful for new programmers to read pre-wrten cade?(Choose Two) Matk for Review (1) Points (Choose all corect answers) Learn new programming techniques. (*) Meet new programmers. Understand code writen by other programmers. (*) Its not helpful to read code written by other programmers. Incoreet Incorrect. R 15. Which ofthe following statements about inher (1) Points ce is false? Mark for Review [A subcass inherits all the mombers (elds, methods, and nested classes) from is superclass. Inheritance allows you to reuse the flelds and methods of the super class without having to write them yourset Inheritance allows you to minimize the amount af duplicate code in an application by sharing ‘common code among several subclasses. ‘Through inhettance, a parent class is a more specialized form ofthe eilé class. (*) Incorrect Incortect. Refer to Section § Lesson 4 Section 6 (Answer all questions inthis section) 1. A LinkedList is a type of Stack ‘True or false? Mark fr Review (1) Points| True (7) False Correct Correct 2. Which ofthe following is alist of elements that havea fist in last out ordering. Mask for Review (1) Points Arrays Hashiaps Enume Stacks (*) Inoomect Incortct. Reter to Section 6 Lesson 3. 3. AtHashMap can only store String types. ‘True or false? Mark fr Review (1) Points True False () Incorteet Ineortect, Refer to Section 6 Lesson 3, 4. Which ofthe following corectly defines a queue? Mark for Review (1 Points Ast of elements witha festin last out order Ast of elements witha frtin frst out order. (*) Iti a keyword in Java that restrict the use of the cade to local users only. ‘Something that enables you to create generic class without specifying a type between angle brackets = Incorteet Ineottect, Refer to Section 6 Lesson 3, 5, Which line contains an compilation errr? Intorface Shape 0 lass Circe implements Shapet) public cass Test public static void main(String] args) { Lists = new ArrayList)! Line 4 List ic = new ArrayList): Line 2 Grrele © = now Clee) Is.ada(c); Line 3 lecada(e) Line 4 ) } Mark for Review (1) Points Line 2 Line 4 Line 1 Line 3.) Incorrect Incortect. Refer to Section 6 Lesson 2. 6. Which lass isan ordored collection that may contain duplicates? Mark for Review (1) Points Ist) set array Incoreet Incorrect. R 7. The folowing cade is valid when working with the Callaction Interface, Collection collection = new Collection(s True 0” false? Mark fr Review (1) Points True False () Correct Correct 8, What the outout from the fllowing cade snippet? public state void main(String args) ust wow ArrayList luadat); Nada} print } publi static void prints ist) ( for (Number fist) System outprint(a } Mark for Review (1) Points ‘The code will not compile, 120) Incorect Incorrect. Refer to Section 6 Lesson 1. 9. <7 extends Animal >is an example ofa bounded ganevic wildcard True 0” False? Mack for Review (1) Points True (1 False Correct Correct 10. Whats the correct definition of Enumeration (or enum)? Mark for Review (1) Points Code that nalizes an ArrayList Ast of elements thats dynamically stored. ‘bounded generic class [A keyword that specifies class whose objects are defined inside the class, (*) Incoreet Incortect. Refer to Section 6 Lesson 1. 11, Which ofthe fllowing would intalze a generic class “Cel using a Sting type? 1. Coll cal = new Cel; Ul, Colca = new Steng Mark for Review (1) Points lana 1) tony Wana tony only Ircomvet Incortect. Rter to Section 6 Lesson 1. 12. Why might a sequential search be inofciont? Mark for Roviow (1) Points Iutlizes the “divide and conquer" method, which mak gorithm more err prone, It requires incrementing through the entire array inthe worst case, whichis inefcient on large data sets.) Involves looping through the aray multiple times before finding the value, whch is inofciont on large data sets, It's never inofcont Incoreet Incottect, Refer to Section 6 Lesson 4 13, Which of the faliowing sorting algorithms uizes a “éhide and conquer” technique to sort, ‘arrays with optimal speed? Mark for Reviow (1) Points Sequential Search Morge Sor") Selection Sort Binary Search All of he above 14, Bubble Sort is sorting algorithm that involves swapping the smallast value int the fist Index, finding the next smallest value ana swapping ft into the next index and soon untl the array is sorted. ‘True or false? Mare fr Review (1) Points True False () Incoreet Incorect. Refer to Section 6 Lesson 4. 15. A sequential search isan iteration through the array that stops atthe Index where the dosired olomentis found ‘rus or false? Mark fr Review (1) Points True (1) False Correct Corract Section 6 (answer all questions inthis section) 1. Which ine contains an compilation error? Interface Shape 0 class Circle implements Shape() public clase Test, publi static void main(Strinal args) { List Is = new ArrayList)! Line 4 Liste = new ArrayList): Line 2 Circle ©= new Circle) Is.ada(e; Line 3 lecada(e) Line + ) } Mark for Roviow (1) Points Line 3) Line 4 Line + Line 2 Correct Correct 2. Which ofthese could be set? Why? Mark or Review (1) Points {1.4.2.2 305, 26} because a get may contain duplicates and alls elements are of the same ‘ype. {PApple, 1, "Caro", 2) because it records the index ofthe elements with folowing integer. {1.2,5, 178, 259} bocause it contains no duplicates and alls elements are ofthe same typ. o All ofthe above are sets because they are collections that can be made to fit any ofthe chovoes. Incorrect Incoctoet. Refer to Section 6 Lesson 2 3. Which code inserted into the code below guarantees thatthe program wil Outpt (1.27? import java.t.*; public class Examplet publi state void main(String) args){ insert code here set.add(2); selade(t); System.outprintin(sst); ) ) Mark for Reviow (1) Points Set sot = new SortedSe) Sot sot = new Treeset) (+) Set set = new LinkedHashSet( sets: ow HashSet( List st = new SortodLst); Inoorect Incortect. Refer to Section 6 Lesson 2 4. Blg-© Notation is used in Computer Science to describe the performance of Sorts and ‘Searches on arrays, True or flea? Mark for Review (1) Points| True (1) False Correct Correct 5, Selection sorts efcientforlarge arrays. True or false? Mark for Review (1) Points True False () Incoreet Incottect, Refer to Section 6 Lesson 4 6, Which of the following sorting algrityms uiizes a “divide and conquer” technique to sort, arrays with optimal speed? Mark for Reviow (1) Points Sequential Search Merge Sor (*) Selection Sort Binary Search Allof he above Incorect Incortect. Refer to Section 6 Lesson 4. 7. A sequential search isan eration through the array that stops atthe index where the desired elements found ‘rus or false? Mark for Review (1) Points True) False Corteet Correct 8. Enumerations (enums) are useful for storing data : Mark for Reviow (1) Points \When you know alo the possibilities ofthe class (*) When the class is constantly changing When the class is @ subclass of Object. You cannot store data in an enum, Incoreet Incorrect. Rs 8, A generic class increases the risk of runtime class conversion exceptions, ‘True or False? Mark for Review (1) Points Tue False () Correct Correct 10. Generic methods are required to be declared as stat. ‘True oF False? Mark for Review (1) Points True. False () Correct Correct 11, The folowing code will compile Trus or False? lass Node implements Comparable{ public int compareTo(T abjreturn 4 ) class Test( ble slaie void main(Stingl] args) Node ne=new Node=>(); Comparable com=ne; } ‘Mark for Review (1) Points True (1 False Correct Correct 12, Which scenario best deserbes a stack? Mark for Review (1) Points| A pile of pancakes wih which you add some tothe top and remove them one by one fom the top tothe bottom. (*) ‘A row of books that you can take out of only tho middle ofthe books first and work your way ‘outward foward ether edge Aline atthe grocery store where the fst person inthe line is the fist person to leave, All of he above describe a stack, Incoroet Ineottect, Refer to Section 6 Lesson 3, 13, Wh (1) Points you enqueue an element in the st? Mark for Review ‘adds itt the end of thelist (*) ‘adds itt the stat of thelist removes it om the front ofthe lit removes it from the end ofthe list Incorect Incortect. Refer to Section 6 Lesson 3 14. ALLinkedListis a type of Stack True or false? Mark fr Review (1) Points True (1) False Correct Correct 15, ALinkedList isa lt of True or false? Mark for Review (1) Points smenis that is dynamically stored True (1 False Correct Correct 1. Al classes can by subclassed. Mark for Review (1 Points True False () ‘5. What is special about including a resource ina try statement?(Choose Two) Mark for Review (1) Points (Choose all correct answers) ‘The resources wil auto-clse, (*) {An eror wil be thrown ithe resourees does not open. (*) ‘The program wil fal fhe resource does not open 6. Why should you not use assertions to check parameters? Mark for Review (1) Points| AAssertions can be disabled at run time which may cause unexpected results in your assertons, o Not all methods have parameters, therefore assertions should never be used on parameters Its har to assume expected values for parameters. Assertions do not work on parameters 415. When an objec is able to pass on its stat and behaviors tots children, this called: Mark for Reviow (1) Points Ineitance (+) Encapsulation Polymorphism Isolation Posted by kare resal at 7:27PM 101 comments: © Weer ere zreasaran Section 8 (Aswor al questions inthis suction) 1. An example ofan upper bounded wird i. ‘AayLlst() raytist, Arrayist Arraylist 2.Erumeratios (enums) are useful for storing data ‘wipe the class is constant changing When you krow al of he possibites of ho cass () ‘When the cassis subclass of Object. You cannot lore data in a ern, 5. When woul an enum (or enumeration) bo used? ‘nen you aready knew athe posses for abc of hat lass. (+) ‘nen you wish o remove data rom menery When you wis ont ze a Hassel, ‘wh you want to be able to create any number of obec oF hat lass 4 Enumeration (enum) must be declared inher own class. Twe False) '5.Bubble Sor is soring algo that involves swapping the smallest value into the frst index. Fring the next smabest value and swapping it into the next index and s0 on unl he aay is sorts, Fake) ‘inch of the following best describes lslographcal oder? ‘An order based on the ASCII value of characters) “Te onder of inde aftr an aray has bean sorted ‘Asimpl soringalgorthm that is inetiiant on large rays ‘Acamplex sorting algorithm thatiseffciont on larg aay. 7.Big-0 Notation is used in Computer Scionco to describ the perfeance of Sots and Soarchos on arrays. Tro or false? Two) Fatee 1. Which ofthe flowing sorting alors uizes a “vide and conquer echrique to 2 antays with optinal speed? Sequential Search Merge Sort") Selecton Sort Binary Search| ‘Allo the above. ich of to following corecty adds "Cabbage" to the ArrayList vegetables? vegetables cabbage’ vogolabos += "Cabbage": vogelabes et'Cabbag vegetables add Cabbage") ‘so. Ienltrface forme the roo of he calectons hierarchy? sa Map ait sal.coteston () sa Colectons 1. What a so? ‘Acolection of elents that does net contin duplicates.) ‘Akeyword in dava that ies an ArrayList Somothng ta enables you fe create @ goneic class without spectyng a type betwoon angle brackets =. ‘Acotection of elronts that contains dupeatos. 12. To slow our classos to have a natural order we coud implemen! te Comparable rice ‘rue orfaee? Twe() Fates 1. ¥Mieh ofthe folowing i a st of eloents that have afin fst ot ordering stacks) ashaaps arrays ‘4.0hy cana Liked st be considered a stack anda quous7( Choose Th Because you can add slaments to the end oi () Because you can not ad lament tothe bgining of ‘Because yu can remove element from he and (+) ‘Because you can remove lament from the Beginning of.) 18 mien sconavo best doserbes a sack? ‘plo of pancakes wih wich you ads some to th top and remove them ane by one frm te op tothe botiom. () ‘A row of books thal you can take out of only the mide ofthe books fst and work your way outward toward ether edge ‘Ane atthe grocery store whore the frst person inthe line fs the rs person to eave. Allo he above doserbe a sack, Reply Replies Unknown December 21,2018 3t 555 AM 16. A gonaie assis type of class that assocstes one or more nor-specfe Java ‘ypes wisi Tr or Flee? Te) False 17:The local pang z00 is wing a program fo be able to collet group animals according to species to better koop Lack of what animal they have, mich of tie folowing comocy dofnes a callecton that may create those types of groupings for each speciosa ho 2007 publi class ‘aimatCollecton (}() publi ass snimalColetion(AnimaType 1) rb publi ass ‘animalCollecon()) publ lass snimatColecionaninalType i} None ofthe nese ‘8.What the result rom the flowing code snippet? publi state vld man(Stng ra) ( List fst = new ArrayList Ista Gum) List 2 = lit 1s adanow Isgera): System out pntnst2sze) : “The code wil na compl ‘an exception wl be thrown a runtime 20) 18:The Comparable interface defines the compareTo metro. Tue) Falco 20.Whichsiatements, inserted ia ine 2, wil ensure hat the code snippet wi compile sucossstily (Choose Tw): 1 public ate vod main (Snags) 2. code here 3. spur (stusertio, 123): a (choose all comet anawers) Map e= new SoredMapt Sortsiap 5 now Treekant (7) ArrayList = new Araya Hashifap s© new Hashivap)() 21.rich's the corel way tint a Hast? HashSet ciseMatos now sens) ClassMats = pubte dass Hasse; Sting elssMates = now Stat elassMates = new HashSetStingt 22,0hoose the best datinton fra callin, Ik enables you to crt Ihe an terface in he 18 generic dass wihout speciying @ type between angle faut package thatle used te define group of cbc) Ihe special ype of class tha is associated wih one or mora non-specifed Java ype, Ihe subeles of Lit 23.Wich ofthe following i a soring algorithm that involves repeatedly ineremontng through the aay and swapping 2 adjacont values thoy ae inthe wrong order un all flements ar inthe erect order? Merge Sort Bubble Sor) Binary Search Sequential Search Selection Sor © Vere wea ecnar ‘secon 7 (answer all questions inthis section) 1. Whats the corect explanation of when this cde wil otum ts? rotum stratchos( 0-96)" Mark for Raviow () Poins Anytime that st contain wo dos ‘Any ino that sr contains a soquorco of 6 igs.) ‘Any te hat st-has belweon zero and rine characters followed by a. ‘ny ine st contain a6. ways Ineowee. Rete to Seeton 3 Lescon 2 2. Which ofthe folowing methods for he Stung cass take a regular expression 3s parameter and retuns tue he sng matohes the expression? Mark fr Review (Poms compareTo(Sting regex) ual Sting regex) matces(Sting egex)(*) cequalstonoreCase(Sting 298%) Incorrect. Refer te Sacton 3 Laston 2. 2. Whats the funcbon othe asterisk (*)nregular expressions? Mark or Review (1 Poins Indicates that he preceing character may occur © o more times ina proper match (1) “The asters has no function in regular expressions, Indicates that the precasing character may occu or more times ina proper match Incorrect, Refer to Section 3 Lesson 2 4. Which ofthe folowing corey danas Matoner? Mark fr Review (Pains ‘A regular expression symbol that represents any charactor. A mtod of diving a sing ino a sot of ub-sings. ‘A. class in th ava. regex pact that stores tho format of regular exprosion Aclass inthe javautrogex package that stores the matches between a patie anda sting. (*) 5. Matchor has a find method thal chocks ithe spociod patiom exist a a sub-sing of he sing boing matched Te ols? Mark for Reviow (1) Points True (9) comet 6 Which fhe folowing corey defines Pater? Mark or Review (1) Pains ‘A egularexoresson symbol that represents any characte. ‘Amathod of dvidng a string into a sot of sub-sting. A clas inthe javautLragex package that stores the format ofa regula expression") Alas in th aval regex package that stores matches Incorect. Refer to Section 3 Lasson 2 7, Which ofthe folowing corey Italzes @ Matcher m for Pattern p and Sting st? Mark for Review (1) Points Matcher m = sr atehertp Match m = naw Matener(ostr Natener m= pmatenertetr Incorrect. Rafer to Sacton 3 Lasson 2. 8. Alinear recursion requies the method to cal which drecton? Mark for Review (Poms Forward Backward (7) Both ford and backwara None of he above Incorrect. Refer to Seton 3 Lesson 3. 8. Which ease does a recursive metho call lst? Mark for Reviow (DPoins Recursive Case Convergence Case Basie Case case ¢) None fhe above Ccomect 10. nonsinoar recursive method is less expensive than a near recursive method. Tru or false? ark for Review (Pots Te Falco") Cconoct Reply Repos Q mor cere sre sesoas 11-Anonsinear cursive method cals how mary copios of isl in the rocusve case? Mark for Review (Points 2ormare() comect 12. Using the FOR Toop method o incrementing trough Sting is bonetcalf you si fo: (Choose al that apply) Mark for Reviow (Pointe (Choose all conect answers) Pars the Sting.) Read the Sting backwards (fom st elemento fst element () Search for specie character of Sting inside ofthe Sting. () ‘You dont use a FOR loop wih Stings Income, Refer to Section 3 Lesson 4. 18. So is @ metod for Stings tat parses a sting by a speciiod charactor, oi Lunspecie, by spaces, and retuns te parsed element nan array of Stings. “re o fala? Mark for Review (Ponts tue Fate ¢) conect 14. Which of ho folowing comely intalizes a StngBulder? Mark for Roviow (1) Points Stenger so = "Thies my Sting Bude’ StengBuilder 6 ring Bur); Stingbulder 8 = new StingBulse) () None ofthe above, Income. Reler to Section 3 Lesson 1. 15. Which ofthe folowing are wus about he method spt? Mark for Review (Points (Choose a corset anawers) Itretums an aray of sings.) Ihean be used wih a string as parameter. (*) 5 default with no specs parameta,'s parsing by spaces. Itean be used with a regular exrossion asa pramter.*) Incomec. Refer to Section 3 Lesson 1. 1. Matchor tas a find mated that checks Ifthe speciod pate ists as a sub sting ofthe sting being matched, “True or alo? Mark for Reviow (Points THe False Income. Rel to Section 3 Lesson 2 2. Wie ofthe folowing metnod fr the Siring class take a regular expression paramer and retums tr if te sng matches the expression? Hark fr Review (0) Points ‘compareTo(Stng a9ex) rmatches(Sting eos) ting e900) Incomec. Refer to Section 3 Lesson 2, Unknown Oscember 21,2018 at 641 AM 3. Which of ho folowing dos not correctly match the rogular expression symbol fos proper foneton? tek for Reviow (Points “pe means tere must bo x occurences ofthe precoting charactor nthe sing lobo a match “> moan hare may be 2:0 oF one occurrences ofthe preceding character the sing to be a match “+ moans there may be zero or more cccurtences ofthe preceing character inthe sing to be 8 match) “(uy means there may 28% or mare occurances of he preceading charactrin the sting to be @ rath, “teyff means there may be between x andy occurences of te preceing character inthe sting tobe mate, Incorrect. Refer to Section 3 Lesson 2 4 Consider designing program that organizes your contacts alphabetical by last name, ten by fest name, Oday all of your contact frst and lat names ae excl ve eters ng Wien ofthe folowing segments of code establishes @ Pattern namePatier wih 2 group forte fest name ard a grup forthe last ame considering thatthe sting contactsName Is always inthe format lnstName_fretNam? Mars for Rovow (Pins Pattrn namePatom = Pattem.compile((5))((6)" Pattrn namePatom = Patlor.compila( rst lst) Pattern namePatem = new PaltamtastSh rts) Incomes. Refer to Sacton 3 Lesson 2 5. Tho fallowing code corey initaizes a pater with he ruler expression “0-9}24IO-}2}(0- sey. Pattarn data = Patem.comsile 0-2) (0-9H2V(0-842)) “Tras or flee? Mark for Review (Pains Two () Fatee Incorrect, Refer to Section 3 Lesson 2, 6. na eoguar expression, (x and x) present he same thing, tal he preceding charter may accu" oF mote tos to create a match Tre or falee? Hark for Review (Pins Tw Fave) conve 7. Whats the comect explanation of when tis code wil tum ts? rotum stratchos( 0-96}. Mark for Review (Poms Any tims that contain two dos Ay te that st contains a sequence of 6 gts. () [Any that thas between zero and rine charac lowed by a6. ‘Any imo st contain a8. Incoract, Refer to Section 3 Lesson 2 1. Using the FOR loop mothod of incrementing though a Sting it beneficial f you desi to (Choose al tat apply) Mark for Review (Ponts (Choose all eoract answers) ‘Search or specie character or Sing inside of he Sting () Parse the Sting. (1) You dont us FOR Toop wih Stings Read the Sting backwards (rom last element to fist element.) Incorrect. Refer te Sacton 3 Lassan 1 8. Which othe folowing ar tue about he meth spt? Mark for Review () Poins (Choose al conect answers) Its data, wih no specifies param 1's parsing by spaces, Itean be used wit a regular expression asa pramter(*) lean be used wit a sting as a parameter. Heotuns an aray of tinge.) 10. ently the method, of those Ited below, that is not avaiable to both StingBulders ana Stings? Mark for Review (Pons engin Indexotseing st) charatitindex) eet start, int ond) ¢) Incorrect. Refer te Secton 3 Lesson 1 Reply Unknown Dacember 21,2018 at 61 AM ‘1. Wich of te following methods ave spec to SingBulers? Mark for Review (1 Points| append datete replace [Alo tne above.) Incorrect. Refer to Sacton 3 Laon 1 12.A nandingar recursive method can cllhow many copes of isl? Mark or Review (Pains 2ormore() comet 18, The base case condton can work wih a consan! or variable, Tue or alse? Mark for Rev (1 Points Tw () Fave Incomes. Refer te Sacton 3 Lesson 3 14. Forward thinking helps when ceating near recursive methods. Tue or alse? Mark for Review (Pins Tre Fale) cones 16.A linear recursive methed srecy cals now many oops of sein the recurave cate? Mark for Review (Pains 10 2ormore 4. Which ofthe ftawing (Poms rectly Inlalzes @ Matcher m for Pattern p and Sting st? Mark for Matcher m = strmateherp Matcher m = pmatererts Nate ow Matchett) Nate ww Mate Incorrect, Refer to Section 2 Lesson 2 2. Whats the coroet explanation of whan this code wlretum tus? rotum stratches( 0-96}. "): Mark for Review (1) Poins ‘ny ime that sr contains two dls ‘ny ine thats contains 8 sequence of 6 ig.) ‘Any ime thats has between zero and nine charactors followed by a6, Any ime st contain a. ways Incorrect. Refer to Sacton 3 Lesson 2 8. Your teacher asks you to wie @ segment of code that tums te if Sing sr contains zero or fone character(s) and false oervis, Which of te folwng cade segments completes tis ask? Nar tor Review (Poms (Choose al conc answers) (return ru} rotun false: (*) rotum steatchos.7 (1) rotum strates I-21 Incoree, Rete to Section 3 Leston 2, 4 In eoguar expression, (x and (x) represent he same thing, tal the preceding character may (Poms False) Ccomct '5, Consider designing 8 program nat organizes your contacts alphabetical by ast rama, ten by feat name, Ody all of your contact frst and lat ame ae excl ve lets long. nen of tne following segments of code establishes @ Pati namePatiem wih a group forte fest name and a grup forthe lastname considrng thatthe sting contacisName is always in the format ltName_fratName? Mars for Review (1) Poins Pattern namePatem = Patter compile) (5) C) Pattern namePatem = Patler.compil( rat la) Patten namePatom = now PatiomtastSh rs) Pattern namePatom = now Patter) None of he above Reply © Weer mers acne 8. Tho flowing code corey iniaizes a pater with he regular expression O-S}2VIO-SH2}(0- sy. Patra datoP = Patom.comgio(1-2¥(0-H2M0-9427, “True oral? Mark for Review (1) Points Tee) Fate Incorrect, Refer to Section 3 Lesson 2, 7 Matcher asa fnd method that checks ifthe specie pltemexists as a sub-sting ofthe sing being matches “rus o lea? Nark fr Rovow (Poms twee) alee Incorrect. Rafer to Sacton 3 Lasson 2. 8. Aronsngar recursive mathod is loss expansive than a linear rocursiva mathed. Tus o falss? Mark tor Review (Poms Te Fats") Cconct 8, Which ease handle the last recursive cal? Mark for Review (Pins ‘The primary case “Tho tase case") ‘The convergence cas “Tre recurve cope “The secondery case Incorrect. Refer to Gaston 3 Lasson 3 10.A nonsinear recursive method is less expensive han a Inear recursive method. True o false? Nar for Review (Pains Te Fale) Incorect, Refer to Section 3 Lesson 3 1. A tnoae for Review (Pots cursive mathed direc calls how many copes of ise nthe recursive case? Mark 10 2ormore Ineoreet. Refer to Seton 3 Lesson 3 12. hen of the folowing are true about the method pl? Mark for Review (Poms (Choose a eoroct answers) Ita be used witha sng a8 parameter.) lis deter, wih no specifies parameter, is parsing by spaces, Ian be used wi a reguar expression asa pramter°) Items an aray of sings.) Incorrect, Refer to Section 3 Laston 1 Reply Unknown December 21,2018 at 644 AM 419. Using the FOR loop method of incrementing trough a Siting is Benelli you desite to (Choose al tal apply) Mark for Review (1) Poins (Choose at eorect answers) Road the Sting backwards (rom ast slment to fst elon.) Search or specie charector oF Slag sie of he Sting () You dont use a FOR loop wih tongs Parae the Seng. (1) Incorrect. Refer te Sacton 3 Lesson 1. 14. Which fhe falowing comet intalzes a StingBulér? Mark for Review (Pains StingBuieo “This my Sting Bulb’ ‘StingBulder eb = SringBuler60} StingBuido ew StingBulde () Incorrect, Refer to Secton 3 Lesson 1 18. Which ofthe folowing ae tru about parsing a Sting? Mark fr Rovow (1) Ponts (Choose all eoract answers) 1s not poset to pase a sing using regular expressions It 8 way of ving a sting io ase of sub-stings. Its possible tou for loop to parse a sing. ¢ is possibie to use he Sting spt method to parse a strng.() Incorrect. Refer te Sacton 3 Lassan 1 4. Which othe folowing corey dans a StringBuilder? Mark for Review (Pains Alas that represen a sting ike object. (+) is no such thing as a StingBulderin Java A method thal adds charactor oa sting Adass inside the java regex package. Incorrect, Refer to Secton 3 Lesson 1. 2. Using the FOR loop method of incrementing though a Sting is beneficial f you desi to (Choose all tat apply) Mark for Review (Poms (hoote at eoroct anewers) ‘Search or a spec character or Sting side ofthe Sting () Parae the Sting. (7) Read the Sting backwards (rom last element to fst ent.) You dont use loop with Stings Incorrect. Refer to acton 3 Lesson 1 ‘3. What clas isthe spit) mothed a member of? Mark for Review (1 Points ting ¢) StingBuiaer 4 Spits a metnod fr Stings tat parses a ting by a specified character of unspected, by spaces, and retums the parsed laments in an arayof Stings Tras or falee? Mark fr Review (Pains False) Cconect 5. Your teacher asks you to wie @ segment of code that tums te Sting sr contains ze or fone character(s) and false olherwie, Wch of te follwing cade segments completes ti ask? ark for Review (1) Poins (Choose all conoct answers) retun steatchest 121" i seiengt9 (robes return ale; 0 slong Incorrect. Refer to Seaton 3 Lesson 2 Reply opis © en rn anaes 6. Consider designing 2 program that organizes your contacsalphabetcaly by last nares, ten by fet name, Oday lof your contacts’ stand lst rams are exacly five lees lng, nich of the folowing segments of code establishes a Pater namaPattom with a soup forthe fst name ané a group for te last name considering thatthe sting contactsName is always in the format lstName,frstNam? Mark fr Review (1) Points Patter namePattem = Pater comile(5) (5) Patirn naroPater last Pattern. compile fret Pater namoPate row Patras} et) Patter namePaltem = new Pater) 7. What does the dot (represent in regular expressions? Mar for Review (Points [An nda for one or mors ceourences ofthe preceding character. [Amat for any chars.) ‘A range spsciiad betwesn brackats that allows variably of a character, Nothing, tis marly a dot Income, Refer fo Section 3 Lesson 2, 8, One benef to using groups with regular expressions is that you can segment & matching sting and recall he sogmons or goups} ator in your program. “True or fale? Mar for Review (1) Points we) False Incomac, Refer to Section 3 Lesson 2, 8, A regular expression je @ character or a eaquence of characters that represent a sting or mutiple sings. “True or fale? Mark for Review (1) Points we False Incomec. Refer fo Section 3 Lesson 2, 10. Consider that you ar wring a program for analyzing feeeback onthe video game you have developed. You have completed everyting except the segment of code that checks that the users input, Sting used isa va rating. Note that aval rating is @ singh igi otwoon 1 and 8 nclsve. Which of he flowing segmonts of code rotums tre ihe usr inputs a val rating? Mark for Reviow (0) Points (Choose all corset answors) roluen usr matches 1511 tetuen user matches) retum userimatches 11-51)": ¢) retun usr matches Income. Refer to Section 9 Lesson 2, “1-Which ofthe flowing comectydefnes a repstion operator? Mark for Review (Pains ‘Asymialthat represents any character in regular expressions. A method that returns the numberof ccurences ofthe specie characte. {Any symbolin ogiar expressions that indeates the numberof occurrences a specified character appear ina matching sting.) None ofthe above, Incomec, Refer to Section 3 Lesson 2, 12. A noninear recursive method is less expensive than & near recursive mothe, “True or fala? Mark for Review (1 Points False Income, Refer to Section 3 Lesson 3 18, Forward thinking helps when creating linear recursive methods. Tue or false? Mark for Review (Ponts tue Faso) comect 14. A (1) Points 3 ocusivo method can call how many copies of iso? Mak for Roviow 1°) 2ormore Nore Ircomect. Refer te Section 3 Lesson 3 15. whic cate docs a recursive metho cl st? Mak for Review (0) Points Recursive Case Convergence Case base Case Bare Cato") None ofthe above Incorec. Refer to Section 3 Lesson 3 Unknown Oacember 21,2018 at 702 AM Section 8 (Aanswor all questions inthis section) 4. Which fhe following isan atibue ofa tro tir arhtacture appeation? Mark or Review (1 Points an applleston of that ha lant and server only 8 complex application tat includes a cent a server and database) an apleaton ofthat ans on a singe computer None of he above Incorrect. Refer to Gaston Lesson 1. 2, Java Web Starts usd o deploy ava applications “ros orfalee? Wark for Revaw (Pains Tet) Incorrect, Refer to Secton 4 Lesson 1 8. Tho method for connecting a Java application toa database is by using: Mak for Raviow (1 Points Jarttes one osc ¢) ava Web Stat None fhe above Incorrect. Refer te Secton 4 Lesson 1 4. Which of th folowing isnot a reason to use a Java package? Mark for Review (Pins Its 8 way to organize fos whon a project consists of multiple medtulos. Its a way to help resale naming oonfets when diferent packages havo classe with the same Its way to protect data rom being use bythe ron-authorzed classes. Its way tallow programms to receive packs of information fom databases.) None othe above Incorrect, Refer to Seetond Lesson 1. 5. To deploy java applications you may uss Ja “rus or flee? Mark for Review (Pains Web Sta Twe() False Cconct 6, How would you make an instanceof Carina class that in import he vehicle package blow? Nar for Review (Pains care =new Cart vohide Car ennew Gar vohice.Care=new vehie.Car) ehide-Care=new vehicle None fhe above 7. How would you make an instance of Carina cass that dd impor the vehicle package below? Nar or Review (1) Pains care = new Car) vohide Car e=new Cart vohice.Carc=new vehi. Cr vehide.Carcmnew vail None of he above Incorrect, Refer te Secton 4 Lesson 8 Which othe folowing isan atibus ofa two tir architecture appcation? Mark for Reviow (1 Points ‘An application of that has tent and server on) ‘complex appeation hat inches allot, Server and database ‘An applica ofthat rans on single computer, None of he above, Incorrect. Refer te Sacton 4 Lason 4. 8. Which of the foowing are fas that must be uploaded to a web sarver to deply a java appicaionapplt? Mark for Review ()Poins (Choose all conoct answers) jaefles(*) INLP files mt ls java Sos None of he above 40. 11a casein a package, the system's CLAS (Poms Tue False) comet, 11, An example of to tr archtecture would be a clent applcaton working wih a server application “rs or flee? Mark for Review ()Poins Two) False Incorrect, Refer to Sectond Lesson 1. 12. The method for connecting a java application oa database Is NLP Treo alse? Mark for Revow (Points Fate) conect 13. 1fa programmer uses the lne import com fst, here Is no no “rue or flee? Wark for Review (Pains to import com stcode* we False") Reply Repos Q aor Sete sro aros ha 14, Which ofthe folowing files are not requited to be uploaded to a web server to oploy a java appcationlaplet? Mar for Rewew (1) Points jarfes JINLP tes it fies Java tes ¢) None ofthe above Ircomect. Refer to Section Lesson 18, What option do you choose fom th Fils manu io Eclipse to stat te procees of ‘creatng arunnable JAR fle? Mark for Review (Points Import Bpart() ‘sth Workspace Properties Incomec. Refer to Section 4 Lesson 1. 1. dava Web Starts sod to deply java applications. “True or alo? Mark for Reviow (Points Tw. False Income. Rafer to Section 4 Lesson 4. 2. 8 programmer uses the line impor comes “Thue or fale? Mar for Review (1) Points there Ie 9 need to import we Faso () corect 3. Aj fils built onthe ZIP fle format and used o deploy java applets, “True or alo? Mark for Revi (6) Points Two () False 4. Te deply java applications you may use ava Web Star. “Tyo or a0? Mark for Review (Pols we) Fa Incorrect. Rafer to Section Lesson 1. 5. An example of wo er _applicaten. “True or fale? Mark for Review (1) Points revtcture woul be lent application workng with 2 server Two () False Incomact. Refer to Section Lesson 1. 65, Which ofthe flloning not a reason to use a Java package? Mark for Review (Points Ins way to organize les when a projet consists of multiple modules It ls a way to help resolve naming cones when diferent packages have easses with the same names, Ina way to protect dat rom being used by the non-authorized classes. Ins way to alow programmers to receive packets of information fom databases.) corect 7. What option do you choose fom the Fle meny in Eclipse to stat the process of ‘reatng arunable JAR fle? Mark for Raviow (1 Points Properties Inport ‘Switch Workspace Brport (7 Incomect. Refer te Section 4 Lesson 1. 1. How would you make an inslance of Car in dass that ais import the vehicle package below? Mare for Review (Ponts ew Car) vanile.car new Cart venila.Care=new veil Cat voticle.Car e=nen vile) Incomac. Refer to Section 4 Lesson 1. 9 Which ofthe folowing isan atibute of a thre or architecture application? Mark fo Roviow (Points an application ofthat has a clot and server only ‘complex appteaton thal nluses& lent a server and databace (*) an application of hat uns on a sng computer None ofthe above onset 10. The method for connecting a java application oa database is JNLP. “Tue or fale? Mark for Review (Paints we Faso) Unknown December 21,2018 at 7:04 AM 11. Which of be flowing are fs that must be uploaded toa wab server to deploy @ Jave appleationiapplet? Mark for Review (1) Pains (Choose all corset anawors) Jacfies ¢) INL? les) il fs java es None ofthe above Incomact. Rete to Section 4 Lesson 1. 12. How would you make an instance of Car in a class that didnt import the vehicle package below? Mare for Review (Points car e= new Car vehiee.Cateznew Cat vette. Car sna vehicte.Car (1) vanila.Car e=na vile) Inoomec. Rater to Sacto Lesson 1. 13.tfa class isn a package, the syston’s CLASSPATH must be altered to access the class “Thue or fale? Mark for Review (9) Points tue False) comect 14, When of the flowing is an Review (Points tole ofa Wo er architecture application? Mark for ‘An application of hatha a cent an server ony.) ‘Acamplex application that includes cant, a server and daabase, {An application ofthat runs on a singe computor. None ofthe above, Income. Reler to Section 4 Lesson 4. 18. The metnod for connecting @ ave application toa database Is by using: Mark for Review (0) Points Jarfos aN ose ¢) Java Web Stat None ofthe above corect 4. Alar lis uit onthe ZIP flo format an fe used o deploy java applets, “True or faa? Mark for Review (Points Te) False Income. Retr to Section Lesson 2.n example of Wo application, “Tuo or a0? Mark for Revo 4 sreitctre would bea clint appiation working with a server (Points Twe () Flee Incomac. Refer to Gactond Lesson 1. 3. Which ofthe folowing isan attbute ofa wo tir architecture application? Mark for Review (Points ‘An application of hatha a cent an server ony.) ‘Acomplex application that includes cant, asorver and daabase, {An application ofthat runs on a singe compute. None ofthe above. Conect 4. Wie ofthe following are files that must be uploaded toa wab server to deploy & Java appeationtappat? Mark fr Review (0) Points (Choose alt conect answers) Jacfles¢) INLP es ¢) Incomac, Refer to Sacton 4 Lesson 1. 5. How would you make an instanes of Car in a class that dt impor the vehicle package below? Mark for Review (Points new Car vehiee.Carexnew Cat vobil.Car nem veicte.Car (1) vanila.Care=naw vile) onset 68, Which of the following isan atrbute of tree Review (1) Points architecture appleation? Mark for ‘an sopiation of that has a cent and seve only ‘a complex applcaion that includes a cont, 3 server and database (*) ‘an application ofthat rns on angle computer Incomect. Retr fo Section Lesson 7. The method for conecting a Java application to database & by using: Mak for Revlow (9) Points Jaros NLP ec ¢) ava Web Stat corect 8 fa classi in package, the system's CLASSPATH must be atered to access the class “Tuo or fala? Mark for Review (Points we Fase () Unknown December 21,2018 at 704 AM 8. Which ft fllowing fos are not roquires tobe uploaded toa web sarvero deploy java appicatorlapolet? Mark for Review (Points Jarfes INLP es it Java les) 10. 1 programmer uses the ine import contest”, there Is no need to import comtestcose.* “Trp or fan? Mark for Revow (1 Points we False ¢) Coneet “11. What option do you choose fom the Fle menu In Eclipse to slat the process of ‘cating 9 tuneble JAR fle? Mark for Review (Ponts ‘won Workspace Import Properties Biport (1) Incomec. Refer to Sexton 4 Lesson 4. 12, Java Web Stari used to deploy java appcations. “True or alo? Mark for Reviow (Points Tw False onect 13, When ofthe folowing ie not 2 reason to se @ Java package? Mak for Review (Points Ins way to organize ls when s project consists of multiple modules. Its a way to elp resolve naming cones when diferent packages have classes with the some name Ins way to protect data rom being used by the non-autotized classes. Ins way to alow programmers to recs packs of information fom databases." Incomes. Refer fo Section Lesson 1. 14. To dopey java appations you may use Java Web Start “Tue or ale? Mark for Review (Points we) False onset 15. How would you make an instance of Car In @ class that dll import the veice package below? Mark for Review (Points ew Car) vatila.Care=nen Cart vyotile.Care-new vile Cat votiele.Car =n vite) None ofthe above 11, The BurferedinputSteam i a doc sublas of wha ther dass? Mark for Review (Points InpetSteam Fitornputsiream () Pipedinputsteom Inputstoam Floinpustoam [correc Corset 12:Tha Files clas provides a instance moth that coats a new BuffeedRsader. “Tue or fala? Mark for Review (Points Tae) False [Correct Cort 18:The BuferedOulpuStoam is acret subclass of wnat ober lass? Mark for Rovow (Points DigestOutputsteam FitrOuputsosm () urutsteam bectOxapust [Correct Corset "Y.Which of te folowing state mothe i nat provided by the Fes dass to check fle properios or duplication? Mark fr Review (Points Flos aitaole(Path 9); Fles:sRoadabe(Pat Fes avchivodPath 9h Flos shidden Path [Correct Coret 18:The Paths class provdes@ state get) method toa vad Pat “Tuo or fals0? Mark for Revo (Points we) Fase [Correct Corset Reply Q rm wear Secton 9 (now al questions inthis section) 4. Wich of the flowing ean fit nth /INSERT HERE correct? (Choose Tw) ResultSet rat = stmt exeowtsueryeqlQuery) ies nextX IMINSERT HERE Narkfor Review ()Poins (Choose all corect answers) Object s=rs.gtObjoc( () Sting $= gotSting(th ‘Sting s= v2 got0bjoc0) Sting $= rs.etSting(0h 2 JOC has a type syst that can contol the conversion between Oracle detabese types ang ava types Mav or Review (Pos Twee) Fates 4, From JOBC, now would you execute DML statements (12, inser. delet, update) im the databace? Mar for Review (D Poins By making us of he execute.) statement rom DataStatement Object By invoking the oxoeuteD 5), sxacuteUpdata..) mathods of th DalaStaterent By invoking the execute. executeUpdate.) method of a JDBC Statorent objector sub inertaco object") By invoking the DeloleStatorent or UpdateStatorert JOBC object 4 Which ype of Statement can execute parameterized queries? Mark fr Review (1 Poms ParameterizadStatement Calablestatament and ParameterzadSiatement PreparedStatoment() Aloft above '5. Which of te flowing sth corsct statement be inserted at INSERT CODE location that calls the database-stred procedure sayllo? cass Tost publi state void main(String args) yt Connection conn = getConnecton( imnseRT CODE stat setSting, Ho) ‘tal rogsterOulParametor2, Types NUMERIC} cetatselh2, 10 atc SOLExcepton oH (Poms Calabiastatement estat» con pepareCalf(eayHalo?, 2); cal procedure say (2,2) Calablestatament att on pepareCalt'(ca sal Callabiestatement estat = con preparaCa'sayll(?, Calablestatement stat on pepareCalcaleayHallo(?, 2: C) 6. Suppose that you have @ table EMPLOYEES with three rows. The frat 1.8, and. What does the foloning output? ame those rows are ‘Sting a= sole rename fom Employees ores by fname dose Staleront “sinteconn.eealeSiatorent (ResutSeu.TYPE_SCROLL_SENSITIVE Resule.CONCUR._READ_ONLY) ResullSotrset= sir oxecuieQuey (el Feolabsolt(t); reel next System cut pint(set. getting Mark for Review (Pointe “The code dos rotcompll ‘A SQLException i thrown. 7. Which symbol is used as a placsholder lo pass parameters to a ProparodStalement or Callabistatoment? Mark for Review (Pains 1. Wich ofthe following methods wil move the cursor, retuming @ Boolean vale from the RResuSet Object? Mar or Review (1 Points (Choose al eoract answers) betoreFis) () solute) ater) stertaat) betoreLasty 8. Which oF he flowing isthe correct order ocose the database objet? Mart for Roviow (Points ResliSet, Statement, Connection (*) Connection, Statement, ResultSet Statement, Connection, ResultSet ResultSet, Comecton, Statement Statemant, ResulSet, Connection 10. Which of the folowing clases or itrfaces ae included inthe databa (Choose two) Mark for Review (Pains vendor ever eran’? (Choose all comect answers) ‘Statemantintrtace implementation () Java sa\Comnection Javan DataSoures Javan DataSource implementation (7) Java sOrvertanagor implementation Reoly Repos Q meee +11 Whi of the falowing fs NOT # JDL interface used to excoute SLO statements? Mack for Review (1) Points Statement itrace ProparedStatomert Interface PrePreparedStatoment Iterace CcalableStatement Interface 12, You must expt close ResulSet ang Statement objects once they are no longer Inuse, Mark for Review (Points Tue) False ‘13Mow many categories of JOBC avers avo there? Mark for Revow (Points 40 "¥,What ype of JDBC river wil conver the database invocation dec into newark protect? Matk fr Revow (1) Points “ype 1 aver “Type 2 aver “ype aver Type 4 aver) 18:To execute a sored SOL procotue, which JOBC inerace should bo used? Mark fr Revlew (Points Statement trace PrepareaStatemant Itertace ProPreparodStatomentInstace CCatabloStatement nerface (*) Unknown December 21,2018 at 732 AM 4. en of he flowing can iin the INSERT HERE covrecty? (Choose Two) Result ret = stexecutaQuery(sqlQuery) iano (INSERT HERE } Mack for Review (1) Points (Choose all corset answers) Object s =r gat0bject() () Sting 51s gelSting(h Sting 8 = a get0bject0 Seng +s.getSung(} 2 Suppose that you have a table EMPLOYEES with tnoe rons, The fe ‘hose rows ae A,B, and C, What does the folowing outout? ‘Sting sql "selec rename from Employees order by Frst_name desc Statement ‘imisconnereatStatoment - (ReosulSotTYPE_SCROLL_SENSITIVE Resul$ot CONCUR_READ_ONLY} ResultSet reet=simtexecuieQuerysq rset absohto() ‘aot net Systom out printn(sot getSting\) Mare for Review (0) Points Bo) “The code does not compile ASQLEXcepton is town 5. Which ype of Statement can execute parameterzed queries? Mark fr Review (Points ParameteraeoStatement CalableStatoment and ParametrizodStatoment PropareaStatoment(*) Allo ne above 4. Which to following stalomants is NOT TRUE about DataSource? Mark fr Review (1) Points DDaaource can be implamentas as apo of connectons DataSource can pariepate inthe Distbuted ansacton DataSource can manage as of JOBC Drivers registred the sytem.) DataSource wal pial be rostered wth a naming service. 5. JDBC has a type system tat can contel the conversion between Oracle databas ‘ypes and Java types. Mark fr Review (Points Tue) Fa 6. Which ofthe folowing methods wi move the cursor, ‘he ResulSet Object? Mark or Review (6) Points (Choose all corset answors) botooFet0 (1) aveottog terest) ater.ast beforeLast) 7. Which symba is used as placeholder to pass parameters to PreparedStatement ‘or CallablStatement? Mark fr Review (Pains oy '5. From JOBC, how would you execute DML statements (Le inser, deel, update in ‘he database? Mark for Review (1) Points By making Use of the execu.) taament rom DataStatement Objet By invokeg the oxocuteDebte.), executeUpdate. method of the DataStatement By invoking tho exocuet.) oF exesuteUpdatat.. method of ¢ JDBC Statement object ‘or subinterface obec (1 By Invoking the DeleteStatement or Up 8 Which of ho flowing is a vale JDBC URL? Wark for Roviow (1 Points oracleshinlocahost@utoudtot 152120 |besoracle-inovol@orack:1525x0 bcioractetsolsot@tocatos*521%0 () oracle hinjebesfotot@bcaost 18216 Unknown December 21,2018 at 732 AM 10. To oxoculs a storod SAL procedure, whieh JOBC interface should be uses? Mark forReview (1) Points Statemonthtsace PropareaStatomontIntertace ProPreparedStatement hletace Catabiestatomentinrace *) 11. Which of te flowing Review (Points come order to olga the database obect? Mark for Result, Statement, Connection (7) CConneton, Statement ResultSet Statement, Connection, ResultSst ResultSet, Connection, Satement Statement, ResuiSet, Connection 12, The java.sDovartanager cass wil typical be registred with a naming service based onthe Java Naming Directory (ND! AP. Mak for Reviow (Ponts we Faso) 1 How many calgores of JOB divers are thers? Mark for Reviow (1) Points 14. Given the flowing code, assume here ate rows of data inthe table EMP. What the raul? + Connacton on - naw Cannecton(URL} 2 Statamant sit = conn ceataSttement 3 RosulSo osu - sm: exaculeQuor(selet count om EMP") Aisne '5 Systam.out primis get) 5) Mark for Review (Paints Compiler eraron line 2 Runtime err on ine 3 Compiler err on tne 4) 15:You must expelly lose ResulSet and Statement objets once they are no longer (1) Potts Tue) False ep Unknown December 21,2018 at 814 AM va Programming Final Exam {LA sequential search fs an eration trough he aray that stops athe index where the desies coments fund, “rus or flee? Wark for Review (Pots Tee 2,bubble Sort isa oting algo that involves swapping te smallest valu int the fst indox fring the nox smaest value and swapping it into the next index and s0 on ul ho aay is sorte. True of lee? Mark fr Review (Poms Fate) ‘8¥iny might sequential search be neeent? Mak for Review (Poms the “dhe anc conquer method, whieh makes he algarihm mars ear pron. Itroqutes incrementing tough the entre aray inthe worst case, which is nefcent on lage data set.) Itinolves loping trough large data sets. Tay multe times before fining tne value, which is inefiint on Its novorineficint “Whi ofthe flowing ie @ sorting algo that involves repeatty incrementing trough tne aay and swapping 2 adjacent values if they ae in the wrong order unil all elements ae in te caro order? Mark for Rev (1 Points Sequential Search Marge Sort Bubble Son) Binary Searen| Selecton Sort ‘Binary searches canbe performed on sorted and unsorted data, Tre or false? Mark for Review (Peis Two Fats") 5. Why might sequent search be inafcert? Mar or Review (Pos ubiizes the “vide and conquer method, which makes the algorithm more eror prone, Itoqutres incrementing twough the entre ray inthe worst case, which neon on age dat st.) It invlve looping trough the aay mull mes before fing the value, which is naficent on larg da set It naver inact 7.Big-0 Notation is used in Computer Sciance to describe the pefoemance of Sots and Searches on arrays, Tru or false? Mar for Review (Pons Two () Stacks ave ional lo Quoves. (1) Potts False) FIFO stancs for Mare for Review (Pains Fastin Fast Out Fast Interface Fast Output Ft Interface Fst Outpt Fst in First Out) 10:The Comparable interface defines the compareTo metro. “re o fle? Hark for Rovow (1 Points Tee) ply Repos Q rer cortez sre seea ‘The Comparable interface inches @ method cated compareTo, “True or fale? Mark for Review (Pains me False {2ALinkodListie a type of Stack, “True or fale? Marc for Review (1) Points Tue) {8.¥hich ofthe following is Hof elarents tt have a fist in tas out ordering, Mark (9) Points stacks (*) Asay mums Hachlape 14,Whie clas ean ore (Points collection that may contain duplcatos? Mark for Reviow ie) {8:¥hich of he folowing correctly adds "Cabbage" tothe ArrayList vegetables? Mark (Ponts vagelales get'Cabage vegetables += "Cabbage vegetables] = "Cabbage" ‘vegetables ade('Cabbage"| (*) 16. ArayList and Arrays both require you to dein ther size before use “True or fale? Mark for Review (1) Points Twe False) “Thich of ese could be So? Why? Mark for Rev (Points (9,1, 2, 22, 308, 26) because a set may contain duplicates and al is eloments are of tne same ype. (chople’, 1, “Carrot, 2) because it records the index of the elements wih flowing integers. (1, 2.5, 178, 25) because It contains no duplicates and alts claments are of te same ‘ype. [Allo he above are sets because they are collections that can be made of any ofthe hoes ‘18.¥hich's the comct way tinal a HashSet? Mark for Review (Points Claret Hashset classates 1 Hashing) Sting elassMates Stat HashsetcaseMates = ew ashe () 19.An example ofan upper bounded wildcards, Mark fr Review (Points Arroyist Arraytist Arraytist Arrytist*) 20.Gonori methods are required tobe declared a sai “True of False? Mark or Review (Points Tue False) Unknown December 21,2018 at 8:15 AM 21.The flowing code wil compl “Thue or Faso? ‘lass Node implements Comparable PublicintcompareTa(Tobetrn 13) } dass Test, Publi state void main Stn] eos) Node ne=new Nodo<>( Comparable com=ne; } Mace for Review (Points Tue) False 22.7 extends Amal > would ony atow classes or subclasses of Animal to be used Tre or False? Mark forRewew (Paints Two) Fas 23.pble state vol pentrayT ray san example of what? Mark for Review (Points ‘Aconereate method, generic method) Agsnerc ass [A gonericinstance 24: Whats the result rom the following code snippet? publ stat vid main(Stna eos) ( Ls gt = now ArrayList lett adsinow Gum Ls 2 = it 2 adsnow Intogot) System out pintnist2sze } Mark fr Review (Points The code wil not compl, 20) an exception wil be thrown at runting 25 Matcher has 2d method that checks ithe specited patio oxss as 2 sub-sting of te sting bang matched “True or fale? Mark for Review (1) Points we False 26.Square backs ate opresentation for ny charactor regular expressions 7: “True or alo? Mark for Reviow (1) Points Two Fatve 2Z1-MMrch of he flowing coracty defines Patter? Mark for Review (1) Points ‘A regular expression symbol that represents any character. Aclacs in tn java apex package that stores the fomat a regular expression.) ‘class inthe java ogox package that stores matchos. Amathod of diving a stg nto a st of substings. 28:Whatdoos the do) roprsont in roguar oxpossions? Mark or Review (Points {ninco for one or more cacurences ofthe procading character Armateh or any charactor.) ‘A range spacited between brackets ta alows variably of a character Nothing, tis merely 2 do 2a.Which of he folowing correct initalzes a Singur? Mark for Reviow (Points SegBulder StengBullder StengBuilder so None ofthe above, 30.¥hat is the result rom the following cago? public las Test { Publi state void main( Stina] eos) ( Sting = "91204" r= 23 System out prints } ) Mark fr Review (0) Points 12023 7)

You might also like