Which of the following statements declares a variable? (Assume all statements ar
ID: 3912591 • Letter: W
Question
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;
Flag this Question
Question 20.05 pts
"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?
Flag this Question
Question 30.05 pts
Which of the following statements are true?
A method may have no parameters.
A method may have one or more parameters.
A method may or may not return a value.
Flag this Question
Question 40.05 pts
Which of the following is the name of a reference type (object type) we have encountered this quarter?
Flag this Question
Question 50.05 pts
Which of the following is a method of a String object?
Flag this Question
Question 60.05 pts
The arguments of a method call must match the parameters of a method definition in what ways?
Mark all that are correct.
Flag this Question
Question 70.05 pts
What units are required when specifying an angle for the trigonometric methods (sin, cos, etc.)?
Flag this Question
Question 80.05 pts
If two methods within the same class have the same name, what do you have?
Flag this Question
Question 90.05 pts
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(...))?
Flag this Question
Question 100.05 pts
Which of the following is NOT true about class Scanner?
Flag this Question
Question 110.05 pts
Which of the following is the name of a local variable in the Strange class below?
public class Strange{
public static final int MAX = 5;
public static void unknown(){
int number = 0;
for (int i = MAX; i >= 1; i--)
number += i * i;
System.out.println(number);
}
public static void main(String[] a){
unknown();
}
}
Flag this Question
Question 120.05 pts
Which of the following is NOT a method of the Graphics object?
Flag this Question
Question 130.05 pts
Which of the following statements constructs an object?
Flag this Question
Question 140.05 pts
What is the correct syntax for declaring a class constant named BET_LIMIT?
Flag this Question
Question 150.05 pts
Which of the operators listed below has the highest precedence? (Be able to list all operators in order of precedence for the test.)
Flag this Question
Question 160.05 pts
Which of the following are primitive data types in Java (mark all correct answers).
Flag this Question
Question 170.05 pts
Which of the following is the name of a data type in Java? Mark all that apply. (Recall that every variable is declared using a data type to specify the kind of information that can be stored in the variable.)
Flag this Question
Question 180.05 pts
Enter the index value (a number) that identifies the first character in a String object.
Flag this Question
Question 190.05 pts
The abs() method in the Math class is an overloaded method. How many different versions are there?
Flag this Question
Question 200.05 pts
What is the proper way to instantiate a DrawingPanel object?
1Explanation / Answer
(Q1)Which of the following statements declares a variable? (Assume all statements are valid.)
(Ans- )(C) 1 and 3 are correct.
(Q2)"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?
(Ans- )(A) local variable
(Q3)Which of the following statements are true?
(Ans- )(D)I ,II and III are all true.
(Q4)Which of the following is the name of a reference type (object type) we have encountered this quarter?
(Ans- )(E)All of the above.
(Q5)Which of the following is a method of a String object?
(Ans-)(A)length
(Q6)The arguments of a method call must match the parameters of a method definition in what ways?
(Ans- )All are correct.
(Q7)What units are required when specifying an angle for the trigonometric methods (sin, cos, etc.)?
(Ans- )(B)radians
(Q8)If two methods within the same class have the same name, what do you have?
(Ans-)(A)overloaded method
(Q9)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(...))?
(Ans-)(C)Both of the above.
(Q10)Which of the following is NOT true about class Scanner?
(Ans- )(D)All of the Scanner methods return type String.
(Q11)Which of the following is the name of a local variable in the Strange class below?
(Ans- )(D) number.
(Q12)Which of the following is NOT a method of the Graphics object?
(Ans- )(A)getGraphics
(Q13)Which of the following statements constructs an object?
(Ans- )(E)All of the above statements construct objects.
(Q14)What is the correct syntax for declaring a class constant named BET_LIMIT?
(Ans- )(D)public static final int BET_LIMIT = 1000;
(Q15)Which of the operators listed below has the highest precedence?
(Ans- )(D)() (parentheses)
(Q16)Which of the following are primitive data types in Java (mark all correct answers).
(Ans- )(A),(C) and (D)
(Q17)Which of the following is the name of a data type in Java?
(Ans- )(A),(B) and (C)
(Q18)The abs() method in the Math class is an overloaded method. How many different versions are there?
(Ans- )(B)3
(Q19)What is the proper way to instantiate a DrawingPanel object?
(Ans- )(D)DrawingPanel dp = new DrawingPanel(500, 500);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.