Answer:
The correct answer is "List of posts with the most recent ones at the top".
Explanation:
A website that includes someone else's thoughts, insights, views, etc. about a writer or community of authors and that also has photographs as well as searching the web.It indicates that perhaps the blog should distinguish between different articles about the site because then customers who frequent the site will observe and experience the articles on everyone's blogs.So that the above would be the appropriate one.
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:
Does the cloud solution offer equal or greater data security capabilities than those pro-vided by your organization’s data center?
Answer:I think greater. Answer my question that I posted plz
Explanation:
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 method that accepts a String object as an argument and returns a copy of the string with the first character of each sentence capitalized. For instance, if the argument is "hello. my name is Joe. what is your name?" the method should return the string "Hello. My name is Joe. What is your name?" Demonstrate the method in a program that asks the user to input a string and then passes it to the method. The modified string should be displayed on the screen.
Answer:
The programming language is not stated; However, the program written in C++ is as follows: (See Attachment)
#include<iostream>
using namespace std;
string capt(string result)
{
result[0] = toupper(result[0]);
for(int i =0;i<result.length();i++){
if(result[i]=='.' || result[i]=='?' ||result[i]=='!') {
if(result[i+1]==' ') {
result[i+2] = toupper(result[i+2]);
}
if(result[i+2]==' ') {
result[i+3] = toupper(result[i+3]);
}
} }
return result;
}
int main(){
string sentence;
getline(cin,sentence);
cout<<capt(sentence);
return 0;
}
Explanation:
The method to capitalize first letters of string starts here
string capt(string result){
This line capitalizes the first letter of the sentence
result[0] = toupper(result[0]);
This iteration iterates through each letter of the input sentence
for(int i =0;i<result.length();i++){
This checks if the current character is a period (.), a question mark (?) or an exclamation mark (!)
if(result[i]=='.' || result[i]=='?' ||result[i]=='!') {
if(result[i+1]==' '){ ->This condition checks if the sentence is single spaced
result[i+2] = toupper(result[i+2]);
-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized
}
if(result[i+2]==' '){ ->This condition checks if the sentence is double spaced
result[i+3] = toupper(result[i+3]);
-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized
}
}
} The iteration ends here
return result; ->The new string is returned here.
}
The main method starts here
int main(){
This declares a string variable named sentence
string sentence;
This gets the user input
getline(cin,sentence);
This passes the input string to the method defined above
cout<<capt(sentence);
return 0;
}
The policy that allows a transaction to commit even if it has modified some blocks that have not yet been written back to disk is called the __________ policy.
Answer:
No-force policy
Explanation:
The policy that allows a transaction to commit even if it has modified some blocks that have not yet been written back to disk is called the _NO-FORCE_ policy.
In data theory, the No-Force Policy is beneficial for the control of transaction. In this policy, when a transaction commits, changes that are made are not required to be written to disk in place. The changes recorded are preserved in order to make transaction durable. The recorded changes must be preserved at commit time.
identification and authentication in local and distributed systems
Answer:
This local distributed systems identification and authentication computer system networks describe centrally support facilities.
Explanation:
Identification is the process of identify employ, student and others is associated with a other entity, identify is associated by always that a person,id number and they personal id.
Identification number is assigned to the employee and students an administration system identification entities such as departments, roles, computer base service.
Identification is the number to perform regular faculty staff as defined in the register.
Authentication is the secure identification system of users,all users computer system and network must develop implement control policies.
Authentication responsible for the determining method to use among that available for a particular system,provide by standard organization then using the authentication method system.
Authentication policy apply to the transactions routing school and office area transmission by administrative offices, transaction is crucial to conduct of university business.
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.
10.7 LAB: Fat-burning heart rate Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burning_heart_rate() to
Answer:
I've written in python
Explanation:
age = int(input("Enter the person's age: ")
def fat_burning_heart_rate(x):
rate =( 70/100 * 220 ) - age
print(fat_burning_heart_rate(age))
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
Consider the binary search tree constructed for the words oenology, phrenology, campanology, ornithology, ichthyology, limnology, alchemy, and astrology using alphabetical order. Find the number of comparisons needed to locate or to add each of the following words in the search tree, starting fresh each time:
a. palmistry
b. etymology
c. paleontology
d. glaciology
Explanation:
Binary Search Tree is also called ordered tree or sorted binary tree. In the tree each node contains smaller values in the left side of the subtree and larger values in the right side of the subtree.
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
Which function in Excel tells how
? many numeric entries are there
SUM O
COUNT
SQRT O
SORT O
Answer:
Count
Explanation:
Let's see which function does what:
SUM
This function totals one or more numbers in a range of cells.COUNT
This function gets the number of entries in a number field that is in a range or array of numbersSQRT
This function returns the square root of a number.SORT
This function sorts the contents of a range or array.As we see, Count is the function that gets the number of entries.
Answer:
CountExplanation:
Tells how many numeric entries are there.
Consider the following instruction: OR( %1111_0000, AL ) ; After its execution, what will be true about the bits stored in AL?
Answer:
the higher order bits in AL will be true
Explanation:
We know from the truth table that in an OR operation, once one operand is true the result is true, no matter the value of the other operand. From the above AL will have the higher order bits to be true since the first four higher order bits are 1s, 1111_0000, this is regardless of the original values of AL. We cannot however ascertain if the lower bits of AL are true from this. Note 1 evaluates to true while 0 is false
Which recovery method helps users boot into an environment to get them back into the system so they can begin the troubleshooting process
Answer:
sfadasda
Explanation:
dsadasdadas
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!
(Process scores in a text file) Suppose that a text file contains an unspecified number of scores. Write a program that reads the scores from the file and displays their total and average. Scores are separated by blanks. Your program should prompt the user to enter a filename. Here is a sample run:
Answer:
Here is the Python program:
def scores(file): # method scores that takes a file name as parameter and returns the sum and average of scores in a file
with open(file, 'r') as infile: # open the file in read mode
lines = [score.split() for score in infile] # split the scores into a list
print("The scores are:",lines) #print the scores
for line in lines: # loops through each score
total= sum(int(score) for score in line) # adds the scores
average =total/len(line) # computes average by taking sum of scores and dividing by number of scores in file
print("The sum is:", total) #prints the sum of scores
print("The average is:", "{:.2f}".format(average)) #prints the average
filename = input("Enter name of the file: ") #prompts user to enter name of file
scores(filename) #calls scores method by passing the file name to it in order to compute sum and average of file contents i.e. scores
Explanation:
It is assumed that the scores in the file are separated by a blank space.
The scores() method takes a file name as parameter. Then it opens that input file in read mode using object infile.
split() method is used to split the scores in a file into a list. Suppose the scores are 1 2 3 4 5 6 . So after the split, they become ['1', '2', '3', '4', '5', '6']
The loop iterates through each score in the file, splits them into a list and stores this list in lines. The next print statement prints these scores in a list.
The second loop for line in lines iterates through each score of the list and the statements: total= sum(int(score) for score in line) and average =total/len(line) computes the total and average of scores.
total= sum(int(score) for score in line) statement works as follows:
for loop iterates through each element of list i.e. each score
int() converts that string element into integer.
sum() method adds the integers to compute their total.
So if we have ['1', '2', '3', '4', '5', '6'] each element i.e. 1,2,3,4,5,6 is converted to integer by int() and then added together by sum method. So this becomes 1+2+3+4+5+6 = 21. This result is stored in total. Hence
total = 21.
average = total/len(line) works as follows:
The computed sum of scores stored in total is divided by the number of scores. The number of scores is computed by using len() method which returns the length of the line list. So len() returns 6. Hence
average = total/len(line)
= 21 / 6
average = 3.5
The next two print statement prints the value of sum and average and "{:.2f}".format(average)) prints the value of average up to 2 decimal places.
The screenshot of the program along with its output is attached.
Which wireless device connects multiple laptops, tablets, phones, and other mobile devices in a corporate environment?
Answer:
Bluetooth or a wifi router or a gateway
Explanation:
#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
Select the function completion that satisfies this docstring description: def convert_to_string(nums): """ (list of number) -> NoneType Replace each item in nums with its string equivalent. >>> nums
Answer:
def convert_to_string(nums):
for i in range(len(nums)):
nums[i] = str(nums[i])
nums = [7, 28, 92]
print(nums)
convert_to_string(nums)
print(nums)
Explanation:
Create a function called convert_to_string that takes one parameter, nums
Create a for loop that iterates through the nums. Inside the loop, set each item to its string equivalent using type casting (str)
Initialize a list
Print the list before the function call
Call the function, passing the list as a parameter
Then, print the list again to see the difference
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 function called population_density. The function #should take one parameter, which will be a list of #dictionaries. Each dictionary in the list will have three #key-value pairs: # # - name: the name of the country # - population: the population of that country # - area: the area of that country (in km^2) # #Your function should return the population density of all #the countries put together. You can calculate this by #summing all the populations, summing all the areas, and #dividing the total population by the total area. # #Note that the input to this function will look quite long; #don't let that scare you. That's just because dictionaries #take a lot of text to define. #Add your function here!
Answer:
def population_density(dictionary_list):
""" this function calculates the population density of a list of countries"""
total_population= 0
total_area= 0
for country in dictionary_list:
total_population += country['population']
total_area += country['area']
population_density = total_population / total_area
return population_density
Explanation:
In python, functions are defined by the "def" keyword and a dictionary is used to hold immutable data key and its value. The for loop is used to loop through the list of dictionaries and the values of the country data and extracted with bracket notation.
Management wants to ensure any sensitive data on company-provided cell phones is isolated in a single location that can be remotely wiped if the phone is lost. Which of the following technologies BEST meets this need?a. Geofencingb. containerizationc. device encryptiond. Sandboxing
Answer:
B. Containerization.
Explanation:
In this scenario, management wants to ensure any sensitive data on company-provided cell phones is isolated in a single location that can be remotely wiped if the phone is lost. The technology which best meets this need is containerization.
In Computer science, containerization can be defined as a process through which software applications are used or operated in an isolated space (environment). It uses an operating system level virtualization method, such as a single host OS kernel, UFS, namespaces, Cgroups, to run software applications.
Hence, using the containerization technology makes it easy to wipe off the cell phones if lost because it is isolated in a single location.
Assign decoded_tweet with user_tweet, replacing any occurrence of 'TTYL' with 'talk to you later'.Sample output with input: 'Gotta go. I will TTYL.'Gotta go. I will talk to you later.code given:user_tweet = input()decoded_tweet = ''' Your solution goes here '''print(decoded_tweet)
Answer:
Here is the Python program:
user_tweet = input()
decoded_tweet = user_tweet.replace('TTYL', 'talk to you later')
print(decoded_tweet)
Explanation:
The program works as follows:
Suppose the input is: 'Gotta go. I will TTYL'
This is stored in user_tweet. So
user_tweet = 'Gotta go. I will TTYL'
The statement: user_tweet.replace('TTYL', 'talk to you later') uses replace() method which is used to replace a specified string i.e. TTYL with another specified string i.e. talk to you later in the string stored in user_tweet.
The first argument of this method replace() is the string or phrase that is to be replaced and the second argument is the string or phrase that is to replace that specified string in first argument.
So this new string is assigned to decoded_tweet, after replacing 'TTYL' with 'talk to you later' in user_tweet.
So the print statement print(decoded_tweet) displays that new string.
Hence the output is:
Gotta go. I will talk to you later.
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
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:
some properties of Internal and External Storage.
Answer:
Internal Storage
This has to do with the primary memory of a computer that is used to store the user's files, applications, etc. This is where the Operating System and pre-installed software is installed. There are two types of internal memory which are ROM and RAM.
Properties
They are volatileThey contain the OS of the systemROM loses data when power is lostRAM does not lose storage when power is lost.External Storage
These are secondary memory that is not primarily permanently attached to the computer. This is a device that contains all the addressable data storage which are not inside the computer's storage. Some examples of external storage are flash drives, CD ROMs, etc.
Properties
They are addressableThey can be easily detached.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'.
Complete the function by filling in the missing parts. The color_translator function receives the name of a color, then prints its hexadecimal value. Currently, it only supports the three additive primary colors (red, green, blue), so it returns "unknown" for all other colors. m 1 - def color_translator(color): 2. if _== "red": 3 hex_color = "#ff0000" 4- elif == "green": 5 hex_color = "#00ff00" elif == "blue": hex_color = "#0000ff" in 0 hex_color = "unknown" return _ . 12 13 14 15 16 17 print(color_translator("blue")) # Should be #0000ff print(color_translator ("yellow")) # should be unknown print(color_translator("red")) # Should be #ff0000 print(color_translator ("black")) # should be unknown print(color_translator("green")) # Should be #00ff00 print(color translator("")) # should be unknown Run Reset
Answer:
The completed program is
def color_translator(color):
if color == "red":
hex_color = "#ff0000"
elif color == "green":
hex_color = "#00ff00"
elif color == "blue":
hex_color = "#0000ff"
else:
hex_color = "unknown"
return hex_color
Explanation:
Since the parameter in the above function is color,
This variable will serve as the name of a color and it'll be used in the conditional statements to check if the name of color is any of red, green and blue;
And that is why we have
if color == "red":
elif color == "green":
elif color == "blue":
The variable used to hold the color codes, hex_color, will be returned at the end of the function and that's why we have
return hex_color
When the program is tested with print(color_translator("blue")) and others, it prints the desired output
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.
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.