The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Question 11
Given
int quantity = 3
double value = 7.52
String number = ""one
Which of all of the following are valid assignments?
A. quantity = value
B. quantity = (int)value
C. value = quantity
D. quantity = (double)value
E. quantity = number
F. Both B and C
Â
Â
Question 12
Select the best answer.
A(n) ____ can add instance variables and methods to an existing class.
A. subclass
B. polymorphism
C. superclass
D. constructor
Â
Â
Question 13
What is the error in the following code fragment?
double data[] = new double[20]
data[20] = 15.25
A. Out-of-bounds error
B. Data not initialized
C. A two-dimensional array is required
D. A cast is required
Â
Â
Question 14
If you know that your loop must iterate at least one time, it is recommended that you use a _________ loop
A. do _ while
B. repeat
C. for
D. while
Â
Â
Â
Question 15
Multiplying an int (such as 5) by a double (such as 0.1) gives
A. an exception is thrown
B. an int
C. an error
D. a double
Â
Â
Question 16
After executing this code segment
double v1 = 2000.0
double v2 = v1
v2 = v2 + 500.0
What will be the value of v1?
A. Unknown
B. 2000.0
C. 2500.0
D. 0.0
Â
Â
Question 17
Which of the following indicates that a method does not return a value?
A. double
B. static
C. void
D. public
Â
Â
Question 18
Where an inherited method is overridden, the type of the actual object, not the type of the reference to the object is used to determine which method to call?
True
False
Â
Â
Question 19
The compiler will generate an error if the same name but different signature is used for more than one method or constructor.
True
False
Â
Â
Question 20
Given this code fragment
int x = 5, y = 6, z = 7
foo(x, y, z)
System.out.println(x + "", "" + y + "", "" + z)
public void foo(int a, int b, int c)
a = a + 3
b = a + c
c = c + b
What is the output?
A. 5, 6, 7
B. 8, 12, 13
C. 2, 0, 4
D. 8, 15, 22
Â
Â