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
valentinak56 [21]
3 years ago
9

Consider this program segment: int newNum = 0, temp; int num = k; // k is some predefined integer value 0 while (num > 10) {

temp = num % 10; num /= 10; newNum = newNum * 10 + temp; } System.out.println(newNum); Which is a true statement about the segment? I If 100 <= num <= 1000 initially, the final value of newNum must be in the range 10 <= newNum <= 100. II There is no initial value of num that will cause an infinite while loop. III If num <= 10 initially, newNum will have a final value of 0.
Computers and Technology
1 answer:
Doss [256]3 years ago
6 0

Answer:

All of these statements are true.

Explanation:

Since the while loop is reversing the integer number and leaving the highest order digit in the num and stores the reversed number in the newNum variable.

It skips one digit so if the num is in the range of [100,1000] it will result in a number between 10 and 100.

This loop can never go in infinite loop for any initial value of num because the loop will run as many times as the number of digits.

and if the value of the num is <=10 the while loop will never run and the value of newNum will be 0.

You might be interested in
The loop function is similar to range(), but handles the parameters somewhat differently: it takes in 3 parameters: the starting
nexus9112 [7]

Answer and Explanation:

def loop(start, stop, step):

   return_string = ""

   if step == 0:

       step = 1

   if start > stop:  # the bug was here, fixed it

       step = abs(step) * -1

   else:

       step = abs(step)

   for count in range(start, stop, step):

       return_string += str(count) + " "

   return return_string.strip()

5 0
3 years ago
Footnotes and endnotes can be used to explain information in more detail, add opinions or comments, or to cite sources in the do
adell [148]
Well thats false. They are only notes, not extra details.
8 0
2 years ago
You are given a class named Clock that has three instance variables: One of type int called hours, another of type boolean calle
Ivahew [28]

Answer:

Clock (int hours, boolean isTicking, int diff) // constructor clock

{

this.hours = hours;

// set the instance variable hours

this.isTicking = isTicking;

// set the boolean variable isTicking

this.diff =diff;

//set the instance variable diff

}

Explanation:

Here we declared a constructor clock which has 3 parameter hours,boolean isTicking,and diff.

The int hours, diff is of int type and isTicking is of boolean type. In this constructor, we set the instance variables values by using this keyword.

5 0
3 years ago
From the television industry's point of view, which of the following would be the most desirable viewer?
slava [35]
A 50-year-old African American man
4 0
3 years ago
Which environment variable affects the number of past commands used in the current shell session?
scoray [572]
HISTSIZE is the environment variable affects the number of past commands used in the current shell session.
4 0
3 years ago
Other questions:
  • Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
    14·1 answer
  • 1. Why is it important to compare features of a computer before making a purchase?
    13·2 answers
  • Free points! your welcome
    9·2 answers
  • Which one is a run-on sentence? you get mark the brilist
    5·2 answers
  • What is a help desk
    15·1 answer
  • What is the best operating system
    12·1 answer
  • Explain briefly the purpose of the Computer Management Console in Microsoft Windows.
    12·1 answer
  • Your disaster recovery plan calls for tape backups stored at a different location. The location is a safe deposit box at the loc
    13·1 answer
  • ANSWER QUICKLY PLEASE
    7·1 answer
  • Why might you want to save a downloaded file to your computer first instead of running it immediately?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!