Java Fundamentals Final-Version 1
Java Fundamentals Final-Version 1
+- ~
mApps
T D Student Sign In
X./
Outline
~lark
for Review
( 1) Points
~lark
for Review
( 1) Points
Correct
Defines where this class lives relative to other classes, and provides a level of access control. (* )
Provides the compiler information that identifies outside classes used within the current class.
Precedes the name of the class.
D Understanding lnhe1itance:
0.. Understanding lnhe1itance:
Correct
D Understanding Polymorphi-sm:
0 Understanding Polymorphi"Sm:
0 ....
II (*J
/*
*I
I*/
Unde"tanding Polymorphism:
o....
Correct
4. A workspace is:
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. (* )
f3
Other bookmarks
LJ
5. For eve1y opening curly brace { there does not need to be a closing curly brace} for the program to compile without error. True or False?
True
False(* )
Page 1 of 10
Correct
I Next I I Summary I
.-
RO ""'
'
I" t;l
C )
18:14
17.04.2015
'
+- ~
mApps
T D Student Sign In
X./
LJ
Outline
6. In Eclipse, when you run a Java Application, the results are displayed in a new window. True or False>
Passing Objects and O.oerloading
True
False(* )
0 ....
D Understanding lnhe1itance:
(1) Points
A workspace
A physical location
A perspective (* )
All of the above
Correct
D Understanding Polymorphi-sm:
0 Understanding Polymorphi'Sm:
0 ....
Unde"tanding Polymorphism:
Other bookmarks
~s
2
3
4
5
6
(1) Points
x = z % Yi
o....
2 (* )
2.5
6
14
9. Which line of Java code properly calculates the area of a triangle using A= 1/ 2(b)(h) where band h are Java primitive integers?
( 1) Points
double A= 1/ 2* b* h;
double A= 1/ 2bh;
double A=(double) 1/ (double)2* b*h; (* )
double A=(double)( 1/ 2)* b* h;
1
2
St ring [) mountains =
{"Ch i mbora zo","Ma tterho r n 11 ,"0l ympus","Evere st","Ki nab alu",
( 1) Points
.-
RO ""'
'
I" t;l
C )
18:14
17.04.2015
'
+- ~
mApps
T D Student Sign In
X./
C ~ I D ilearn ing .o racle .com/ilearn/enj learner/jsp/player.jsp?rco_id= l340353197&classroom_id = l361817065&scorm_a ttempt= l429282683005&sessionld= 6361287741L
,.,. Samsung Galaxy s II... xda [KITCHEN] ArchiKitc... E [Guide)Theme yo ur ... How To Build A Dec... LJ de cautat
2
3
4
(String args[] )
{ i nt x; i nt y = 4; i nt z = 1 0 ; x = z % y;
System . out.print l n (x ) ; }}
5
6
What is the value of variable x?
2 (* )
2.5
6
14
~s
f)
D Understanding lnhe1itance:
9. Which line of Java code properly calculates the area of a triangle using A=1/ 2(b)(h) where band h are Java primitive integers>
double A=1/ 2* b* h;
double A=1/ 2bh;
double A=(double) 1/ (double)2* b* h; (* )
double A=(double)( 1/ 2)* b* h;
0 Understanding Polymorphi-sm:
0 Understanding Polymorphi-sm:
0 ....
Unde"tanding Polymorphism:
o....
Other bookmarks
Outline
LJ
f)
St ring [) mountains =
2
3
4
for Review
( 1) Points
5
6
~lark
What is printed>
55555
87658
AtlanticPacificindianArcticSouthern
Code does not compile
ArrayindexDutofBoundsException is thrown (* )
Previous
Correct
Page 2 of 10
I Next I I Summary I
.-
RO ""'
'
I" t;l
C )
18:14
17.04.2015
'
+- ~
mApps
T D Student Sign In
X./
D Understanding lnhe1itance:
0.. Understanding lnhe1itance:
LJ
Outline
0 Understanding Polymorphi"Sm:
0 ....
Unde"tanding Polymorphism:
f)
Correct
3
4
5
s +="\\ ";
\\\\
\\\\\\\\\\\\\\
\\
~
Correct
for Review
(1) Points
\\\\\\\ (* )
~lark
Section 4
(Answer all Questions in this section)
o....
Review your answers, feedback, and QUestion scores below. An asterisk (*) indicates a correct answer.
12. Suppose that str1 and str2 are two strings. Which of the statements or expressions are valid>
D Understanding Polymorphi-sm:
Other bookmarks
i f (s.charAt( 3) == 'd' )
.-
RO ""'
'
I" t;l
C )
18:15
17.04.2015
'
+- ~
mApps
T D Student Sign In
X./
1
2
3
4
System.out.print l n (s);
\\\\
\\\\\\\ (* )
\\
~
Unde"tanding Polymorphism:
True
False(* )
3
4
5
6
Correct
0 Understanding Polymorphi"Sm:
\\\\\\\\\\\\\\
o....
Correct
D Understanding lnhe1itance:
0 ....
D Understanding Polymorphi-sm:
Outline
Other bookmarks
LJ
Section 5
(Answer all questions in this section)
15. switch statements work on all input types including, but not limited to, int, char, and String. True or false>
True
False(* )
Correct
Page 3 of 10
I Next I I Summary I
.-
RO ""'
'
I" t;l
C )
18:15
17.04.2015
'
+- ~
mApps
T D Student Sign In
X./
LJ
Outline
16. Which of the following could be a reason to use a switch statement in a Java program?
Because it allows the code to be run through until a ce1tain conditional statement is true.
Because it allows the program to run ce1tain 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.
D Understanding lnhe1itance:
0.. Understanding lnhe1itance:
o....
for Review
( 1) Points
~lark
for Review
( 1) Points
True
False (*)
~lark
Correct
18. One advantage to using a while loop over a for loop is that a while loop always has a counter. True or false?
for Review
( 1) Points
True
False (*)
Unde"tanding Polymorphism:
~lark
if ((5. 1 > 4.3 && 6.2 < 8.4) && !(7.2 < 3.5 I I 1.2 == 2. 1 I I 2.2 != 2.25)) <
System.out.print("TRUE"); else
System.out.print("FALSE");
0 Understanding Polymorphi"Sm:
D Understanding Polymorphi-sm:
0 ....
Section 5
(Answer all Questions in this section)
Review your answers, feedback, and QUestion scores below. An asterisk (*) indicates a correct answer.
Other bookmarks
Correct
x = 1;
8; 27
27; 8 (* )
27; 8
30; 5
3; 9; 11
. ...
RO ""'
'
I" t;l
C )
18:15
17.04.2015
'
+- ~
mApps
T D Student Sign In
X./
LJ
Other bookmarks
Outline
True
False (*)
Correct
18. One advantage to using a while loop over a for loop is that a while loop always has a counter. True or false?
True
False(* )
D Understanding lnhe1itance:
x*=3;
count-=3;
0 Understanding Polymorphi"Sm:
Unde"tanding Polymorphism:
o....
D Understanding Polymorphi-sm:
0 ....
Correct
4;
3;
5;
5;
3;
8; 27
27; 8 (* )
27; 8
30; 5
9; 11
Correct
20. What should replace the comment "//your answer here" in the code below if the code is meant to take no action when i o/o 2 is 0 (in other words when i is even)?
~lark
for Review
( 1) Points
continue; (* )
break;
return;
k+ =1;
Previous
Correct
Page 4 of 10
I Next I I Summary I
.-
RO ""'
'
I" t;l
C )
18:15
17.04.2015
'
+- ~
mApps
T D Student Sign In
X./
LJ
Outline
D Understanding Polymorphi-sm:
0 Understanding Polymorphi"Sm:
0 ....
Unde"tanding Polymorphism:
o....
21. Big-0 Notation is used in Computer Science to describe the performance of Sorts and Searches on arrays. True or false?
True(* )
False
~
Correct
22. Which of the following sorting algorithms utilizes a "divide and conQuer" techniQue to sort arrays with optimal speed>
~lark
for Review
(1) Points
~lark
for Review
( 1) Points
~lark
for Review
( 1) Points
SeQuential Search
Merge So1t (* )
Selection So1t
Binary Search
All of the above
23. Which of the following is the correct lexicographical order for the conents of the int array?
{17, 1, 1, 83,
{ 1, 2, 7, 0, 9, 5, 6, 4, 8, 3}
{1, 1, 3, 17, 22, 28, 29, so, 71, 83} (*)
Correct
nA2
lg(n) (* )
n* lg(n)
Section 6
(Answer all Questions in this section)
D Understanding lnhe1itance:
Review your answers, feedback, and QUestion scores below. An asterisk (* ) indicates a correct answer.
Other bookmarks
t r y{
i f ( x< O)
.-
RO ""'
'
I" t;J
C 1)
18:16
17.04.201S
'
W (} Facebook
+- ~
mApps
T Cl Student Sign In
{ 1, 2, 7, 0, 9, 5, 6, 4, 8, 3}
{1, 1, 3, 17, 22, 28, 29, so, 71, 83} (* )
D Understanding lnhe1itance:
Correct
D Understanding Polymorphi-sm:
0 Understanding Polymorphi"Sm:
nA2
0 ....
lg(n) (* )
n* lg(n)
Unde"tanding Polymorphism:
o....
{17, 1, 1, 83,
Outline
2 3. Which of the following is the correct lexicographical order for the conents of the int array?
Other bookmarks
LJ
2
3
4
5
6
7
t r y{
i f ( x < 0)
catch {
System .out.print l n ( "Enter your v alue again.");
It is missing a semicolon.
It does not compile. (* )
It gives you an out of bounds exception.
There is nothing wrong with this code.
Prev iou s
Page 5 of 10
I Next I I Summary I
.-
RO """
'
I" t;J
C )
18:17
17.04.201S
'
W (} Facebook
+- ~
mApps
T Cl Student Sign In
1
2
3
4
111
D Understanding Polymorphi-sm:
( 1) Points
1 1 1 (*)
001
0 10
100
0 Understanding Polymorphi"Sm:
Unde"tanding Polymorphism:
(1) Points
28. Which of the following declares and initializes a one dimensional array named words of size 3 so that all entries can be Strings>
(1) Points
0 11
001
100
0 10
001
100
110
D Understanding lnhe1itance:
o....
Outline
26. What will be the content of the a1ray variable table after executing the following code?
5
6
0 ....
Other bookmarks
Section 6
(Answer all questions in this section)
LJ
.-
RO ""'
'
I" t;J
C )
18:17
17.04.2015
'
W (} Facebook
+- ~
mApps
X '
Cl
Student Sign In
f3
2 8. Which of the following declares and initializes a one dimensional array named words of size 3 so that all entries can be Strings>
D Understanding lnhe1itance:
D Understanding Polymorphi-sm:
0 Understanding Polymorphi"Sm:
f3
0 ....
Unde"tanding Polymorphism:
o....
9630
963 (* )
987654321
97531
This code doesn't compile.
Other bookmarks
Outline
LJ
int number();
float ()averages;
double marks[ 5);
counter int(); (* )
f3
Section 7
(Answer all questions in this section)
30. Which segment of code correctly defines a method that contains two objects of class Tree as parameters?
Previou s
Correct
Page 6 of 10
I Next I I Summary I
.-
RO ""'
'
I" t;J
C )
18:17
17.04.2015
'
W (} Facebook
+- ~
mApps
X '
Cl Student Sign In
LJ
Outline
Correct
~lark
for Review
(1) Points
~lark
for Review
( 1) Points
D Understanding lnhe1itance:
0.. Understanding lnhe1itance:
D Understanding Polymorphi-sm:
0 Understanding Polymorphi"Sm:
0 ....
Unde"tanding Polymorphism:
o....
Having more than one constructor with the same name but different arguments. (* )
Having more than one constructor with different names and the same arguments.
A variable argument method that returns an array.
A type of access specifier that only allows access from inside the same class.
~
Correct
33. Which of the following is the correct way to code a method with a return type an object Automobile?
Automobile upgrade( String carA){
carA="Turbo";
return carA;}
Automobile upgrade(Automobile carA){
carA.setTurbo("yes");
return carA;} (*)
String upgrade(String carA){
carA="Turbo";
return carA;}
upgrade(Automobile carA) Automobile{
carA.setTurbo("yes");
return carA;}
None of the above. It is not possible to return an object.
~
Correct
34. Which of the following is the definition for a variable argument method?
Section 7
(Answer all Questions in this section)
Review your answers, feedback, and QUestion scores below. An asterisk (*) indicates a correct answer.
Other bookmarks
..
RO ""'
'
I" t;J
C )
18:18
17.04.2015
'
W (} Facebook
+- ~
mApps
X '
Cl Student Sign In
LJ
Outline
D Understanding lnhe1itance:
0.. Understanding lnhe1itance:
D Understanding Polymorphi-sm:
0 Understanding Polymorphi"Sm:
Unde"tanding Polymorphism:
o....
Correct
34. Which of the following is the definition for a variable argument method?
Correct
33. Which of the following is the correct way to code a method with a return type an object Automobile?
0 ....
Having more than one constructor with the same name but different arguments. (*)
Having more than one constructor with different names and the same arguments.
A variable argument method that returns an array.
A type of access specifier that only allows access from inside the same class.
Other bookmarks
Correct
35. Which of the following correctly describes the use of the keyword super>
A keyword that
A keyword that
A keyword that
A keyword that
Previous
Correct
Page 7 of 10
I Next I I Summary I
.-
RO ""'
'
I" t;J
C )
18:18
17.04.2015
'
W (} Facebook
+- ~
mApps
X '
Cl Student Sign In
LJ
Outline
D Understanding Polymorphi-sm:
0 Understanding Polymorphi"Sm:
0 ....
Unde"tanding Polymorphism:
o....
37. If a variable in a superclass is p1ivate, could it be directly accessed or modified by a subclass? Why or why not?
~lark
for Review
( 1) Points
~lark
for Review
( 1) Points
Yes. A subclass inherits full access to all contents of its super class.
Yes. Any variable passed through inheritance can be changed, but private methods cannot.
No. A private variable can only be modified by the same class with which it is declared regardless of its inheritance. (* )
No. Nothing inherited by the super class can be changed in the subclass.
~
True (*)
False
~
2
3
4
5
6
7
Correct
39. If we ovenide the toString() method with the code below, what would be the result of printing?
Correct
38. An access modifier is a keyword that allows subclasses to access methods, data, and constructors from their parent class. True or false?
Section 7
(Answer all Questions in this section)
D Understanding lnhe1itance:
0.. Understanding lnhe1itance:
Review your answers, feedback, and QUestion scores below. An asterisk (*) indicates a correct answer.
Other bookmarks
It would print the array one element at a time. The console screen would display: 0 18 215 64 11 42
It would print the string returned from the method. The console screen would display: (0, 18,215,64, 11,42,] (* )
It would print the array backwards. The console screen would display: 42 11 64 215 18 0
It would print the string returned from the method. The console screen would display: {0, 18, 2 15, 64, 11, 42}
. ...
RO ""'
'
I" t;J
C )
18:18
17.04.2015
'
W (} Facebook
+- ~
mApps
X '
Cl Student Sign In
2
3
4
5
6
7
It
It
It
It
D Understanding lnhe1itance:
0.. Understanding lnhe1itance:
0 Understanding Polymorphi'Sm:
0 ....
( 1) Points
fo r ( i n t
t emp += arr[i]+",";
t emp += "]";}
would
would
would
would
print
print
print
print
the
the
the
the
array one element at a time. The console screen w ould display: 0 18 215 64 11 42
string returned from the method. The console screen would display : [ 0, 18,215,64, 11,42,] (* )
array backwards. The console screen would display: 42 11 64 215 18 0
string returned from the method. The console screen would display: {0, 18, 215, 64, 11, 42}
(1) Points
Unde"tanding Polymorphism:
D Understanding Polymorphi-sm:
Outline
39. If we override the toString() method with the code below, what would be the result of printing>
Other bookmarks
Correct
LJ
return list;
o....
= new Arraylist();
nums = Test.returnlist(nums);
II. Arraylist nums = new Arraylist();
nums = Test.returnlist(nums);
III. Arraylist nums1 = new Arraylist();
List nums2 = Test.returnlist(nums1);
I. List nums
I only
I and III (* )
II only
II and III
I, II, and III
Correct
Page 8 of 10
I Next I I Summary I
.-
RO ""'
'
I" t;J
C )
18:19
17.04.2015
'
W (} Facebook
+- ~
mApps
X '
Cl
Student Sign In
LJ
Outline
Section 7
(Answer all questions in this section)
41. Which of the following are true about abstract methods?
Other bookmarks
D Understanding lnhe1itance:
Correct
4 2. A non-linear recursive method calls how many copies of itself in the recursive case?
~lark
for Review
(1) Points
0
1
D Understanding Polymorphi-sm:
2 or more (* )
0 Understanding Polymorphi"Sm:
0 ....
Unde"tanding Polymorphism:
43. The base case condition can work with a constant or variable. True or false?
o....
False
Correct
44. Static classes can have different access specifiers than the parent class. True or false?
True (*)
False
True (*)
False
Previous
Page 9 of 10
I Next I I Summary I
.-
RO ""'
'
I" t;l
C )
18:19
17.04.2015
'
W (} Facebook
+- ~
mApps
X '
Cl Student Sign In
LJ
Other bookmarks
Outline
46. In Java, an instance field referenced using the this keyword generates a compilation error. True or false?
True
False(* )
~
Correct
4 7. The basic unit of encapsulation in Java is the primitive data type. True or false?
True
False(* )
D Understanding lnhe1itance:
~lark
for Review
(1) Points
~lark
for Review
(1) Points
Correct
True
False(* )
D Understanding Polymorphi-sm:
0 Understanding Polymorphi"Sm:
0 ....
o....
Correct
49. All objects, in Java, are created using int. True or false?
Unde"tanding Polymorphism:
True
False(* )
~
Correct
public class Th i sC la ss {
p riv a t e i nt a=4, b=S;
2
3
4
5
6
7
retur n a;
.-
RO ""'
'
I" t;J
C )
18:19
17.04.2015
'