int[] numList = new int[50]; for (int i = 0; i < 50; i++) numList[i] = 2 * i; nu
ID: 3639929 • Letter: I
Question
int[] numList = new int[50];for (int i = 0; i < 50; i++)
numList[i] = 2 * i;
num[10] = -20;
num[30] = 8;
What is the index number of the last component in the array numList seen in the accompanying figure?
a 0
b 30
c 49
d 50
What is the default definition of the method toString?
a There is no default definition; you must define the method yourself.
b It creates a string that is the name of the object’s class, followed by the hash code of the object.
c It creates a string that is the name of the program.
d It creates a string that is the name of the package, followed by the name of the class, followed by the hash of the object.
Suppose that Book is class with two instance variables-name of type String and numOfBooks of type int. Which of the following would be appropriate syntax for the heading of a copy constructor for the class called Book?
a public Book(String n, int num)
b public Book()
c public Book(Book b)
d public copyBook(String n, int num)
Class members consist of all of the following EXCEPT ____.
a named constants
b variable declarations
c pre-defined methods
d methods
Explanation / Answer
PS: Please rate the asnwer
1. When you declarate an array of length 50, the indexes run from 0 to 49. So the index number of the last component in the array numList is 49.
2.It creates a string that is the name of the object’s class, followed by the hash code of the object.
3. public Book(String n, int num)
4. I'm not sure of this one. I think its named constants or pre-defined methods. Someone plz confirm.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.