download serba-serbi aneka konten

Breaking

Selasa, 22 Januari 2019

Answers Oracle Academy Java Fundamental Part 18

1.  What is printed by the following code segment?    Mark for Review (1) Points
   
   
\\\\  
   
\\\\\\\ (*)  
   
\\\\\\\\\\\\\\  
   
\\  
   
    
 Correct  
   
  
2.  Consider the following code snippet. 
   What is printed? 
 Mark for Review (1) Points
   
   
Cayrbniz  
   
CayrbnizCayrbniz  
   
yr (*)  
   
ay  
   
ArrayIndexOutofBoundsException is thrown  
   
   
 Incorrect. Refer to Section 4 Lesson 4.  
   
  
3.  What will the following code segment output?  String s="\\\n\"\n\\\n\""; System.out.println(s); 
 Mark for Review (1) Points
   
   
\" \"  
   
""\ "" \ 
""      \ " \ " (*)       " \ " \ " "  
   
   
 Incorrect. Refer to Section 4 Lesson 4.  
   
  
4.  The following program prints "Not Equal". True or false?    Mark for Review (1) Points
   
   
True  
   
False (*)  
   
   
 Incorrect. Refer to Section 4 Lesson 4.  
   
  
5.  Which of the following creates a String named Char? 
 Mark for Review (1) Points
   
   
char string;  
   
String Char; (*)  
   
char Char;  
   
char char;  
   
String char;  
   
   
 Correct   Section 4  (Answer all questions in this section) 
     
  
6.  What is the purpose of the Eclipse Editor Area and Views? 
 Mark for Review (1) Points
         (Choose all correct answers) 
          To modify elements. (*)  
   
To navigate a hierarchy of information. (*)  
   
To choose the file system location to delete a file.  
     
    
 Incorrect. Refer to Section 4 Lesson 1.  
     
  
7.  The ______________ is the location into which you will store and save your files. 
 Mark for Review (1) Points
          Perspective  
   
Works (*)  
   
Editor  
   
None of the above  
     
     
  
8.  You need to _______________ Java code to generate a .class file 
 Mark for Review (1) Points
          Collect  
   
Compile (*)  
   
Package  
   
Assemble  
     
    
     
  
9.  Eclipse does not provide views to help you navigate a hierarchy of information. True or False?  Mark for Review (1) Points
          True  
   
False (*)  
     
    
 Correct  
     
  
10.  For every opening curly brace { there does not need to be a closing curly brace} for the program to compile without error. True or False?  Mark for Review (1) Points
          True  
   
False (*)  

11.  When importin g another package into a class you must import only the package classes that will be called and not  Mark for Review  (1) Points 
the entire package . True or false? 
          True  
   
False (*)  
          Incorrect. Refer to Section 4 Lesson 2.  
     
  
12.  Which of the two diagrams below illustrate the general form of a Java program?   Mark for Review (1) Points
          Example A  
   
Example B (*)  
          Correct  
     
  
13.  Select the statement that declares a number of type double and initializes it to 6 times 10 to the 5th power.  Mark for Review (1) Points
          double number=6*10^5;  
   
double number=6e5; (*)  
   
double number=6(e5);  
   
double number=6*10e5;  
          Incorrect. Refer to Section 4 Lesson 3.  
     
  
14.  What two values can a boolean variable have? 
 Mark for Review (1) Points
          Numbers and characters  
   
True and false (*)  
   
Relational and logic operators  
   
Arithmetic and logic operators  
   
Integers and floating point types  
          Correct  
      
       Section 5  (Answer all questions in this section) 
     
  
15.  Which of the following is true about a do-while loop? 
 Mark for Review (1) Points
          It is a post-test loop.  
   
It is a modified while loop that allows the program to run through the loop once before testing the boolean condition.  
   
It continues looping until the condition becomes false.  
   
All of the above. (*)  
          Incorrect. Refer to Section 5 Lesson 2.   (Answer all questions in this secti on) 
     
  
16. How many times will the following loop be executed?  What is the value of x after the loop has finished?  What is the value of count after the loop has finished? 
int count = 17; int x = 1; while(count > x){ x*=3; 
 Mark for Review (1) Points
count-=3; } 
          4; 8; 27  
   
3; 27; 8 (*)  
   
5; 27; 8  
   
5; 30; 5  
   
3; 9; 11  
     
    
 Incorrect. Refer to Section 5 Lesson 2.  
     
  
17. Why are loops useful? 
 Mark for Review (1) Points
          They save programmers from having to rewrite code.  
   
They allow for repeating code a variable number of times.  
   
They allow for repeating code until a certain argument is met.  
   
All of the above. (*)  
     
    
 Incorrect. Refer to Section 5 Lesson 2.  
     
  
18. In an if-else construct the condition to be evaluated must end with a semi-colon. True or false?  Mark for Review (1) Points
          True  
   
False (*)  
     
    
 Incorrect. Refer to Section 5 Lesson 1.  
     
  
