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
vova2212 [387]
2 years ago
8

8.10.8 guess the passcode codehs

Computers and Technology
1 answer:
harkovskaia [24]2 years ago
7 0

Answer:

sorry its late

Explanation:

/*

* Write a program that guesses every possible 4 digit passcode

* combinations until the correct passcode is guessed.

*

* The passcode is randomly generated and stored in the variable

* secretPasscode.

*

* Print out how many guesses it took to guess the correct passcode.

*/

function start() {

   var correctCode = generateRandomPasscode();

   var b = 0;

   while(true){

       var guessCode = generateRandomPasscode();

       b++;

       if(isCorrect(guessCode, correctCode)){

           println("The correct passcode was " + guessCode);

           println("It took you " + b + " tries to guess it");

       break;

       }

   }

}

function isCorrect(guessCode, correctCode) {

   return guessCode == correctCode;

}

function generateRandomPasscode() {

   var randomPasscode = "";

   for(var i = 0; i < 4; i++) {

       var randomDigit = Randomizer.nextInt(0, 9);

       randomPasscode += randomDigit;

   }

return randomPasscode;

}

You might be interested in
Suppose a program contains 500 million instructions to execute on a processor running on 2.2 GHz. Half of the instructions takes
Anit [1.1K]

Answer:

1.48 s

Explanation:

Number of instructions = 500 million = 500 * 10⁶

clock rate = 1 / 2.2 GHz = 1 / (2.2 * 10⁹ Hz) = 0.4545 * 10⁻⁹ s

We need to compute the clocks per instruction (CPI)

The CPI = summation of (value * frequency)

CPI = (50% * 3 clock cycles) + (50% * 10 clock cycles)

CPI = (0.5 * 3) + (0.5 * 10) = 1.5 + 5 = 6.5

Execution time = number of instructions * CPI * clock rate

Execution time = 500 * 10⁶ * 6.5 * 0.4545 * 10⁻⁹ =1.48 s

5 0
3 years ago
1. I am a rectangle in a flowchart. What do I represent?
Strike441 [17]

Answer:

Down;

1.Parallelogram

3. Start

Across;

1. process

2.diamond

4. Flowchart

5. Arrow

Explanation:

3 0
3 years ago
Which of these describes, in increasing order, the file sizes of the same image in different formats? Group of answer choices
Nesterboy [21]

Answer:

If left being the shortest file size and right being the biggest file size...

It is JPEG, PNG, TIFF.

Explanation:

TIFF is used primarily for editing photos or for uncompressed high quality images for things like 4K textures. The file size will be bigger since generally it is uncompressed.

PNG reserves the maximum quality of the image and can not be compressed. (It can be compressed but the results are very minimal).

JPEG allows for the user to decide the compression and quality of the image. JPEG also doesn't hold transparency data, thus making JPEG generally use less space than PNG and definitely more than TIFF.  

8 0
3 years ago
What sorts of items can be
Bumek [7]

Answer:

A router connects multiple computers to the Internet through a single connection. The router manages the flow of data, delivering the right information to each computer on the network. Routers may also be used to connect multiple networks. A managed router is a router that is owned and managed by a third-party.

6 0
4 years ago
If the transmitting device would like for the receiving device to push currently buffered data to the application on the receivi
Andreyy89

Answer:

The right approach will be "PSH".

Explanation:

  • The PSH flag seems to be an acceptable solution through TCP which always encourages the submit implementation to immediately transfer data but only whenever the buffer isn't complete.
  • The implementation helps to formulate this same flag towards true for something like the connection, as well as TCP will instantly begin transmitting the relevant information.
3 0
3 years ago
Other questions:
  • Which term describes the distinct number of colors a graphic contains? (1 point)?
    10·1 answer
  • A(n application system is the master controller for all the activities that take place within a computer system. _______________
    15·1 answer
  • Which best explains what Grace did with the revisions?
    7·1 answer
  • A bagel shop has two locations, one campus location and one downtown location. A random sample of 40 customers at the campus loc
    13·1 answer
  • Consider an unpipelined or single-stage processor design like the one discussed in slide 6 of lecture 17. At the start of a cycl
    10·1 answer
  • Which two of the following skills are important for a meteorologist
    12·1 answer
  • A test's directions often clarify any questions a student might have about answering a response question.
    5·2 answers
  • Check image dont answer if you dont know please
    13·1 answer
  • 4. Each mobile device described in this chapter requires that the user have a/an ____________________ associated with services o
    5·1 answer
  • Identify the two top benefits of using angel investors to start a business.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!