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
VikaD [51]
3 years ago
5

Question 5

Computers and Technology
1 answer:
OverLord2011 [107]3 years ago
4 0

Answer:

The answer to this question is given below in the explanation section.

Explanation:

This is a Python function that generates random number between the given range. However, it includes the numbers that are given in the range.

So this function can generate a random number and return a number between 1 and 9 (inclusive 1 and 9).

The function is written below

...........................................................................................................

import random

print(random.randint(1, 9))

<em>#returns a number between 1 and 9 (both included)</em>

.....................................................................................................................

You might be interested in
To insert a new slide, which tab option should you select?
jek_recluse [69]

Ithink that the answer is C)

4 0
2 years ago
Read 2 more answers
Xbrl taxonomy: is the document format used to produce web pages. is the final product (report. is a classification scheme. is a
frosja888 [35]
The answer to this is "is a classification scheme"..hope that helped
3 0
3 years ago
1. How many bits would you need to address a 2M × 32 memory if:
Dominik [7]

Answer:

  1. a) 23       b) 21
  2. a) 43        b) 42
  3. a) 0          b) 0

Explanation:

<u>1) How many bits is needed to address a 2M * 32 memory </u>

2M = 2^1*2^20, while item =32 bit long word

hence ; L = 2^21 ; w = 32

a) when the memory is byte addressable

w = 8;  L = ( 2M * 32 ) / 8 =  2M * 4

hence number of bits =  log2(2M * 4)= log2 ( 2 * 2^20 * 2^2 ) = 23 bits

b) when the memory is word addressable

W = 32 ; L = ( 2M * 32 )/ 32 = 2M

hence the number of bits = log2 ( 2M ) = Log2 (2 * 2^20 ) = 21 bits

<u>2) How many bits are required to address a 4M × 16 main memory</u>

4M = 4^1*4^20 while item = 16 bit long word

hence L ( length ) = 4^21 ; w = 16

a) when the memory is byte addressable

w = 8 ; L = ( 4M * 16 ) / 8 = 4M * 2

hence number of bits = log 2 ( 4M * 2 ) = log 2 ( 4^1*4^20*2^1 ) ≈ 43 bits

b) when the memory is word addressable

w = 16 ; L = ( 4M * 16 ) / 16 = 4M

hence number of bits = log 2 ( 4M ) = log2 ( 4^1*4^20 ) ≈ 42 bits

<u>3) How many bits are required to address a 1M * 8 main memory </u>

1M = 1^1 * 1^20 ,  item = 8

L = 1^21 ; w = 8

a) when the memory is byte addressable

w = 8 ; L = ( 1 M * 8 ) / 8 = 1M

hence number of bits = log 2 ( 1M ) = log2 ( 1^1 * 1^20 ) = 0 bit

b) when memory is word addressable

w = 8 ; L = ( 1 M * 8 ) / 8 = 1M

number of bits = 0

5 0
2 years ago
Help!!
Eduardwww [97]

the undo option is the right answer



8 0
2 years ago
Read 2 more answers
Which of the following would be a valid method call for the following method? public static void showProduct (int num1, double n
Alenkinab [10]

Answer:

showProduct(int,double)

for example: showProduct(10,10.5) is the correct answer even showProduct(10,10.0) is also correct but showProduct(10.0,10.5) or showProduct(10,10) or showProduct(10.0,10) are wrong calls.

Explanation:

The code is

  1.       <em>public static void showProduct (int num1, double num2){</em>
  2. <em>       int product;</em>
  3. <em>       product = num1*(int)num2;</em>
  4. <em>       System.out.println("The product is "+product);</em>
  5. <em>       }</em>

showProduct is function which asks for two arguments whenever it is called, first one is integer and second one is of type double which is nothing but decimal point numbers. Generally, in programming languages, 10 is treated as integer but 10.0 is treated as decimal point number, but in real life they are same.

If showProduct( 10,10.0) is called the output will be 'The product is 100'.

Strange fact is that, if you enter showProduct(10,10.5) the output will remain same as 'The product is 100'. This happens because in the 3rd line of code,which is <em>product=num1*(int)num2</em>, (int) is placed before num2 which makes num2 as of type integer, which means whatever the value of num2 two is given, numbers after decimal is erased and only the integer part is used there.

This is necessary in JAVA and many other programming languages as you <u>cannot</u><u> multiply two different datatypes</u> (here one is int and another is double). Either both of them should be of type int or both should be of type double.

3 0
2 years ago
Other questions:
  • Compute the bitwise XOR between 10010100 and 11101010.
    12·1 answer
  • What is a geotag?
    10·1 answer
  • Advantages and disadvantages of internet
    11·2 answers
  • Which of the following lines of code is syntactically correct?
    14·1 answer
  • Special words are those words that start and end with the same letter. [14]
    12·1 answer
  • What is the result of executing the following code? You can assume the code compiles and runs. #include using namespace std; voi
    6·1 answer
  • Write a program that asks a user to enter a date in month day year format (for example 10 12 2016) and displays the day of the w
    5·1 answer
  • Write a C program to calculate salary raise for employees. If salary is between$ 0 &lt; $ 30000 the rate is 7.0%If salary is bet
    8·1 answer
  • Determine what is printed by the following code.
    8·1 answer
  • When designers follow accepted standards and protocols, which of the four basic characteristics of network architecture is achie
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!