Answer:
The answer is below
Explanation:
Since palindrome is a string that reads the same from the left and from the right. For example, mom and tacocat are palindromes, as are any single character strings.
Therefore, given that the input word is: 'Redivider'
Hence, the Palindromic substrings are ['r', 'e', 'd', 'i', 'v', 'i', 'd', 'e', 'r', 'ivi', 'divid', 'edivide', 'redivider']. There are 13 palindromic substrings.
What's the value of this Python expression? ((10 >= 5*2) and (10 <= 5*2))
Answer:
1 (true)
Explanation:
10 == 10 is valid=> 10 >= 10 is valid => 10 >=(5*2) is valid
10 == 10 is valid=> 10 <= 10 is valid => 10 <=(5*2) is valid
=> ((10 >= 5*2) and (10 <= 5*2)) is valid => Return 1 or True
A service provider recently upgraded one of the storage clusters that houses non-confidential data for clients. The storage provider wants the hard drives back in working condition. Which of the following is the BEST method for sanitizing the data given the circumstances?
a. Hashing
b. Wiping
c. Purging
d. Degaussing
Answer:
c. Purging
Explanation:
Based on the information provided it can be said that the best method for sanitizing the data would be Purging. This is a process that permanently erases the data from a specific storage unit. Doing so prevents data from being recovered by an expert and also frees up storage and memory space to be used for other information. Since it is very inexpensive and provides the best overall results this would be the best option in this scenario.
Identify the spreadsheet tool that is used to determine the optimal solution to a problem with multiple constraints.
a. Excel scenario manager
b. Excel Solver
c. Excel filter
d. Excel chart
Answer:
Excel Solver
Explanation:
Would these statements cause an error? Why or why not? int year = 2019; int yearNext = 2020; int & ref = year; & ref = yearNext;
Answer: YES
Explanation:
int year=2019;
int yearNext=2020;
int &ref=year;
&ref=yearNext; {This line leads to error as references cannot be reassigned}
(//compilation error: lvalue required as left operand of assignment
) lvalue(&ref) is not something which can be assigned.
To get this better, here are the difference between pointers and reference variables
Pointers
Pointers can be incremented
Array can be formed with pointers
Pointers can be reassigned
Pointer can be declared as void
Reference variable
References cannot be incremented
Array cannot be formed with references
References cannot be reassigned as references shares the address of the variable its assigned
References can never be void
Driving is expensive. Write a program with a car's miles/gallon (as float), gas dollars/gallon (as float), the number of miles to drive (as int) as input, compute the cost for the trip, and output the cost for the trip. Miles/gallon, dollars/gallon, and cost are to be printed using two decimal places. Note: if milespergallon, dollarspergallon, milestodrive, and trip_cost are the variables in the program then the output can be achieved using the print statement: print('Cost to drive {:d} miles at {:f} mpg at $ {:.2f}/gallon is: $ {:.2f}'.format(milestodrive, milespergallon, dollarspergallon, trip_cost)) Ex: If the input is: 21.34 3.15
Answer:
milespergallon = float(input())
dollarspergallon = float(input())
milestodrive = int(input())
trip_cost = milestodrive / milespergallon * dollarspergallon
print('Cost to drive {:d} miles at {:f} mpg at $ {:.2f}/gallon is: $ {:.2f}'.format(milestodrive, milespergallon, dollarspergallon, trip_cost))
Explanation:
Get the inputs from the user for milespergallon, dollarspergallon and milestodrive
Calculate the trip_cost, divide the milestodrive by milespergallon to get the amount of gallons used. Then, multiply the result by dollarspergallon.
Print the result as requested in the question
Answer:
def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):
gallon_used = driven_miles / miles_per_gallon
cost = gallon_used * dollars_per_gallon
return cost
miles_per_gallon = float(input(""))
dollars_per_gallon = float(input(""))
cost1 = driving_cost(10, miles_per_gallon, dollars_per_gallon)
cost2 = driving_cost(50, miles_per_gallon, dollars_per_gallon)
cost3 = driving_cost(400, miles_per_gallon, dollars_per_gallon)
print("%.2f" % cost1)
print("%.2f" % cost2)
print("%.2f" % cost3)
Explanation:
I have tried looking for this answer everywhere, and I could not find the answer
I have a Windows 10 Laptop, with a 12GB RAM Card, okay? I also have my 1TB Disk Partitioned so that I have 3 Disks. 2 of them are my primary, both of those are 450GB apiece. The last one ([tex]Z:[/tex]) I named "RAM" and set that one to 100GB.
How do I turn the drive [tex]Z:[/tex] into strictly RAM?
I already did the Virtual Memory part of it, but I was wondering if I can make it strictly RAM so the system uses drive [tex]Z:[/tex] before using the RAM disk? If it is not possible, I'm sorry.
If my computer has 4 gigabytes of ram memory then I have 4e+9 bytes of memory. I think-
Answer: That isn't a software problem, its a hardware problem. There is a difference between 12gb of ram versus 100 gb of HDD. Ram is temporary storage, you can not turn SSD or HDD storage into RAM. If you are a gamer, STEER AWAY FROM LAPTOPS, DO NOT BUY A GAMING LAPTOP. Either buy a DESKTOP (or build) or a console. They give more performance for the price and they are easily upgradable. Not many people can open up a laptop and put in more RAM because the hardware is incredibly small.
Let's revisit our lucky_number function. We want to change it, so that instead of printing the message, it returns the message. This way, the calling line can print the message, or do something else with it if needed. Fill in the blanks to complete the code to make it work.
def lucky_number(name):
number = len(name) * 9
___ = "Hello " + name + ". Your lucky number is " + str(number)
___
print(lucky_number("Kay"))
print(lucky_number("Cameron"))
Answer:
Replace the first blank with:
message = "Hello " + name + ". Your lucky number is " + str(number)
Replace the second blank with:
return message
Explanation:
The first blank needs to be filled with a variable; we can make use of any variable name as long as it follows the variable naming convention.
Having said that, I decided to make use of variable name "message", without the quotes
The next blank is meant to return the variable on the previous line;
Since the variable that was used is message, the next blank will be "return message", without the quotes
In other to make the function lucky_number return the message rather than print, we use the return keyword.
def lucky_number(name):
number = len(name) * 9
message = "Hello " + name + ". Your lucky number is " + str(number)
return message
In other to return a variable or expression in a defined function such as the lucky_number function defined above, all we have to do is use the return keyword with the message.
When we use :
print(message) : the output when the lucky_number function is called is that, content of the message variable is printed or displayed. However, return message would return message back to the caller making it useful in other parts of our program.The returned value could also be printed using the statement :
print(lucky_number(name)) : This statement prints the content of the returned message variable.
Learn more : https://brainly.com/question/17027551
Your boss wants you to start making your own Ethernet cables to save the company money. What type of connectors will you need to order to make them?
Answer:
Bulk Ethernet Cable - Category 5e or CAT5e
Bulk RJ45 Crimpable Connectors for CAT-5e
Explanation:
Write a program that displays the values in the list numbers in ascendingorder sorted by the sum of their digits.
Answer:
Here is the Python program.
def DigitList(number):
return sum(map(int, str(number)))
list = [18, 23, 35, 43, 51]
ascendList = sorted(list, key = DigitList)
print(ascendList)
Explanation:
The method DigitList() takes value of numbers of the list as parameter. So this parameter is basically the element of the list. return sum(map(int, str(number))) statement in the DigitList() method consists of three methods i.e. str(), map() and sum(). First the str() method converts each element of the list to string. Then the map() function is used which converts every element of list to another list. That list will now contain digits as its elements. In short each number is converted to the string by str() and then the digit characters of each string number is mapped to integers. Now these digits are passed to sum() function which returns the sum. For example we have two numbers 12 and 31 in the list so each digit is 1 2 and 3 1 are added to get the sum 3 and 4. So now the list would have 3 4 as elements.
Now list = [18, 23, 35, 43, 51] is a list of 5 numbers. ascendList = sorted(list, key = DigitList) statement has a sorted() method which takes two arguments i.e. the above list and a key which is equal to the DigitList which means that the list is sorted out using key=DigitList. DigitList simply converts each number of list to a another list with its digits as elements and then returns the sum of the digits. Now using DigitList method as key the element of the list = [18, 23, 35, 43, 51] are sorted using sorted() method. print(ascendList) statement prints the resultant list with values in the list in ascending order sorted by the sum of their digits.
So for the above list [18, 23, 35, 43, 51] the sum of each number is 9 ,5, 8, 7, 6 and then list is sorted according to the sum values in ascending order. So 5 is the smallest, then comes 6, 7, 8 and 9. So 5 is the sum of the number 23, 6 is the sum of 51, 7 is the sum of 43, 8 is the sum of 35 and 9 is the sum of 18. So now after sorting these numbers according to their sum the output list is:
[23, 51, 43, 35, 18]
A customer contacts the help disk stating a laptop does not remain charged for more than 30 minutes and will not charge more than 15%. Which of the following components are the MOST likely causes the issue? (Select three.) A. LCD power inverter B. AC adapter C. Battery D. Processor E. VGA card F. Motherboard G. Backlit keyboard H. Wireless antenna
Answer:
A. LCD power inverter
B. AC adapter
C. Battery
ZigBee is an 802.15.4 specification intended to be simpler to implement, and to operate at lower data rates over unlicensed frequency bands.
a. True
b. False
Answer:
True
Explanation:
Solution
ZigBee uses unlicensed frequency bands but operate at slower speed or data rates.
ZigBee: This communication is particular designed for control and sensor networks on IEEE 802.15.4 requirement for wireless personal area networks (WPANs), and it is a outcome from Zigbee alliance.
This communication level defines physical and (MAC) which is refereed to as the Media Access Control layers to manage many devices at low-data rates.
An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours, plus any overtime pay. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. Write a program that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay.
Answer:
Assuming this is Python, I would do something like the following:
Explanation:
hourWage= float(input ("What is your hourly wage?: "))
regularHours= float(input ("How many regular hours did you work this week?: "))
overtimeHours= float(input ("How many overtime hours did you have this week?: "))
overtimeWage= (1.5*hourWage)
totalWeeklyPay= (hourWage*regularHours)+(overtimeHours*overtimeWage)
print= ("Your total weekly pay is: " ,totalWeeklyPay)
I hope this works!
Following are the program to calculate weeklyPay value:
Program Explanation:
Defining a variable "Wage, Hour, Hours" that uses the float with the input method to take float value from the user-end.After input value, a "weeklyPay" is declared that calculates the value by the formula.After calculating the value a print method is declared that prints its calculated value.Program:
Wage = float(input("Enter hourly wage: "))#defining a variable Wage that inputs float value
Hour = float(input("Enter total number of regular hours: "))#defining a variable Hour that inputs float value
Hours = float(input("Enter overtime hours: "))#defining a variable Hours that inputs float value
weeklyPay = (Wage*Hour) + (1.5*Wage*Hours)#defining a variable weeklyPay that calculates the values
print (weeklyPay)#defining a print method that prints weeklyPay value
Output:
Please find the attached file.
Learn more:
brainly.com/question/8020777
Now, search for similar information on at least two other web sites, including Mayo Clinic (mayoclinic.org) and WebMD (webmd). Is the information provided by these sites consistent with what you found on the CDC web site?
Answer:
No
Explanation:
The other websites provide very detailed information, when you search the same information that is mentioned at CDC website. The information related to causes and symptoms of brain injuries is similar on both the websites. The reliability of information provided on other websites is questioned. These websites provide a lot of information and it is sometimes time consuming to find the relevant information.
A virus that attaches to an executable program can do anything that the program is permitted to do.
a) true
b) false
Answer:
a) True
Explanation:
A macro virus infects executable portions of code. A virus that attaches to an executable program can do anything the program is permitted to.
Most use an Email for spreading macro viruses, which is a common method and is rather easy. Although, more advanced softwares trick people into giving personal information.
Bernard has a visual disability. Which type of assistive technology would he use to access print on the chalkboard or overhead screen?
Answer:
a tactile input device
Explanation:
Based on the scenario being described it can be said that the best assistive technology for Bernard would be a tactile input device. Such a device would allow Bernard to physically interact with the print on the chalkboard or overhead screen from the device itself without having to actually get close to the chalkboard or screen. Thus allowing him to view its content from the palm of his hand.
Convert +41.50 in a IEEE 754 single precision format.
Convert - 72.125 in a IEEE 754 double precision format.
+41.50 = 0 10000100 01001100000000000000000 [single precision]
-72.125 = 1 10000000101 0010000010000000000000000000000000000000000000000000 [double precision]
Explanation:(I) +41.50 using single precision
Follow the following steps:
(a) Single precision has 32 bits in total and is divided into three groups: sign (has 1 bit), an exponent (has 8 bits) and a mantissa (also called fraction, has 23 bits)
(b) Divide the number (41.50) into its whole and decimal parts:
Whole = 41
Decimal = 0.50
(c) Convert the whole part to binary:
2 | 41
2 | 20 r 1
2 | 10 r 0
2 | 5 r 0
2 | 2 r 1
2 | 1 r 0
| 0 r 1
Reading upwards gives 41 = 101001₂
(d) Convert the decimal part to binary:
0.50 x 2 = 1.0 = 1 [number in front of decimal]
0.0 x 2 = 0.0 = 0 [number in front of decimal]
Reading downwards gives 0.5 = 10₂
(e) Put the two parts together as follows;
101001.10₂
(f) Convert the result in (e) to its base 2 scientific notation:
Move the decimal to just before the leftmost bit as follows;
1.0100110
In doing so, we have moved over 5 numbers to the left. Therefore, the exponent is 5. Moving to the left gives a positive exponent while moving to the right gives a negative exponent.
Altogether we have;
1.0100110 x 2⁵
(g) Determine the sign bit of the number and display in binary: Since the number +41.50 is positive, the sign bit is 0.
(h) Determine the exponent bits.
Since this is a single precision conversion, the exponent bias is 127.
To get the exponent we add the exponent value from (e) to the exponent bias and get;
5 + 127 = 132
(i) Convert the exponent to binary:
2 | 132
2 | 66 r 0
2 | 33 r 0
2 | 16 r 1
2 | 8 r 0
2 | 4 r 0
2 | 2 r 0
2 | 1 r 0
| 0 r 1
Reading upwards gives 132 = 10000100₂
(j) Determine the mantissa bits:
The mantissa is the rest of the number after the decimal of the base 2 scientific notation found in (f) above.
0100110 from 1.0100110 x 2⁵ [Just remove the leftmost 1 and the decimal point]
(k) Combine the three parts: sign bit (1 bit), exponent bits (8 bits) and mantissa bits (23 bits)
sign bit = 0 [1 bit]
exponent bits = 10000100 [8 bits]
mantissa bits = 0100110 [7 out of 23 bits]
Then fill out the remaining part of the mantissa with zeros to make it 23 bits.
mantissa bits = 01001100000000000000000
Putting all together we have
0 10000100 01001100000000000000000 as +41.50 in a IEEE 754 single precision format.
(II) -72.125 using double precision
Follow the following steps:
(a) Double precision has 32 bits in total and is divided into three groups: sign (has 1 bit), an exponent (has 11 bits) and a mantissa (also called fraction, has 52 bits)
(b) Divide the number (72.125) into its whole and decimal parts:
Whole = 72
Decimal = 0.125
(c) Convert the whole part to binary:
2 | 72
2 | 36 r 0
2 | 18 r 0
2 | 9 r 0
2 | 4 r 1
2 | 2 r 0
2 | 1 r 0
| 0 r 1
Reading upwards gives 72 = 1001000₂
(d) Convert the decimal part to binary:
0.125 x 2 = 0.25 = 0 [number in front of decimal]
0.25 x 2 = 0.50 = 0 [number in front of decimal]
0.50 x 2 = 1.00 = 1 [number in front of decimal]
0.00 x 2 = 0.00 = 0 [number in front of decimal]
Reading downwards gives 0.125 = 0010₂
(e) Put the two parts together as follows;
1001000.0010₂
(f) Convert the result in (e) to its base 2 scientific notation:
Move the decimal to just before the leftmost bit as follows;
1.0010000010
In doing so, we have moved over 6 numbers to the left. Therefore, the exponent is 6. Moving to the left gives a positive exponent while moving to the right gives a negative exponent.
Altogether we have;
1.0010000010 x 2⁶
(g) Determine the sign bit of the number and display in binary: Since the number -72.125 is negative, the sign bit is 1.
(h) Determine the exponent bits.
Since this is a double precision conversion, the exponent bias is 1023.
To get the exponent we add the exponent value from (e) to the exponent bias and get;
6 + 1023 = 1029
(i) Convert the exponent to binary:
2 | 1029
2 | 514 r 1
2 | 257 r 0
2 | 128 r 1
2 | 64 r 0
2 | 32 r 0
2 | 16 r 0
2 | 8 r 0
2 | 4 r 0
2 | 2 r 0
2 | 1 r 0
| 0 r 1
Reading upwards gives 1029 = 10000000101₂
(j) Determine the mantissa bits:
The mantissa is the rest of the number after the decimal of the base 2 scientific notation found in (f) above.
0010000010 from 1.0010000010 x 2⁶ [Just remove the leftmost 1 and the decimal point]
(k) Combine the three parts: sign bit (1 bit), exponent bits (11 bits) and mantissa bits (52 bits)
sign bit = 1 [1 bit]
exponent bits = 10000000101 [11 bits]
mantissa bits = 0010000010 [10 out of 52 bits]
Then fill out the remaining part of the mantissa with zeros to make it 52 bits.
mantissa bits = 0010000010000000000000000000000000000000000000000000
Putting all together we have
1 10000000101 0010000010000000000000000000000000000000000000000000 as -72.125 in a IEEE 754 double precision format.
1. A systems administrator has installed a new UTM that is capable of inspecting SSL/TLS traffic for malicious payloads. All inbound network traffic coming from the internet and terminating on the company's secure web servers must be inspected. Which of the following configurations would best support this requirement?
A. The web servers’ CA full certificate chain must be installed on the UTM
B. The UTM’s certificate pair must be installed on the web servers
C. The web servers’ privet certificate must be installed on the UTM
D. The UTM and web server must use the same certificate authority
2. A company has migrated to two-factor authentication for accessing the corporate network, VPN, and SSO. Several legacy applications cannot support multifactor authentication and must continue to use usernames and passwords. Which of the following should be implemented to ensure the legacy applications are as secure as possible while ensuring functionality?
A. Privileged accounts
B. Password reuse restrictions
C. Password complexity requirements
D. Password history
E. Password recovery
F. Account disablement
Answer:
1 Option(A) is the correct answer .
2 Option(A) and Option(B) is the correct answer .
Explanation:
1
In this the administrator of the system built the new UTM capable of reviewing the SSL / TLS flow for the suspicious payloads it see that the both inbound traffic flow originating from both the web and stopping on protected application server of the business .The full CA certificate sequence of web servers should be built on a UTM configuration will solve the problem .
2
The Two-factor authentication is used for the security purpose .In this technique only authorized people will accessing the data the unauthorized people is not accessing the data.
The main objective of two-factor authentication it provide the better security then the other security .The Two-factor authentication is ensuring the security of Privileged accounts as well as the reuse restrictions of the passwordDo transformers have life insurance or car insurance? If you chose life insurance, are they even alive?
Answer:
Car insurance
Explanation:
they are machines with ai
CHALLENGE ACTIVITY |
6.2.2: Function call in expression.
Assign to maxSum the max of (numa, numB) PLUS the max of (numy, numz). Use just one statement. Hint: Call FindMax() twice in an expression.
1. #include
2. using namespace std; passed
3.
4. double FindMax(double numi,
5. double num2) { double maxVal; emos
6.
7. // Note: if-else statements need not be understood to complete this activity
8. if (numi > num2) { // if num1 is greater than num2,
9. maxVal = num1; // then num1 is the maxVal.
10.
11. All tests passed else
12. {maxVal = num2; // Otherwise, // num2 is the maxval.
13.
14.
15. return maxVal;
16. }
17.
18. int main() {
19. double numA;
20. double numB;
21. double numY;
22. double numz;
Answer:
maxSum = FindMax(numA, numB) + FindMax(numY, numZ);
The maxSum is a double type variable which is assigned the maximum of the two variables numA numB PLUS the maximum of the two variables numY numZ using FindMax function. The FindMax() method is called twice in this statement one time to find the maximum of numA and numB and one time to find the maximum of numY numZ. When the FindMax() method is called by passing numA and numB as parameters to this method, then method finds if the value of numA is greater than that of numB or vice versa. When the FindMax() method is called by passing numY and numZ as parameters to this method, then method finds if the value of numY is greater than that of numZ or vice versa. The PLUS sign between the two method calls means that the resultant values returned by the FindMax() for both the calls are added and the result of addition is assigned to maxSum.
Explanation:
This is where the statement will fit in the program.
#include <iostream>
using namespace std;
double FindMax(double num1, double num2) {
double maxVal = 0.0;
if (num1 > num2) { // if num1 is greater than num2,
maxVal = num1; // then num1 is the maxVal. }
else {
maxVal = num2; // num2 is the maxVal. }
return maxVal; }
int main() {
double numA;
double numB;
double numY;
double numZ;
double maxSum = 0.0;
maxSum = FindMax(numA, numB) + FindMax(numY, numZ);
cout << "maxSum is: " << maxSum << endl; }
Lets take an example to explain this. Lets assign values to the variables.
numA = 6.0
numB = 3.0
numY = 4.0
numZ = 9.0
maxSum =0.0
maxSum = FindMax(numA, numB) + FindMax(numY, numZ);
FindMax(numA,numB) method call checks if numA>numB or numB>numA and returns the maximum of the two. Here numA>numB because 6.0 is greater than 3.0. So the method returns numA i.e. 6.0
FindMax(numY, numZ) method call checks if numY>numZ or numZ>numY and returns the maximum of the two. Here numZ>numY because 9.0 is greater than 4.0. So the method returns numZ i.e. 9.0
FindMax(numA, numB) + FindMax(numY, numZ) this adds the two values returned by the method FindMax for each call.
FindMax returned maxVal from numA and numB values which is numA i.e. 6.0.
FindMax returned maxVal from numY and numZ values which is numZ i.e. 9.0.
Adding these two values 9.0 + 6.0 = 15
So the complete statement FindMax(numA, numB) + FindMax(numY, numZ) gives 15.0 as a result.
This result is assigned to maxSum. Hence
maxSum = 15
To see the output on the screen you can use the print statement as:
cout<<maxSum;
This will display 15
The code for function calling is coded below.
To assign the maximum sum of `(numA, numB)` plus the maximum of `(numY, numZ)` to the variable `maxSum` using just one statement, you can call the `FindMax()` function twice in an expression.
Here's the code:
maxSum = FindMax(numA, numB) + FindMax(numY, numZ);
This code calls the `FindMax()` function twice, once with the parameters `(numA, numB)` and again with the parameters `(numY, numZ)`.
It calculates the maximum of each pair of numbers using the `FindMax()` function and then adds the two maximum values together. The result is assigned to the `maxSum` variable.
Learn more about Function call here:
https://brainly.com/question/31798439
#SPJ6
Assume 151 and 214 are signed 8-bit decimal integers stored in two’s complement format. Calculate 151 + 214 using saturating arithmetic. The result should be written in decimal. Show your work
Answer:
-128
Explanation:
[tex](151)_{10}[/tex]
We have to convert this decimal number into the binary number
[tex](10010111) _{2}[/tex]
Performing the 2's complement number so we have to subtract 1 from this
[tex]10010111 -1 \\=(10010110)_{2}[/tex]
Now to getting the original number we have to complement the previous number it means convert 1 ->0 and 0 -> 1
[tex](10010110)_{2} ---->(01101001)_{2}[/tex]
The previous number is converted binary to decimal we get ,
[tex](01101001)_{2}=(105) _{10}[/tex]
-105(According to the rule of 2's complement )
Similarly same process will apply on the [tex](214)_{10}[/tex]
We have to convert this decimal number into the binary number
[tex](11010110)_{2}[/tex]
Performing the 2's complement number so we have to subtract 1 from this
[tex]11010110 - 1 =(11010101)_{2}[/tex]
Now to getting the original number we have to complement the previous number it means convert 1 ->0 and 0 -> 1
[tex](11010101)_{2}---------> (00100101)_{2}[/tex]
The previous number is converted binary to decimal we get ,
[tex](00100101)_{2}------->(42)_{10}[/tex]
-42(According to the rule of 2's complement )
Therefore the result is
151 + 214
=(-105 + (-42)
=-147
Hence the -147 is smaller then -128 that is smaller 8 bit signed integer is Therefore result is : -128
Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write your code so that it works no matter how many items are in the list.
Answer:
Following is the program in python programming language
sports = [14, 25, 32, 63, 79, 38, -10] #list sports
print("The original list is : " + str(sports)) #display original list
last = sports[-3:] #extracts the last 3 items from the list
print("The last 3 elements of list is : " + str(last)) #display the last 3 item
Output:
The original list is : [14, 25, 32, 63, 79, 38, -10]
The last 3 elements of list is: [79, 38, -10]
Explanation:
Following are the description of program
Declared and initialized the items in the list "sports".After that display the list "sports" by using str function in the python language sports[-3: this will extract the last 3 three items in the list and store the result in the last variable .Finally display the last variable it will print the last 3 element in the listA distributed system uses a process called _____, where all the connected computers must confirm or agree on the answer or result to a computation before submitting it to a database.
Answer:
Distributed Consensus
Explanation:
A distributed system refers to a set of connected computers to achieves a goal. They can each work independently and they usually appear as a single computer system to end users.
Database computations usually require each connected computer node to agree on the computations and results before submitting it to the database.
This process is referred to as a Distributed Consensus.
A distributed consensus makes sure that in a distributed system, the data among nodes all reach an agreement and make confirmations before submitting to a database.
A process can be A. single threaded B. multithreaded C. both single threaded and multithreaded D. none of the mentioned
Answer: C. both single threaded and multithreaded
Explanation:
A process can either be single threaded and multithreated. Single threaded processes is when the execution of instructions are in a single sequence i.e the sequence is one command at a time while for multithreaded processes, there are. execution of several multiple parts of a program that occurs at the same time.
A single threaded process only runs on one CPU, whereas for the execution of a multi-threaded, it may be divided amongst the available processors.
The protections from the security software must continue when the device is taken off the network, such as when it is off-grid, or in airplane mode and similar. Still, much of the time, software writers can expect the device to be online and connected, not only to a local network but to the World Wide Web, as well. Web traffic, as we have seen, has its own peculiar set of security challenges. What are the challenges for an always connected, but highly personalized device?
Answer:
third ighjojdudjz
ghddduewjj
wkckdjjj
Explanation:
cchmddkhwmx
ndhdnahdd
jruditndjed
SUWIDHA stands for .
You are in a rectangular maze organized in the form of M N cells/locations. You are starting at the upper left corner (grid location: (1; 1)) and you want to go to the lower right corner (grid location: (M;N)). From any location, you can move either to the right or to the bottom, or go diagonal. I.e., from (i; j) you can move to (i; j + 1) or (i + 1; j) or to (i+1; j +1). Cost of moving right or down is 2, while the cost of moving diagonally is 3. The grid has several cells that contain diamonds of whose value lies between 1 and 10. I.e, if you land in such cells you earn an amount that is equal to the value of the diamond in the cell. Your objective is to go from the start corner to the destination corner. Your prot along a path is the total value of the diamonds you picked minus the sum of the all the costs incurred along the path. Your goal is to nd a path that maximizes the prot. Write a dynamic programming algorithm to address the problem. Your algorithm must take a 2-d array representing the maze as input and outputs the maximum possible prot. Your algorithm need not output the path that gives the maximum possible prot. First write the recurrence relation to capture the maximum prot, explain the correctness of the recurrence relation. Design an algorithm based on the recurrence relation. State and derive the time bound of the algorithm. Your algorithm should not use recursion
Answer:
Following are the description of the given points:
Explanation:
A) The Multiple greedy approaches could exist, which could be to reach for the closest emergency diamond, and yet clearly we are going to miss some very essential routes in that case. So, it can make every argument quickly, and seek to demonstrate a reference case for that.
B) An approach to the evolutionary algorithm and its users are going to just have states M x N. But each state (i, j) indicates the absolute difference between the amount of the selected diamond and the amounts of the costs incurred.
DP(i, j) = DimondVal(i, j) + max ((DP(i, j-1)-2), (DP(i-1,j-1)-3))
DP(i, j) is a description of the state.
DimondVal(i, j) is the diamond value at (i j), 0 if there is no diamond available.
This states must calculate the states of M N and it involves continuous-time for each State to determine. Therefore the amount of time of such an algo is going to be O(MN).
What are the pros and cons of using a linked implementation of a sparse matrix, as opposed to an array-based implementation?
Answer:
Linked lists and arrays are both linear data structures but while an array is a collection of items that can be accessed randomly, a linked list can be accessed sequentially.
A sparse matrix contains very few non-zero elements. For example;
_ _
| 0 0 3 0 6 |
| 0 5 0 0 4 |
| 2 0 0 0 0 |
|_ 0 0 0 0 0 _|
In the implementation of a sparse matrix, the following are some of the pros and cons of using a linked list over an array;
PROS
i. Linked lists are dynamic in nature and are readily flexible - they can expand and contract without having to allocate and/or de-allocated memory compared to an array where an initial size might need to be set and controlled almost manually. This makes it easy to store and remove elements from the sparse matrix.
ii. No memory wastage. Since the size of a linked list can grow or shrink at run time, there's no memory wastage as it adjusts depending on the number of items it wants to store. This is in contrast with arrays where you might have unallocated slots. Also, because the zeros of the sparse matrix need not be stored when using linked lists, memory is greatly conserved.
CONS
i. One of the biggest cons of linked lists is the difficulty in traversing items. With arrays, this is just of an order of 0(1) since the only requirement is the index of the item. With linked lists, traversal is sequential which means slow access time.
ii. Storage is another bottle neck when using linked lists in sparse matrix implementation. Each node item in a linked list contains other information that needs to be stored alongside the value such as the pointer to the next or previous item.
Write a program that create Employee class with fields id,name and sal and create Employee object and store data and display that data.
Answer:
Here is the C++ program for Employee class with fields id,name and sal.
#include <iostream> // to use input output functions
#include <string> //to manipulate and use strings
using namespace std; // to access objects like cin cout
class Employee { //class Employee
private:
/* the following data members are declared as private which means they can only be accessed by the functions within Employee class */
string name; //name field
int id; //id field
double sal; //salary field
public:
Employee(); // constructor that initializes an object when it is created
/* setName, setID and setSalary are the mutators which are the methods used to change data members. This means they set the values of a private fields i.e. name, id and sal */
void setName(string n) //mutator for name field
{ name = n; }
void setId(int i) //mutator for id field
{ id = i; }
void setSalary(double d) //mutator for sal field
{ sal = d; }
/* getName, getID and getSalary are the accessors which are the methods used to read data members. This means they get or access the values of a private fields i.e. name, id and sal */
string getName() //accessor for name field
{ return name; }
int getId() //accessor for id field
{ return id; }
double getSalary() //accessor for sal field
{ return sal; } };
Employee::Employee() { //default constructor where the fields are initialized
name = ""; // name field initialized
id = 0; // id field initialized to 0
sal = 0; } // sal field initialized to 0
void display(Employee);
// prototype of the method display() to display the data of Employee
int main() { //start of the main() function body
Employee emp; //creates an object emp of Employee class
/*set the name field to Abc Xyz which means set the value of Employee class name field to Abc Xyz through setName() method and object emp */
emp.setName("Abc Xyz");
/*set the id field to 1234 which means set the value of Employee class id field to 1234 through setId() method and object emp */
emp.setId(1234);
/*set the sal field to 1000 which means set the value of Employee class sal field to 1000 through setSalary() method and object emp */
emp.setSalary(1000);
display(emp); } //calls display() method to display the Employee data
void display(Employee e) { // this method displays the data in the Employee //class object passed as a parameter.
/*displays the name of the Employee . This name is read or accessed through accessor method getName() and object e of Employee class */
cout << "Name: " << e.getName() << endl;
/*displays the id of the Employee . This id is read or accessed by accessor method getId() and object e */
cout << "ID: " << e.getId() << endl;
/*displays the salary of the Employee . This sal field is read or accessed by accessor method getSalary() and object e */
cout << "Salary: " << e.getSalary() << endl; }
Explanation:
The program is well explained in the comments mentioned with each statement of the program.
The program has a class Employee which has private data members id, name and sal, a simple default constructor Employee(), mutatator methods setName, setId and setSalary to set the fields, acccessor method getName, getId and getSalary to get the fields values.
A function display( ) is used to display the Employee data i.e. name id and salary of Employee.
main() has an object emp of Employee class in order to use data fields and access functions defined in Employee class.
The output of the program is:
Name: Abc Xyz
ID: 1234
Salary: 1000
The program and its output are attached.
"Inheritance is the process by which a new class - known as a _________ - is created from another class, called the _____________. "
Answer:
child class
parent class
Explanation:
"Inheritance is the process by which a new class - known as a __child class__ - is created from another class, called the __parent class__. "
Write code to create a list of numbers from 0 to 67 and assign that list to the variable nums. Do not hard code the list. Save & RunLoad HistoryShow CodeLens
Answer:
The program written in Python is as follows
nums = []
for i in range(0,68):
-->nums.append(i)
print(nums)
Explanation:
Please note that --> is used to denote indentation
The first line creates an empty list
nums = []
This line creates an iteration from 0 to 67, using iterating variable i
for i in range(0,68):
This line saves the current value of variable i into the empty list
nums.append(i)
At this point, the list has been completely filled with 0 to 67
This line prints the list
print(nums)