View
4.037
Download
12
Category
Preview:
Citation preview
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Top of FormSection 4
(Answer all questions in this section)
1.Which of the following declarations are correct?Mark for Review(1) Points
(Choose all correct answers)
double duty; (*)
float loan; (*)
boolean value = 12;
int start = 34, 3nd = 99;
Correct
2.Which line of Java code will assign the value of the square root of 11 to a variable named a?Mark for Review(1) Points
double a=11^(1/2);
double a=sqrt(11);
int a=Math.sqrt(11);
double a=Math.sqrt*11;
double a=Math.sqrt(11); (*)
Correct
3.The ______________ is the location into which you will store and save your files.Mark for Review(1) Points
Perspective
Workspace (*)
Editor
None of the above
Correct
4.A workspace is:Mark for Review(1) Points
The physical location onto which you will store and save your files.
The location where all projects are developed and modified.
The location where you can have one or more stored perspectives.
All of the above. (*)
Correct
5.A workspace can not have more than one stored projects. True or false?Mark for Review(1) Points
True
False (*)
Correct
Page 1 of 10NextSummary
Bottom of Form
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Top of FormSection 4
(Answer all questions in this section)
6.You can return to the Eclipse Welcome Page by choosing Welcome from what menu?Mark for Review(1) Points
File
Edit
Help (*)
Close
Correct
7.A perspective is described as:Mark for Review(1) Points
A combination of views and editors (*)
A combination of views and windows
A combination of editor tabs
None of the above
Incorrect. Refer to Section 4 Lesson 1.
8.Which of the following defines a driver class?Mark for Review(1) Points
Contains a main method and other static methods. (*)
Contains classes that define objects.
Contains a main method, a package, static methods, and classes that define objects.
None of the above.
Incorrect. Refer to Section 4 Lesson 2.
9.Which of the following defines an object class?Mark for Review(1) Points
Contains a main method and other static methods.
Contains classes that define objects. (*)
Contains a main method, a package, static methods, and classes that define objects.
None of the above.
Correct
10.Consider the following code snippet.
What is printed?Mark for Review(1) Points
88888 (*)
88888888
1010778
101077810109
ArrayIndexOutofBoundsException is thrown
Incorrect. Refer to Section 4 Lesson 4.
PreviousPage 2 of 10NextSummary
Bottom of Form
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Top of FormSection 4
(Answer all questions in this section)
11.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.
12.Given the code:
String s = new String("abc");
Which of the following statements will change the length of s to the largest length?Mark for Review(1) Points
s.trim()
s.replace("a", "aa")
s.substring(2)
s.toUpperCase()
None of the above will change the length of s. (*)
Correct
13.What is printed by the following code segment?
Mark for Review(1) Points
\\\\
\\\\\\\ (*)
\\\\\\\\\\\\\\
\\
Correct
14.The following code is an example of creating a String reference:
String s;
True or false?Mark for Review(1) Points
True (*)
False
Correct
Section 5
(Answer all questions in this section)
15.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;count-=3;}Mark for Review(1) Points
4; 8; 27
3; 27; 8 (*)
5; 27; 8
5; 30; 5
3; 9; 11
Correct
PreviousPage 3 of 10NextSummary
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Top of FormSection 5
(Answer all questions in this section)
16.One advantage to using a while loop over a for loop is that a while loop always has a counter. True or false?Mark for Review(1) Points
True
False (*)
Incorrect. Refer to Section 5 Lesson 2.
17.Updating the input of a loop allows you to implement the code with the next element rather than repeating the code always with the same element. True or false?Mark for Review(1) Points
True (*)
False
Correct
18.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.
Correct
19.Determine whether this boolean expression evaluates to true or false:
!(36||6= 5) ? 0 : 10;
fee = ( balance >= 500) ? 10 : 0;
fee = ( balance > 5) ? 10 : 0;
Incorrect. Refer to Section 5 Lesson 1.
PreviousPage 4 of 10NextSummary
Bottom of Form
Test: Java Fundamentals Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Top of FormSection 6
(Answer all questions in this section)
21.Which of the following declares a one dimensional array name scores of type int that can hold 14 values?Mark for Review(1) Points
int scores;
int[] scores=new int[14]; (*)
int[] scores=new scores int[14];
int score= new int[14];
Incorrect. Refer to Section 6 Lesson 1.
22.What is the output of the following segment of code?
int array[][] = {{1,2,3},{3,2,1}};for(int i=0;i
Recommended