1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alex17521 [72]
3 years ago
5

Which input value causes the loop body to execute a 2nd time, thus outputting "In loop" again? { String s = "Go"; while ((!s.equ

als("q"))&& (!s.equals("")) System.out.println("In loop"); 5 - scnr.nextO;
a) "Quit"
b) "q" only
c) "Q only
d) Either "q" or "Q"
Computers and Technology
1 answer:
Ksenya-84 [330]3 years ago
6 0

Answer:

a) "Quit"  

c) "Q only

Explanation:

Given

<em>String s = "Go"; </em>

<em>while ((!s.equals("q"))&& (!s.equals("")))  {</em>

<em>System.out.println("In loop"); </em>

<em>s = scnr.next();</em>

<em>}</em>

<em />

Required

What input causes another execution

Analyzing the while condition

<em>while ((!s.equals("q"))&& (!s.equals("")))  </em>

<em />

This can be split into:

<em>!s.equals("q")) && (!s.equals(""))</em>

<em />

Meaning

When s is not equal to "q" and when s is not an empty string

<em />

In other words,

the loop will be executed when user input is not "q" and user input is not empty.

So, from the list of given options: The loop both will be executed when:

a) Input is "Quit"

c) Input is Q only

<em>Input of q will terminate the loop, hence b and d are incorrect</em>

<em />

You might be interested in
3. Round off to the nearest hundredth (2 decimal places).
blagie [28]
<h3>#a</h3>

\boxed{ \mathfrak{3.752 = 3.75}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#b</h3>

\boxed{ \mathfrak{0.506 = 0.51}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#c</h3>

\boxed{ \mathfrak{3.966 = 3.97}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#d</h3>

\boxed{ \mathfrak{1.838 = 1.84}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#e</h3>

\boxed{ \mathfrak{30.063 = 30.7}}

:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:-:

<h3>#f</h3>

\boxed{ \mathfrak{404.759 = 404.76}}

3 0
2 years ago
Create a datafile called superheroes.dat using any text-based editor, and enter at least three records storing superheroes’ name
vitfil [10]

Answer:

Open a text-based editor like Microsoft word, notepad, libraoffice, etc, type the name of the super hero on the first field and the main power on the second field. Then click on the file menu or press ctrl-s and save file as superheroes.dat.

Explanation:

The file extension 'dat' is used to hold data for programs, for easy access. The file above holds data in fields separated by a space and has multiple records.

7 0
4 years ago
Building relationship during your carrer exploration is called
Paul [167]

Answer:

Building relationships during your career exploration is called <u>networking</u>.

4 0
4 years ago
Live footage refers to:
QveST [7]

Answer:

D

Explanation:

live refers to happening right now and footage refers to videos taken and captured.

8 0
2 years ago
Create a file using any word processing program or text editor. Write an application that displays the files, name, containing f
MArishka [77]

Answer:

below is a Shell I have ;

1.Import java.nio.file.*;

2.Import java.nio.file attribute.*;

3.Import java.10 Exception;

4.public class FileStatistics

5.{

6.public static void main(string []args)

7.{

8.path file=

9.

paths.get("C:\\Java\\chapter.13\\TestData.txt")

10.try

11.{

12.\\declare count and then display path, file, name and folder name.

13.

14.

15.

16.\\declare a BasicFileAttributes object, then add statements to display the file's size and creation time.

17.

18.}

19.

20.catch (10 Exception e)

21.{

22.\\add display 10 Exception

23.

24.}

25.}

4 0
2 years ago
Other questions:
  • Lola's teacher asked her to create a web page for the school's FBLA chapter. Lola isn't sure where to begin. Which tool should s
    12·2 answers
  • Lindsay owns a candy store that typically makes all if its sales to tourists visiting a nearby zoo. Why might she decide to set
    14·2 answers
  • What can help you best learn about appearance, habitats and behaviors of birds in your area
    9·1 answer
  • An administrator needs to set up an authentication server for users connecting to a network through a VPN. What kind of server c
    12·1 answer
  • The IT department at Piggy Parts BBQ has recently learned of phishing attempts that rely on social engineering to break into its
    7·1 answer
  • Cooper Technologies is a technology company that offers many IT services in Chicago. The company's services and products include
    5·1 answer
  • Do you think<br> brain uploading<br> is a good idea?
    7·1 answer
  • For which tasks would Excel be useful? Check all that apply.
    7·1 answer
  • Why do we need to learn about engineering and technology?
    6·1 answer
  • Which option is designed by software engineers?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!