Answer:
import java.util.Scanner;
class Main
{
public static void main(String[] args)
{
System.out.println(" Enter the the two numbers:");
Scanner input = new Scanner(System.in);
int a = input.nextInt();
int b = input.nextInt();
int c = sumsquareFunction(a, b);
System.out.println("Sum of Square of two numbers are:" + c);
}
public static int sumsquareFunction(int n1, int n2) {
int c= n1*n1 + n2*n2;
return c;
}
}
Explanation:
Please check the answer.
import random
def random_number_file_writer(nums):
f = open("random.txt", "w")
i = 0
while i < nums:
f.write(str(random.randint(1,500))+"\n")
i += 1
f.close()
def random_number_file_reader():
f = open("random.txt", "r")
total = 0
count = 0
for x in f.readlines():
total += int(x)
count += 1
print("The total of the numbers is "+str(total))
print("The number of random numbers read from the file is "+str(count))
def main():
random_number_file_writer(int(input("How many random numbers do you want to generate? ")))
random_number_file_reader()
main()
I hope this helps!
Answer:
Option C, Disaster recovery plan
Explanation:
The seven domains of IT are
User Domain
System/Application Domain
LAN Domain
Remote Access Domain
WAN Domain
LAN-to-WAN Domain
Workstation Domain
To these seven domain, the Disaster recovery plan only applies to the LAN-to-WAN Domain as it is vulnerable to corruption of data and information and data. Also, it has insecure Transmission Control Protocol/Internet Protocol. (TCP/IP) applications and it at the radar of Hackers and attackers
Answer:
void ranges(int x[], int npts, int *max_ptr, int *min_ptr)
{
*max_ptr=*min_ptr=x[0];
for(int i=1;i<npts;i++)
{
if(x[i]>*max_ptr) //this will put max value in max_ptr
*max_ptr=x[i];
if(x[i]<*min_ptr) //this will put min value in min_ptr
*min_ptr=x[i];
}
}
Explanation:
The above function can be called like :
ranges(x,n,&max,&min);
where x is array and n is number of elements and max and min are address of variables where maximum and minimum values to be stored respectively.
Answer:
2.6 seconds
Explanation:
We first start by calculating the speed up
The formula is given as:
n/1+(n-1)F
We have n = 3 which is the number of processors
F = 20% = percentage of algorithm
When we put values into the formula
3/1+(3-1)0.20
= 3/1+2*0.20
= 3/1+0.4
= 3/1.4
Speed up = 2.14
From here we calculate the expected time
T/speedups
= 5.6/2.14
= 2.6
Therefore the expected time is 2.6 seconds