Consider the class definition shown below. Notice that some lines have been replaced by descriptions (in angle brackets) of the code required. The class defines methods newWord, convertWord and toString. Fill in the appropriate Java and then select the correct options in the following text. (A) How many variables in total are referenced by newWord? (B) How many data types are used in convertWord? (C) How many variables are referenced by convertWord? Select the option that correctly answers questions A, Band c ISelect) [ Select] (Select (A) 6 (B) 4 (C) 4 (A) 6 (B) 3 (C) 5 (A) 4 (B) 4 (C) 5 (A) 4 (B) 4 (C) 4 (A) 6 (B) 3 (C) 4 (A) 6 (B) 4 (C) 5 (A) 4 (B) 3 (C) 5 (A) 4 (B) 3 (C) 4 Calling newWord with 2 as parameter would return Select Calling convertWord with "examination as parameter would return (Select) Given an instance of this class, System.out.printin would print (Select ) Select] Select]

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

correct answer please 

Question 7
Consider the class definition shown below. Notice that some lines have been replaced by descriptions (in angle brackets) of the code required. The class defines methods
newWord, convertWord and toString. Fill in the appropriate Java and then select the correct options in the following text.
(A) How many variables in total are referenced by newWord? (B) How many data types are used in convertWord? (C) How many variables are referenced by convertWord?
Select the option that correctly answers questions A, B and C. ISelect)
[ Select]
12
Select
Calling newWord with 2 as parameter would return ISelect ]
(A) 6 (B) 4 (C) 4
(A) 6 (B) 3 (C) 5
(A) 4 (B) 4 (C) 5
(A) 4 (B) 4 (C) 4
(A) 6 (B) 3 (C) 4
(A) 6 (B) 4 (C) 5
(A) 4 (B) 3 (C) 5
(A) 4 (B) 3 (C) 4
Calling convertWord with "examination" as parameter would return (Select]
13
Given an instance of this class, System.out.printin would print (Select]
[ Select]
[Select
edm
dleader to a detinition of a clasa called "Woede
deciacation of String tielda called nd "yr, vith
initialitation to "ab" and "edef" Eepectively.>
emd
dme
dem
[ Select)
( Select]
afcdebfcde
t afedebfcde
afcdebccde
abfcdebfcde
pblie String nevord(int no, int ni) (
StEing terult *"
for (int i - 0; i < x.1ength(): 1+*
result K.chAEÁT ((1460) % X.Length());
tor (int )- 0:< T-length(): 3++) {
EEult y.chaEĀT{{3+nl) y.length(}); }
Select
tetuen teults
1 [ Select )
[Select]
plie Steing conrertlord(StEing word)
int a. vord.length()1
StEing teult-"
chart) but new char(n]i
tor (int 1 - 0: 1c n i) E
but(n-1-1]- Vord.charat (1)}
tor (int i - 0: 1c but.length/2: 1++) {
toina
noita
niota
Eerult buE[1]; )
noati
zetuen reult:
Transcribed Image Text:Question 7 Consider the class definition shown below. Notice that some lines have been replaced by descriptions (in angle brackets) of the code required. The class defines methods newWord, convertWord and toString. Fill in the appropriate Java and then select the correct options in the following text. (A) How many variables in total are referenced by newWord? (B) How many data types are used in convertWord? (C) How many variables are referenced by convertWord? Select the option that correctly answers questions A, B and C. ISelect) [ Select] 12 Select Calling newWord with 2 as parameter would return ISelect ] (A) 6 (B) 4 (C) 4 (A) 6 (B) 3 (C) 5 (A) 4 (B) 4 (C) 5 (A) 4 (B) 4 (C) 4 (A) 6 (B) 3 (C) 4 (A) 6 (B) 4 (C) 5 (A) 4 (B) 3 (C) 5 (A) 4 (B) 3 (C) 4 Calling convertWord with "examination" as parameter would return (Select] 13 Given an instance of this class, System.out.printin would print (Select] [ Select] [Select edm dleader to a detinition of a clasa called "Woede deciacation of String tielda called nd "yr, vith initialitation to "ab" and "edef" Eepectively.> emd dme dem [ Select) ( Select] afcdebfcde t afedebfcde afcdebccde abfcdebfcde pblie String nevord(int no, int ni) ( StEing terult *" for (int i - 0; i < x.1ength(): 1+* result K.chAEÁT ((1460) % X.Length()); tor (int )- 0:< T-length(): 3++) { EEult y.chaEĀT{{3+nl) y.length(}); } Select tetuen teults 1 [ Select ) [Select] plie Steing conrertlord(StEing word) int a. vord.length()1 StEing teult-" chart) but new char(n]i tor (int 1 - 0: 1c n i) E but(n-1-1]- Vord.charat (1)} tor (int i - 0: 1c but.length/2: 1++) { toina noita niota Eerult buE[1]; ) noati zetuen reult:
<Header for a definition of a class called "Words">
<Declaration of String fields called "x" and "y", with
initialization to "ab" and "cdef" respectively.>
public String newWord(int no, int nl) {
String result = "";
for (int i
result + x.charAt( (i+n0) x.length());
for (int j = 0; j < y.length(); j++) {
result += y.charAt ( (j+nl) % y.length (0); }
0; i < x.length(); i++) {
%3D
return result;
public String convertWord(String word) (
int n = word. length():
String result
*";
char[] buf
= new char[n];
0; i < n; i++) {
= word.charAt(i); }
0; i < buf.length/2; i++) {
for (int i
%3D
buf[n-i-1]
for (int i
result += buf[i]; }
return result;
}
<Definition of a public String method named "tostring",
which returns the result of calling convertWord with
the String "unnamed".}
<End of class definition>
Transcribed Image Text:<Header for a definition of a class called "Words"> <Declaration of String fields called "x" and "y", with initialization to "ab" and "cdef" respectively.> public String newWord(int no, int nl) { String result = ""; for (int i result + x.charAt( (i+n0) x.length()); for (int j = 0; j < y.length(); j++) { result += y.charAt ( (j+nl) % y.length (0); } 0; i < x.length(); i++) { %3D return result; public String convertWord(String word) ( int n = word. length(): String result *"; char[] buf = new char[n]; 0; i < n; i++) { = word.charAt(i); } 0; i < buf.length/2; i++) { for (int i %3D buf[n-i-1] for (int i result += buf[i]; } return result; } <Definition of a public String method named "tostring", which returns the result of calling convertWord with the String "unnamed".} <End of class definition>
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY