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
OLga [1]
3 years ago
13

What does the following code segment do?

Computers and Technology
1 answer:
vampirchik [111]3 years ago
4 0

Answer:

Hi!

var count =0;  <em>//initialize count.</em>

var sevens =0 ;  <em>//initialize sevens.</em>

while(count<100)  <em>// loops while count is minor than 100. *counts never add 1 at the final of the loop, so this while is always true. </em>

{

<em>//Math.floor(x) round to the max Integer a number. Example : 45.90 -> 46.</em>

<em>//Math.random() returns a number between [0, 1).</em>

var roll1 = Math.floor(Math.random()*6+1);   <em>//Gets a integer using Math.random(), adds 1, and round it withMath.floor() then saves in roll1.</em>

var roll2 = Math.floor(Math.random()*6+1);  <em>//Gets a integer using Math.random(), adds 1, and round it withMath.floor() then saves in roll2.</em>

if(roll1 + roll2 == 7) <em> //If the sum of roll1 and roll2 is 7 adds 1 to sevens.</em>

sevens = sevens +1;  

}

<em>//*count is not incremented, so while(count<100) -> always true.</em>

You might be interested in
6. Suppose you’re assisting with a cable installation using fiber-optic cabling that will support Gigabit Ethernet. You’re appro
Natalka [10]

Answer:

You will use Single Mode Fiber (SMF).

Explanation:

SMF is the best option in this case since we will be installing segments of up to 4000m. SMF is known for its capability to maintain a high-quality signal and practically zero degradation across long distances.

5 0
4 years ago
Do you guys know the addition and subtraction of binary numbersi need help in that
Gala2k [10]

Answer:

The process of adding binary numbers is the same as the process adding decimal numbers which are the normal base 10 numbers with the difference being that in decimal numbers there are digits 1 to 9 and in binary numbers, there are only digits 1 and 0

So when we add binary numbers, we havr;

0 + 0 = 0

1 + 0 = 1

0 + 1 = 1

1 + 1 = 10

Why 1 + 1 = 10 is because, there are no 2s in binary number system, just like when we get from 0 to 9 in a decimal system we start again at 10

For binary subtraction, we have the following;

0 - 0 = 0

1 - 0 = 1

1  - 1 = 0

10 - 1 = 1 (from 1 + 1 = 10)

For example 1100₂ - 1010₂ = 0010₂

As shown below

Borrow 1

,     ↓

 1, 1 ¹0 0

<u>  1, 0 1 0</u>

, 0  0  1  0

The addition and subtraction of the binary number system are similar to that of the decimal number system. The only difference is that the decimal number system consists the digit from 0-9 and their base is 10 whereas the binary number system consists only two digits (0 and 1) which make their operation easier

Explanation:

4 0
4 years ago
An administrator needs to examine ftp commands being passed to a server. what port should the administrator be monitoring?
Hitman42 [59]
Port 21

The server-PI (Server Interpreter) is the process that listens to port 21 on the FTP server. The Server Interpreter has control over server-DTP (Server Data Transfer Process), the method used for data transfer connection. The server-PI must be in a position to respond to standard FTP commands like USER and PASS and several other commands.

 

 



7 0
3 years ago
A camera scan of grieving Columbine family members and friends_
Reika [66]

Answer:

is an invasion of privacy and therefore not newsworthy

Explanation:

8 0
3 years ago
a cisc-style instruction set has a large number of high-level instructions that perform highly complex operations in a single st
NikAS [45]

Both desktop and laptop computers employ CISC (complex instruction set computer) CPUs. Small programs are on CISC machines. It requires a lot of time to execute because it contains a great deal of compound instructions.

<h3>What do you mean by CISC?</h3>

Both desktop and laptop computers employ CISC (complex instruction set computer) CPUs. More complex instructions can be processed by this kind of CPU. For instance, a single instruction might load two values, add them, and then store the outcome back in memory.

A computer that, in contrast to a computer with a limited instruction set, allows individual instructions to perform numerous processes and need a large number of cycles to complete (RISC).

Small programs are on CISC machines. It requires a lot of time to execute because it contains a great deal of compound instructions. In this case, a single set of instructions is safeguarded in stages; each instruction set contains more than 300 distinct instructions. On average, instructions take two to ten machine cycles to complete.

To learn more about CISC refer to:

brainly.com/question/13266932

#SPJ4

8 0
2 years ago
Other questions:
  • How can i complain a rude comment
    7·1 answer
  • What language(s) must be used to display a bare-minimum web page?
    9·2 answers
  • How many worksheets display in the Excel window when you create a new blank workbook?
    10·2 answers
  • (03.05 LC) Match the term with its description. (4 points) Column A 1. Acid : Acid 2. Alkaline : Alkaline 3. pH : pH 4. Ion : Io
    8·1 answer
  • What do you need to know when buying screws<br>​
    12·2 answers
  • What output is generated by this for loop?
    6·1 answer
  • Por favor definir que es un pseudocódigo y que es un diagrama de flujo.
    13·2 answers
  • What are your thoughts on the last nintendo direct
    5·2 answers
  • What is generation of computer ?​
    7·2 answers
  • What are some other possible causes of an overheating laptop
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!