Answer:
import java.util.Scanner;
public class num9 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter year");
int givenYear =in.nextInt();
if(givenYear>=2101){
System.out.println("Distant Future");
}
else if(givenYear>=2001){
System.out.println("21st Century");
}
}
}
Explanation:
Using Java programming LanguageImport Scanner class to receive user input of the variable givenYearUse if statement to check the first condition if(givenYear>=2101)Use else if statement to check the second condition if(givenYear>=2001)print Distant future and 21st century respectivelyThe function below takes two parameters: a string parameter: CSV_string and an integer index. This string parameter will hold a comma-separated collection of integers: '111,22,3333,4'. Complete the function to return the indexth value (counting from zero) from the comma-separated values as an integer. For example, your code should return 3333 (not '3333') if the example string is provided with an index value of 2. Hint: you should consider using the split() method and the int() function.
To return the integer at a given index from a comma-separated string, split the string into a list and then convert the desired element to an integer.
Explanation:To obtain the indexth value from a comma-separated string of integers, you can use the split() method to create a list of substrings, then use the int() function to convert the desired element to an integer. Here's an example of how you could write such a function:
def get_index_value(CSV_string, index):python3 Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character of each sentence capitalized. For instance, if the argument is "hello. my name is Joe. what is your name?" the function should return the string "Hello. My name is Joe. What is your name?". The program should let the user enter a string and then pass it to the function. The modified string should be displayed.
Answer:
MyString= input('Enter string: ')
string_capitalize(MyString)
print(MyString)
def string_capitalize(str):
str= str.capitalize()
return str
Explanation:
This python code is learnt to access string value from users and capitalize all characters in the beginning of each sentence.
Create a procedure that generates a random string of length L , containing all capital letters. The procedure, CreateRandomString, receives the length of the string (L) in EAX, and returns the pointer to a byte array in ESI held the random string. Part 2 Write a driver program uses the CreateRandomString procedure to generate 20 random strings. Each random string with a random length between 1~100. Output all strings in the console window.
A student seeks help with assembly programming to create a procedure generating random strings of capital letters. The procedure must handle varying lengths and return a pointer to the generated string. The driver program calls this procedure multiple times to output different strings.
Explanation:The student's question relates to the field of assembly programming and specifically deals with creating a procedure that generates a random string. The procedure CreateRandomString receives the length of the string in the EAX register and returns a pointer to the string in the ESI register. The driver program calls this procedure 20 times to generate random strings with lengths varying between 1 and 100 characters, using uppercase ASCII character codes (65-90).To implement this in assembly, pseudocode for the CreateRandomString procedure would set up the loop to iterate L times, each time generating a random number within the range of uppercase letter ASCII codes and storing it in the resulting array. After the string is crafted, the pointer to this array is placed in the ESI register for the calling program to use. The calling or driver program uses a loop to generate 20 such strings, each time generating a new length at random from 1 to 100, then calling CreateRandomString and outputting the result to the console.
TVBCA has just occupied an old historic building in downtown Pittsburgh in which 15 employees will work.
Because of historic building codes, TVBCA is not permitted to run cables inside walls or ceilings.
Required results:
Employees must be able to share files and printers as in a typical LAN environment without the use of cables.
Optional desired results:
Employees must be able to use their laptops and move freely throughout the office while maintaing a network connection.
Because of the size of some computer-aided design (CAD) files employees use frequently, data transfer speeds should be more than 20Mbps.
Proposed Solution:
Install an 802.11a wireless access point and configure each computer and laptop with a wireless network card.
1. Which results does the proposed soulution deliver?
Explain your answer.
a. The proposed solution delivers the required result and both optional desired results.
b. The proposed solution delivers the required result and only one of the two optional desired results.
c. The proposed solution delivers the required result but neither optional desired result.
d. The proposed solution does not deliver the required result.
Answer:
A. The proposed solution delivers the required result and both optional desired results.
Explanation:
The IEEE 802.11a is the standard code of the wireless communication technology known as WIFI, it is wireless as it requires no cable to connect to a network device. The data transmission rate of the IEEE 802.11a is 1.5 - 54Mbps (mega bit per second). So, the employees in the TVBCA building can wireless connect to the network, which allows them to be mobile and they can also send large CAD files among themselves.
You will implement three different types of FFs with two different reset types. You have to show your results on your FPGA. You have to use behavioral verilog. Steps: 1. Build a positive edge triggered TFF. 2. Add a synchronous reset to TFF. a. The reset signal should be attached to a button when you load JTAG. 3. Using a separate piece of code: Add an asynchronous reset to TFF. a. Copy and reuse your old code with some modifications.
Answer:
Step 1 : For TFF with asynchronous reset, the verilog code is :
'timescale 1ns/100ps
module tff1( input t,clk,reset, output reg q );
if (reset ) begin
always at (posedge clk ) begin
q <= #4 not q;
end
end else begin
q <= 1'b0;
end
end module
Step 2 : For TFF with synchronous reset, just include reset condition inside always statement as shown :
always at(posedge clk ) begin
if ( reset ) then
q <= #4 not q;
end else begin
q <= 1,b0'
end
end
Step 3 : For developing a DFF from a TFF , you need to have a feedback loop from ouput to input . Make sure you assign the wires correctly including the signal direction . Combine both the input D and ouptut of TFF using XOR and input it to the T.
module dff (input d, clk , reset ,output reg q )
wire q;
reg t;
tff1 ( t, clk, reset , q ); //module instantiation
xor ( t,q,d);
end module
For synchronous reset , you can just replace the tff asynchronous module with synchronous module
Step 4 : For obtaining JK FF using the DFF , we just to config the 4x1 MUX such that the required output is generated
module JKFF ( input j,k ,clk, reset , output reg q)
DFF ( d ,clk, reset ,q )
reg d;
case (j,k)
when "00" then d <= q;
when "01" then d <= 1'b0;
when "10" then d <= 1'b1;
when "11" then d <= #4 not d;
default : d <= 1'bX;
end module;
Write a predicate function called check_list that accepts a list of integers as an argument and returns True if at least half of the values in the list are less than the first number in the list. Return False otherwise.
Answer:
# the function check_list is defined
# it takes a parameter
def check_list(integers):
# length of half the list is assigned
# to length_of_half_list
length_of_half_list = len(integers) / 2
# zero is assigned to counter
# the counter keep track of
# elements whose value is less
# than the first element in the list
counter = 0
# the first element in list is
# assigned to index
index = integers[0]
# for loop that goes through the
# list and increment counter
# whenever an element is less
# than the index
for i in range(len(integers)):
if integers[i] < index:
counter += 1
# if statement that returns True
# if counter is greater than half
# length of the list else it will return
# False
if counter > length_of_half_list:
return True
else:
return False
# the function is called with a
# sample list and it returns True
print(check_list([5, 6, 6, 1, 9, 2, 3, 4, 1, 2, 3, 1, 7]))
Explanation:
The program is written is Python and is well commented.
The example use returns True because the number of elements with value less than 5 are more than half the length of the list.
Consider the following functions: (4) int hidden(int num1, int num2) { if (num1 > 20) num1 = num2 / 10; else if (num2 > 20) num2 = num1 / 20; else return num1 - num2; return num1 * num2; } int compute(int one, int two) { int secret = one; for (int i = one + 1; i <= two % 2; i++) secret = secret + i * i; return secret; } What is the output of each of the following program segments? a. cout << hidden(15, 10) << endl; b. cout << compute(3, 9) << endl; c. cout << hidden(30, 20) << " " << compute(10, hidden(30, 20)) << endl; d. x = 2; y = 8; cout << compute(y, x) << endl;
Answer:
a. cout<<hidden(15,10)<<endl;
output = 5
b. cout << compute(3, 9) << endl;
output=3
c. cout << hidden(30, 20) << " " << compute(10, hidden(30, 20)) << endl;
output = 10
d. x = 2; y = 8; cout << compute(y, x) << endl;
output= 8
Explanation:
solution a:
num1= 15;
num2= 10;
according to condition 1, num1 is not greater than 20. In condition 2, num2 is also not greater than 20.
so,
the solution is
return num1 - num2 = 15 - 10 = 5
So the output for the above function is 5.
solution b:
as in function there are two integer type variables named as one and two. values of variables in given part are:
one = 3
two = 9
secret = one = 3
for (int i= one + 1 = 3+1 = 4; i<=9%2=1; i++ )
9%2 mean find the remainder for 9 dividing by 2 that is 1.
// there 4 is not less than equal to 1 so loop condition will be false and loop will terminate. statement in loop will not be executed.
So the answer will be return from function compute is
return secret ;
secret = 3;
so answer return from the function is 3.
solution c:
As variables in first function are num1 and num2. the values given in part c are:
num1 = 30;
num2= 20;
According to first condition num1=30>20, So,
num1= num2/10
so the solution is
num1 = 20/10 = 2
now
num1=2
now the value return from function Hidden is,
return num1*num2 = 2* 20 = 40
Now use the value return from function hidden in function compute as
compute(10, hidden(30, 20))
as the value return from hidden(30, 20) = 40
so, compute function becomes
compute(10, 40)
Now variable in compute function are named as one and two, so the values are
one= 10;
two = 40;
as
secret = one
so
secret = 10;
for (int i= one + 1 = 10+1 = 11; i<=40%2=0; i++ )
40%2 mean find the remainder for 40 dividing by 2 that is 0.
// there 11 is not less than equal to 0 so loop condition will be false and loop will terminate. statement in loop will not be executed.
So the answer will be return from function compute is
return secret ;
secret = 10;
so answer return from the function is 10.
solution d:
Now variable in compute function are named as one and two, so the values are
one = y = 8
two = x = 2
There
Secret = one = 8;
So
for (int i= one + 1 = 8+1 = 9; i<=2%2=0; i++ )
2%2 mean find the remainder for 2 dividing by 2 that is 0.
// there 9 is not less than equal to 0 so loop condition will be false and loop will terminate. statement in loop will not be executed.
So the answer will be return from function compute is
return secret ;
secret = 8;
so answer return from the function is 8.
10. Consider sending a 3000-byte IPv4 datagram into a link that has an MTU of 700 bytes. Suppose the original datagram is stamped with the identification number 1001. Assume that all IP datagram headers have a size of 20 bytes. How many fragmented datagrams will be generated? For *each* of the fragmented datagrams, please give: the identification number of the fragmented datagram, the value in the offset field of the datagram header, the length of the fragmented datagram, and the length of the payload in the fragmented datagram.
Answer:
Number of fragmented datagrams: 5
Explanation:
Since the MTU is 700 bytes,the payload will be 680 bytes and Up header will be 20 bytes.
The datagram is of size 3000 bytes. Therefore this datagram is fragmented to send it in 700 bytes MTU.
The first four fragments has the size 680 bytes of payload(4*680= 2720 bytes). The remaining 280 bytes will be sent in the 5th fragment.
The offset value gives how much was sent before the current fragment in terms of 8-byte blocks.
For first fragment it will be 0, as no data was sent before this first fragment.
For second fragment, 680 bytes(680/8=85 8-bytes block) were sent in first fragment before this current fragment. Hence the value will be 0+85=85.
For third fragment it is : 0+85+85=170
Number of fragmented datagrams: 5
Task1: #Define a function called show_students which takes 2 parameters students and message #Print out a message, and then the list of students #Next, put the students in alphabetical order and print them #Next, Put students in reverse alphabetical order and print them Example Output: Our students are currently in alphabetical order. - Aaron - Bernice - Cody Our students are now in reverse alphabetical order. - Cody - Bernice - Aaron
Answer:
def show_students(message, sList): print(message) print(sList) print("Our students are currently in alphabetical order") sList.sort() output = "" for student in sList: output += "-" + student print(output) print("Our students are currently in reverse alphabetical order") sList.sort(reverse=True) output = "" for student in sList: output += "-" + student print(output) show_students("Welcome to new semester!", ["Aaron","Bernice", "Cody"])Explanation:
Firstly we declare a function that will take two inputs, message and student list (Line 1).
In the function, we first print the message and the original input student list (Line 2 - 3). Next, we use sort method to sort the input list and then output the sorted items from the list using a for loop (Line 5-10).
Next, we sort the list again by setting reverse = True and this will sort the list in descending order (Line 13). Again we use the similar way mentioned above to output the sorted items (in descending order) using a for loop (Line 14 -17)
We test the function using a sample student list (Line 18) and we shall get the output:
Welcome to new semester!
['Aaron', 'Bernice', 'Cody']
Our students are currently in alphabetical order
-Aaron-Bernice-Cody
Our students are currently in reverse alphabetical order
-Cody-Bernice-Aaron
Write a program that prints the block letter “B” in a 7x7 grid of stars like this:
*****
* *
* *
*****
* *
* *
*****
Then extend your program to print the first letter of your last name as a block letter in a 7X7 grid of stars.
Answer:
output = "" for i in range(7): if(i % 3 == 0): for i in range(5): output+= "*" output += "\n" else: for i in range(2): output += "* " output += "\n" print(output)Explanation:
The solution code is written in Python 3.
Firstly, create a output variable that holds an empty string (Line 1).
Create an outer loop that will loop over 7 times to print seven rows of stars (Line 2). In row 0, 3 and 6 (which are divisible by 3) will accumulate up to 5 stars using an inner loop (Line 4-5) whereas the rest of the row will only print two stars with each start followed by a single space (Line 8-9) using another inner loop.
At last, print the output (Line 12).
Package Newton’s method for approximating square roots (Case Study 3.6) in a function named newton. This function expects the input number as an argument and returns the estimate of its square root. The script should also include a main function that allows the user to compute square roots of inputs until she presses the enter/return key.
Final answer:
The question is about creating a programming function named newton that utilizes Newton's method for an efficient approximation of square roots without solving for quadratic equation roots. The function is applicable in various mathematical scenarios, particularly where manual computation is required, such as in equilibrium problems.
Explanation:
The student's question relates to the programming of a function called newton that implements Newton's method for approximating square roots. The method is a mathematical approach that allows for expedient calculations by avoiding the need to solve for the roots of a quadratic equation. Newton's method is particularly useful in situations where square roots need to be computed manually or understood conceptually, such as in some equilibrium problems in chemistry or physics. By creating a function and utilizing a loop, users can repeatedly input numbers and receive an estimate of the square root until the enter/return key is pressed.
In the context of programming, it can be wrapped in a function to allow for repeated efficient calculation of the square root of any positive number. The square root function is fundamental in handling various mathematical computations like in equilibrium problems or any scenario where roots need to be analyzed for a final answer. Also, understanding the approximate square root computation is beneficial for students working without a calculator or aiming to grasp the underpinning principles of square roots and exponents, as indicated by √x² = √x.
Final answer:
The newton function can be implemented in Python using Newton's method for approximating square roots. The main function can then call the newton function repeatedly until the user presses the enter/return key.
Explanation:
The newton function can be implemented in Python using Newton's method for approximating square roots. Here's how you can define the newton function:
def newton(number):Alice and Bob decide to communicate using NTRUEncrypt with parameters (N, p, q) = (7, 3, 29). Alice’s public key is h(x) = 3 + 14X − 4X2 + 13X3 − 6X4 + 2X5 + 7X6 . Bob sends Alice the plaintext message m(x)= 1+ X − X2 − X3 − X6 using the random element r(x) = −1 + X2 − X5 + X6.
(a) What ciphertext does Bob send to Alice?
(b) Alice’s private key is f(x) = −1 + X − X2 + X4 + X6 and F 3(x)=1+ X + X2 + X4 + X5 − X6. Check your answer in (a) by using f and F 3 to decrypt the message.
Final answer:
To encrypt the plaintext message, Bob uses Alice's public key and a random element. The ciphertext is obtained by multiplying the plaintext message with the public key. To decrypt the ciphertext, Alice uses her private key by multiplying the ciphertext with the private key polynomial and reducing modulo p.
Explanation:
To encrypt the plaintext message, Bob needs to use Alice's public key along with a random element. The ciphertext is obtained by multiplying the plaintext message with the public key. In this case, the plaintext message m(x)= 1+ X − X2 − X3 − X6 and the random element r(x) = −1 + X2 − X5 + X6. By multiplying these polynomials, Bob obtains the ciphertext c(x)= -1 - X - X^2 + 4X^3 + 8X^4 - 5X^5 - 30X^6 + 5X^7 - 6X^9 - 3X^10 + 8X^11 + 13X^12 + 2X^13 - 6X^14 + 26X^15 - 16X^16.
To decrypt the ciphertext, Alice uses her private key. She multiplies the ciphertext with her private key polynomial and reduces modulo p, resulting in the decrypted message. The private key polynomial for Alice is f(x) = −1 + X − X2 + X4 + X6. By multiplying the ciphertext c(x) with the private key polynomial f(x) modulo 3, the decrypted message is obtained: d(x)= 1+ X − X2 − X3 − X6.
Guidelines:
Loops are completely banned (for loop and while loop)
You must use recursion in each function
You are not allowed to import anything.
You are not allowed to use the built-in function max(). Everything else is okay
You are allowed to use sets, dictionaries, and any of their respective operations.
You are allowed to use any string method except for string.join()
You can do string slicing, but you cannot use the string[::-1] shortcut.
You can use any list operation, except for list.sort() and list.reverse()
Do not hard code to the examples
------------------------------------------------------------------------------------------------------------
Functions (You must use recursion in each function WITHOUT altering the original function signature):
def merge(listA, listB):
Description:
Combine two lists into one list, maintaining the order of the elements. You should assume that both lists given to this function contain elements in ascending order (smallest first).
Parameters:
listA, listB, two lists of elements (could be anything – assume homogenous data)
Return value:
a list, the combination of elements from listA and listB in ascending order.
Examples:
merge([1,2,3], [4,5,6]) → [1,2,3,4,5,6]
merge([1,2,3], [2,3,4]) → [1,2,2,3,3,4]
merge([2,4,6], [1,3,5]) → [1,2,3,4,5,6]
---------------------------------------------------
def largest_sum(xs, x, y):
Description:
Zig-zag through a two-dimensional list of integers from some starting point until you reach one of the list's boundaries, computing the largest sum that you find along the way. X and Y represent the row and column position in xs of the first number to use in the sum. The zig-zag pattern is made by limiting yourself to only looking at the number immediately on the right of (x,y) and the number immediately below (x,y) when figuring out which of those numbers yields the largest sum.
Parameters: xs, a 2D list of integers, x,y are the row and col position in xs
Return value: an integer, the largest sum you can find from position (x,y)
Examples:
largest_sum([[1,2],[3,0]],0,0) → 4
largest_sum([[5,6,1],[2,3,3]],0,0) → 17
largest_sum([[0,7,5],[6,-1,4],[-5,5,2]],0,0) → 18
largest_sum([[0,7,5],[6,-1,4],[-5,5,2]],1,1) → 6
Answer:
See Explaination
Explanation:
def merge(listA, listB):
if not listA:
return listB
if not listB:
return listA
# create a empty resulting list(merged list)
result = []
# check the first elements of list listA, listB)
if(listA[0]<listB[0]):
# append the first element of listA to result
result.append(listA[0])
# use recursion to get remaning elements
# listA is now reduced to listA[1:]
result.extend(merge(listA[1:],listB))
else:
# append the first element of listB to result
result.append(listB[0])
# use recursion to get remaning elements
# listB is now reduced to listB[1:]
result.extend(merge(listA,listB[1:]))
# return the resultant list
return result
def largest_sum(xs, x, y):
# get number of rows and columns
m = len(xs[0])
n = len(xs)
# if move is invalid
if(x>=n or y>=m):
return 0
# check if we have reached boundary then return xs[x][y]
if(x==(n-1) and y==(m-1)):
return xs[x][y]
else:
# return max of two possible moves(leftmove, down move)
# move left (in this increment x)
left = xs[x][y] + largest_sum(xs,x+1,y)
# move down (in this increment y)
down = xs[x][y] + largest_sum(xs,x,y+1)
# return the maximum of two possible moves
if(left>down):
return left
else:
return down
# test code
print("Output for sample test cases given in problem:")
print(merge([1,2,3], [4,5,6]))
print(largest_sum([[1,2],[3,0]],0,0))
print(largest_sum([[5,6,1],[2,3,3]],0,0))
print(largest_sum([[0,7,5],[6,-1,4],[-5,5,2]],0,0))
print(largest_sum([[0,7,5],[6,-1,4],[-5,5,2]],1,1))
1. Perform risk analysis for your home network. 2. Prepare a disaster recovery plan for your home net- work. 3. Research antivirus and antispyware so ware that you can purchase for your home network
Answer:
See the attached file for the answers
Explanation:
Find attached for the explanation
Amnswer:
Exposure of kids to unwanted pages, poor power system and refusal to backup works are some of the risk analysts
Explanation:
RISK ANALYSIS
1. Kids access to unwanted pages and sites if online are a big risk to private information and exposure to threat from hackers and information scammers
2. Poor power system results in an abrupt shutdown of system which is not encouraged. This is commonly responsible for system breakdown and other malfunctioning of the system
3. Lack of backup structure when not put in place are a very good avenue to home network risk which could have a very harmful effect to the home network activities.
DISASTER RECOVERY PLANS
1. Establish a system recovery and restore plans that could help you roll back actions when there is a system error that prevents the network from booting or starting up.
2. Establish a system restriction plan on your home network when kids and children are involved in it usage else vital information and configurations could be hampered. Focus in this context should also be geared towards website control system and constant system monitoring structure.
3. Power backup plans must include setting up a steady power source which should serve as alternatives to inconsistent power outage, irregular power supply and possible related issues. Such power structure should be able to mitigate for any network activities that requires a long time to backup
4. Other home network activities that requires consistent and constant backup should be done through external storage devices and through on line drives in order to ensure that document are not lost when emergency breakdown occurs.
SYSTEM ANTIVIRUS AND ANTI SPYWARES
From research some of the most used antivirus with spyware's features that has been largely used both online band offline include;
1. The Norton 360
2. Norton security
3. Avast
4. Avira ad lots more.
The function below takes a single input, containing list of strings. This function should return string containing an HTML unordered list with each of in_list strings as a list item. For example, if provided the list ['CS 105', 'CS 125', 'IS 206'], your function should return a string containing the following. The only whitespace that is important is those contained in the given strings (e.g., the space between CS and 105).
The following code will be used to calculate the given requirement.
Explanation:
This function will return string containing an HTML unordered list with each of in_list strings as a list item
def make_html_unordered_list(in_list):
result = '<ul>\n'
for item in in_list:
result += '<li>' + item + '</li>\n'
return result + '</ul>'
# Testing the function here. ignore/remove the code below if not required
print(make_html_unordered_list(['CS 105', 'CS 125', 'IS 206']))
Note: The only whitespace that is important is those contained in the given strings.
The program is an illustration of loops.
Loops are used to perform repetitive and iterative operations.
The function in Python where comments are used to explain each line s as follows:
#This defines the function
def make_html_unordered_list(in_list):
#This creates the opening tag of an HTML unordered list
result = '<ul>\n'
#This iterates through the list
for item in in_list:
#This creates the unordered list, without the last closing tag
result += '<li>' + item + '</li>\n'
#This returns the unordered list, with the last closing tag
return result + '</ul>'
Read more about similar programs at:
https://brainly.com/question/14282285
Recall that two strings u and v are ANAGRAMS if the letters of one can be rearranged to form the other, or, equivalently, if they contain the same number of each letter. If L is a language, we define its ANAGRAM CLOSURE AC(L) to be the set of all strings that have an anagram in L. Prove that the set of regular languages is _not_ closed under this operation. That is, find a regular language L such that AC(L) is not regular. (We’re now allowed to use Kleene’s Theorem, so you just need to show that AC(L) is not recognizable.)
Final answer:
We use a non-regular language, L = {a^n b^n | n ≥ 0}, to demonstrate by contradiction that the anagram closure AC(L) including strings with any order of 'a's and 'b's cannot be recognized by a finite automaton, proving that the set of regular languages is not closed under the operation of forming an anagram closure.
Explanation:
To prove that the set of regular languages is not closed under the operation of forming the anagram closure (AC), let us consider a simple regular language L over some alphabet Σ such that L = {anbn | n ≥ 0}. Although this definition of language L leads to a non-regular language, it is routinely used in theoretical computer science as a starting point to demonstrate properties of language classes. For the sake of argument, we are considering the set of strings where the number of 'a's is equal to the number of 'b's, and for our purposes, this forms our regular language L.
The anagram closure of L, AC(L), would include all strings with equal numbers of 'a's and 'b's regardless of order. However, if we consider languages recognizable by finite automata, which are a characterization of regular languages due to Kleene's Theorem, we realize that a finite automaton cannot keep count of an unbounded number of characters, and thus cannot recognize a language that has an unbounded interchangeable ordering of 'a's and 'b's with equality. This makes AC(L) non-regular because a finite state machine cannot handle the counting necessary for validating anagrams in this context.
Therefore, since AC(L) is not recognizable by a finite automaton, it follows that the set of regular languages is not closed under the operation of taking an anagram closure, and we have our proof by contradiction.
Which of the following is true about open-source enterprise resource planning (ERP) system software? a. An open-source ERP system software’s source code can be modified easily. b. An open-source ERP system software’s source code is not flexible enough to adapt it for changing business needs. c. An open-source ERP system software’s source code is too complex to be modified. d. An open-source ERP system software’s source code is not visible to users.
Answer:
a. An open-source ERP system software’s source code can be modified easily.
Explanation:
Open source software is the software that is available for modification by any one easily. These software are available publicly for the purpose of modifications. User can modify these software as their requirements. There are different software available for enterprise resource planing. Different users and companies use this software freely and modify them for their company according to the demand and need.
Tryton, Odoo and ERPNext are the examples of some open source enterprise resource planning (ERP) software. These software are available for free to modify their source code and use according to the need of the company. As the main advantage of these software is they are available and modifiable easily.
Write a function findWithinThreshold that identifies the elements of a given array that are inside a threshold value. Takes the following as input arguments/parameters : an integer array argSource that brings in the values that need to be examined. an integer that gives the size of the array argSource. an integer that gives the threshold value argThreshold. an integer array argTarget whose contents are to be filled by this function with elements from argSource that are less than argThreshold an integer argTargetCount that has been passed by reference to the function findWithinThreshold (this value needs to be filled by this function bas
Answer:
See explaination
Explanation:
#include <iostream>
using namespace std;
/* Type your code for the function findWithinThreshold here. */
void findWithinThreshold(int argSource[], int argsSourseSize, int argThreshold, int argTarget[], int &argsTargetSize)
{
argsTargetSize = 0;
for (int i = 0; i < argsSourseSize; i++)
{
if (argSource[i] <= argThreshold)
argTarget[argsTargetSize++] = argSource[i];
}
}
/* Type your code for the function findWithinLimits here. */
void findWithinLimits(int argSource[], int argsSourseSize, int argLowLimit, int argHighLimit,int argTarget[],int &argTargetCount)
{
argTargetCount = 0;
for (int i = 0; i < argsSourseSize; i++)
{
if (argSource[i]>=argLowLimit && argSource[i] <= argHighLimit)
argTarget[argTargetCount++] = argSource[i];
}
}
int main() {
const int MAX_SIZE = 100;
int source[MAX_SIZE]; //integer array source can have MAX_SIZE elements inside it ;
// user may chose to use only a portion of it
// ask the user how many elements are going to be in source array and
// then run a loop to get that many elements and store inside the array source
int n;
cout << "How many elements: ";
cin >> n;
for (int i = 0; i < n; i++)
{
cout << "Enter " << (i + 1) << " element: ";
cin >> source[i];
}
int threshold, lower_limit, upper_limit;
/* Type your code to declare space for other required data like
target array (think how big it should be)
threshold
lower limit
upper limits
as well as the variable that will bring back the info regarding how many elements might be in target array
*/
int *target = new int[n];
int targetCount;
cout << "\nEnter thresold value: ";
cin >> threshold;
/* Type your code to get appropriate inputs from the user */
cout << "\nEnter lower limit: ";
cin >> lower_limit;
cout << "\nEnter upper limit: ";
cin >> upper_limit;
/* Type your code here to call/invoke the function findWithinThreshold here.. */
/* Type your code to print the info in target array - use a loop and think about how many elements will be there to print */
findWithinThreshold(source, n, threshold, target, targetCount);
cout << "\nElement in the threshold = " << targetCount << endl;
for (int i = 0; i < targetCount; i++)
cout << target[i] << "\n";
/* Type your code here to call/invoke the function findWithinLimits here.. */
/* Type your code to print the info in target array - use a loop and think about how many elements will be there to print */
findWithinLimits(source, n, lower_limit, upper_limit, target, targetCount);
cout << "\n\nElements with in the " << lower_limit << " and "<<upper_limit<<endl;
for (int i = 0; i < targetCount; i++)
cout << target[i] << " ";
cout << endl;
system("pause");
return 0;
}
The function findWithinThreshold identifies elements in an array less than a given threshold. It takes four parameters and outputs the target array and count of elements below the threshold. Sample C++ code is provided for implementation.
Function to Identify Elements within a Threshold :
To solve this problem, you need to write a function findWithinThreshold that identifies elements in an array which are less than a given threshold. The function takes four parameters:
argSource: The input integer array to be examined.argSize: The size of the input array.argThreshold: The threshold value.argTarget: The output integer array to be filled with elements from argSource less than argThreshold.argTargetCount: A reference integer that will hold the count of elements in argTarget.Here's a sample implementation in C++:
void findWithinThreshold(int argSource[], int argSize, int argThreshold, int argTarget[], int& argTargetCount) {In this function, argTargetCount is set to 0 initially, and for each element in argSource that is less than argThreshold, the element is added to argTarget and argTargetCount is incremented.
Modify the program so that it can do any prescribed number of multiplication operations (at least up to 25 pairs). The program should have the user first indicate how many operations will be done, then it requests each number needed for the operations. When complete, the program should then return "done running" after displaying the results of all the operations in order. It is in the Arduino Language
You can write the code from scratch if you'd like without modifying the given code. In any expected output.
//Initializing the data
float num1 = 0;
float num2 = 0;
int flag1 = 0;
// a string to hold incoming data
String inputString = " ";
// Whether the string is Complete
boolean stringComplete = false;
//This is where the void setup begins
void setup() {
//Initializing the serial
Serial.begin (9600);
//Reserving 200 bytes for the inputString
inputString.reserve (200);
Serial.println("Provide The First Number");
}
void loop() {
//Print the string when the new line arrives
if (stringComplete) {
if (flag1 == 0) {
Serial.println(inputString);
num1 = inputString.toFloat( );
flag1 = 1;
//Asking the user to input their second string
Serial.println("Provide The Second Number");
}
else if (flag1 == 1) {
Serial.println(inputString);
num2 = inputString.toFloat( );
flag1 = 2;
Serial.println("The Product is Calculating...");
}
if (flag1 == 2) {
Serial.println("The Product is: ");
Serial.println(num1*num2);
Serial.println("Press Reset");
flag1 = 5;
}
//This clears the string
inputString = " ";
stringComplete = false;
}
}
void serialEvent() {
while (Serial.available( )) {
// get the new byte
char inChar = (char)Serial.read( );
//add it to the inputString
inputString += inChar;
//if the incoming character is a newline, set a flag so the main loop can
//do something about it
if (inChar == '\n') {
stringComplete = true;
}
}
}
The provided Arduino program was modified to allow user input for the total number of multiplication operations. It prompts the user, performs each multiplication as numbers are input, and outputs results immediately after each operation, indicating completion with 'Done running.'
Explanation:The student is working with a program written in the Arduino programming language, which involves performing multiple multiplication operations. To modify the program to handle a user-specified number of operations, we need to include a loop and some condition checks to process multiple pairs of numbers. Below is an example sketch that allows the user to specify the number of multiplication operations to perform, input each pair of numbers, and then output the results in order:
int numOperations = 0;Project 4: Strictly Identical arrays
Problem Description:
Two arrays are strictly identical if their corresponding elements are equal. Write a program with class name StrictlyIdentical that prompts the user to enter two lists of integers of size 5 and displays whether the two are strictly identical.
Here are two sample runs:
Sample 1:
Enter 5 elements of list1: 23 55 31 2 10
Enter 5 elements of list2: 23 55 31 2 10
Two lists are strictly identical.
Sample 2:
Enter 5 elements of list1: 23 55 31 2 10
Enter 5 elements of list2: 23 55 3 2 10
Two lists are not strictly identical.
You need to define and utilize a user-defined function using the following method header:
public static boolean equals(int[] array1, int[] array2)
This method will return true if array1 and array2 are strictly identical otherwise it will return false. Note that it is incorrect to check the equality of two arrays using array1 == array2 because they are reference type variables. You need to use a for loop to check each element of array1 and array2. If any of the corresponding elements differ, these two lists are not strictly identical. If all of the corresponding elements are the same, these two lists are strictly identical.
You can use the following steps in your code:
Declare and create two arrays list1 and list2 of integer type and size 5.
Prompt the user to enter 5 elements of list1 and list2. Use for loop to read these entries and assign them to the elements of list1 and list2 respectively (for example, list1[i] = input.nextInt().)
Invoke the boolean method equals (that you defined) to pass the two arrays. If the return type is true then display that the lists are strictly identical. Otherwise, display that the two lists are not strictly identical.
What to deliver?
Your .java file including:
1. (Code: 5 points, Comments: 3 points)
Your code with other appropriate comments.
2. (2 points) Two sample run test the following lists:
(1) 1 2 3 4 5 and 1 2 3 4 5
(2) 1 2 3 4 5 and 5 4 3 2 1
Answer:
import java.util.Scanner;
public class StrictlyIdentical
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int[] list1 = new int[5];
int[] list2 = new int[5];
System.out.println("Enter the numbers for list1: ");
for (int i=0; i<5; i++) {
list1[i] = input.nextInt();
}
System.out.println("Enter the numbers for list2: ");
for (int i=0; i<5; i++) {
list2[i] = input.nextInt();
}
if (equals(list1, list2))
System.out.println("the lists are strictly identical.");
else
System.out.println("the two lists are not strictly identical.");
}
public static boolean equals(int[] array1, int[] array2) {
boolean isIdentical = true;
for (int i=0; i<5; i++) {
if (array1[i] != array2[i])
isIdentical = false;
}
return isIdentical;
}
}
Explanation:
Create a function called equals that takes two parameters, array1, and array2
Initialize the isIdentical as true, this will be our control variable to change its value if two arrays are not identical
Create a for loop that iterates through the arrays. If corresponding elements of the arrays are not equal, set isIdentical as false.
When the loop is done, return the isIdentical
Inside the main:
Declare two arrays
Ask the user to enter numbers for the arrays using for loop
Check if two arrays are identical using the equal function. Print the appropriate message
Given the following System with a maximum of 18 devices: Job No. Devices Allocated Maximum Required Remaining Needs Job 1 6 8 X Job 2 2 9 X Job 3 5 8 X Job 4 3 5 X Using the Banker’s Algorithm, answer these questions: a. Calculate the number of available devices. b. Determine the remaining needs for each job in each system. c. Determine whether the system is safe or unsafe.
Complete Data:
Job No. Devices Allocated Maximum Required Remaining Need
Job 1 6 8 X
Job 2 2 9 X
Job 3 5 8 X
Job 4 3 5 X
Answer:
a) Number of available devices = 2
b) Remaining need for job 1 = 2
Remaining need for job 2 = 7
Remaining need for job 3 = 3
Remaining need for job 4 = 2
c) The system is safe
Explanation:
a) Calculate the number of available devices
Number of available devices = (Maximum number of devices) - (Total number of devices allocated)
Maximum number of devices = 18
Total number of allocated devices = (6 + 2 + 5 + 3)
Total number of allocated devices = 16
Number of available devices = 18 - 16
Number of available devices = 2
b) Determine the remaining needs for each job in each system
Remaining needs = (Maximum Required - Number of devices allocated)
For Job 1
Remaining need = 8 - 6 = 2
For Job 2
Remaining need = 9 - 2 = 7
For Job 3
Remaining need = 8 - 5 = 3
For Job 4
Remaining need = 5 - 3 = 2
c) Determine whether the system is safe or unsafe
For the system to be safe, Need ≤ Available
Where New Available = Available + Allocation
For Job 1
Need = 2
Available devices = 2
2 ≤ 2 (Job 1 is safe)
New available = 2 + 6 = 8
For Job 2
Need = 7
Available devices = 8
7 ≤ 8 (Job 2 is safe)
New available = 2 + 8 = 10
For Job 3
Need = 3
Available devices = 10
3 ≤ 10 (Job 3 is safe)
New available = 5 + 10 = 15
For Job 4
Need = 2
Available devices = 15
2 ≤ 15 (Job 2 is safe)
New available = 3 + 15 = 18
Since all the jobs are safe, the system is safe
1. In the.js file, write the JavaScript code for this application. Within the click event handlers for the elements in the sidebar, use the title attribute for each link to build the name of the JSON file that needs to be retrieved. Then, use that name to get the data for the speaker, enclose that data in HTML elements that are just like the ones that are used in the starting HTML for the first speaker, and put those elements in the main element in the HTML. That way, the CSS will work the same for the Ajax data as it did for the starting HTML. 2. Don’t forget to clear the elements from the main element before you put the new Ajax data in that element. 3. Verify there are no errors.
Answer:
Kindly note that the codes below must be executed through any server like apache, xampp, ngnix, etc...
Explanation:
Other files are not changed... only speakers.js modified
speakers.js
$(document).ready(function() {
$("#nav_list li").click(function() {
var title = $(this).children("a").attr("title");
$.get(title + ".json", function(data, status) {
data = data['speakers'][0];
$("main h1").html(data['title']);
$("main h2").html(data['month']+"<br />"+data['speaker']);
$("main img").attr("src", data.image);
$("main p").html(data.text);
});
});
});
Why is it a good idea for the DBMS to update the catalog automatically when a change is made in the database structure? Could users cause problems by updating the catalog themselves? Explain
Answer:
Explanation:
A catalog is a directory where information about the location of file or database is stored
(a) It is good for DBMS to upgrade the catalog automatically when there is a change in the database structure.
It has the following benefits;
- The updated form of the database can be made available and accessible to other users
- The data of the database will remain in a stable and consistent state
- There will not be a need to execute the update query to update the database.
-If there is no update automatically, only users that made changes will be able to have access to the database
(b) Yes, users can cause problems by up dating the catalog manually.
The following will be the disadvantage when the catalog is updated by users;
- Updated database will not be seen until the user update manually by themselves
- Persistence and consistency of problems
Answer:
The catalog is defined as a directory in which the information about the database is stored. This catalog contains information about the location of any file or database. That DBMS update its catalog automatically when any change in the database is made is a good choice, since any user could enter and consult either a file or a database that is kept updated. If DBMS does not automatically update the database, only users who make any modifications to that database will be able to access that updated information, this would be a typical inconvenience if users update the catalog manually.
Explanation:
The function below takes one parameter: a list of numbers (number_list). Complete the function to count how many of the numbers in the list are greater than 100. The recommended approach for this: (1) create a variable to hold the current count and initialize it to zero, (2) use a for loop to process each element of the list, adding one to your current count if it fits the criteria, (3) return the count at the end.
Answer:
#include<iostream>
#include<conio.h>
using namespace std;
main()
{
int n;
cout<<"enter the size of array"<<endl;
cin>>n;
int a[n],count=0;
for (int i=0;i<n;i++)
{
cout<<"\nenter the values in array"<<i<<"=";
cin>>a[i];
}
for (int j=0;j<n;j++)
{
if (a[j]>=100)
{
count=count+1;
}
}
cout<<"Total Values greater than 100 are ="<<count;
getch();
}
Explanation:
In this program, an array named as 'a' has been taken as integer data type. The array haves variable size, user can change the size of array as per need or demand.
Values will be inserted by user during run time. This program will check that how many values are greater than and equal to 100 in array. The number of times 100 or greater value will appear in array, it count the value in variable "count". After complete traversal of array the result will shown on output in terms of total number of count of value greater than or equal to 100.
Translate the following C++ program to MIPS assembly program. *Please explain each instruction of your code by a comment and submit a .asm file*#include using namespace std; void myfunction(int arr[], int n) { int writes = 0; for(int start = 0; start <= n-2; start++){ int item = arr[start]; int pos = start; for(int i = start+1; i< n; i++) if (arr[i]
This response translates a C++ function to MIPS assembly language, detailing each MIPS instruction with comments and explanations. The step-by-step process converts high-level constructs like loops and conditions into MIPS equivalents. Detailed MIPS code is provided and explained for better understanding.
Translation of C++ Program to MIPS Assembly
The provided C++ function performs an operation on an array, and we will convert each instruction to its MIPS equivalent.
C++ Code:
#include using namespace std;
void myfunction(int arr[], int n)
{ int writes = 0;
for(int start = 0; start <= n-2; start++)
{ int item = arr[start];
int pos = start;
for(int i = start+1; i < n; i++)
if (arr[i] < item) pos++;
// ... for swapping and updating ... }}
MIPS Assembly Code:
# Comment: function myfunction(int arr[], int n) defined start:
# Commentary on each variable:
# arr = $a0 (base address of the array)
# n = $a1 (number of elements in array)
# writes = $s0
# start = $s1
# item = $s2
# pos = $s3
# i = $s4
# Clear writes variable to 0 li $s0, 0
# Outer loop for start = 0 to n-2 outer_loop: move $s1, $zero
# initialize start move $s1, $t0
# copy start from $t0
# Check condition start <= n-2: sub $t2, $a1, 2 ble $s1, $t2, continue_outer_loop j end_of_program continue_outer_loop:
# int item = arr[start] sll $t1, $s1, 2
# start * 4 add $t3, $a0, $t1
# arr[start] lw $s2, 0($t3)
# item = arr[start]
# int pos = start move $s3, $s1
# pos = start
# Inner loop for(int i = start+1; i < n; i++) inner_loop: add $s4, $s1, 1
# i = start + 1 move $t4, $a1
# $t4 = n ble $s4, $t4, continue_inner_loop j update_outer_loop continue_inner_loop:
# if (arr[i] < item) lw $t5, 0($t3)
# arr[i] blt $t5, $s2, increment_pos j end_inner_loop increment_pos: add $s3, $s3, 1
# pos++ end_inner_loop: j inner_loop update_outer_loop:
# ... code for swapping and updating ... j outer_loop end_of_program:
Here are the detailed explanations for each MIPS instruction:
li $s0, 0: Initialize counter 'writes' to 0.
move $s1, $zero: Initialize 'start' to 0.
sll $t1, $s1, 2: Calculate memory offset for arr[start] (start*4).
add $t3, $a0, $t1: Get the address of arr[start].
lw $s2, 0($t3): Load value of arr[start] into 'item'.
move $s3, $s1: Initialize 'pos' with 'start'.
add $s4, $s1, 1: Set 'i' to start+1.
blt $t5, $s2,: Compare arr[i] with 'item'.
add $s3, $s3, 1: Increment 'pos' if arr[i] is less than 'item'.
(Multiply the digits in an integer) Write a program that reads an integer between 0 and 1000 and multiplies all the digits in the integer. For example, if an integer is 932 , the multiplication of all its digits is 54 . Hint: Use the % operator to extract digits, and use the / operator to remove the extracted digit. For instance, 932 % 10
Answer:
number = int(input("Enter a number: "))
product = 1
while number > 0:
digit = number % 10
number -= digit
number /= 10
product *= digit
print(int(product))
Explanation:
*The code is in Python
Ask the user for an integer
Initialize the product variable that will hold the multiplication of the digits
Initialize a while loop that iterates until number is greater than 0
To find the digit of a number, use number modulo 10. Then subtract the result from the number and divide the new number by 10.
Multiply each digit and hold the value in the product
When the loop is done, print the product
Sam has worked for a project-based firm for five years. After being assigned to a high profile special project, he realized that he needed a quiet environment that was free from distractions to finalize project files on a daily basis. His project supervisor agreed and approved for Sam to telecommute from his home. The organization furnished Sam with a standard PC laptop and upgrades to the business class DSL modem. Sam must upload all completed project files to a secured server at the end of each business day, plus maintain a backup copy on his tower unit.
Required:
a. What firewall configuration would you recommend for Sam's home-based office/network? Justify your response.
b. What firewall setup would provide the firm both flexibility and security? Justify your response.
c. Which firewall technologies should be deployed
i. to secure the internet-facing web servers.
ii. to protect the link between the web servers and customer database.
iii. to protect the link between internal users and the customer database?
Answer:
a. Packet filter gateway
b. The dynamic firewall
c. I. Proxy firewall. ii. Application firewall iii. Circuit level gateway
Explanation:
A. The packet filter gateway firewall is the recommended firewall off Sam operation from home. This is because it operates at the network OSI model level where it filter all unwanted packet and content across the home/ office network
B. The dynamic firewall or the stateful packet filter operates changeably without distorting the security of the network. Hence it is the most ideal that provides flexibility and security.
C. I. The proxy firewall is a technology that provides security between the internet to web server
ii. Application firewall technologies take care of the link between web server and customer database.
iii. The circuit level gateways ensure that the link between internal users and customer database are secured.
The information system used by Caesar's Entertainment, which combines data from internal TPS with information from financial systems and external sources to deliver reports such as profit-loss statements and impact analyses, is an example of DSS. ESS. CDSS. MIS.
Answer:
ESS
Explanation:
Employee self-service (ESS) is a widely used human resources technology that enables employees to perform any job-related functions, such as applying for reimbursement, updating personal information and accessing company benefits information -- which was once largely paper-based, or otherwise would have been maintained by management or administrative staff.
Employee self-service is often available through the employer's intranet or portal. It can also be part of larger human capital management (HCM), enterprise resource planning (ERP) or benefits administration software, which is often delivered via SaaS platforms. Employee self-service software, once sold as a stand-alone product, is now usually incorporated into more comprehensive HR tech systems.
Employee self-service systems are being optimized for mobile more and more on social media-like platforms, and are often part of larger employee engagement strategies, which can include wellness programs, recognition, learning management systems and organization-wide social activities.
Define a struct named PatientData that contains two integer data members named heightInches and weightPounds. Sample output for the given program with inputs 63 115: c language
Answer:
Following are program to this question:
#include <stdio.h> //defining hader file
struct PatientData //defining structure PatientData
{
int heightInches, weightPounds; //defining integer variable
};
int main() //defining main method
{
struct PatientData pd= {63,115}; //creating structure object and assign value
printf("%d %d", pd.heightInches, pd.weightPounds); //print value
return 0;
}
Output:
63 115
Explanation:
The program to this question can be described as follows:
In this program, a structure "PatientData" is declared, in which two integer variables, that is "heightInches and weightPounds". Then the main method is declared, inside the main method, structure object "pd" is created, that assigns a value, that is "63 and 115", and uses the print method, that prints its value.Write a Python function isPrime(number) that determines if the integer argument number is prime or not. The function will return a boolean True or False. Next, write a function HowManyPrimes(P), that takes an integer P as argument and returns the number of prime numbers whose value is less than P. And then write a function HighestPrime(K) that takes integer K as an argument and returns the highest prime that is less than or equal to K.
Answer:
def test_prime(n):
if (n==1):
return False
elif (n==2):
return True;
else:
for x in range(2,n):
if(n % x==0):
return False
return True
print(test_prime(9))
Final answer:
The Python functions isPrime(number), HowManyPrimes(P), and HighestPrime(K) are used to check if a number is prime, count how many prime numbers are less than P, and find the highest prime number — respectively.
Explanation:
To determine if an integer number is prime, you can write a Python function isPrime(number). A simple way to do this is to check whether the number has any divisors other than 1 and itself. Here's a possible implementation:
def isPrime(number):
if number <= 1:
return False
for i in range(2, int(number**0.5) + 1):
if number % i == 0:
return False
return True
The function HowManyPrimes(P) can be written to count the number of prime numbers less than an integer P. Here is a function that uses isPrime to do that:
def HowManyPrimes(P):
count = 0
for number in range(2, P):
if isPrime(number):
count += 1
return count
To find the highest prime number that is less than or equal to a given integer K, you can create the function HighestPrime(K):
def HighestPrime(K):
for number in range(K, 1, -1):
if isPrime(number):
return number
return None