19. This keyword is used to instruct specific code when the input for a switch statement that does not match any of the cases.  Mark for Review (1) Points
          Switch  
   
Case  
   
Break  
   
Default (*)  
   
None of the above  
     
    
 Incorrect. Refer to Section 5 Lesson 1.  
     
  
20. Which of the following could be a reason to use a switch statement in a Java program?  Mark for Review (1) Points
          Because it allows the code to be run through until a certain conditional statement is true.       Because it allows the program to run certain segments of code and neglect to run others based on the input given. (*)       Because it terminates the current loop.  
   
Because it allows the user to enter an input in the console screen and prints out 
a message that the user input was successfully read in. 
     
      Incorrect. Refer to Section 5 Lesson 1.   2 1.  What is the output of the following segment of code?    Mark for Review  (1) Points 
         321111      11 (*)      111      1111      This code doesn't compile.  
     
    
Incorrect. Refer to Section 6 Lesson 1.  
     
  
22. What is the output of the following segment of code?  
 Mar k for Review (1) Points
         321123      642      642246 (*)      312213      This code doesn't compile.  
     
    
Correct  
     
  
23. Which of the following statements is not a valid array declaration?  Mar k for Review (1) Points
         int number[];      float []averages;      double marks[5];      counter int[]; (*)  
     
    
Incorrect. Refer to Section 6 Lesson 1.  
     
  
24. What is the output of the following segment of code if the command line arguments are "a b c d e f g"?  
 Mar k for Review (1) Points
         f      e (*)      c      d      This code doesn't compile.  
     
    
Incorrect. Refer to Section 6 Lesson 1.  
     
  
25. Suppose you misspell a method name when you call it in your program. Which of the following explains why this gives you an exception? 
 Mar k for Review (1) Points
         Because the parameters of the method were not met.      Because the interpreter does not recognize this method since it was never initialized, the correct spelling of the method was initialized.      Because the interpreter tries to read the method but when it finds the method you intended to use it crashes.      This will not give you an exception, it will give you an error when the program is compiled. (*)  
     
    
Incorrect. Refer to Section 6 Lesson 3.  
26.  Of the options below, what is the fastest run- time? 
 Mark for Review (1) Points
          n  
   
n^2  
   
lg(n) (*)  
   
n*lg(n)  
          Incorrect. Refer to Section 6 Lesson 2.  
     
  
27.  Selection sort is efficient for large arrays. True or false? 
 Mark for Review (1) Points
          True  
   
False (*)  
          Correct  
     
  
28.  Binary searches can be performed on sorted and unsorted data. True or false? 
 Mark for Review (1) Points
          True  
   
False (*)  
          Correct  
     
  
29.  A sequntial search is an iteration through the array that stops at the index where the desired element is found. True or false?  Mark for Review (1) Points
          True (*)  
   
False  
          Correct  
      
       Section 7  (Answer all questions in this section) 
     
  
30.  What is the Java Applet? 
 Mark for Review (1) Points
         (Choose all correct answers) 
          It is the virtual machine that translates Java code into a representation that the computer can understand.       A web-based Java program that is embedded into a web browser. (*)  
   
A graphic visual included in Java. (*)  
   
There is no such thing as a Java Applet.  
          Incorrect. Refer to Section 7 Lesson 4.   31 .  Why is it not possible to extend more than one class at a time in an inherita nce hierarch Mark for Review  (1) Points 
y chain? 
          It is not necessary considering all public content is passed from super class to subclass and further to their subclass and that subclass' subclass and so on. (*)       Because the computer cannot handle code that complex.  
   
To prevent confusion for the programmer.  
   
It is possible to extend more than one class at a time.  
     
    
Incorrect. Refer to Section 7 Lesson 4.  
     
  
32. Which of the following correctly describes an "is-a" relationship? 
 Mark for Review (1) Points
          A helpful term used to conceptualize the relationships among nodes or leaves in an inheritance hierarchy. (*)       A programming philosophy that promotes simpler, more efficient coding by using exiting code for new applications.       It restricts access to a specified segment of code.  
   
A programming philosophy that promotes protecting data and hiding implementation in order to preserve the integrity of data and methods.  
     
    
Correct  
     
  
33. Which of the following is the correct way to call an overriden method needOil() of a super class Robot in a subclass SqueakyRobot?  Mark for Review (1) Points
          Robot.needOil(SqueakyRobot);  
   
SqueakyRobot.needOil();  
   
super.needOil(); (*)  
   
needOil(Robot);  
     
    
Incorrect. Refer to Section 7 Lesson 4.  
     
  
34. It is possible to overload a method that is not a constructor. True or False? 
 Mark for Review (1) Points
          True (*)  
   
False  
     
    
Correct  
     
  
35. Identify the error(s) in the class below. Choose all that apply.   Mark for Review (1) Points
         (Choose all correct answers) 
          No method named min is defined. (*)  
   
Two methods cannot have the same name.  
   
