Answer:

**Answer:**

I am writing Python program.

**string = input("Enter a string: ")**

**print(string.count(' '))**

**Explanation:**

The first statement takes input string from the user.

**input() **is used to read the input from the user.

The next statement uses **count()** function to count the number of times the specified object which is space** ' ' **hereoccurs in the string.

The **print()** function is used to return the number of times the space occurs in the string entered by the user.

**Output:**

Enter a string: How are you doing today?

4

The screenshot of program and its output is attached.

All of the following are strengths of the Internet as a source of information except

Write a program (main method) that advises the user on programming language. So if a user for instance enters "Java" the program might say "awesome" or if the user enters "Ruby" it might say "are you sure?" . Make the program comment on at least 5 programming languages.

Does the following code return a string or a number def of() return 3

In cell B13, create a formula without a function using absolute references that subtracts the values of cells B5 andB7 from cell B6 and then multiples the result by cell B8. please help with excel!! I'm so lost

Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional.

Write a program (main method) that advises the user on programming language. So if a user for instance enters "Java" the program might say "awesome" or if the user enters "Ruby" it might say "are you sure?" . Make the program comment on at least 5 programming languages.

Does the following code return a string or a number def of() return 3

In cell B13, create a formula without a function using absolute references that subtracts the values of cells B5 andB7 from cell B6 and then multiples the result by cell B8. please help with excel!! I'm so lost

Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent single conditional.

Answer:

End to End Delay = 64 micro second

Explanation:

Given

Bandwidth = 125Mbps

A packet = 1000 bytes

Converting bandwidth from Mbps to bit/s

Bandwidth = 125* 10^6 bits/s

Bandwidth = 125,000,000 bit/s

End to End delay is calculated as

Length of Packet ÷ Bandwidth

Length of Packet = 1,000 byte --- convert to bits

Length of Packet = 1000 * 8

Length of Packet = 8,000 bits

So, End to End delay = 8,000/125,000,000

End to End Delay = 0.0000064 seconds --- convert to micro second

End to End Delay = 64 micro second

Ex: If the input is:

Enter the number of integers in your list: 5

Enter the 5 integers:

50

60

140

200

75

Enter the threshold value: 100

the output is:

The integers that are less than or equal to 100 are:

50

60

75

The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. Such functionality is common on sites like Amazon, where a user can filter results. Your code must define and call the following two functions: def get_user_values() def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold) Utilizing functions will help to make your main very clean and intuitive.

**Answer:**

def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):

for value in user_values:

if value < upper_threshold:

print(value)

def get_user_values():

n = int(input())

lst = []

for i in range(n):

lst.append(int(input()))

return lst

if __name__ == '__main__':

userValues = get_user_values()

upperThreshold = int(input())

output_ints_less_than_or_equal_to_threshold(userValues, upperThreshold)

**Explanation:**

(b) Selection-sort on a sequence of size n.

(c) Merge-sort on a sequence of size n.

(d) Radix sort on a sequence of n integer keys, each in the range of[ 0, (n^3) -1]

(e) Find an element in a red-black tree that has n distinct keys.

**Answer:**

Answers explained below

**Explanation:**

(a) Construction of a heap of size n , where the keys are not known in advance.

Worst Case Time complexity - O(n log n)

Two procedures - build heap, heapify

Build_heap takes O(n) time and heapify takes O(log n) time. Every time when an element is inserted into the heap, it calls heapify procedure.

=> O(n log n)

(b) Selection-sort on a sequence of size n.

Worst Case Time complexity - O(n^2)

Selection sort finds smallest element in an array repeatedly. So in every iteration it picks the minimum element by comparing it with the other unsorted elements in the array.

=> O(n^2)

(c) Merge-sort on a sequence of size n.

Worst Case Time complexity - O(n log n)

Merge sort has two parts - divide and conquer. First the array is divided (takes O(1) time) into two halves and recursively each half is sorted (takes O(log n) time). Then both halves are combines (takes O(n) time).

=> O(n log n)

(d) Radix sort on a sequence of n integer keys, each in the range of[ 0 , (n^3) -1]

Worst Case Time complexity - O (n log b (a))

b - base of the number system, a - largest number in that range, n - elements in array

Radix sort is based on the number of digits present in an element of an array A. If it has 'd' digits, then it'll loop d times.

(e) Find an element in a red-black tree that has n distinct keys.

Worst Case Time complexity - O (log n)

Red-black tree is a self-balancing binary tree => The time taken to insert, delete, search an element in this tree will always be with respect to its height.

=> O(log n)

The answer is MS-Word

**Answer:**

Centralized Processing

**Explanation:**

Centralized processing was developed to process all of the data in a single computer, and since the first computers were stand-alone with all input and output devices in the same room, only the largest organizations could afford to use centralized processing.

a. Throwing the exception

b. Completely handling the exception

c. Rethrowing the same exception for the calling environment

d. Partially processing of the exception

**Answer:**

A.

**Explanation:**

because its throwing the exception