Answer:
Tracking and Review features.
Explanation:
Tracking and Review are used to show detailed Markup when reviewing a document to make some changes to it.
To reveal detailed Markup, select REVIEW, then select VIEW OPTION from the Review list.
A Simple Markup shows a red line to where changes have already been made.
All Markup shows different person's edits in different colors of texts.
In what way does a hash provide a better message integrity check than a checksum (such as the Internet checksum)?
Answer:
Hash function have less collision than a internet checksum because of computational infeasibility.
Explanation:
A collision means there is more then one way to produce the same sum. It is nearly difficult to developed two messages with same hash however, in checksum, it is more easier to develop or modify two messages to have same sum, thereby enabling attackers to have access to the message or the information arising to less message integrity.
Suppose that the tuition for a university is $10,000 this year and increases 4% every year. In one year, the tuition will be $10,400. Write a program using for loop that computes the tuition in ten years and the total cost of four years’ worth of tuition after the tenth year.
Answer:
The programming language is not stated; however, I'll answer using Python programming language (See attachment for proper format)
tuition = 10000
rate = 0.04
for i in range(1,15):
tuition = tuition + tuition * rate
if i <= 10:
print("Year "+str(i)+" tuition:",end=" ")
print(round(tuition,2))
if i == 14:
print("Tuition 4th year after:",end=" ")
print(round(tuition,2))
Explanation:
The first 2 lines initializes tuition and rate to 10000 and 0.04 respectively
tuition = 10000
rate = 0.04
The next line iterates from year 1 to year 14
for i in range(1,15):
This line calculates the tuition for each year
tuition = tuition + tuition * rate
The next 3 lines prints the tuition for year 1 to year 10
if i <= 10:
print("Year "+str(i)+" tuition:",end=" ")
print(round(tuition,2))
The next 3 lines prints the tuition at the 4th year after year 10 (i.e. year 14)
if i == 14:
print("Tuition 4th year after:",end=" ")
print(round(tuition,2))
Define the missing method. licenseNum is created as: (100000 * customID) licenseYear, where customID is a method parameter. Sample output with inputs 2014 777:
Answer:
I am writing the program in JAVA and C++
JAVA:
public int createLicenseNum(int customID){ //class that takes the customID as parameter and creates and returns the licenseNum
licenseNum = (100000 * customID) + licenseYear; //licenseNum creation formula
return(licenseNum); }
In C++ :
void DogLicense::CreateLicenseNum(int customID){ //class that takes the customID as parameter and creates the licenseNum
licenseNum = (100000 * customID) + licenseYear; } //licenseNum creation formula
Explanation:
createLicenseNum method takes customID as its parameter. The formula inside the function is:
licenseNum = (100000 * customID) + licenseYear;
This multiplies 100000 to the customID and adds the result to the licenseYear and assigns the result of this whole expression to licenseNum.
For example if the SetYear(2014) means the value of licenseYear is set to 2014 and CreateLicenseNum(777) this statement calls createLicenseNum method by passing 777 value as customID to this function. So this means licenseYear = 2014 and customID = 777
When the CreateLicenseNum function is invoked it computes and returns the value of licenseNum as:
licenseNum = (100000 * customID) + licenseYear;
= (100000 * 777) + 2014
= 77700000 + 2014
licenseNum = 77702014
So the output is:
Dog license: 77702014
To call this function in JAVA:
public class CallDogLicense {
public static void main(String[] args) {//start of main() function
DogLicense dog1 = new DogLicense();//create instance of Dog class
dog1.setYear(2014); // calls setYear passing 2014
dog1.createLicenseNum(777);// calls createLicenseNum passing 777 as customID value
System.out.println("Dog license: " + dog1.getLicenseNum()); //calls getLicenseNum to get the computed licenceNum value
return; } }
Both the programs along with the output are attached as a screenshot.
Answer:
public int createLicenseNum(int customID){
licenseNum = (100000 * customID) + licenseYear;
return(licenseNum);
}
Explanation:
In Antivirus Software, Heuristic detection looks for things like anomalies, Signature based detection uses content matches.a. Trueb. False
Answer:
true
Explanation:
PROGRAM 8: Grade Converter! For this program, I would like you to create a function which returns a character value based on a floating point value as
Answer:
This function will return a character grade for every floating-point grade for every student in the class.
function grade( floatPoint ){
let text;
switch ( floatPoint ) {
case floatPoint < 40.0 :
text= " F ";
break;
case floatPoint == 40.0 :
text= " P ";
break;
case floatPoint > 40.0 && floatPoint <= 50.0 :
text= " C ";
break;
case floatPoint > 50.0 && floatPoint < 70.0 :
text= " B ";
break;
case floatPoint >=70.0 && floatPoint <= 100.0 :
text= " C ";
break;
default :
text= "Floating point must be between 0.0 to 100.0"
}
return text;
}
Explanation:
This javascript function would return a character grade for floating-point numbers within the range of 0.0 to 100.0.
Complete the function to replace any period by an exclamation point. Ex: "Hello. I'm Miley. Nice to meet you." becomes:
"Hello! I'm Miley! Nice to meet you!"
#include
#include
using namespace std;
void MakeSentenceExcited(char* sentenceText) {
/* Your solution goes here */
}
int main() {
const int TEST_STR_SIZE = 50;
char testStr[TEST_STR_SIZE];
strcpy(testStr, "Hello. I'm Miley. Nice to meet you.");
MakeSentenceExcited(testStr);
cout << testStr << endl;
return 0;
}
Answer:
Here is the complete function:
void MakeSentenceExcited(char* sentenceText) { // function that takes the text as parameter and replaces any period by an exclamation point in that text
int size = strlen(sentenceText); //returns the length of sentenceText string and assigns it to size variable
char * ptr; // character type pointer ptr
ptr = sentenceText; // ptr points to the sentenceText string
for (int i=0; i<size; i++){ //iterates through the sentenceText string using i as an index
if (sentenceText[i]=='.'){ // if the character at i-th index of sentenceText is a period
sentenceText[i]='!'; } } } //places exclamation mark when it finds a period at i-th index of sentenceText
Explanation:
The program works as follows:
Suppose we have the string:
sentenceText = "Hello. I'm Miley. Nice to meet you."
The MakeSentenceExcited method takes this sentenceText as parameter
int size = strlen(sentenceText) this returns the length of sentenceText
The size of sentenceText is 35 as this string contains 35 characters
size = 35
Then a pointer ptr is declared which is set to point to sentenceText
for (int i=0; i<size; i++) loop works as follows:
1st iteration:
i=0
i<size is true because i=0 and size = 35 so 0<35
So the body of loop executes:
if (sentenceText[i]=='.') statement checks :
if (sentenceText[0]=='.')
The first element of sentenceText is H
H is not a period sign so the statement inside if statement does not execute and value of i increments to 1. Now i = 1
2nd iteration:
i=1
i<size is true because i=1 and size = 35 so 1<35
So the body of loop executes:
if (sentenceText[i]=='.') statement checks :
if (sentenceText[1]=='.')
This is the second element of sentenceText i.e. e
e is not a period sign so the statement inside if statement does not execute and value of i increments to 1. Now i = 2
So at each iteration the if condition checks if the character at i-th index of string sentenceText is a period.
Now lets see a case where the element at i-th index is a period:
6th iteration:
i=5
i<size is true because i=5 and size = 35 so 5<35
So the body of loop executes:
if (sentenceText[i]=='.') statement checks :
if (sentenceText[5]=='.')
This is the character at 5th index of sentenceText i.e. "."
So the if condition evaluates to true and the statement inside if part executes:
sentenceText[i]='!'; statement becomes:
sentenceText[5]='!'; this means that the character at 5th position of sentenceText string is assigned an exclamation mark.
So from above 6 iterations the result is:
Hello!
This loop continues to execute until all the characters of sentenceText are checked and when the value of i gets greater than or equal to the length of sentenceText then the loop breaks.
The screenshot of the program along with its output is attached.
What caused the substantial schedule delay of software development for the Jaguar project? (b) How did the software problem impact the project? (c) If you were the project manager, what would you have done differently to prevent the software problem from happening?
Answer:
ES LA B
Explanation:
Given a number N, write a code to print all psoitive numbers less than N in which all adjacent digits differ by 1
Answer:
def lesser_adjacent_num ( N ):
N = int( N )
while N == True:
next = N - 1
print if next >= 0 ? next : break
Explanation:
The python function above called "lesser_adjacent_num" accepts an argument called "N" which is an integer. The function print the number "next" which is a number less than the N integer for every loop for the condition where N is not zero.
Explain data hazard and structural hazard. Then, explain how we can prevent each type of hazard. Provide two examples to support your explanations
Answer:
Answered below
Explanation:
Data hazards happen when instructions exhibiting data dependence modify data in the different stages of a pipeline. Potential data hazards when not attended to, can result in race hazards or race conditions. Examples of situations where data hazards can occur is read after write, write after read, write after write. To resolve data hazards we can insert a pipeline whenever a read after write, dependence is encountered, use out-of-order execution or use operand forwarding.
Structural hazards happen when multiple instructions which are already in pipeline new the same resource. Example is a situation which many instructions are ready to execute an there is a single Arithmetic Logic Unit. Methods for preventing this hazard include pipeline break an pipeline flushing.
Write a recursive function sumSquares(num) that given an integer num, returns the sum of squares of numbers from 1 to num. For example: sumSquares(3) should return 1^2 2^2 3^2
Answer:
Here is the recursive function sumSquares(num) that takes an integer num as parameter and returns the sum of squares of numbers from 1 to num.
def sumSquares(num):
if(num >= 0): # checks if the value of num is less than or equal to 0
if (num==0): #if value of num is 0
return 0 #returns 0 if value of num is 0
else: #if value of num is greater than 0
return sumSquares(num - 1)+ num * num #recursively calls the sumSquares method to return the sum of squares of numbers from 1 to num
else: # if a user enters a negative num
(print("The number if not positive")) #prints this message
exit() # exits after displaying that number if not positive message
#below print statement is used in order to check the working of the function
print(sumSquares(3)) #calls function and passes value 3 for num
Explanation:
The program works as follows:
The function sumSquares(num) that takes an integer num as parameter and returns the sum of squares of numbers from 1 to num
The first if condition checks if value of num is positive. If this condition evaluates to true then the another if statement inside this if statement is executed which checks if the value of num is 0. If this condition evaluates to true then the program returns 0. However if this condition evaluates to false then the else part executes which has the following statement:
return sumSquares(num - 1) + num * num
For example num = 3
so the above recursive statement works as follows:
sumSquares(3-1) + 3 * 3
sumSquares(2) + 9
Note that the sumSquares() method is called again and the value 2 is passed as num. As 2 is greater than 0. So again the recursive statement executes:
sumSquares(2 - 1) + 2 * 2 + 9
sumSquares(1) + 4 + 9
sumSquares(1) + 13
sumSquare() method is called again and the value 1 is passed as num. As 1 is greater than 0. So again the recursive statement executes:
sumSquares(1 - 1) + 1 * 1 + 13
sumSquares(0) + 1 + 13
sumSquares(0) + 14
sumSquare() method is called again and the value 0 is passed as num
As the value of num=0 So the if (num == 0): condition evaluates to true and the statement returns 0 executes which returns 0:
sumSquares(0) + 14
0 + 14
Hence the output is:
14
The screenshot of the program along with its output is attached.
Write a Bash script that searches all .c files in the current directory (and its subdirectories, recursively) for occurrences of the word "foobar". Your search should be case-sensitive (that applies both to filenames and the word "foobar"). Note that an occurrence of "foobar" only counts as a word if it is either at the beginning of the line or preceded by a non-word-constituent character, or, similarly, if it is either at the end of the line or followed by a non-word- constituent character. Word-constituent characters are letters, digits and underscores.
Answer:
grep -R '^foobar'.c > variable && grep -R 'foobar$'.c >> variable
echo $variable | ls -n .
Explanation:
Bash scripting is a language used in unix and linux operating systems to interact and automate processes and manage files and packages in the system. It is an open source scripting language that has locations for several commands like echo, ls, man etc, and globbing characters.
The above statement stores and appends data of a search pattern to an already existing local variable and list them numerically as standard out 'STDOUT'.
Universal Containers will be using multiple environments to manage the development, testing, and deployment of new functionality to sales users. Which deployment tool can be used to migrate metadata across Salesforce environments
Answer:
1. Force.com IDE
2. change sets
Explanation:
1. Force.com IDE is an integrated development environment. It is useful for creating applications on the force.com using metadata. it uses text based files to constitute the different parts of Salesforce.
2. change sets:
these can send configuration from one between different Salesforce organizations. It migrates changes in metadata between different organizations.
Your system is infected with a virus that can modify signature each time it is executed to fool antivirus software. Which type of virus is this?
Answer:Polymorphic Virus
Explanation:
Malware that can change its signature each time is polymorphic
CHALLENGE ACTIVITY 3.7.2: Type casting: Reading and adding values.
Assign totalowls with the sum of num_owls A and num_owls_B.
Sample output with inputs: 34
Number of owls: 7
1. total_owls -
2.
3. num_owls A - input
4. num_owls_B - input
5.
6. " Your solution goes here
7.
8. print("Number of owls:', total_owls)
Answer:
total_owls = 0
num_owls_A = int(input())
num_owls_B = int(input())
total_owls = num_owls_A + num_owls_B
print("Number of owls:", total_owls)
Explanation:
Initialize the total_owls as 0
Ask the user to enter num_owls_A and num_owls_B, convert the input to int
Sum the num_owls_A and num_owls_B and set it to the total_owls
Print the total_owls
avg_owls=0.0
num_owls_zooA = int(input())
num_owls_zooB = int(input())
num_owls_zooC = int(input())
num_zoos = 3
avg_owls = (num_owls_zooA + num_owls_zooB + num_owls_zooC) / num_zoos
print('Average owls per zoo:', int(avg_owls))
There is a problem while you are trying the calculate the average owls per zoo.
As you may know, in order to calculate the average, you need to get the total number of owls in all the zoos, then divide it to the number of zoos. That is why you need to sum num_owls_zooA + num_owls_zooB + num_owls_zooC and divide the result by num_zoos
Be aware that the average is printed as integer value. That is why you need to cast the avg_owls to an int as int(avg_owls)
Learn more about integer value on:
https://brainly.com/question/31945383
#SPJ6
Reasons why operating system is pivotal in teaching and learning
Answer:
Explanation: The operating system simply acts as the communication interface between the user and the components if a computer including it's hardware. The reasons why an operating system is pivotal in leaching and learning includes :
In most cases, teaching and learning requires the use of application programs or softwares which could be the program to be learnt or that which is used to aid learning. Irrespective of the type of application program, it's installation and usage depends and is made possible with the help of an operating system. Programs used for video sessions during teaching, writing programs and document editors all require an operating system in other to aid installation and ultimately function.
Your task is to write and test a function which takes one argument (a year) and returns True if the year is a leap year, or False otherwise. The seed of the function is already sown in the skeleton code in the editor. Note: we've also prepared a short testing code, which you can use to test your function. The code uses two lists - one with the test data, and the other containing the expected results. The code will tell you if any of your results are invalid.
Answer:
function isLeapYear( aYear ){
var confirmYear= year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
return confirmYear ? True : False;
}
Explanation:
The javascript function above requires an argument which is the year when it is passed, it is analyzed, counting the number of days in that year and a boolean value of true or false is dynamically assigned to the variable 'confirmYear'.
The ternary operator would logically select the right value, which is outputted to the user. To test the function, use the console to call the function with an argument.
console.log( isLeapYear( 1999 ) );
Suppose there are 4 nodes sharing a broadcast channel using TDMA protocol. Suppose at time t=0: • Node 1 has 6 frames to transmit, • Node 2 has 4 frames to transmit, • Node 3 has 8 frames to transmit, • Node 4 has 3 frames to transmit. Maximum number of frames which can be transmitted by a node in a time slot = 3 The time required to transmit one frame = 1 Second Explain how TDMA protocol works to complete this task? How much time will it take to transmit all frames?
Answer:
Following are the description of the given nodes:
Explanation:
The Multiple Access frequency - division facilitates control by granting every node a fixed time slot. Also, every slot seems to be identical in width. Its whole channel bandwidth is often used in every channel node. Compared to FDMA it takes more time.
Time slot=3 frames for all the above scenario
In the first point, It is reserved the node 1, and as well as 3 frames were also transmitted 1. In the second point, It is reserved the node 2, and as well as 3 frames are transmitted. In the third point, It is reserved 3 nodes, and as well as 3 frames were transmitted. In the fourth point, It is reserved 4 slots and the transmit 3 frames. In the fifth point, It stores the slot 1 and the transmit 3 frames. In the sixth point, It stores the slot 2 and the transmit 1 frame. In the seventh point, It stores the slot 3 and the transmit 3 frames. In the Eight points, It stores the slot 3 and the transmit 2 frames.Time interval = number of frames in first slot Time to send 1 frame number of images
[tex]= 8 \times 3 \times 1 \\\\ = 8 \times 3 \\\\= 24 \ seconds[/tex]
Giving Branliest IFFF CORRECT
Which feature displays certain data in a database?
Chart
Filter
Seek
Sort
Answer:
filter
Explanation:
when you use filter, it only fetches data that meets the filter criteria you applied
Answer:
(2)/B - Filter
Explanation:
You suspect that a hacker has compromised a computer using one of its open ports. Which command would allow you to view the open ports on the computer
Answer:
[tex]netstat[/tex]
Explanation:
The netstat command displays network connections for TCP and can help to view the open ports on the computer.
Hope this helped!
list 2 forms of computer output
Answer:
Soft copy like audio
Hard copy e.g printouts
Explanation:
Will the Python code below print something? And will it terminate?
def print_n(s, n):
if n > 0:
print(s)
print_n(s, n-1)
return n
n = 3
while print_n("hi", n):
print_n("there!", n)
n = 0
a. no and no
b. yes and no
c. no and yes
d. yes and yes
e. syntax error
Answer:
Yes and Yes
Explanation:
When programs are written without indentation; it becomes a problem to read;
I'll rewrite your program as follows:
def print_n(s, n):
if n > 0:
print(s)
print_n(s, n-1)
return n
n = 3
while print_n("hi", n):
print_n("there!", n)
n = 0
Using the above as a point of reference,
Yes, the program will run and Yes, it'll terminate;
Because n is initialized to 3 at line 6 (where the main starts);
The following is passed to the function; s = "hi" and n=3
This prints "hi", three times
s = "there" and n=3 is then passed to the function print_n, afterwards;
The function then prints "there" three times
Then, the program terminates
Giving BRANLIEST IFFF CORRECT
Which type of chart or graph shows the contribution of each item in a total of 100%?
Bar graph
Column chart
Line graph
Pie chart
Answer:
pie chart
Explanation:
pie chart shows percentage per item
Answer:
pie chart
Explanation:
You are asked to write an app to keep track of a relatively small music library. The app should load song information from a data file once the app is started. It should allow user to view, add, remove, and search for songs. The app should save the data back to the same data file when the program exits.
Answer:
C++ PROGRAM
Explanation:
Write a method named coinFlip that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of whitespace-separated tokens. Assume that the input file data represents results of sets of coin flips. A coin flip is either the letter H or T, or the word Heads or Tails, in either upper or lower case, separated by at least one space. You should read the sequence of coin flips and output to the console the number of heads and the percentage of heads in that line, rounded to the nearest whole number. If this percentage is 50% or greater, you should print a "You win!" message; otherwise, print "You lose!". For example, consider the following input file: H T H H T Tails taIlS tAILs TailS heads HEAds hEadS For the input above, your method should produce the following output: 6 heads (50%) You win!
Answer:
Here is the JAVA program:
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException{ //the start of main() function body, it throws an exception that indicates a failed attempt to open the file
Scanner input = new Scanner(new File("file.txt")); //creates a Scanner object and a File object to open and scan through the file.txt
coinFlip(input); } //calls coinFlip method
public static void coinFlip(Scanner input) { //coinFlip method that accepts as its parameter a string input holding a file name
while(input.hasNextLine()) { //iterates through the input file checking if there is another line in the input file
Scanner scan = new Scanner(input.nextLine()); //creates a Scanner object
int head = 0; // stores count of number of heads
int count = 0; //stores count of total number of tokens
while(scan.hasNext()) { //iterates through the sequence checking if there is another sequence in the input file
String token= scan.next(); // checks and returns the next token
if (token.equalsIgnoreCase("H")||token.equalsIgnoreCase("Heads")) { //compares H or Heads with the tokens in file ignoring lower case and upper case differences
head++; } //if a token i.e. any form of heads in file matches with the H or Heads then add 1 to the number of heads
count++; } //increment to 1 to compute total number of counts
double result = Percentage(head, count); //calls Percentage method passing number of heads and total counts to compute the percentage of heads
System.out.println(head + " heads " + "(" + result +"%)"); // prints the number of heads
if(result >= 50.00) { //if the percentage is greater or equal to 50
System.out.println("You win!");} //displays this message if above if condition is true
else //if the percentage is less than 50
{System.out.println("You lose!");} } } //displays this message if above if condition is false
public static double Percentage(int h, int total) { //method to compute the percentage of heads
double p = (double)h/total* 100; // divide number of heads with the total count and multiply the result by 100 to compute percentage
return p; } } //returns result
Explanation:
The program is well explained in the comments mentioned with each line of the above code. I will explain how the method coinFlip works.
Method coinFlip accepts a string holding a file name as its parameter. It opens that file and reads its contents as a sequence of tokens. Then it reads and scans through each token and the if condition statement:
if (token.equalsIgnoreCase("H")||token.equalsIgnoreCase("Heads"))
checks if the each token in the sequence stored in the file is equal to the H or Heads regardless of the case of the token. For example if the first token in the sequence is H then this if condition evaluates to true. Then the head++ statement increments the count of head by 1. After scanning each token in the sequence the variable count is also increased to 1.
If the token of the sequence is HeAds then this if condition evaluates to true because the lower or upper case difference is ignored due to equalsIgnoreCase method. Each time a head is found in the sequence the variable head is incremented to 1.
However if the token in the sequence is Tails then this if condition evaluates to false. Then the value of head variable is not incremented to 1. Next the count variable is incremented to 1 because this variable value is always incremented to 1 each time a token is scanned because count returns the total number of tokens and head returns total number of heads in the tokens.
Percentage method is used to return the percentage of the number of heads in the sequence. It takes head and count as parameters (h and total). Computes the percentage by this formula h/total* 100. If the result of this is greater than or equal to 50 then the message You win is displayed otherwise message You lose! is displayed in output.
#Write a function called fancy_find. fancy_find should have #two parameters: search_within and search_for. # #fancy_find should check if search_for is found within the #string search_within. If it is, it should print the message #"[search_for] found at index [index]!", with [search_for] #and [index] replaced by the value of search_for and the #index at which it is found. If search_for is not found #within search_within, it should print, "[search_for] was #not found within [search_within]!", again with the values #of search_for and search_within. # #For example: # # fancy_find("ABCDEF", "DEF") -> "DEF found at index 3!" # fancy_find("ABCDEF", "GHI") -> "GHI was not found within ABCDEF!"
Answer:
Here is the Python program:
def fancy_find(search_within , search_for): # function definition of fancy_find function that takes two parameters
index = 0 #to store the index of search_within where the search_for string is found
if search_for in search_within: #checks if the string search_for is present in string search_within
sf = search_for[0] #points to the first character of the search_for
for sw in search_within: #iterates through search_within
if sw == sf: #if the first character of search_for is equal to the character at sw index of search_within
if search_within[index:index+len(search_for)] == search_for: #checks if the value of search_for is found in search_within
print(search_for,"found at index",index,"!") #if above condition is true prints the message "[search_for] found at index [index]!", with [search_for] and [index] replaced by the value of search_for and the index at which it is found
return ""
index += 1 #increments value of index at each iteration
print(search_for,"is not found within", search_within) #if search_for is not found within search_within, prints message "[search_for] was not found within [search_within]!" with the values of search_for and search_within.
return ""
#following two statements are used to test the working of above function
print(fancy_find("ABCDEF", "DEF")) #calls fancy_find() passing "ABCDEF" as search_within and "DEF" as search_for
print(fancy_find("ABCDEF", "GHI")) #calls fancy_find() passing "ABCDEF" as search_within and "GHI" as search_for
Explanation:
The program is well explained in the comments. I will explain the working of the function with the help of an example:
Suppose
search_within = "ABCDEF"
search_for = "DEF"
We have to find if search_for i.e. DEF is present in search_within i.e. ABCDEF
if search_for in search_within statement checks using in operator that if DEF is included in ABCDEF. Here this condition evaluates to true so the next statement sf = search_for[0] executes which sets the first element of search_for i.e. D to sf. So sf = 'D'
for sw in search_within this statement has a for loop that iterates through ABCDEF and works as following:
At first iteration:
sw contains the first character of search_within i.e. A
if sw == sf: condition checks if the first character of the search_for i.e. D is equal to sw i.e. A. Its not true so the program control moves to this statement:
index += 1 This increases the value of index by 1. index was initialized to 0 so now it becomes 1. Hence index=1
At second iteration:
sw contains the second character of search_within i.e. B
if sw == sf: condition checks if the first character of the search_for i.e. D is equal to sw i.e. B Its not true so the program control moves to this statement:
index += 1 This increases the value of index by 1. index was initialized to 0 so now it becomes 2. Hence index=2
At third iteration:
sw contains the third character of search_within i.e. C
if sw == sf: condition checks if the first character of the search_for i.e. D is equal to sw i.e. C Its not true so the program control moves to this statement:
index += 1 This increases the value of index by 1. index was initialized to 0 so now it becomes 3. Hence index=3
At fourth iteration:
sw contains the third character of search_within i.e. D
if sw == sf: condition checks if the first character of the search_for i.e. D is equal to sw i.e. D. Its true so so the program control moves to this statement:
if search_within[index:index+len(search_for)] == search_for:
current value of index=3
len(search_for) returns the length of DEF i.e. 3
So the if condition checks for the search_for in search_within. The statement becomes:
if search_within[3:3+3] == search_for:
search_within[3:3+3] means from 3rd index position of search_within to 6-th index position of the search_within. This means from 4th element of search_within i.e. D to the last. Hence search_within[3:3+3] is equal to DEF.
search_for = DEF so
if search_within[3:3+3] == search_for: checks if
search_within[3:3+3] = DEF is equals to search_for = DEF
Yes it is true so
print(search_for,"found at index",index,"!") statement is executef which prints the following message:
DEF found at index 3!
This output is because search_for = "DEF" and index=3
Windows workstations all have elements of server software built-in. What are these elements, and why is the Windows Professional OS not considered a server?
Answer:
The answer is below
Explanation:
Elements of Server software that is built-in, in Windows workstations are:
1. Hard drives,
2. RAM (Random Access Memory)
3. Processors
4. Network adapters.
Windows Professional OS is not considered a server due to the following:
1. Windows Professional OS has a limit on the number of client connections it allowed.
2. Unlike Server, Professional OS uses less memory
2. In comparison to Server, Professional OS uses the CPU less efficiently
4. Professional OS is not built to process background tasks, unlike Server that is configured to perform background tasks.
The intention of this problem is to analyze a user input word, and display the letter that it starts with (book → B).
a. Create a function prototype for a function that accepts a word less than 25 characters long, and return a character.
b. Write the function definition for this function that evaluates the input word and returns the letter that the word starts with in capital letter (if it’s in small letters).
c. Create a function call in the main function, and use the function output to print the following message based on the input from the user. (Remember to have a command prompt in the main function requesting the user to enter any word.)
Computer starts with the letter C.
Summer starts with the letter S.
d. Make sure to consider the case where a naughty user enters characters other than the alphabet to form a word and display a relevant message.
%sb$ is not a word.
$500 is not a word.
e. Have the program process words until it encounters a word beginning with the character
Answer:
Here is the C++ program:
#include<iostream> // to use input output functions
using namespace std; //to identify objects like cin cout
void StartChar(string str) { // function that takes a word string as parameter and returns the first letter of that word in capital
int i;
char c;
do //start of do while loop
{
for (int i = 0; i < str.length(); i++) { //iterates through each character of the word str
if(str.length()>25){ //checks if the length of input word is greater than 25
cout<<"limit exceeded"; } //displays this message if a word is more than 25 characters long
c = str.at(i); // returns the character at position i
if (! ( ( c >= 'a' && c <= 'z' ) || ( c >= 'A' && c <= 'Z' ) ) ) { //checks if the input word is contains characters other than the alphabet
cout<<str<<" is not a word!"<<endl; break;} //displays this message if user enters characters other than the alphabet
if (i == 0) { //check the first character of the input word
str[i]=toupper(str[i]); //converts the first character of the input word to uppercase
cout<<str<<" starts with letter "<<str[i]<<endl; } // prints the letter that the word starts with in capital letter
} cout<<"Enter a word: "; //prompts user to enter a word
cin>>str; //reads input word from user
}while(str!="#"); } //keeps prompting user to enter a word until the user enters #
int main() //start of the main() function body
{ string str; //declares a variable to hold a word
cout<<"Enter a word: "; //prompts user to enter a word
cin>>str; //reads input word from user
StartChar(str); } //calls function passing the word to it
Explanation:
The program prompts the user to enter a word and then calls StartChar(str) method by passing the word to the function.
The function StartChar() takes that word string as argument.
do while loop starts. The for loop inside do while loop iterates through each character of the word string.
First if condition checks if the length of the input word is greater than 25 using length() method which returns the length of the str. For example user inputs "aaaaaaaaaaaaaaaaaaaaaaaaaaa". Then the message limit exceeded is printed on the screen if this if condition evaluates to true.
second if condition checks if the user enters anything except the alphabet character to form a word. For example user $500. If this condition evaluates to true then the message $500 is not a word! is printed on the screen.
Third if condition checks if the first character of input word, convert that character to capital using toupper() method and prints the first letter of the str word in capital. For example if input word is "Computer" then this prints the message: Computer starts with the letter C in the output screen.
The program keeps prompting the user to enter the word until the user enters a hash # to end the program.
The output of the program is attached.
________type of website is an interactive website kept constantly updated and relevant to the needs of its customers using a database.
Answer:
Data-driven Website
Explanation:
A Data-driven website is a type of website that is continually updated by its administrators so as to meet users' needs. It is opposed to a static website whose information remains the same and is never changed once uploaded.
The data-driven website is used in a platform where information has to be continually updated. An example is an online platform where people place orders for goods and services. There are usually changing prices and new goods continually uploaded. So, to keep the consumers updated, the administrators of such platforms would use a data-driven platform.
The program to check the highEst of n numbercan be done by ......,..
Answer: Given an array of numbers, arrange them in a way that yields the largest value. For example, if the given numbers are {54, 546, 548, 60}, the arrangement 6054854654 gives the largest value. And if the given numbers are {1, 34, 3, 98, 9, 76, 45, 4}, then the arrangement 998764543431 gives the largest value.
Explanation: If you need more help follow me on istagram at dr.darrien
-thank you
Design a class named Rectangle to represent a rectangle. The class contains:
Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height.
A no-arg constructor that creates a default rectangle.
A constructor that creates a rectangle with the specified width and height.
A method named getArea() that returns the area of this rectangle.
A method named getPerimeter() that returns the perimeter.
Draw the UML diagram for the class then implement the class. Write a test program that create two Rectangle objects - one with width 4 and height 40, and the other with width 3.5 and height 35.9.
Display the width, heigth, area, and perimeter of each rectangle in this order.
Answer:
function Rectangle(width=1, height= 1 ) {
this.width= width;
this.height= height;
this.getArea= ( ) = > {return width * height};
this.getPerimeter= ( ) = >{ return 2( height + width)};
}
var rectangleOne= new Rectangle(4, 40)
var rectangleTwo= new Rectangle(3.5, 35.9)
console.log(rectangleOne.width, rectangleOne.height, rectangleOne.getArea( ), rectangleOne.getPerimeter( ) )
console.log(rectangleTwo.width, rectangleTwo.height, rectangleTwo.getArea( ), rectangleTwo.getPerimeter( ) )
Explanation:
This is a Javascript class definition with a constructor specifying arguments with default values of one for both width and height, and the getArea and getPerimeter methods.