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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 23:10, Tatertotzzzz
Write a method that accepts a string object as an argument and returns the number of words it contains. for instance, if the argument is "four score and seven years ago", the method should return the number 6. demonstrate the method in a program that asks the user to input a string and then passes that string into the method, printing out whatever the method returns.
Answers: 3
image
Computers and Technology, 22.06.2019 04:30, kkeith121p6ujlt
Eye injuries usually occur as a result of all of the following things, except: a) proper machine operation b) battery explosion c) falling or flying debris d) electric welding arc
Answers: 2
image
Computers and Technology, 22.06.2019 06:00, wbrandi118
What role do chromosomes play in inheritance?
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, josephmelichar777
Write a full class definition for a class named player , and containing the following members: a data member name of type string .a data member score of type int .a member function called setname that accepts a parameter and assigns it to name . the function returns no value. a member function called setscore that accepts a parameter and assigns it to score . the function returns no value. a member function called getname that accepts no parameters and returns the value of name .a member function called getscore that accepts no parameters and returns the value of score .this is what i have, aparently this is wrong: class player{private: string name; int score; public: void player: : setname (string n){name =n; }void player: : setscore (int s){score = s; }string player: : getname (){return name; }int player: : getscore (){return score; }};
Answers: 2
You know the right answer?
Consider the following declaration***In Java*** Widget thing = new Widget();
Which of the fol...

Questions in other subjects:

Konu
Computers and Technology, 25.10.2019 14:43