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
jek_recluse [69]
3 years ago
6

Consider the classes below: public class TestA { public static void main(String[] args) { ​ int x = 2; ​ int y = 20 ​ int counte

r = 0; ​ for (int j = y % x; j < 100; j += (y / x)) { ​ counter++; ​ } } } public class TestB { public static void main(String[] args) { ​ int counter = 0; ​ for (int j = 10; j > 0; --j) { ​ ++counter; ​ } } } Which of the following statements is true?a. The value of j will be the same for each loop for all iterations b. The value of counter will be different at the end of each for loop for each class. c. Both A and B are true. d. Neither A nor B is true.
Computers and Technology
1 answer:
grigory [225]3 years ago
3 0

Answer:

The answer is "Option d".

Explanation:

In the given code, two class "TestA and TestB" is defined, that calculates some values which can be described as follows:

  • In class "TestA", three integer variable "x, y, and counter" is declared, that initializes with a value, that is "2, 20, and 0", inside the class for loop is declare that uses variable j which starts from and ends when the value of j is less than 100, it will increment the value of counter variable by 1.
  • In the class "TestB", an integer "counter" variable is initializes a value with 0, inside the class the for loop is used that uses variable j, which starts from 10, and ends when j is less than 0. in the loop it increments the value of "counter" variable by 1.  that's why in this question except "option d" all were wrong.

You might be interested in
What is better ford our a chevy
blsea [12.9K]
Definitely Chevy. I love chevys.
4 0
3 years ago
Read 2 more answers
A system administrator is selecting an operating system for use by the company's research and development team. The team require
ruslelena [56]

Answer:

Linux

Explanation:

Linux is a family of open source operating system and can be easily modified and changed to meet its particular requirements. Linux is one the most used operating systems on servers, mainframe computers and even super computers. Being a free and open source system, it can be modified and distributed for both commercial and non commercial by anyone under the terms of its licence.

6 0
4 years ago
Write down the character of Morden computer​
Arturiano [62]

<em>The</em><em> </em><em>characteristics</em><em> </em><em>of</em><em> </em><em>a</em><em> </em><em>modern</em><em> </em><em>computer</em><em> </em><em>are</em><em> </em><em>:</em>

  • <em>Speed</em><em> </em>
  • <em>Accuracy</em><em> </em>
  • <em>storage</em><em> </em>
  • <em>Automation</em><em> </em>
  • <em>Communication</em><em> </em>
  • <em>Versatility</em><em> </em>
  • <em>Memory</em><em> </em>
  • <em>Reliability</em><em> </em>
6 0
3 years ago
Is L.A. film school a private school?
Fudgin [204]
Is a private institution
6 0
4 years ago
Read 2 more answers
Assume the availability of a function is_prime. Assume a variable n has been associated with positive integer. Write the stateme
vivado [14]

Answer:

def main():

   n = int(input('Enter the value of the variable n:'))

   k=2;

   totalSum = 0

   print('The list of the prime numbers are as follows:')

   while k <= n:

       totalSum = totalSum+is_prime(k)

       k=k+1

   print('Total sum of the prime numbers:',totalSum)

def is_prime(k):

   primeNumber = 0      

   i=1

   while i<=int(k):

       if (k % i) == 0:

           primeNumber = primeNumber + 1

       i=i+1

   if(primeNumber==2):      

       print(k)

       return k;

   else:        

       return 0;

main()

Explanation:

  • Run the while loop until k is less than n.
  • Determine if the variable k is prime then add it to the totalSum variable.
  • Increment the value of k by 1.
  • Create a function isPrime to check whether the number is prime  or not by determining the factors of k which can be found using the modulus operator.
  • Call the main function at the end.

6 0
3 years ago
Other questions:
  • Which of the following types of e-commerce presence is best suited for creating an ongoing conversation with one's customers?A)
    6·1 answer
  • Which key on the keyboard do you use when you copy using Drag and Drop? The Alt key. The Ctrl key. The Shift key. None of the ab
    5·2 answers
  • If you can log into a website to add, edit, or delete content that has been added by you or another user, you are most likely us
    6·1 answer
  • Write 2-3 lines about the Basic operations of computer
    5·1 answer
  • Neil holds a discussion session with his clients. He recommends the kinds of network topologies the clients should consider, acc
    9·1 answer
  • In the forward chaining technique, used by the inference engine component of an expert system, the _____ condition is evaluated
    5·1 answer
  • Which of the following statements about content-based filtering is TRUE?
    9·1 answer
  • Please help me with this question<br>it on the picture​
    9·1 answer
  • bailey reads wikis at the beginning of his research project to get his bearings on the topic. he switches to peer-reviewed journ
    10·1 answer
  • What is the answer <br> Answer 1<br> Answer 2<br> Answer 3<br> Answer 4
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!