Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Which of the following statements declares a variable? (Assume all statements are valid.) /* 1 */ Oval dot = new Oval(); /* 2 */

1) Which of the following statements declares a variable? (Assume all statements are valid.) /* 1 */ Oval dot = new Oval(); /* 2 */ dot.setColor(new Color(0, 0, 255)); /* 3 */ int dx = 120; /* 4 */ dot.translate(dx, 0); /* 5 */ dx = dx + 10;

a) 1
b) 1 and 2
c) 1 and 3
d) 1, 3 and 5
e) None of the above

2) "The scope of this type of variable begins with its declaration inside a method and ends at the end of the block in which it is declared." What kind of variable is it?

a) a local variable
b) an instance variable
c) a class variable
d) a static variable
e) None of the above

3) Which of the following statements are true?

I) A method may have no parameters.

II) A method may have one or more parameters.

III) A method may or may not return a value.

I only
I and II only
II and III only
I, II and III are all true.
None of the statements is true.

4) Which of the following is the name of a reference type (object type) we have encountered this quarter?

a) String
b) Graphics
c) Scanner
d) DrawingPanel
e) All of the above

5) Which of the following is a method of a String object?

a) length
b) String
c) public
d) char
e) None of the above

6) The arguments of a method call must match the parameters of a method definition in what ways? Mark all that are correct.

image text in transcribed the number of arguments must match the number of parameters
image text in transcribed the order in which the arguments are listed must match the parameters
image text in transcribed the name of each argument must match the corresponding parameter
image text in transcribed the data type of each argument must match the corresponding parameter

7) What units are required when specifying an angle for the trigonometric methods (sin, cos, etc.)?

a) degrees
b) radians
c) sextants

8) If two methods within the same class have the same name, what do you have?

a) an overloaded method
b) a class conflict
c) a syntax error
d) a run-time error
e) a rookie programmer

9) What is the name given to a method that can be called using the name of its class, rather than an object reference, as a qualifier (for example, Math.round(...))?

a) a static method
b) a class method
c) Both of the above
d) None of the above
e) This is not possible in Java

10) Which of the following is NOT true about class Scanner?

a) The Scanner class is part of the java.util package.
b) A Scanner object can be used to get keyboard input if it is constructed using System.in as the source stream.
c) A Scanner object must be constructed before it can be used.
d) All of the Scanner methods return type String.
e) None of the above -- all of these statements are true.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

1. PricewaterhouseCoopers

Answered: 1 week ago

Question

3. SCC Soft Computer

Answered: 1 week ago

Question

2. KMPG LLP

Answered: 1 week ago