subject

Consider the following declaration***In Java*** Widget thing = new Widget();
Which of the following best describes the situation?

A. Widget is an object of the thing class type

B. thing is an object of the Widget class type

C. thing is a primitive value of the Widget type

D. Widget is a primitive value of the thing type

E. Widget and thing are both classes

Question 2
Which of the following is used to indicate a new line?

A. \\

B. \'

C. \n

D. \"

E. \t

Question 3
Look at the following code - assume that Game is a class that creates an object that represents the progress of a player within a video game. By default, the value stored is 1. Also assume that changeLevel() is a void method that will update the progress by adding 1 to the current value stored.

Game progress1 = new Game();
Game progress2 = progress1;
progress1.changeLevel();
What is true about progress1 and progress2?

A. The level of progress1 is changed to 2 by the changeLevel() method, but since it is not simultaneously changed for progress2, the level is not updated completely. Therefore the level of progress1 and progress2 are both 1.

B. An error occurs because progress2 is not properly created. You cannot set one object equal to another object.

C. An error occurs, because when progress1 is stored to progress2, progress1 no longer exists so changeLevel() can no longer be used on progress1.

D. progress1 and progress2 point to the same object, so the level of progress1 and progress2 are both now 2.

E. The value of the level stored in progress1 is now 2 and the the value stored in progress2 is 1.

Question 4
What is output?

int x = 10;
System. out. println(" " + x + 5);

A. 15

B. None of the above

C. x5

D. x10

E. 105

Question 5
Consider the following code:

String str = "Computer Science";
Which of the following statements correctly prints the first character in the String str?

A. System. out. println(str. substring(0));

B. System. out. println(str. substring(0, 0));

C. System. out. println(str. substring(1, 1));

D. System. out. println(str. substring(1, 2));

E. System. out. println(str. substring(0, 1));


Consider the following declaration***In Java***

Widget thing = new Widget();
Which of the followi
Consider the following declaration***In Java***

Widget thing = new Widget();
Which of the followi
Consider the following declaration***In Java***

Widget thing = new Widget();
Which of the followi

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
What is the first view you place in your drawing?
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
Write a program that reads a file consisting of students’ test scores in the range 0–200. it should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. output the score ranges and the number of students. (run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.)
Answers: 3
question
Computers and Technology, 22.06.2019 21:50
Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting numbers, and store this value in total. thus your code should put 11 + 22 + 33 + + 4949 + 50*50 into total. use no variables other than k and total.
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
What is the primary difference between the header section of a document and the body? a. the body is displayed on the webpage and the header is not. b. the header is displayed on the webpage and the body is not. c. the tag for the body is self-closing, but the tags for the headers must be closed. d. the tag for the header is self closing, but the tag for the body must be closed.
Answers: 3
You know the right answer?
Consider the following declaration***In Java*** Widget thing = new Widget();
Which of the fol...
Questions
question
Mathematics, 06.05.2021 02:50
question
English, 06.05.2021 02:50
Questions on the website: 13722363