The parameters must be the same for all methods with the same name.  
   
Private cannot be used as an access modifier.  
   
Final cannot be used as an access modifier.  
     
     Incorrect. Refer to Section 7 Lesson 2.   36.  Which of the following could be a reason to return an object?  Mark for Review (1) Points
          Because you wish to be able to use that object inside of the method.  
   
It has faster performance than returning a primitive type.  
   
The method makes changes to the object and you wish to continue to use the updated object outside of the method. (*)  
   
None of the above. It is not possible to return an object.  
          Incorrect. Refer to Section 7 Lesson 2.  
        37.  Which of the following is the definition for a variable argument method? 
 Mark for Review 
(1) Points
          A way to create a new class.  
   
Specifies accessibility to code.  
   
Having more than one constructor with the same name but different arguments.  
   
A type of argument that enables calling the same method with a different number of arguments. (*)  
          Incorrect. Refer to Section 7 Lesson 2.  
     
  
38.  Which segment of code correctly defines a method that contains two objects of class Tree as parameters?  Mark for Review (1) Points
          void bloom(Tree pine, Tree oak) {//code here }; (*)  
   
Tree bloom (pine, oak) {//code here };  
   
void bloom, Tree pine, Tree oak {//code here };  
   
None of the above, objects cannot be passed as parameters.  
          Correct  
     
  
39.  Abstract classes cannot implement interfaces. True or false? 
 Mark for Review (1) Points
          True  
   
False (*)  
          Incorrect. Refer to Section 7 Lesson 5.  
     
  
40.  What is Polymorphism? 
 Mark for Review (1) Points
          A way of redefining methods with the same return type and parameters.  
   
A way to create multiple methods with the same name but different parameters.  
   
A class that cannot be initiated.  
   
The concept that a variable or reference can hold multiple types of objects. (*)  
          Incorrect. Refer to Section 7 Lesson 5.   41.  It is possible to inherit from an abstract class. True or false?  Mark for Review (1) Points
          True (*)  
   
False  
     
    Correct  
     
  
42.  Static methods can return any object type. True or false? 
 Mark for Review (1) Points
          True (*)  
   
False  
          Incorrect. Refer to Section 7 Lesson 3.  
     
  
43.  A non-linear recursive method is less expensive than a linear recursive method. True or false?  Mark for Review (1) Points
          True  
   
False (*)  
          Incorrect. Refer to Section 7 Lesson 3.  
     
  
44.  Forward thinking helps when creating linear recursive methods. True or false? 
 Mark for Review (1) Points
          True  
   
False (*)  
          Correct  
     
  
45.  What is wrong with the following class declaration?  
class Account{ ;  private int number;  private String name;;  public Account;  } 
 Mark for Review (1) Points
          Classes cannot include strings.  
   
Classes cannot include mixed data types.  
   
The constructor method has no definition. (*)  
   
There is nothing wrong.  
          Incorrect. Refer to Section 7 Lesson 1.   4 6 .  Which of the following creates an instance of the class below?    Mar k for Review  (1) Points 
          ThisClass t=new ThisClass();  
   
ThisClass t;  
   
ThisClass t=new ThisClass(3,4);  
   
ThisClass t=new ThisClass(5); (*)  
          Incorrect. Refer to Section 7 Lesson 1.  
     
  
47. A class can only have one constructor. True or false? 
 Mar k for Review (1) Points
          True  
   
False (*)  
          Incorrect. Refer to Section 7 Lesson 1.  
     
  
48. Which of the following creates a method that returns a boolean value?  Mar k for Review (1) Points
           
     
    
(*)       

   
None of the above.  
          Correct  
     
  
49. The constructor method must always have at least one parameter. True or false?  Mar k for Review (1) Points
          True  
   
False (*)  
          Incorrect. Refer to Section 7 Lesson 1.  
     
  
50. Identify the driver class that correctly initializes employees Jane and Brandon. The Employee class is below. 
public class Employee { private String name;  private int age;  private double salary; public Employee(String n, int a, double s) { name = n;  age = a;  salary = s;  } //methods for this class would go here } 
 Mar k for Review (1) Points
          public class driver_class { public static void main(String[] args) { Employee Jane = new Employee("Jane", 48, 35.00); Employee Brandon = new Employee("Brandon", 36, 20.00);  } } (*)       public class driver_class { public static void main(String[] args) { Employee("Jane", 48, 35.00); Employee("Brandon", 36, 20.00);  } }       public class driver_class { public Employee{ Jane = new Employee("Jane", 48, 35.00); Brandon = new Employee("Brandon", 36, 20.00);  
} }      public class Employee { public class driver-class{ Employee Jane = new Employee(); Employee Brandon = new Employee();  } }  
          Incorrect. Refer to Section 7 Lesson 1.    
Test: Java Fundamentals Final Exam  Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. 
 Section 4  (Answer all questions in this section) 

Tidak ada komentar:

Posting Komentar

Post Top Ad

Your Ad Spot

Pages