Computers and Technology, 05.05.2020 19:26 tay8556
Consider the following two code segments, which are both intended to determine the longest of the three strings "pea", "pear", and "pearl" that occur in String str. For example, if str has the value "the pear in the bowl", the code segments should both print "pear" and if str has the value "the pea and the pearl", the code segments should both print "pearl". Assume that str contains at least one instance of "pea".
I) if (str. indexOf("pea") >= 0)
{System. out. println("pea");}
else if (str. indexOf("pear") >= 0)
{System. out. println("pear");}
else if (str. indexOf("pearl") >= 0)
{System. out. println("pearl");}
II) if (str. indexOf("pearl") >= 0)
{System. out. println("pearl");}
else if (str. indexOf("pear") >= 0)
{System. out. println("pear");}
else if (str. indexOf("pea") >= 0)
{System. out. println("pea");}
Which of the following best describes the output produced by code segment I and code segment II?
a) Both code segment I and code segment II produce correct output for all values of str.
b) Neither code segment I nor code segment II produce correct output for all values of str.
c) Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pear" but not "pearl".
d) Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pearl".
e) Code segment II produces correct output for all values of str, but code segment I produces correct output only for values of str that contain "pea" but not "pear".
Answers: 2
Computers and Technology, 23.06.2019 00:00
Which is the correct sequence of steps to set up a document in landscape orientation? a. select page setup from the file menu. then click the margins tab and select landscape. b. select page setup from the edit menu. then click the margins tab and select landscape. c. select page setup from the insert menu. then click the margins tab and select landscape. d. select page setup from the format menu. then click the margins tab and select landscape
Answers: 1
Computers and Technology, 23.06.2019 06:30
Martha is designing a single-player game. her manager suggests that she plan the design to incorporate future modifications. which principle of game design relates to planning for future modifications?
Answers: 1
Computers and Technology, 23.06.2019 09:30
After you present a proposal, the committee starts asking you questions, some beyond the strict focus of your proposal. they ask questions about implications in other fields and knowledge about other fields. you are asked to redo your proposal. what is most likely missing? breadth of material depth of material clarity of material details of material
Answers: 1
Computers and Technology, 23.06.2019 14:30
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
Consider the following two code segments, which are both intended to determine the longest of the th...
Biology, 05.05.2020 05:21
English, 05.05.2020 05:21
Mathematics, 05.05.2020 05:21
Mathematics, 05.05.2020 05:21
Mathematics, 05.05.2020 05:21
Physics, 05.05.2020 05:21
History, 05.05.2020 05:21
Chemistry, 05.05.2020 05:21