Answer:
Please see the explanation
Explanation:
ACM professional code has following characteristics:
Genaral moral Imperative- This further consists of:
Contribute to society and human well being
Avoid harm to others
Be honest and trustworthy
Honor property rights including copyrights and patent
Respect the privacy of other
2) Professional responsibilities
Acquire and maintain professional coompetence
Achieve the highest quality
Accept and provide appropriate professional review
Respect the existing laws
Access computing and communication resources only when authorized to do so.
3) Organizational leadership
Articulate social responsibilities of members of an organizational unit and encourage full acceptance of those responsibilities.
Manage personnel and resources to design and build information systems that enhance the quality of working life.
Ensure that users and those who will be affected by a system have their needs clearly articulated during the assessment and design of requirements; later the system must be validated to meet requirements.
Create opportunities for members of the organization to learn the principles and limitations of computer systems.
4) Compliance with Code
Uphold and promote the principles of this Code.
Treat violations of this code as inconsistent with membership in the ACM.
Software Engineering Code of Ethics and Professional Practice
In accordance with their commitment to the health, safety and welfare of the public, software engineers shall adhere to the following Eight Principles:
Public: Software engineers shall act consistently with the public interest.
Client and Employer: Software engineers shall act in a manner that is in the best interests of their client and employer, consistent with the public interest.
Product: Software engineers shall ensure that their products and related modifications meet the highest professional standards possible.
Judgement: Software engineers shall maintain integrity and independence in their professional judgment.
Management: Software engineering managers and leaders shall subscribe to and promote an ethical approach to the management of software development and maintenance.
Profession: Software engineers shall advance the integrity and reputation of the profession consistent with the public interest.
Colleagues: Software engineers shall be fair to and supportive of their colleagues.
Self: Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
Australian Code of Professional Conduct
As an ACS member you must uphold and advance the honour, dignity and effectiveness of being a professional. This entails, in addition to being a good citizen and acting within the law, your conformance to the following ACS values.
1. The Primacy of the Public Interest
You will place the interests of the public above those of personal, business or sectional interests.
2. The Enhancement of Quality of Life
You will strive to enhance the quality of life of those affected by your work.
3. Honesty
You will be honest in your representation of skills, knowledge, services and products.
4. Competence
You will work competently and diligently for your stakeholders.
5. Professional Development
You will enhance your own professional development, and that of your staff.
6. Professionalism
You will enhance the integrity of the ACS and the respect of its members for each other.
In a situation of conflict between the values, The Primacy of the Public Interest takes precedence over the other values.
This Code of Professional Conduct is aimed specifically at you as an individual practitioner, and
is intended as a guideline for your acceptable professional conduct. It is applicable to all ACS
members regardless of their role or specific area of expertise in the ICT industry
All the three codes focus on the public interest, honestl, loyalty, ensuring quality of life, and professional development.
In Australian Code of conduct, in a situation of conflict between the values, The Primacy of the Public
Interest takes precedence over the other values, while there is no such thing in other two codes.
Software Engineering Code of Ethics and Professional Practice includes development of self, that is, Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession, which is not usually seen in other two codes.
Write a Raptor program that will generate a random number between 1 and 100; do not display the randomly generated number. Let the user guess within 3 tries what the random number is. Display appropriate messages based on each try, for example, "1 remaining try" or "You guessed correctly!"
Final answer:
A Raptor program for a number guessing game involves generating a random number and using a loop to allow the user three tries to guess it, with messages for guidance and number of remaining tries.
Explanation:
Creating a Number Guessing Game in Raptor
When creating a number guessing game in Raptor, you need to leverage the program's ability to generate random numbers and manage user input. The program should generate a random number between 1 and 100 and give the user three attempts to guess it. Each attempt should be followed by a message guiding the user whether to guess higher or lower, and indicate the number of remaining tries. Upon correct guess or exhausting all attempts, the game ends with an appropriate message to the user.
Basic Structure of the Program
Generate a random number between 1 and 100.Set a counter for the number of tries initialized at 0.Use a while loop to run until the user has made 3 guesses.Prompt the user to enter a guess.Before the next guess, display a message indicating whether the user should guess higher or lower, and the number of tries remaining.If the guess is correct, display "You guessed correctly!" and end the loop.After all tries are used, if the user hasn't guessed correctly, provide a concluding message.For a list of numbers entered by the user and terminated by 0. Write a program to find the sum of the positive numbers and the sum of the negative numbers. (Hint: This is similar to an example in this chapter. Be sure to notice that the example given in this chapter counts the number of positive and negative numbers entered, but this problem asks you to find the sums of the positive and negative numbers entered Use Raptor in a reverse loop logic with no on left and yes on right.)
Final answer:
To find the sum of positive and negative numbers entered by the user, you can use a loop to continuously prompt the user for numbers until they enter 0. In each iteration, check if the number is positive or negative and update the respective sum variables.
Explanation:
To write a program that finds the sum of the positive and negative numbers entered by the user, you can use a loop to continually prompt the user for numbers until they enter 0. In each iteration, you can check if the entered number is positive or negative and update the respective sum variables accordingly. Here's an example program in Python:
positive_sum = 0
negative_sum = 0
while True:
number = int(input('Enter a number (0 to exit): '))
if number == 0:
break
elif number > 0:
positive_sum += number
else:
negative_sum += number
print(f'Sum of positive numbers: {positive_sum}')
print(f'Sum of negative numbers: {negative_sum}')
Write a program to store water usage data of 4 customers in a text file. The program asks the user to enter account number, customer type (R for residential or B for business), and number of gallons used for each of the 4 customers. Store the data in a text file named "water.txt". Overwrite old data in "water.txt" if the file already exists.
Answer:
with open('water.txt','w') as file:
i = 4
while i > 0:
accNo = input('Enter Account Number: ')
bType = input('Enter Customer Type R or B: ')
nGallons = input('Enter Number of gallons: ')
ls = ' '.join(['Account Number:', accNo,'\nType:', bType, '\nNumber Of gallons:',nGallons,'\n\n'])
file.write(ls)
i -= 1
Explanation:
The programming language used is python.
A file water.txt is created, and a counter is initialized to ensure data is collected for all the the customers.
A loop is created to collect the input of the four customers. The data is collected, assigned to a list and joined using the join method, to create a string of the data collected and it is written to the file.
Using a WITH statement allows a file to automatically close.
Write a program whose input is two integers and whose output is the two integers swapped.
Ex: If the input is:
3 8
then the output is:
8 3
Your program must define and call a function. SwapValues returns the two values in swapped order.
void SwapValues(int* userVal1, int* userVal2)
#include
/* Define your function here */
int main(void) {
/* Type your code here. Your code must call the function. */
return 0;
The program requires creating a SwapValues function to swap two integers in C and then calling this function from the main to output the swapped values.
The student is asking how to write a program in C that swaps two integers using a function. This involves understanding pointers, functions, and basic input/output in C programming.
The function SwapValues should be defined outside of the main function. Inside main, the program should accept two integers from the user, call the SwapValues function to swap them, and then output the swapped values.
Here is the complete program:
#include <stdio.h>Which of the following statements is incorrect?
Group of answer choices
O The semantic web captures, organizes, and disseminates knowledge (i.e., know-how) throughout an organization.
OThe semantic web describes the relationships between things.
O The semantic web is not about links between web pages.
O The semantic web describes the properties of things.
Answer:
O The semantic web captures, organizes, and disseminates knowledge (i.e., know-how) throughout an organization.
Explanation:
To understand the semantic web you need to understand that it's not about links between web pages. Rather it describes the relationship between things and the properties of things like size, price, weight, age.
The object-oriented database model supports _______________. That is, new objects can be automatically created by replicating some or all of the characteristics of one or more parent objects. Select one:
a. inheritance
b. morphing
c. duplication
d. cloning
Answer:
The correct option to the following question is an option (A) Inheritance.
Explanation:
Because Inheritance is the feature in which the child class can obtain the properties of the parent class.
So, that's why this option is true.
Morphing is not the model of object-oriented database and it is the effect in which we create our images with those who look like as I'm.
So, that's why this option is false.
Duplication is not the model of the object-oriented database and it is a process in which we create the image as like that thing.
So, that's why this option is false.
Cloning is also much like the duplication and it is also not the model of the object-oriented database.
So, that's why this option is false.
In the context of an object-oriented database model, inheritance allows new objects to automatically inherit characteristics from parent objects.
Explanation:The object-oriented database model supports inheritance. This means new objects can be automatically created by replicating some or all of the characteristics of one or more parent objects. In object-oriented programming languages, inheritance is a feature that allows a class to inherit attributes and methods from another class, enabling the reuse of existing code. This concept is akin to biological inheritance but in the context of software objects. In terms of databases, an object-oriented database model would leverage this property to create new entity instances or objects that inherit properties from existing ones.
45, 78, 23, 12, 63, 90, 38, 56, 88, 15 Using the sequential search as described in this chapter, how many comparisons are required to find whether the following items are in the list? (Recall that by comparisons we mean item comparisons, not index comparisons.)
a. 90
b. 14
c. 45
d. 23
e. 5
Explanation:
By using the sequential search we find the following results.
The first key is 90 and its comparison number is 6. The second key is 14 and its comparison number is 10. The third key is 45 and its comparison number is 1. The fourth key is 23 and its comparison number is 3. The fifth key is 5 and its comparison number is 10.In function main prompt the user for a time in seconds. Call a user defined function to calculate the equivalent time in hours, minutes, and seconds. Parameters should be the time in total seconds and pointers to the hours, minutes, and seconds. Print the equivalent in hours, minutes, and seconds in function main. Test with a value of 36884 seconds Output should look something like this: 5000 seconds can be broken into 1 hour 23 minutes and 20 seconds"
Answer:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout<<"Enter time in seconds:";
int time, hour, minutes, seconds,initialTime;
cin>>time;
initialTime = time;
hour = floor(time / 3600);
time = time % 3600;
minutes = floor(time / 60);
time = time % 60;
seconds = time;
cout<< initialTime<<" can be broken down into: "<<endl;
cout<<hour << " hour(s)"<<endl;
cout<<minutes <<" minutes"<<endl;
cout<<seconds <<" seconds"<<endl;
return 0;
}
Explanation:
The programming language use is c++
The module cmath was called to allow me perform some math operations like floor division, and the Iostream allows me to print output to the screen. Using namespace std allows me to use classes from the function std.
I prompt the user to enter time in second, then declare all the variables that will be used which include time, hour, minutes, seconds and initialTime.
initialTime is used to hold the the time input entered by the user and will be printed at the end no arithmetic operation is carried out on it.
Floor division (returns the quotient in a division operation) and Modulo (returns the remainder in a division operation) division is used to evaluate the hours, the minutes and the seconds.
The final answers are then printed to the screen.
I have uploaded the c++ file and a picture of the code in action
Write a function named "sort_by_product" that takes a list/array of lists/arrays as a parameter where each of the values of input is a list containing 6 floating point numbers. Sort the input based on multiplication of the sixth and second values in each list
Answer:
Following are the program in the Python Programming Language:
def sort_by_product(products): #define function
products.sort(key=lambda x: x[4] * x[1]) #solution is here
return products #return products
#set list type variable
product = [
[1, 2, 9, 1, 1, 2],
[1, 7, 9, 9, 7, 2],
[1, 1, 9, 5, 2, 2],
[1, 5, 9, 4, 6, 2],
]
sort_by_product(product) #call function
print(product) #print result
Explanation:
Here, we define function "sort_by_product" and pass an argument inside it.
inside the function we sort the list and writr the following solution in it.we return the value of productsThen, we set the list type variable 'product' then, call the function.
Assume that a 5 element array of type string named boroughs has been declared and initialized. Write the code necessary to switch (exchange) the values of the first and last elements of the array. So, for example, if the array's initial values were: brooklyn queens staten_island manhattan bronx then after your code executed, the array would contain: bronx queens staten_island manhattan brooklyn
Answer:
Explanation:
Let's do this in python. First we can set a placeholder variable to hold the first element of the array, then we can set that first element to the last element (5th) of that array. Then we set the last element of that array to the placeholder, which has value of the original first element of the array
placeholder = boroughs[0] # in python, 0 is the first element or arra
boroughs[0] = boroughs[-1] # -1 means the last element of the array
boroughs[-1] = placeholder
In an If-Then-Else statement, the Else clause marks the beginning of the statements to be executed when the Boolean expression is ________.
Answer:
False
Explanation:
The definition for the If-Then-Else structure is as follows:
IF (boolean_condition)
THEN (commands_for_true)
ELSE (commands_for_false)
When there is an ELSE sentence, its commands are to be executed whenever previous conditions where not evaluated as true .
Final answer:
The correct answer is False. In programming, the Else clause in an If-Then-Else statement is executed when the Boolean expression is false. It's a key component of conditional statements, directing the flow of the program when conditions are not met.
Explanation:
In an If-Then-Else statement, the Else clause marks the beginning of the statements to be executed when the Boolean expression is false. Essentially, the If-Then-Else statement is a form of conditional statement that controls the flow of execution in a program. The structure typically looks like IF X, THEN Y, ELSE Z, where X is the condition, Y is the statement block executed if the condition X evaluates to true, and Z is the statement block executed if the condition X evaluates to false. Here, X is a Boolean expression, indicating a condition that evaluates to either true or false.
An If-Then-Else statement ensures that one out of two possible paths of execution is followed in the program. If the condition in the IF clause is true, the code following the THEN keyword is executed. If the condition is false, the code following the ELSE keyword is executed, hence the critical role of the ELSE clause is to handle the scenario where the condition evaluates as false.
Which of the following is no an example of virtualization software that can be used to install Linux within another operating system?
a. VMWare
b. Microsoft Hyper-V
c. Spiceworks
d. Oracle VirtualBo
Answer:
C. Spiceworks
Explanation:
Spiceworks is the answer as it is not an example of virtualization software. The other options (VMWare, Microsoft Hyper-V and Oracle VirtualBox) are all example of virtualization software that can be use to install Linux within another operating system.
Spiceworks is not an example of virtualization software; it is used for network monitoring and help desk ticketing.
Explanation:The student is asking about virtualization software that can be used to install Linux within another operating system. The correct answer is c. Spiceworks. VMWare, Microsoft Hyper-V, and Oracle VirtualBox are all examples of virtualization platforms that allow for the creation and management of virtual machines (VMs) where one can install various operating systems, including Linux. Spiceworks, however, is a software that offers network monitoring and help desk ticketing, not virtualization.
Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by each candidate. The program should then output each candidate’s name, the votes received by that candidate. Your program should also output the winner of the election. A sample output is: Candidate Votes Received % of Total Votes Johnson 5000 25.91 Miller 4000 20.73 Duffy 6000 31.09 Robinson 2500 12.95 Ashtony 1800 9.33 Total 19300 The Winner of the Election is Duffy.
Answer:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string names[5];
int votes[5];
for(int i=0;i<5;i++)
{
cout<<"Enter candidate name"<<endl;
getline(cin,names[i]);
cout<<"Enter candidate votes"<<endl;
cin >> votes[i];
cin.ignore();
}
int total_votes=0;
int max =-1;
int max_val=0;
for(int i=0;i<5;i++)
{
total_votes=total_votes+votes[i];
if(max_val<votes[i])
{
max_val=votes[i];
max=i;
}
}
cout<<"Total votes"<<total_votes<<endl;
for(int i=0;i<5;i++)
{
float per=(votes[i]/total_votes)*100;
cout<<"float per"<<per<<endl;
cout<<" "<<names[i]<<" "<<votes[i]<<" "<<per<<" %" <<endl;
}
cout<<"Winner is "<<names[max]<<" "<<votes[max]<<endl;
return 0;
}
Explanation:
Define a string array of size 5 for names. Define one integer array of size 5 for votes. Take input from user in loop for string array and int for votes.
In another loop find maximum of the list and sum all the votes. Store max votes index in max variable. In another loop display names along with their votes and percentage.
Display winner name and votes using max as index for name and votes array.
Write a loop that reads in a collection of words and builds a sentence out of all the words by appending each new word to the string being formed. For example, if the three words This, is, one are entered, your sentence would be "this", then "This is", and finally "This is one". Exit your loop when a word that ends with a period is entered or the sentence being formed is longer than 20 words or contains more than 100 letters. Do not append a word if it was previously entered
Answer:
#section 1
import re
wordcount = 0
lettercount = 0
words = ['This', 'is', 'one','one', 'great','Dream.', 'common', 'hella', 'grade','grace','honesty','diligence','format','young',]
sentence = []
#section 2
for a in words:
wordcount = wordcount + 1
for i in a:
lettercount= lettercount + 1
if a not in sentence:
sentence.append(a)
if lettercount > 100:
break
if wordcount > 20:
break
if re.search('(\w+\.$)', a):
break
sentence = ' '.join(sentence)
print(sentence)
Explanation:
The programming language used is python.
#section 1
The regular expression module is imported because we need to use it to determine if a word entered ends with a full-stop.
Two variables are initialized to hold the number of words and the number of letters and an empty list is created to hold the sentence that is going to be created.
A collection of words are placed in a list in order test the code.
#section 2
Two FOR loops and a group of IF statements are used to check if the words entered satisfy any of the conditions.
The first FOR loop counts the number of words and the second one counts the number of letters.
The first IF statement checks to make sure the word has not been added to the sentence list and adds it if not present, while the next two IF statements check the word count and letter count to ensure that they have not exceeded 20 or 100 respectively and if they exceed, the loop is broken. The last IF statement uses regular expression to check if a word ends with a full-stop and if it does, it breaks the the loop.
Finally, the sentence list is joined and the sentence is printed to the screen.
A CPU with interrupt driven I/O is busy servicing a disk request. While the CPU is midway through the disk-service routine, another I/O interrupt occurs.
a. What happens next?
b. Is it a problem?
c. If not, why not? If so, what can be done about it?
Answer:
Working scenario:When a CPU is working with interrupt driven I/O scheme, it will control the I/O interrupt on the basis of priority. This means that interrupts with higher priority will be processed first and others will be processed later.
Part (a)When the CPU is busy servicing a disk request and another I/O interrupt occurs, the CPU will check the priority line (assigned during design phase) of both the interrupts and then decides the precedence from both of them.
When the CPU gets ready to process the interrupt, an Interrupt Acknowledge signal (INTA) is sent back in return to interrupt signal (INT).
Part(b)Occurring of interrupts while the CPU is midway through the disk-service is not a problem. It can happen normally.
Part (c)Occurring of interrupts while the CPU is midway through the disk-service is not a problem, the CPU just picks the multiple interrupts checks the priority line and processes one of the multiple interrupts based on the highest priority matter.
i hope it will help you!
Write a program that asks the user for several days' temperatures and computes the average temperature for that period and how many days were above average. First ask the user how many days he\she wants to calculate the average for. Then create an array with that number and ask for the temperature of each day. Store the temps in the array. Then find the average and the number of days above that average. Print the results to the screen.
Answer:
#section 1
no_of_days= int(input('How many days are we geting the average for: '))
tem=[]
for i in range(no_of_days):
a= int(input('Enter temperaure: input ' + str(i+1)+' :'))
tem.append(a)
#section 2
average = round(sum(tem)/len(tem),2)
print('The Average is ',average)
gdays=[]
for i in tem:
if i > average:
gdays.append(i)
print('The following days are greater than the average: ',gdays)
Explanation:
The above code is written in python 3
#section 1:
An input is gotten for number of days that is to be used in the calculation, and an array is created to hold the temperature that will be inputted into the program.
A range of values from [0 - (no_of_days - 1)] is created from the number of days entered, this is done so that the FOR loop can iterate through every number and call for inputs.
The FOR loop prompts the user for an input based on the range and passes that input to an integer data type before appending it to the tem array.
#section 2:
The sum of the new list and the length is used to calculate the average and the it is rounded up to 2 DP, The average is then printed to the screen.
Another FOR loop is used to check which of the days are greater than the average and passes it to another array (gdays), this array is also printed to the screen.
check the attachment to see how the code works.
The merger of various structured techniques (especially data-driven information engineering) with prototyping techniques and joint application techniques to accelerate systems development is known as:A) Application architectureB) Object-oriented designC) Model-driven designD) Rapid application developmentE) None of these
Answer:
The correct option to the following question is an option (D) Rapid application development.
Explanation:
The RAD(Rapid application development) or the JAD(Joint application development) both are the function of the software development by which an organization can take an informed decision that which is best on the projects of software development.
Both are the functions of the software development process.
What is Scrum?
1. A routine method of deploying deliverables to operations
2. A process for continuously maintaining deployment readiness
3. A lightweight process for cross-functional, self-organized teams
4. A methodology used to deliver usable and reliable solutions to the end user
Answer:
A lightweight process for cross-functional, self-organized teams.
Explanation: The process in which teams are cross functional and self organizing to complete a particular task. This term is used in software development. Progress towards well defined goal with by emphasizing on teamwork and accountability.
Scrum is option 3. a lightweight process for cross-functional, self-organized teams, emphasizing structured roles and regular, brief meetings.
Option 3. Scrum is a lightweight process for cross-functional, self-organized teams. It is widely used in the IT industry and is a focused and organized approach compared to general agile development. Scrum teams operate using defined roles, such as the Scrum Master, and follow structured activities, including daily stand-up meetings to ensure progress and address obstacles.
The process is characterized by:
Product backlogs that contain evolving requirements.Sprint backlogs that dictate tasks for each sprint, typically shorter than 30 days.Self-organizing teams that coordinate tasks independently with the support of a Scrum Master.Short, daily meetings where team members discuss their progress and challenges.Throughout the Scrum workflow, the goal is to incrementally develop and deliver functional project components, ensuring continuous improvement and stakeholder collaboration.
Write a method maxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the method in a program that takes two integer inputs, and outputs the largest magnitude value.Ex: If the inputs are:5 7the method returns:7Ex: If the inputs are:-8 -2the method returns:-8Note: The method does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the absolute-value built-in math method.Your program must define and call a method:public static int maxMagnitude(int userVal1, int userVal2)What I have so far:import java.util.Scanner;public class LabProgram {/* Define your method here */public static void main(String[] args) {/* Type your code here */}
The Java program defines a method `maxMagnitude` to find and return the integer with the larger magnitude. It takes two user inputs, calls the method, and prints the result.
To achieve the desired functionality, you can create a method called `maxMagnitude` that takes two integer parameters and returns the one with the larger magnitude. Additionally, you can use the `Math.abs` method to calculate the absolute value.
Here's the complete Java program:
```java
import java.util.Scanner;
public class LabProgram {
public static int maxMagnitude(int userVal1, int userVal2) {
int absVal1 = Math.abs(userVal1);
int absVal2 = Math.abs(userVal2);
return absVal1 > absVal2 ? userVal1 : userVal2;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Get user inputs
System.out.print("Enter the first integer: ");
int input1 = sc.nextInt();
System.out.print("Enter the second integer: ");
int input2 = sc.nextInt();
// Call the method and print the result
int result = maxMagnitude(input1, input2);
System.out.println("The largest magnitude value is: " + result);
}
}
```
In this program, the `maxMagnitude` method calculates the absolute values of the input integers and returns the one with the larger magnitude. The `main` method takes two user inputs, calls the `maxMagnitude` method, and prints the result.
Write a function called GenMatBorder that takes an array of numbers and produces an array called OutMat, which replaces the top row, bottom row, left column, and right column of the input array with zeros. Restrictions: Do not use loops.
Answer:
clc;
clear all;
function[outMat]=GenMatBorder(inMat)
[row,col]=size(inMat);
frame=ones(row,col);
frame(2:row-1,2:col-1)=0;
inMat(logical(frame))=0;
outMat=inMat;
end
Explanation:
clc and clear all are used to clear all previous garbage values.A function is declared that gives a matrix named outMat. BenMatBorder is the function name that has a parameter inMat passed as reference.The number of rows and columns from the given matrix are stored to make another matrix frame.frame is another matrix that has same order as given matrix and ha all values equal to 1.Now the values except of border entries(top row, bottom row, left column, and right column ) of frame are set to zero.The logical command is used that says wherever the frame value is true (1) make it equal to 0.So all the border entries (top row, bottom row, left column, and right column ) will become zero stored in inMatNow make outMat = inMat to store the matrix into outMat.end will exit the function.Now whenever an initialized matrix is given as a parameter to the function GenMatBorder, it will give the output by making border elements zero.
i hope it will help you!
Final answer:
The function GenMatBorder takes an array of numbers and replaces the border elements with zeros using the numpy library in Python.
Explanation:
The function GenMatBorder can be implemented using Python. Here is an example code:
import numpy as np
def GenMatBorder(arr):
m, n = arr.shape
out_mat = np.copy(arr)
out_mat[0,:] = 0
out_mat[m-1,:] = 0
out_mat[:,0] = 0
out_mat[:,n-1] = 0
return out_mat
This function uses the numpy library to work with arrays. In the code, the top row, bottom row, left column, and right column of the input array are replaced with zeros, and the modified array is returned as OutMat.
When an author produce an index for his or her book, the first step in this process is to decide which words should go into the index; the second is to produce a list of the pages where each word occurs. Instead of trying to choose words out of our heads, we decided to let the computer produce a list of all the unique words used in the manuscript and their frequency of occurrence. We could then go over the list and choose which words to put into the index.
The main object in this problem is a "word" with associated frequency. The tentative definition of "word" here is a string of alphanumeric characters between markers where markers are white space and all punctuation marks; anything non-alphanumeric stops the reading. If we skip all un-allowed characters before getting the string, we should have exactly what we want. Ignoring words of fewer than three letters will remove from consideration such as "a", "is", "to", "do", and "by" that do not belong in an index.
In this project, you are asked to write a program to read any text file and then list all the "words" in alphabetic order with their frequency together appeared in the article. The "word" is defined above and has at least three letters.
Answer:
import string
dic = {}
book=open("book.txt","r")
# Iterate over each line in the book
for line in book.readlines():
tex = line
tex = tex.lower()
tex=tex.translate(str.maketrans('', '', string.punctuation))
new = tex.split()
for word in new:
if len(word) > 2:
if word not in dic.keys():
dic[word] = 1
else:
dic[word] = dic[word] + 1
for word in sorted(dic):
print(word, dic[word], '\n')
book.close()
Explanation:
The code above was written in python 3.
import string
Firstly, it is important to import all the modules that you will need. The string module was imported to allow us carry out special operations on strings.
dic = {}
book=open("book.txt","r")
# Iterate over each line in the book
for line in book.readlines():
tex = line
tex = tex.lower()
tex=tex.translate(str.maketrans('', '', string.punctuation))
new = tex.split()
An empty dictionary is then created, a dictionary is needed to store both the word and the occurrences, with the word being the key and the occurrences being the value in a word : occurrence format.
Next, the file you want to read from is opened and then the code iterates over each line, punctuation and special characters are removed from the line and it is converted into a list of words that can be iterated over.
for word in new:
if len(word) > 2:
if word not in dic.keys():
dic[word] = 1
else:
dic[word] = dic[word] + 1
For every word in the new list, if the length of the word is greater than 2 and the word is not already in the dictionary, add the word to the dictionary and give it a value 1.
If the word is already in the dictionary increase the value by 1.
for word in sorted(dic):
print(word, dic[word], '\n')
book.close()
The dictionary is arranged alphabetically and with the keys(words) and printed out. Finally, the file is closed.
check attachment to see code in action.
As related to the use of computers, ____ is defined as gaining unauthorized access or obtaining confidential information by taking advantage of the trusting human nature of some victims and the naivety of others.
A. DoS
B. social engineering
C. DRM
D. scamming
Answer:
Option(B) i.e., social engineering is the correct option to the question.
Explanation:
The following option is correct because social engineering is the type of attack in which the criminals tricks the computer users to disclose the confidential data or information. Criminals or hackers use this trick because by this they can easily take advantage of your confidential information or corporate secrets.
What is the difference between phishing and pharming?
A. Phishing is not illegal, pharming is illegal
B. Phishing is the right of the company, where pharming is the right of the individual
C. Phishing is a technique to gain personal information for the purpose of identity theft, and pharming reroutes requests for legitimate websites to false websites
D. All of these are correct
Answer:
Option C. Phishing is a technique to gain personal information for the purpose of identity theft, and pharming reroutes requests for legitimate websites to false websites.
is the correct answer.
Explanation:
Phishing is define as a technique to gain personal information for the purpose of identity theft that may be used by hackers. They may send you malicious email that may look like legitimate ones but are the ones that trick you.Pharming is defined as the fraudulent practice that reroutes requests for legitimate websites to false websites. It can even occur by simply clicking the authentic link or type in the website URL.i hope it will help you!
What is VoIP?
A. VoIP uses IP technology to transmit telephone calls
B. VoIP offers the low cost ability to receive personal and business calls via computer
C. VoIP offers the ability to have more than one phone number
D. All of these are correct
Answer:
D. All of these are correct
Explanation:
VoIP transmits voice data packets over the internet. It is a low-cost option for receiving personal and business calls because it uses existing infrastructure that is the internet to transmit calls, unlike traditional telephone systems that require specialized equipment such as PBXs that are costly.VoIP also offers the ability to have more than one telephone number, as long as the bandwidth is enough, it allows multiple connections at any given time.
A term coined to collectively describe any information presented in a format other than traditional numbers, codes and words; including: graphics, sound, pictures and animation, is:A) multimodalB) graphicalC) zonedD) multimediaE) none of these
Answer:
The answer is letter D
Explanation:
A term coined to collectively describe any information presented in those formats is Multimedia
Given six memory partitions of 300 KB, 600 KB, 350 KB, 200 KB, 750 KB, and 125 KB (in order), how would the first-fit, best-fit, and worst-fit algorithms place processes of size 115 KB, 500 KB, 358 KB, 200 KB, and 375 KB (in order)? Rank the algorithms in terms of how efficiently they use memory.
Answer:
In terms of efficient use of memory: Best-fit is the best (it still have a free memory space of 777KB and all process is completely assigned) followed by First-fit (which have free space of 777KB but available in smaller partition) and then worst-fit (which have free space of 1152KB but a process cannot be assigned). See the detail in the explanation section.
Explanation:
We have six free memory partition: 300KB (F1), 600KB (F2), 350KB (F3), 200KB (F4), 750KB (F5) and 125KB (F6) (in order).
Using First-fit
First-fit means you assign the first available memory that can fit a process to it.
115KB will fit into the first partition. So, F1 will have a remaining free space of 185KB (300 - 115).500KB will fit into the second partition. So, F2 will have a remaining free space of 100KB (600 - 500)358KB will fit into the fifth partition. So, F5 will have a remaining free space of 392KB (750 - 358)200KB will fit into the third partition. So, F3 will have a remaining free space of 150KB (350 -200)375KB will fit into the remaining partition of F5. So, F5 will a remaining free space of 17KB (392 - 375)Using Best-fit
Best-fit means you assign the best memory available that can fit a process to the process.
115KB will best fit into the last partition (F6). So, F6 will now have a free remaining space of 10KB (125 - 115)500KB will best fit into second partition. So, F2 will now have a free remaining space of 100KB (600 - 500)358KB will best fit into the fifth partition. So, F5 will now have a free remaining space of 392KB (750 - 358)200KB will best fit into the fourth partition and it will occupy the entire space with no remaining space (200 - 200 = 0)375KB will best fit into the remaining space of the fifth partition. So, F5 will now have a free space of 17KB (392 - 375)Using Worst-fit
Worst-fit means that you assign the largest available memory space to a process.
115KB will be fitted into the fifth partition. So, F5 will now have a free remaining space of 635KB (750 - 115)500KB will be fitted also into the remaining space of the fifth partition. So, F5 will now have a free remaining space of 135KB (635 - 500)358KB will be fitted into the second partition. So, F2 will now have a free remaining space of 242KB (600 - 358)200KB will be fitted into the third partition. So, F3 will now have a free remaining space of 150KB (350 - 200)375KB will not be assigned to any available memory space because none of the available space can contain the 375KB process.Based on the efficient use of memory, the algorithm are ranked as:
Best fit.First fit.Worst fit.
Given the following data:
M1 = 300 KB.M2 = 600 KB.M3 = 350 KB.M4 = 200 KB.M5 = 750 KB.M6 125 KB.P1 = 115 KB.P2 = 500 KB.P3 = 358 KB.P4 = 200 KB.P5 = 375 KB.What is a first-fit algorithm?A first-fit algorithm can be defined as the simplest technique of allocating memory block to processes by assigning the first available memory.
For P1 with a memory size of 115 KB, it would fit into the first memory partition.
[tex]M_1=300-115\\\\M_1=185\;KB[/tex]
For P2 with a memory size of 600 KB, it would fit into the second memory partition.
[tex]M_2=600-500\\\\M_2=100\;KB[/tex]
For P3 with a memory size of 358 KB, it would fit into the fifth memory partition.
[tex]M_5=750-358\\\\M_5=392\;KB[/tex]
For P4 with a memory size of 200 KB, it would fit into the third memory partition.
[tex]M_3=350-200\\\\M_3=150\;KB[/tex]
For P5 with a memory size of 375 KB, it would fit into the remaining fifth memory partition.
[tex]M_5=392 - 375\\\\M_5=17\;KB[/tex]
What is a best-fit algorithm?A best-fit algorithm can be defined as the technique of allocating memory block to processes by assigning the smallest partition size that can store the process.
For P1 with a memory size of 115 KB, it would best fit into the sixth memory partition.
[tex]M_6=125-115\\\\M_6=10\;KB[/tex]
For P2 with a memory size of 600 KB, it would best fit into the second memory partition.
[tex]M_2=600-500\\\\M_2=100\;KB[/tex]
For P3 with a memory size of 358 KB, it would best fit into the fifth memory partition.
[tex]M_5=750-358\\\\M_5=392\;KB[/tex]
For P4 with a memory size of 200 KB, it would best fit into the fourth memory partition.
[tex]M_3=200-200\\\\M_3=0\;KB[/tex]
For P5 with a memory size of 375 KB, it would best fit into the remaining fifth memory partition.
[tex]M_5=392 - 375\\\\M_5=17\;KB[/tex]
What is a worst-fit algorithm?A worst-fit algorithm can be defined as the technique of allocating memory block to processes by assigning the largest partition size that can store the process.
For P1 with a memory size of 115 KB, it would fit into the fifth memory partition.
[tex]M_6=750-125\\\\M_6=635\;KB[/tex]
For P2 with a memory size of 500 KB, it would fit into the remaining fifth memory partition.
[tex]M_5=635 - 500\\\\M_5=135\;KB[/tex]
For P3 with a memory size of 358 KB, it would fit into the second memory partition.
[tex]M_5=600 - 358\\\\M_5=242\;KB[/tex]
For P4 with a memory size of 200 KB, it would fit into the third memory partition.
[tex]M_3=350 - 200\\\\M_3=150\;KB[/tex]
For P5 with a memory size of 375 KB, it would best fit into any of the memory partition that is available.
Read more on memory partition here: https://brainly.com/question/24593920
B. Write a function that takes one double parameter, and returns a char. The parameter represents a grade, and the char represents the corresponding letter grade. If you pass in 90, the char returned will be ‘A’. If you pass in 58.67, the char returned will be an ‘F’ etc. Use the grading scheme on the syllabus for this course to decide what letter to return.
Answer:
#include <iostream>
#include <cstdlib>
using namespace std;
char grade(double marks){
if(marks>=90)
{
return 'A';
}
else if (marks >=80 && marks<90)
{
return 'B';
}
else if (marks >=70 && marks<80)
{
return 'C';
}
else if (marks >=60 && marks<70)
{
return 'D';
}
else if ( marks<60)
{
return 'F';
}
}
int main()
{
double marks;
cout <<"Ener marks";
cin >>marks;
char grd=grade(marks);
cout<<"Grae is "<<grd;
return 0;
}
Explanation:
Take input from user for grades in double type variable. Write function grade that takes a parameter of type double as input. Inside grade function write if statements defining ranges for the grades. Which if statement s true for given marks it returns grade value.
In main declare a variable grd and store function returned value in it.
Write a program that gets a list of integers from input, and outputs the integers in ascending order (lowest to highest). The first integer indicates how many numbers are in the list. Assume that the list will always contain less than 20 integers.Ex: If the input is 5 10 4 39 12 2, the output is: 2 4 10 12 39Your program must define and call the following method. When the SortArray method is complete, the array passed in as the parameter should be sorted.
Answer:
Explanation:
Since no programming language is stated, I'll use Microsoft Visual C# in answering this question.
// C# program sort an array in ascending order
using System;
class SortingArray {
int n; //number of array elements
int [] numbers; //Array declaration
public static void Main() {
n = Convert.ToInt32(Console.ReadLine());
numbers = new int[n];
for(int i = 0; i<n; I++)
{
numbers [n] = Convert.ToInt32(Console.ReadLine());
}
SortArray();
foreach(int value in numbers)
{
Console.Write(value + " ");
}
}
void SortArray()
{
int temp;
// traverse 0 to array length
for (int i = 0; i < numbers.Length - 1; i++)
// traverse i+1 to array length
for (int j = i + 1; j < numbers.Length; j++){
// compare array element with all next element
if (numbers[i] < numbers[j])
{
temp = numbers[i];
numbers[i] = numbers[j];
numbers[j] = temp;
}
}
}
Which of the following describes authentication?
The process of confirming the identity of a user
Confidence in the expectation that others will act in your best interest or that a resource is authentic
A small network, workgroup, or client/server, deployed by a small business, a home-based business, or just a family network in a home
A stated purpose or target for network security activity
Answer:
A.
Explanation:
Authentication is the process of confirming the identity of a user.
In addition to key executives, there are other positions in a company that may be considered critical, or whose loss will be difficult for the company. What will happen if a network administrator leaves? What customers or contacts would the company lose if a sales representative leaves? What other positions can you name where a loss would have a potentially significant negative effect on the company?
Answer:
Explanation:
Every employee who works for a company plays an important role in his field. some of the key employees of a company is sales representative, marketing executives, human resource managers, etc
whereas in manufacturing sector additional employees are developers, manufacturing workers, quality testers, etc, which when leaves a company, there is always a chance for the employee to join the competitors which is a threat to integrity of a company
Plus particular field becomes unstable for that time until a good employee hire again for the same position.
If a network administrator leaves, the company may suffer from their network issues. as a network administrator maintain networks, troubleshoot with any network problem, checks the security of the network and many more, he plays a very important role in the company.
If a sales representative leaves the job from the company, sometimes it results as a great loss of a company as a sales representative is in direct contact with customers, and when they leave a job there are chances that they carry the customer with them which results in loss of business.