Answer:
In Python:
#1
service = input("Enter desired auto service: ")
print("You entered: "+service)
#2
if service.lower() == "oil change":
print("Cost of oil change: $35")
elif service.lower() == "car wash":
print("Cost of car wash: $7")
elif service.lower() == "tire rotation":
print("Cost of tire rotation: $19")
else:
print("Invalid Service")
Explanation:
First, we prompt the user for the auto service
service = input("Enter desired auto service: ")
Next, we print the service entered
print("You entered: "+service)
Next, we check if the service entered is available (irrespective of the sentence case used for input). If yes, the cost of the service is printed.
This is achieved using the following if conditions
For Oil Change
if service.lower() == "oil change":
print("Cost of oil change: $35")
For Car wash
elif service.lower() == "car wash":
print("Cost of car wash: $7")
For Tire rotation
elif service.lower() == "tire rotation":
print("Cost of tire rotation: $19")
Any service different from the above three, is invalid
else:
print("Invalid Service")
Approximately how many numeric IP addresses are possible with IPv4?
4 billon
Answer:
4,294,967,296 (~4.3B)
Explanation:
IPv4 uses 32-bits for representing addresses, thus you can have 2^32 total combinations.
let m be a positive integer with n bit binary representation an-1 an-2 ... a1a0 with an-1=1 what are the smallest and largest values that m could have
Answer:
Explanation:
From the given information:
[tex]a_{n-1} , a_{n-2}...a_o[/tex] in binary is:
[tex]a_{n-1}\times 2^{n-1} + a_{n-2}}\times 2^{n-2}+ ...+a_o[/tex]
So, the largest number posses all [tex]a_{n-1} , a_{n-2}...a_o[/tex] nonzero, however, the smallest number has [tex]a_{n-2} , a_{n-3}...a_o[/tex] all zero.
∴
The largest = 11111. . .1 in n times and the smallest = 1000. . .0 in n -1 times
i.e.
[tex](11111111...1)_2 = ( 1 \times 2^{n-1} + 1\times 2^{n-2} + ... + 1 )_{10}[/tex]
[tex]= \dfrac{1(2^n-1)}{2-1}[/tex]
[tex]\mathbf{=2^n -1}[/tex]
[tex](1000...0)_2 = (1 \times 2^{n-1} + 0 \times 2^{n-2} + 0 \times 2^{n-3} + ... + 0)_{10}[/tex]
[tex]\mathbf {= 2 ^{n-1}}[/tex]
Hence, the smallest value is [tex]\mathbf{2^{n-1}}[/tex] and the largest value is [tex]\mathbf{2^{n}-1}[/tex]
A structure that organizes data in a list that is commonly 1-dimensional or 2-
dimensional
Linear Section
Constant
No answertet provided
It intro technology
Answer:
An array.
Explanation:
An array can be defined as a structure that organizes data in a list that is commonly 1-dimensional or 2-dimensional.
Simply stated, an array refers to a set of memory locations (data structure) that comprises of a group of elements with each memory location sharing the same name. Therefore, the elements contained in array are all of the same data type e.g strings or integers.
Basically, in computer programming, arrays are typically used by software developers to organize data, in order to search or sort them.
Binary search is an efficient algorithm used to find an item from a sorted list of items by using the run-time complexity of Ο(log n), where n is total number of elements. Binary search applies the principles of divide and conquer.
In order to do a binary search on an array, the array must first be sorted in an ascending order.
Hence, array elements are mainly stored in contiguous memory locations on computer.