Answer:
#Declare variable to get the input
#list from the user
input_list = input()
#split the list into words by space
list = input_list.split()
#Begin for-loop to iterate each word
#to get the word frequency
for word in list:
#get the frequency for each word
frequency=list.count(word)
#print word and frequency
print(word,frequency)
Explanation:
This program that we are told to write will be done by using python programming language/ High-level programming language.
The question wants us to write a program in which the output will be as below;
hey 1
hi 2
Mark 1
hi 2
mark 1
Just by imputing hey hi mark hi mark.
Just copy and run the code below.
#Declare variable to get the input
#list from the user
input_list = input()
#split the list into words by space
list = input_list.split()
#Begin for-loop to iterate each word
#to get the word frequency
for word in list:
#get the frequency for each word
frequency=list.count(word)
#print word and frequency
print(word,frequency)
In this exercise we have to use the knowledge in computational language in python to write the following code:
We have the code can be found in the attached image.
So in an easier way we have that the code is
input_list = input()
list = input_list.split()
for word in list:
frequency=list.count(word)
print(word,frequency)
See more about python at brainly.com/question/18502436
The IBM 370 mainframe computer was introduced in 1970. The 370 Model 145 could hold up to 524,288 bytes of data (512 Kbytes). It cost $1,783,000.00 to buy (or $37,330/month to rent). A notebook computer today holds 16 Gbytes of memory and costs $2,500 to buy. If you assume that 100% of the price is just the memory, for both computers:
• how much did 1 Kbyte of memory in the IBM computer cost?
• how much does 1 Kbyte of memory in the laptop cost?
• how many times cheaper is the memory in the laptop than memory in the mainframe?
• what factor is today’s computer cheaper than the IBM 370?
Answer:
a) $3482.4 per Kbyte
b) $0.000149 per Kbyte
c) The laptop is 23369991 times cheaper than the mainframe computer
d) Today's computer is 23369991 times cheaper than IBM 370
Explanation:
a) The 370 Model 145 could hold up to 524,288 bytes of data
one Kb = 1024 bytes, therefore 524,288 bytes = 524288/1024 Kbytes= 512 Kbytes. It cost $1,783,000.00 to buy (or $37,330/month to rent).
Since 100% of the price is just the memory
Cost per 1 Kb = cost of computer / memory
Cost per 1 Kb = $1,783,000 / 512 Kb = $3482.4 per Kbyte
b) A notebook computer today holds 16 Gbytes of memory
one Kb = 1024 bytes, 1024 Kb = 1 Mbyte, 1024 Mbytes = 1 Gbyte.
Therefore 16 Gbytes = (16 * 1024 * 1024) Kbytes = 16777216 Kbytes. It cost $2500 to buy
Since 100% of the price is just the memory
Cost per 1 Kb = cost of computer / memory
Cost per 1 Kb = $2500 /16777216 Kb = $0.000149 per Kbyte
c) Cost per 1 Kb for mainframe/ Cost per 1 Kb for laptop = $3482.4 per Kbyte / $0.000149 per Kbyte = 23369991
The laptop is 23369991 times cheaper than the mainframe computer
d) Today's computer is 23369991 times cheaper than IBM 370
Which of the following are true of trademarks?
Check all of the boxes that apply.
They protect logos.
They protect fabric.
They show who the maker of the item is.
They can be registered with the government.
Answer:
A, C, D
They protect logos
They show who the maker of the item is.
They can be registered with the government
Explanation:
The following are true of trademarks:
They protect logos.
They show who the maker of the item is.
They can be registered with the government.
A trademark is a type of intellectual property consisting of a recognizable sign, design, or expression which identifies products or services of a particular source from those of others. A trademark exclusively identifies a product as belonging to a specific company and recognizes the company's ownership of the brand.
Trademarks protect logos, show who the maker of the item is and can be registered with the government.
Find out more on trademark at: https://brainly.com/question/11957410
The common field cricket chirps in direct proportion to the current temperature. Adding 40 to the number of times a cricket chirps in a minute, then dividing by 4, gives us the temperature (in Fahrenheit degrees). Write a program that accepts as input the number of cricket chirps in fifteen seconds, then outputs the current temperature
Answer:
This program is written in Java programming language;
First, you should understand that:
The formula given in the question implies that the current temperature can only be calculated using measurement of time in minutes;
Given that the number of chirps is directly proportional to the temperature.
If the cricket made n chirps in 15 seconds, it will make n * (60/15) chirps in 1 minutes;
n * (60/15) = n * 4
Base on this analysis, the program is as follows
import java.util.*;
public class cricket
{
public static void main(String []args)
{
//Declare number of chips in 1 minutes
int num;
Scanner input = new Scanner(System.in);
//Prompt user for input
System.out.print("Number of chirps (in 15 seconds): ");
num = input.nextInt();
//Calculate temperature (multiply temperature by 4 to get number of chirps in minutes
double temp = (num * 4+ 40)/4;
//Print temperature
System.out.print("Current Temperature = "+temp+" F");
}
}
Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to print two random integers between (and including) 0 and 9. End with a newline. Ex: 5 7 Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again. (Notes)
GIVEN:
#include
#include // Enables use of rand()
#include // Enables use of time()
int main(void) {
int seedVal = 0;
/* Your solution goes here */
return 0;
}
2). Type two statements that use rand() to print 2 random integers between (and including) 100 and 149. End with a newline. Ex:
101
133
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, srand() has already been called; do not call srand() again.
GIVEN:
#include
#include // Enables use of rand()
#include // Enables use of time()
int main(void) {
int seedVal = 0;
seedVal = 4;
srand(seedVal);
/* Your solution goes here */
return 0;
}
Answer:
1. The solution to question 1 is as follows;
srand(seedVal);
cout<<rand()%10<<endl;
cout<<rand()%10<<endl;
2. The solution to question 2 is as follows
cout<<100+rand()%50 <<endl;
cout<<100+rand()%50 <<endl;
Explanation:
The general syntax to generate random number between interval is
Random Number = Lower Limit + rand() % (Upper Limit - Lower Limit + 1)
In 1;
The solution starts by calling srand(seedVal);
The next two statements is explained as follows
To print two random integers between intervals of 0 and 9 using rand()"
Here, the lower limit = 0
the upper limit = 9
By substituting these values in the formula above; the random number will be generated as thus;
Random Number = 0 + rand() % (9 - 0 + 1)
Random Number = 0 + rand() % (10)
Random Number = rand() % (10)
So, the instruction to generate the two random variables is rand() % (10)
2.
Similar to 1 above
To print two random integers between intervals of 100 and 149 using rand()"
Here, the lower limit = 100
upper limit = 149
By substituting these values in the formula above; the random number will be generated as thus;
Random Number = 100 + rand() % (149 - 100 + 1)
Random Number = 100 + rand() % (50)
So, the instruction to generate the two random variables is 100 + rand() % (50)
The main() module in the starter code below takes integar inputs separated by commas from the user and stores them in a list. Then, it allows the user to manipulate the list using 3 functions:
mutate_list() takes 3 parameters -- a list, index number, and a value -- and inserts the value in the position specified by the index number in the list.
remove_index() takes 2 parameters -- a list and an index number -- and remove the element at the position number indicated by index. It also prints the total number of elements in the list before and after removing the character in this fashion:"Total elements in list = 11
Total elements in list = 10"
reverse_list() takes 1 parameter -- a list -- and returns the list reversed.
Examples:
Example 1:
Enter values in list separated by commas: 1,2,4,63,6,4,22,53,76
[1, 2, 4, 63, 6, 4, 22, 53, 76]
Menu:
mutate list(m), remove (r), reverse_list (R)
Enter choice (m,r,R): m
4,45
[1, 2, 4, 63, 45, 6, 4, 22, 53, 76]
Example 2:
Enter values in list separated by commas: 1,2,4,6,84,3,2,2,76
[1, 2, 4, 6, 84, 3, 2, 2, 76]
Menu:
mutate list(m), remove (r), reverse_list (R)
Enter choice (m,r,R): R
[76, 2, 2, 3, 84, 6, 4, 2, 1]
Example 3:
Enter values in list separated by commas: 12,2,3,5,2,6,2,1,2,333,65
[12, 2, 3, 5, 2, 6, 2, 1, 2, 333, 65]
Menu:
mutate list(m), remove (r), reverse_list (R)
Enter choice (m,r,R): r
Example 4
Total elements in list = 11
Total elements in list = 10
[12, 2, 3, 5, 6, 2, 1, 2, 333, 65]
please use the codes below
def main():
user_list = input("Enter values in list separated by commas: ")
user_list = user_list.split(",")
user_list = [int(i) for i in user_list]
print(user_list)
print("Menu: ")
print("mutate list(m), remove (r), reverse_list (R)")
user_choice = input("Enter choice (m,r,R): ")
if user_choice == 'm':
index_num, v = input().split(",")
index_num = int(index_num)
v = int(v)
mutate_list(user_list, index_num, v)
print(user_list)
elif user_choice == 'r':
index_num = int(input())
remove_index(user_list, index_num)
print(user_list)
elif user_choice == 'R':
new_list = reverse_list(user_list)
print(new_list)
main()
Find the given attachments
Part 1: For this assignment, call it assign0 Implement the following library and driver program under assign0: Your library will be consisting of myio.h and myio.c. The function prototypes as well as more explanations are listed in myio.h. Please download it and accordingly implement the exported functions in myio.c. Basically, you are asked to develop a simple I/O library which exports a few functions to simplify the reading of an integer, a double, and more importantly a string (whole line). In contrast to standard I/O functions that can read strings (e.g., scanf with "%s", fgets) into a given static size buffer, your function should read the given input line of characters terminated by a newline character into a dynamically allocated and resized buffer based on the length of the given input line. Also your functions should check for possible errors (e.g., not an integer, not a double, illigal input, no memory etc.) and appropriately handle them. Then write a driver program driver.c that can simply use the functions from myio library. Specifically, your driver program should get four command-line arguments: x y z output_filename. It then prompts/reads x many integers, y many doubles, and z many lines, and prints them into a file called output_filename.txt. Possible errors should be printed on stderr.
myio.h file
/*
* File: myio.h
* Version: 1.0
* -----------------------------------------------------
* This interface provides access to a basic library of
* functions that simplify the reading of input data.
*/
#ifndef _myio_h
#define _myio_h
/*
* Function: ReadInteger
* Usage: i = ReadInteger();
* ------------------------
* ReadInteger reads a line of text from standard input and scans
* it as an integer. The integer value is returned. If an
* integer cannot be scanned or if more characters follow the
* number, the user is given a chance to retry.
*/
int ReadInteger(void);
/*
* Function: ReadDouble
* Usage: x = ReadDouble();
* ---------------------
* ReadDouble reads a line of text from standard input and scans
* it as a double. If the number cannot be scanned or if extra
* characters follow after the number ends, the user is given
* a chance to reenter the value.
*/
double ReadDouble(void);
/*
* Function: ReadLine
* Usage: s = ReadLine();
* ---------------------
* ReadLine reads a line of text from standard input and returns
* the line as a string. The newline character that terminates
* the input is not stored as part of the string.
*/
char *ReadLine(void);
/*
* Function: ReadLine
* Usage: s = ReadLine(infile);
* ----------------------------
* ReadLineFile reads a line of text from the input file and
* returns the line as a string. The newline character
* that terminates the input is not stored as part of the
* string. The ReadLine function returns NULL if infile
* is at the end-of-file position. Actually, above ReadLine();
* can simply be implemented as return(ReadLineFile(stdin)); */
char *ReadLineFile(FILE *infile);
#endif
Answer:
Explanation:
PROGRAM
main.c
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "myio.h"
int checkInt(char *arg);
int main(int argc, char *argv[]) {
int doubles, i, ints, lines;
char newline;
FILE *out;
int x, y, z;
newline = '\n';
if (argc != 5) {
printf("Usage is x y z output_filename\n");
return 0;
}
if (checkInt(argv[1]) != 0)
return 0;
ints = atoi(argv[1]);
if (checkInt(argv[2]) != 0)
return 0;
doubles = atoi(argv[2]);
if (checkInt(argv[3]) != 0)
return 0;
lines = atoi(argv[3]);
out = fopen(argv[4], "a");
if (out == NULL) {
perror("File could not be opened");
return 0;
}
for (x = 0; x < ints; x++) {
int n = ReadInteger();
printf("%d\n", n);
fprintf(out, "%d\n", n);
}
for (y = 0; y < doubles; y++) {
double d = ReadDouble();
printf("%lf\n", d);
fprintf(out, "%lf\n", d);
}
for (z = 0; z < lines; z++) {
char *l = ReadLine();
printf("%s\n", l);
fprintf(out, "%s\n", l);
free(l);
}
fclose(out);
return 0;
}
int checkInt(char *arg) {
int x;
x = 0;
while (arg[x] != '\0') {
if (arg[x] > '9' || arg[x] < '0') {
printf("Improper input. x, y, and z must be ints.\n");
return -1;
}
x++;
}
return 0;
}
myio.c
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
char *ReadInput(int fd) {
char buf[BUFSIZ];
int i;
char *input;
int r, ret, x;
i = 1;
r = 0;
ret = 1;
input = calloc(BUFSIZ, sizeof(char));
while (ret > 0) {
ret = read(fd, &buf, BUFSIZ);
for (x = 0; x < BUFSIZ; x++) {
if (buf[x] == '\n' || buf[x] == EOF) {
ret = -1;
break;
}
input[x*i] = buf[x];
r++;
}
i++;
if (ret != -1)
input = realloc(input, BUFSIZ*i);
}
if (r == 0)
return NULL;
input[r] = '\0';
input = realloc(input, r+1);
return(input);
}
int ReadInteger() {
char *input;
int go, num, x;
go = 0;
do {
go = 0;
printf("Input an integer\n");
input = ReadInput(STDIN_FILENO);
for (x = 0; x < INT_MAX; x++) {
if (x == 0&& input[x] == '-')
continue;
if (input[x] == 0)
break;
else if (input[x]> '9' || input[x] < '0') {
go = 1;
printf("Improper input\n");
break;
}
}
} while (go == 1);
num = atoi(input);
free(input);
return num;
}
double ReadDouble(void) {
int dec, exp;
char *input;
int go;
double num;
int x;
do {
go = 0;
dec = 0;
exp = 0;
printf("Input a double\n");
input = ReadInput(STDIN_FILENO);
for (x = 0; x < INT_MAX; x++) {
if (x == 0&& input[x] == '-')
continue;
if (input[x] == 0)
break;
else if (input[x] == '.' && dec == 0)
dec = 1;
else if (x != 0&& (input[x] == 'e' || input[x] == 'E') && exp == 0) {
dec = 1;
exp = 1;
}
else if (input[x]> '9' || input[x] < '0') {
go = 1;
printf("Improper input\n");
break;
}
}
} while (go == 1);
num = strtod(input, NULL);
free(input);
return num;
}
char *ReadLine(void) {
printf("Input a line\n");
return(ReadInput(STDIN_FILENO));
}
char *ReadLineFile(FILE *infile) {
int fd;
fd = fileno(infile);
return(ReadInput(fd));
}
myio.h
#ifndef _myio_h
#define _myio_h
/*
* Function: ReadInteger
* Usage: i = ReadInteger();
* ------------------------
* ReadInteger reads a line of text from standard input and scans
* it as an integer. The integer value is returned. If an
* integer cannot be scanned or if more characters follow the
* number, the user is given a chance to retry.
*/
int ReadInteger(void);
/*
* Function: ReadDouble
* Usage: x = ReadDouble();
* ---------------------
* ReadDouble reads a line of text from standard input and scans
* it as a double. If the number cannot be scanned or if extra
* characters follow after the number ends, the user is given
* a chance to reenter the value.
*/
double ReadDouble(void);
/*
* Function: ReadLine
* Usage: s = ReadLine();
* ---------------------
* ReadLine reads a line of text from standard input and returns
* the line as a string. The newline character that terminates
* the input is not stored as part of the string.
*/
char *ReadLine(void);
/*
* Function: ReadLine
* Usage: s = ReadLine(infile);
* ----------------------------
* ReadLineFile reads a line of text from the input file and
* returns the line as a string. The newline character
* that terminates the input is not stored as part of the
* string. The ReadLine function returns NULL if infile
* is at the end-of-file position. Actually, above ReadLine();
* can simply be implemented as return(ReadLineFile(stdin)); */
char *ReadLineFile(FILE *infile);
Suppose that class OrderList has a private attribute double cost[100] which hold the cost of all ordered items, and a private attributes int num_of_items which hold the number of items ordered. For example, if num_of_items is 5, then cost[0], cost[1], ..., cost[4] hold the cost of these 5 items. Implement the member function named total_cost which returns the total cost of this OrderList.
Answer:
OrderList.java
public class OrderList { private double cost[]; private int num_of_items; public OrderList(){ cost = new double[100]; } public double total_cost(){ double total = 0; for(int i=0; i < num_of_items; i++){ total += cost[i]; } return total; } }Main.java
public class Main { public static void main(String[] args) { OrderList sample = new OrderList(); double totalCost = sample.total_cost(); } }Explanation:
Firstly, define a class OrderList with two private attributes, cost and num_of_items (Line 1-3). In the constructor, initialize the cost attribute with a double type array with size 100. Next, create another method total_cost() to calculate the total cost of items (Line 9-15). To implement the total_cost member function, create an OrderList instance and use that instance to call the total_cost() and assign it to totalCost variable.
What is the maximum duration of daily Scrum meetings?
Answer:
15 minutes
Explanation:
this meeting is normally timeboxed to a maximum duration of 15 minutes.
Answer:
A. 15 minutes
B. 45 minutes
C. 10 minutes
D. 30 minutes
The Answer is A): 15 minutes
explanation:
PLZ Mark Me As Brainliest
You are writing a paragraph in a word processor. You
want to use the same text that appears elsewhere in a
different document, but you want to keep it in the other
document. To get the other text into the new document
most efficiently, you should:
Cut and paste
Ctrl + S
Copy and paste
Print the text and retype it so you don't make any mistakes.
Answer:
Explanation:
I mean I would copy and paste it. I hope thats right
Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula: futureInvestmentValue = investmentAmount * (1 + monthyInterestRate)numberOfYears*12. For example if you enter amount 1000, annual interest rate 3.25%, and number of years 1, the future investment value is 1032.98.NB: Please make sure to use the NumberFormat coding for currency to display your results. (Java Programming)
Answer:
Following are the code to this question:
import java.util.*; //importing package for user input
public class Main //defining class
{
public static void main(String []ar) //defining main method
{
double investment_amount,interest_rate,future_investment_value; //defining double variables
int years; //defining integer variable
Scanner obx=new Scanner(System.in); //creating Scanner class Object
System.out.print("Enter invest value: "); //print message
investment_amount=obx.nextDouble(); //input value
System.out.print("Enter interest rate: ");//print message
interest_rate=obx.nextDouble();//input value
System.out.print("Enter number of years: ");//print message
years=obx.nextInt();//input value
future_investment_value=investment_amount*Math.pow((1+interest_rate/1200.),years*12); //calculating value by apply formula
System.out.println("you enter amount: $"+investment_amount); //print calculated value
System.out.println("annual interest rate:"+interest_rate+"%");//print calculated value
System.out.printf("Number of years: "+years+" the future investment value is :$%.2f\n",future_investment_value);//print calculated value
}
}
output:
please find the attachment.
Explanation:
Program Description:
In the above-given program, inside the main method, a variable is declared that are investment_amount, interest_rate, future_investment_value, and years, in which only year variable is an integer type and other variables are double types.In the next step, a scanner class object that is "obx" is created, which is used to input value from the user end, in the next line we apply the formula to calculate the future_investment_value.At the last step, we all the input and a calculated valueYou just got back from a convention where you saw some new software you think the information technology director could use. You can get a discount on the software for the next six weeks because you attended the convention. Unfortunately, the technology director is on vacation this week. How should you tell the IT director about this opportunity
Answer:
Video or Teleconferencing.
Explanation:
Solution
The method in which you will inform the IT director about this opportunity is through video conferencing or tele conferencing.
Video conferencing : refers to a method whereby it enables people at two or more locations or places to hear and see each other simultaneously through computers and communication technology.
what is exchanged between them are information such as visual web cameras and online streaming videos.
Teleconferencing: It is a method of sharing or discussion information and news among a large group of people or team at different places at the same time.
The university computer lab’s director keeps track of lab usage, as measured by the number of students using the lab. This function is important for budgeting purposes. The computer lab director assigns you the task of developing a data warehouse to keep track of the lab usage statistics. The main requirements for this database are to:
Answer:
to keep count of how many users there are in total.
Explanation:
all i had to do was read the question twice to understand the answer is pretty
much in the question.
The director of the computer lab tasks with creating a data warehouse to manage lab utilization data. The major needs for this database are to keep count of how many users there are in total.
What is the budgeting process?
The tactical measures used by a corporation to create a financial plan are the budgeting processes. Budgeting for a future time entails more than simply allocating spending; it also entails figuring out how much income is required to achieve organizational objectives.
These procedures are used by accounting departments to regulate corporate activities, particularly expenditure. A person may use budgeting process to record how much money a business makes and spends over a specific time period.
Therefore, With the aid of budgeting, it may establish financial objectives for the team and the entire organization.
Learn more about the budgeting process, refer to:
https://brainly.com/question/21411418
#SPJ2
WRITTEN INTERVIEW QUESTIONS
Doctoral candidates should provide an authentic personal statement to each of the five following questions/prompts reflecting on their own personal interest. In the event that any outside resources are used, resources should be cited in APA format. Submissions should be a maximum of 500 words or 125 words per question/prompt. It is best to response to each prompt/question individually for clarity of the reviewer. Writing sample should be submitted in Microsoft Word format and include candidate’s name.
PhD IT
1. Tell us about yourself and your personal journey that has lead you to University of the Cumberlands.
2. What are your research interests in the area of information technology? How did you become interested in this area of research?
3. What is your current job/career and how will this program impact your career growth?
4. What unique qualities do you think you have that will help you in being successful in this program?
5. How can obtaining a doctorate impact your contribution to the practices of information technology? Where do you see yourself after obtaining a doctorate from UC?
Explanation:
1. I grew up in a small community and my family owned a small business which involved manual labor. Although, having little income, my Dad sought to give us the best education he could afford from his little savings. With the small family savings I went to college where I studied Information Technology, after graduating I worked for a startup firm for two years before I decided to proceed with post graduate studies and I attained my Masters in UA. I met a friend who recommended I study in University of Cumberlands, I hesitated initially but was convinced after I researched the institution.
2. I'm particularly interested in the applications of information technology in labor intensive businesses and work because of my family background.
3. I have my own startup firm that designs work communication software for companies, however I intend to broaden my knowledge through this program into Information Technology based systems using machine learning algorithm.
4. I am committed to work and study, as some have called me a curious mind because of my passion towards learning.
5. I view obtaining a doctorate as not just a personal achievement but of lasting benefits to society as I use knowledge derived to improve the work experience of society.
I am confident that after my program I would be one the renowned contributors to the applications of information technology in labor intensive businesses.
. The total processing speed of microprocessors (based on clock rate and number of circuits) is doubling roughly every year. Today, a symmetric session key needs to be 100 bits long to be considered strong. How long will a symmetric session key have to be in 30 years to be considered strong?
Answer:
130 bits
Explanation:
If the length of a key = N bits
Total number of key combinations = [tex]\frac{2^{N} }{2}[/tex]
For a key length of 100, the total number of key combinations will be [tex]\frac{2^{100} }{2} = 2^{99}[/tex] combinations. This is a whole lot and it almost seems impossible to be hacked.
The addition of one bit to the length of the symmetric key in 1 year is sufficient to make the key strong, because even at double its speed, the processor can still not crack the number of combinations that will be formed.
Therefore, if a bit is added to the key length per year, after 30 years, the length of the symmetric session key will be 130 bits.
Design an algorithm for a monitor that implements an alarm clock that enables a calling program to delay itself for a specified number of time units (ticks). You may assume the existence of a real hardware clock that invokes a function tick() in your monitor at regular intervals.
Answer:
The algorithm a monitor that implements an alarm clock is designed below.
Monitor alarm
{
Condition c;
int current = 0;
void delay (int ticks)
{
int alarms;
alarms = current + ticks;
while (current > alarms)
c. wait (alarms) ;
c. signal;
}
void tick ( )
{
current = current + 1;
delay. signal;
}
}
write the following function so that it returns the same result, but does
not increment the variable ptr. Your new program must not use anysquare brackets, but must use an integer variable to visit each double in the array. You may eliminate any unneeded variable.
double computeAverage(const double* scores, int nScores)
{
const double* ptr = scores;
double tot = 0;
while (ptr != scores + nScores)
{
tot += *ptr; } ptr++;
}
return tot/nScores;
b. Rewrite the following function so that it does not use any square brackets (not even in the parameter declarations) but does use the integervariable k. Do not use any of the functions such as strlen, strcpy, etc.
// This function searches through str for the character chr.
// If the chr is found, it returns a pointer into str where
// the character was first found, otherwise nullptr (not found).
const char* findTheChar(const char str[], char chr)
{
for(intk=0;str[k]!=0;k++)
if (str[k] == chr)
}
return &str[k];
return nullptr;
}
c. Now rewrite the function shown in part b so that it uses neither square brackets nor any integer variables. Your new function must not use any local variables other than the parameters.
Answer:
Explanation:
a.
// Rewriting the given function without using any square brackets
double computeAverage(const double* scores, int nScores)
{
const double* ptr = scores;
double tot = 0;
int i;//declaring integer variable
for(i=0;i<nScores;i++)
{
//using an integer variable i to visit each double in the array
tot += *(ptr+i);
}
return tot/nScores;
}
b.
// Rewriting the given function without using any square brackets
const char* findTheChar(const char* str, char chr)
{
for(int k=0;(*(str+k))!='\0';k++)
{
if ((*(str+k)) == chr)
return (str+k);
}
return nullptr;
}
c.
//Now rewriting the function shown in part b so that it uses neither square brackets nor any integer variables
const char* findTheChar(const char* str, char chr)
{
while((*str)!='\0')
{
if ((*str) == chr)
return (str);
str++;
}
return nullptr;
}
Seth would like to make sure as many interested customers as possible are seeing his business’s website displayed in their search results. What are a few things he could pay attention to in order to achieve this?
Answer:
Hi! Make sure that the website has a few things. Proper Keywords, the pages have the proper tags, a form on the website, contact information, CIty State, Etc., Then a phone number. Social media icons that link properly to the social media pages.
Explanation:
Write a program that keeps track of where cars are located in a parking garage to estimate the time to retrieve a car when the garage is full. This program will demonstrate the following:_________.
How to create a list for use as a stack,
How to enter and change data in a stack.
Answer: Provided in the explanation section
Explanation:
Code to use;
# Define the main() function.
def main():
# Declare the required variables.
stack_cars = []
move_time = 1
retrieve_time = 2
# Start the loop to display the menu.
while True:
# Display the choices to the user.
print("\n\t\t\t Car Stack Menu")
print("\n1. Add a car")
print("2. Retrieve a car")
print("3. Show the car stack")
print("4. Exit")
# Prompt the user to enter the input.
choice = input("\nEnter your choice: ")
# Append the car in the stack if the choice is 1.
if choice == '1':
car = input("Enter the car name to add: ")
stack_cars.append(car)
# Remove the car from the stack if the choice is 2.
elif choice == '2':
car = input("Enter the car name to retrieve: ")
# Display the error message if the car is not present.
if car not in stack_cars:
print(car + " is not present in the stack.")
# Otherwise, compute the time to retrieve a car.
else:
# Declare a temp stack to move the cars.
temp = []
x = stack_cars.pop()
count = 0
# Start the loop to pop the cars from the stack
# until the car to be retrieved is found.
while x != car:
count += 1
# Store the car in the temp stack.
temp.append(x)
x = stack_cars.pop()
# Start the loop to move the cars back in the
# original stack.
while len(temp) != 0:
stack_cars.append(temp.pop())
# Compute and display the total time.
total_time = move_time * count + retrieve_time
print("Total time to retrieve", car, "=", total_time)
# Display the stack if the choice is 3.
elif choice == '3':
print("Car stack =", stack_cars)
# Return from the funtion if the choice is 4.
elif choice == '4':
print("Exiting from the program...")
return
# Display the message for invalid input.
else:
print("Error: Invalid choice!")
# Call the main() function.
if __name__ == "__main__":
main()
What is an accessory?
A.a security setting that controls the programs children can use
B.a tool that provides proof of identity in a computing environment
C.a set of programs and applications that help users with basic tasks
D.a set of gadgets and widgets that makes it easier to create shortcuts
Answer:
C
Explanation:
Accessories are in Microsoft windows, a set of programs and applications that help users with some basic tasks
Mikayla wants to create a slide with a photograph of a car and the car horn sounding when a user clicks on the car. Which
feature should she use, and why?
a. She should use the Action feature because it allows a user to embed a hyperlink for an Internet video on the car.
b. She should use the Video from Website feature because it allows a user to embed a hyperlink for an Internet video on the car.
c. She should use the Action feature because it allows a user to place an image map with a hotspot on the car.
d. She should use the Video from Website feature because it allows a user to place an image map with a hotspot on the car.
Answer: A
Explanation: edge :)
Answer:
C
Explanation:
#Write a function called "scramble" that accepts a string #as an argument and returns a new string. The new string #should start with the last half of the original string #and end with the first half. # #If the length of the string is odd, split the string #at the floor of the length / 2 (in other words, the second #half is the longer half). # #For example: # scramble("abcd") -> "cdab" # screamble("abcde") -> "cdeab" # scramble("railroad")) -> "roadrail" # scramble("fireworks")) -> "worksfire"
Answer:
def scramble(s):
if len(s) % 2 == 1:
index = int(len(s)//2)
else:
index = int(len(s)/2)
return s[index:] + s[:index]
Explanation:
Create a function called scramble that takes one parameter, s
Check the length of the s using len function. If the length is odd, set the index as the floor of the length/2. Otherwise, set the index as length/2. Use index value to slice the s as two halves
Return the second half of the s and the second half of the s using slice notation (s[index:] represents the characters from half of the s to the end, s[:index] represents the characters from begining to the half of the s)
Francis has designed a picture book appropriate for third graders. He wants teachers across the world to freely download use, and distribute his work, but he would still like to retain his copyright on the content. What type of license should he u for his book?
Answer:
The correct answer will be "Project Gutenberg".
Explanation:
Project Gutenberg continues to obtain lots of requests for authorization for using printed books, pictures, as well as derivatives from eBooks. Perhaps some applications should not be produced, because authorization would be included in the objects provided (as well as for professional usages).You can copy, hand it over, or m actually-use it underneath the provisions including its license that was included in the ebook.So that the above is the right answer.
Two-factor authentication can best be breached by the adversary using:________. a. social engineering attack b. using sniffers like Wireshark and capturing packets c. using rootkits and privilege escalation to get to the kernel processes d. using a virus and destroying the computer that stores authentication information.
Answer:
a. social engineering attack
Explanation:
Two-factor authentication requires that the user/owner of the account enter a second verification code alongside their password in order to access the account. This code is usually sent to a personal phone number or email address. Therefore in order to breach such a security measure the best options is a social engineering attack. These are attacks that are accomplished through human interactions, using psychological manipulation in order to trick the victim into making a mistake or giving away that private information such as the verification code or access to the private email.
Remember to save _____ and be certain that you have your files saved before closing out.
What is a digital security risks?
Answer:
A digital security risk is an action that could result in damage to a computer or similar device's hardware, software, data etc.
C++ Problem: In the bin packing problem, items of different weights (or sizes) must be packed into a finite number of bins each with the capacity C in a way that minimizes the number of bins used. The decision version of the bin packing problem (deciding if objects will fit into <= k bins) is NPcomplete. There is no known polynomial time algorithm to solve the optimization version of the bin packing problem. In this homework you will be examining three greedy approximation algorithms to solve the bin packing problem.
- First-Fit: Put each item as you come to it into the first (earliest opened) bin into which it fits. If there is no available bin then open a new bin.
- First-Fit-Decreasing: First sort the items in decreasing order by size, then use First-Fit on the resulting list.
- Best Fit: Place the items in the order in which they arrive. Place the next item into the bin which will leave the least room left over after the item is placed in the bin. If it does not fit in any bin, start a new bin.
Implement the algorithms in C++. Your program named bins.cpp should read in a text file named bin.txt with multiple test cases as explained below and output to the terminal the number of bins each algorithm calculated for each test case. Example bin.txt: The first line is the number of test cases, followed by the capacity of bins for that test case, the number of items and then the weight of each item. You can assume that the weight of an item does not exceed the capacity of a bin for that problem.
3
10
6
5 10 2 5 4 4
10
20
4 4 4 4 4 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6
10
4
3 8 2 7
Sample output: Test Case 1 First Fit: 4, First Fit Decreasing: 3, Best Fit: 4
Test Case 2 First Fit: 15, First Fit Decreasing: 10, Best Fit: 15
Test Case 3 First Fit: 3, First Fit Decreasing: 2, Best Fit: 2
xekksksksksgBcjqixjdaj
The following are reasons why many organizations are trying to reduce and right-size their information foot-print by using data governance techniques like data cleansing and de-duplication:
A. None of the above
B. reduce risk of systems failures due to overloading
C. improve data quality and reduce redundancies, reduce increased and staggering storage management costs,
D. Both A and B
Answer:
C. improve data quality and reduce redundancies, reduce increased and staggering storage management costs
Explanation:
Excess data retention can lead to retention of redundant and irrelevant data, which can reduce data handling and processing efficiency, while at the same time increasing the cost of data storage and management. This can be curbed be reducing data to the right size by using data governance techniques like data cleansing and de-duplication
Anyone help pls ? Complete the code below to add css to make the background of the web page orange.
< html>
Answer:
In HTML file
<body style="background-color:orange;">
Or
In CSS file
body {
background-color: orange;
}
Answers must be correct. Or else it will be flagged. All of these sub parts need to be answered with step by step process showing all work and reasoning.
DISCRETE STRUCTURES:
1.a. Truth value of a propositional statement For this exercise, it is easier not to use truth tables.
1. Suppose that A → ((BAC)-D) is false. What are the truth values of A, B, C, and D?
2. Suppose that (A-B) v (CA (DAE)) → F) is false.
What are the truth values of A, B, C, D, E, and F?
1.b. Logical equivalence Prove the equivalences below without using truth tables. Instead, use the rules of logical equivalence given in class. Justify your reasoning.
1.c. Inference Formalize the following argument and show that it is valid.
If Jose took the jewellery or Mrs. Krasov lied, then a crime was committed. Mr. Krasov was not in town. If a crime was committed, then Mr. Krasov was in town. Therefore Jose did not take the jewellery
Note: The complete part of question 1b is attached as a file
Answer:
1ai) A = true, B = true, C = true, D = false
Check the attached files for the answers of the remaining parts
Explanation:
The detailed solutions of all the sections of the question are contained in the attached files
CASE II AziTech is considering the design of a new CPU for its new model of computer systems for 2021. It is considering choosing between two (2) CPU (CPUA and CPUB) implementations based on their performance. Both CPU are expected to have the same instruction set architecture. CPUA has a clock cycle time of 60 ns and CPUB has a clock cycle time of 75 ns. The same number of a particular instruction type is expected to be executed on both CPUs in order to determine which CPU would executes more instructions. CPUA is able to execute 2MB of instructions in 5*106 clock cycles. CPUB executes the same number of instructions in 3*106 clock cycles. a) Using the MIPS performance metric, which of the two (2) CPU should be selected to be implemented in the new computer system. Justify your choice. b) Compute the execution time for both CPUs. Which CPU is faster?
Answer:
(a)The CPU B should be selected for the new computer as it has a low clock cycle time which implies that it will implement the process or quicker when compared to the CPU A.
(b) The CPU B is faster because it executes the same number of instruction in a lesser time than the CPU A .
Explanation:
Solution
(a)With regards to the MIPS performance metric the CPU B should be chosen for the new computer as it low clock cycle time which implies that it will implement the process or quicker when compared to the CPU A and when we look at the amount of process done by the system , the CPU B is faster when compared to other CPU and carries out same number of instruction in time.
The metric of response time for CPU B is lower than the CPU A and it has advantage over the other CPU and it has better amount as compared to CPU A, as CPU B is carrying out more execution is particular amount of time.
(b) The execution can be computed as follows:
Clock cycles taken for a program to finish * increased by the clock cycle time = the Clock cycles for a program * Clock cycle time
Thus
CPU A= 5*10^6 * 60*10^-9 →300*10^-3 →0.3 second (1 nano seconds =10^-9 second)
CPU B= 3 *10^6 * 75*10^-9 → 225*10^-3 → 0.225 second
Therefore,The CPU B is faster as it is executing the same number of instruction in a lesser time than the CPU A