Answer:
Find the explanation below.
Explanation:
1. Industry 4.0 -automation revolution is a term first used in Germany in 2011 to describe the fourth generation of the industrial revolution. It is the incorporation of digitalized procedures that use smart technology that can work in real-time to industrial production. This means that the machines used in production can independently interact between themselves to accomplish tasks that would otherwise have needed human involvement.
2. My opinion regarding this industrial revolution is that it is a welcome development for businesses because it will help them execute projects at faster rates and limit some working expenses.
3. Unskilled and Semi-skilled workers will be badly affected by this revolution because tasks ordinarily performed by them would be mostly taken over by these machines. This means that companies would most likely lay off these workers whose jobs would now be performed by machines. Job regulation agencies would do well to seek ways to intervene for this group of workers. They may also have to improve their skills if they want to remain relevant to their jobs.
The revolution, however, would be favorable for high-skilled workers because they would be needed to perform jobs such as the maintenance and programming of these machines.
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a file. The program should output the unique words and their frequencies in alphabetical order. Variations are to track sequences of two words and their frequencies, or n words and their frequencies.
Below is an example file along with the program input and output:
example.txt
I AM SAM I AM SAM SAM I AM
Enter the input file name: example.txt
AM 3
I 3
SAM 3
Answer:
I am writing a Python program.
def concordance(filename): # function that takes a file name as parameter and returns the concordance for that file
file = open(filename,"r") #opens file in read mode
unique={} #creates and empty list
for word in file.read().split(): #loops through every word in the file
if word in unique: # if words is already present in the list
unique[word] += 1 #add 1 to the count of the existing word
else: #if word is not present in the list
unique[word] = 1 #add the word to the list and add 1 to the count of word
file.close(); # close the file
for x in sorted(unique): #sort the list and displays words with frequencies
print(x, unique[x]); #prints the unique words and their frequencies in alphabetical order
#prompts user to enter the name of the file
file_name=input('Enter the input file name: ')
concordance(file_name) #calls concordance method by passing file name to it
Explanation:
The program has a function concordance that takes a text file name as parameter and returns a list of unique words and their frequencies.
The program first uses open() method to open the file in read mode. Here "r" represents the mode. Then creates an empty list named unique. Then the for loop iterates through each word in the file. Here the method read() is used to read the contents of file and split() is used to return these contents as a list of strings. The if condition inside the loop body checks each word if it is already present in the list unique. If the word is present then it adds 1 to the count of that word and if the word is not already present then it adds that unique word to the list and assign 1 as a count to that word. close() method then closes the file. The second for loop for x in sorted(unique): is used to display the list of unique words with their frequencies. sorted() method is used to sort the list and then the loop iterates through each word in the list, through x, which acts like an index variable, and the loop displays each word along with its frequency.
if the bandwidth-delay product of a channel is 500 Mbps and 1 bit takes 25 milliseconds to make the roundtrip, what is the bandwidth-delay product
Answer:
2500 kb
Explanation:
Here, we are to calculate the bandwidth delay product
From the question, we are given that
band width = 500 Mbps
The bandwidth-delay product is = 500 x 10^6 x 25 x 10^-3
= 2500 Kbits
What is displayed in the alert dialog box after the following code is executed? var scores = [70, 20, 35, 15]; scores[scores.length] = 40; alert("The scores array: " + scores);
Answer:
The scores array: 70,20,35,15,40
Explanation:
I will explain the code line by line:
var scores = [70, 20, 35, 15];
The above statement declares and assigns values to an array named scores
scores[scores.length] = 40;
The above statement uses length to set the length of the scores array. It sets the last element of the scores array to 40. So this means 40 is set as the last element of scores.
scores.length returns the length of the scores array i.e. 4 as there are 4 elements in scores array 70,20,35,15
So the statement becomes:
scores[4] = 40;
This assigns value 40 to the 4th index of the scores array. Do not confuse 4th index with 4th element of the array because array element location starts from 0. So scores[4] does not mean 4th element but scores[4] means 4th index position of scores array. This makes 5th element of scores. So set the element 40 as 5th element at 4th index of scores.
alert("The scores array: " + scores);
This displays an alert box with the following message:
The scores array: 70,20,35,15,40
If the current date is Monday, February 26, 2017, what will be displayed by the alert dialog box after the following code executes? var thisDay = new Date(); alert(thisDay.toDateString());
Answer:
Mon Feb 26 2017
Explanation:
Since the current date is considered as Monday, February 26, 2017, thisDay will be set to that value.
The toDateString() method returns the first three letters of the name of the day (The first letter is capitalized), the first three letters of the name of the month (The first letter is capitalized), the day of the month as an integer, and the year as an integer (There are spaces between all)
C create a class called Plane, to implement the functionality of the Airline Reservation System. Write an application that uses the Plane class and test its functionality. Write a method called Check In() as part of the Plane class to handle the check in process Prompts the user to enter 1 to select First Class Seat (Choice: 1) Prompts the user to enter 2 to select Economy Seat (Choice: 2) Assume there are only 5-seats for each First Class and Economy When all the seats are taken, display no more seats available for you selection Otherwise it displays the seat that was selected. Repeat until seats are filled in both sections Selections can be made from each class at any time.
Answer:
Here is the C++ program:
#include <iostream> //for using input output functions
using namespace std; //to identify objects like cin cout
class Plane{ //class Plane
private: // declare private data members i.e. first_class and eco_class
int first_class; //variable for first class
int eco_class; //variable declared for economy class
public: // public access modifier
Plane(){ //constructor to initialize values of first_class and eco_class
first_class=0; //initialized to 0
eco_class=0;} //initialized to 0
int getFirst(){ // class method to get data member first_class
return first_class;} //returns the no of reserved first class seats
int getEco(){ // class method to get data member eco_class
return eco_class;} //returns the no of reserved eco class seats
void CheckIn(){ //method to handle the check in process
int choice; //choice between first and economy class
cout<<"\nEnter 1 to select First Class Seat: "<<endl; //prompts user to enter 1 to reserve first class seat
cout<<"\nEnter 2 to select Economy Class Seat: "<<endl; //prompts user to enter 2 to reserve economy class seat
cin>>choice; //reads the choice from user
switch(choice){ // switch statement is used to handle the check in process
case 1: //to handle the first class seat reservation
if(getFirst()<5){ //if the seat is available and the seat limit has not exceed 5
first_class++; //add 1 to the first_class seat to count that a seat is reserved
cout<<"You reserved First class seat! ";} //display the message about successful seat reservation in first class
cout<<"\nNumber of first class seats reserved: "<<getFirst()<<endl;} //displays the number of seats already reserved
else{ //if all first class seats are reserved then display the following message
cout<<"No more seats available for you selection!"<<endl;
if(getEco()>=5 && getFirst()>=5){ //if all seats from first class and economy class are reserved display the following message
cout<<"All seats are reserved!"<<endl;
exit(1);}} //program exits
break;
case 2: //to handle the economy seat reservation
if(getEco()<5){ //if the seat is available and the seat limit has not exceed 5
eco_class++; //add 1 to the eco_class seat to count that a seat is reserved
cout<<"You reserved Economy class seat! "; //display the message about successful seat reservation in economy class
cout<<"\nNumber of Economy class seats reserved: "<<getEco()<<endl;} //displays the number of seats already reserved
else{ //if all economy class seats are reserved then display the following message
cout<<"No more seats available for you selection!"<<endl;
if(getEco()>=5 && getFirst()>=5){ //if all seats from first class and economy class are reserved display the following message
cout<<"All seats are reserved!"<<endl;
exit(1);}} //program exits
break;
default: cout<<"Enter a valid choice"<<endl; } } }; //if user enters anything other that 1 or 2 for choice then this message is displayed
int main(){ //start of main() function body
int select; // choice from first or economy class
Plane plane; //create an object of Plane class
cout<<"**************************"<<endl;
cout<<"Airline Reservation System"<<endl; //display this welcome message
cout<<"**************************"<<endl;
while(true){ // while loop executes the check in procedure
plane.CheckIn();} } //class CheckIn method of Plane classs using plane object to start with the check in process
Explanation:
The program is elaborated in the comments with each statement of the above code. The program has a class Plane that has a method CheckIn to handle the check in process. The user is prompted to enter a choice i.e. enter 1 to select First Class Seat and enter 2 to select Economy Seat. A switch statement is used to handle this process. If user enters 1 then the case 1 of switch statement executes which reserves a seat for the user in first class. If user enters 2 then the case 2 of switch statement executes which reserves a seat for the user in economy class.There are only 5 seats for each First Class and Economy. So when the limit of the seats reservation exceeds 5 then the no more seats available for you selection is displayed. If all the seats are taken in both the first and economy class then it displays the message All seats are reserved. If the user enters anything other than 1 or 2 then display the message Enter a valid choice. Whenever the user reserves one of first or economy class seats the relevant seat is incremented to 1 in order to count the number of seats being reserved. The program and its output are attached.
A variable that can have values only in the range 0 to 65535 is a :
a. Two-byte unsigned int.
b. Four-byte int.
c. Two-byte int.
d. Four-byte unsigned int.
Answer:
a.
Explanation:
Two bytes have 2 times 8 bits is 16 bits.
Max value that can be expressed is 2¹⁶-1 = 65535
The new_directory function
Answer:The new directory method creates a new directory within the current working directory.
Explanation:The new directory function and returns the list of the files within that directory.The new directory function allow to with the built in function MK dir().
To the new directory function create a current working directory.
import OS
OS.MKdir()
The code creates the directory projects in the current working directory to specify the full path.
Complete the below method, isPalindrome(), that takes in a String and returns a boolean. The boolean should be true if the String is a palindrome, i.e., the String is the same if read forwards or in reverse. For example, "racecar" is a palindrome. The method should return false if the String is not a palindrome. Note: any single-letter word is considered a palindrome.
public class StringMethod {
public static boolean isPalindrome(String word) {
//TODO: Complete this method
}
}
Answer:
public static boolean isPalindrome(String word) {
//TODO: Complete this method
String reverse = "";
for (int i = (word.length()-1); i>=0; i--) {
if(word.charAt(i)!=' '){
reverse+=word.charAt(i);
}
}
String without_space = word.replaceAll(" ", "");
return reverse.equals(without_space);
}
Methods are collections of named code blocks, that are executed when called or evoked.
The isPalindrome method written in Java, where comments are used to explain each line is as follows
//This defines the method
public static boolean isPalindrome(String word) {
//This removes all the spaces in the word
String newStr = word.replaceAll(" ", "");
//This initializes an empty string
String rev = "";
//This iterates through the word, in reverse order
for (int i = (word.length()-1); i>=0; i--) {
//This gets all the characters in the string (without the space)
if(word.charAt(i)!=' '){
rev+=word.charAt(i);
}
}
//This returns true or false
return reverse.equals(newStr);
}
Read more about methods at:
https://brainly.com/question/19360941
Write a function named twoWordsV2 that has the same specification as Problem 1, but implement it using while and not using break. (Hint: provide a different boolean condition for while.) Since only the implementation has changed, and not the specification, for a given input the output should be identical to the output in Problem 1.
Answer:
I am writing a Python program. Here is the function twoWordsV2:
def twoWordsV2 (length,firstLetter):#definition of function which takes length of the first word and first letter of the second word as parameter and returns these two words in a list
word1 = "" # stores the first word
word2= "" #holds the second word
while(len(word1)!=length): # checks if the input word1 length is not equal to the specified length
word1 = input('A ' + str(length) + '-letter word please: ') #asks user to enter the input word1 of specified length
while(word2!=firstLetter): #checks if the first character of input word2 is not equal to the specified firstLetter character
word2 = input('A word beginning with ' + firstLetter+ ' please: ')#asks user to enter the input word2 begining with specified first letter
if word2[0] == firstLetter.upper() or word2[0] == firstLetter.lower():#second word may begin with either an upper or lower case instance of firstLetter
return [word1,word2] #return the two words in a list
#to check the working of the function use the following statement
print(twoWordsV2(4,'B')) #calls twoWordsV2 method by passing 4 (length) and B (first letter)
Explanation:
twoWordsV2 method has two parameters i.e length which is the length of the first word and firstLetter which is the first character of the the second word. This means the first word should be of specified length, and the second word should begin with a specified first letter. The function returns the two resultant words with the above specifications. These two words are displayed in a list. I will explain the working of the function with the help of an example:
Suppose length = 4 and firstLetter = 'B' and user enters "ok" as word1. input() method takes first word input from user.
The first while loop checks if the length of word1 i.e. ok is not equal to specified length i.e. 4. Length of word1 is checked using len function which returns 2 so length of word1 is 2. The loop condition is true because length of word1 i.e. 2 is not equal to specified length i.e. 4. So the body of the loop executes which displays this message:
A 4-letter word please:
Here notice that str(length) is changed to 4. This is because length=4 and str() converts this value into string.
So the above message keeps displaying until user enters a four letter word. Lets suppose user now enters "four". Now the while loop condition evaluates to false and the loop breaks. The program control moves to the next line which is a while loop.
The second while loop checks if the first character of input word2 is not equal to the specified firstLetter character. Suppose word2 = "apple" and firstLetter= 'B'
Now the loop condition evaluates to true because word2 is not equal to first letter B. Now the main part of this while loop is the if condition: if word2[0] == firstLetter.upper() or word2[0] == firstLetter.lower() This statement checks if the first index of the word2 is equal to firstLetter. The word2 can contain a capital B or a small B so if condition checks both the cases by using upper and lower methods that converts the firstLetter to upper or lower and then match with the first letter of word2 i.e. the letter at index 0 of the word2. If this condition evaluates to true then next return statement returns the word1 and word2 in a list otherwise the second while loop keep asking user to enter the word2 with starting letter to be firstLetter i.e. 'B'.
The screenshot of the program and its output is attached.
The function for the given problem is:
def twoWordsV2 (length,firstLetter):word1 = "" # stores the first wordword2= "" #holds the second word while(len(word1)!=length): word1 = input('A ' + str(length) + '-letter word please: ') while(word2!=firstLetter): word2 = input('A word beginning with ' + firstLetter+ ' please: ')if word2[0] == firstLetter.upper() or word2[0] == firstLetter.lower(): return [word1,word2] print(twoWordsV2(4,'B')) Brief Explanation:These 10 lines of code were written using the Python programming language and this was used to define, store and hold the function and then request input from the user, check if the given input was according to the required parameters, and then print the output.
Read more about python programming language here:
https://brainly.com/question/7015522
What is the best way to show a complex data chart in word?
Answer:just do it
Explanation:
How different quantities are determined
Which best describes the purpose of LoJack on a computer
Answer:The purpose of the lo jack on a computer to the lock and delete files on the computer devices.
Explanation:The lo jack on a computer to locate all the lock and delete files.
lo jack can provides the computer on the passwords that contains different levels of the bios access.
lo jack perform on the computer operating system provides on the boot only the trusted by the computer operating system.
Lo jack computer on the function is used to the published the exam answers on the websites.
Lo jack insures to the data into hard drives to the correct computer password.
What is displayed by the alert dialog box after the following code executes? var name = "Donny,Duck"; var index = name.indexOf(","); var lastName = name.substr(index + 1, name.length - 1);; alert("Last name: " + lastName);
Answer:
Last name: Duck
Explanation:
explanation is provided in the attached document.
When organizing your career portfolio, you should.
A. always assemble it by topic
B. highlight the skills and experiences most relevant to those
thinking of hiring you
C. highlight only your education and work experiences but not your
skills
D. always assemble it chronologically
Answer:
B
Explanation:
When organizing your career portfolio, you should highlight the skills and experiences most relevant to those thinking of hiring you. Thus, option B is correct.
A combination resume can be described as the resume format which was designed for highly-trained job seekers with previous work experience.
In a case whereby a chronological resume lists your work history in reverse order, starting with your current or most recent job and working backwards and many employers like this format because it presents your work history in a clear, easy-to-follow arrangement the type of resume will you choose to use is Combination resume.
It should be noted that it is been reffered to as combination” as a result of how it combines the most notable features of both the functional resume format and the chronological resume.
Therefore, When organizing your career portfolio, you should highlight the skills and experiences most relevant to those thinking of hiring you. Thus, option B is correct.
Learn more about resume at:
brainly.com/question/14218463
#SPJ7
The program below counts the number of characters in a file, assuming the file is encoded as ASCII. Modify the program so that it counts the number of characters in a file encoded as UTF-8. CODE: #include #include typedef unsigned char BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("Usage: ./count INPUT\n"); return 1; } FILE *file = fopen(argv[1], "r"); if (!file) { printf("Could not open file.\n"); return 1; } int count = 0; while (true) { BYTE b; fread(&b, 1, 1, file); if (feof(file)) { break; } count++; } printf("Number of characters: %i\n", count); }
Answer:
Coding is a skill where you take instructions (the steps in a task) and translate it into a language the computer understands since computers do not communicate like humans. They communicate in a language called BINARY and it is uses 0's and 1's. Coders write the instructions using a programming language.
Explanation:
Coding is a skill where you take instructions (the steps in a task) and translate it into a language the computer understands since computers do not communicate like humans. They communicate in a language called BINARY and it is uses 0's and 1's. Coders write the instructions using a programming language.
JavaScript
Code Example 4-1
var name = prompt("Enter the name to print on your tee-shirt");
while (name.length > 12) {
name = prompt("Too long. Enter a name with fewer than 12 characters.");
}
alert("The name to be printed is " + name.toUpperCase());
What will happen if the user enters Willy Shakespeare at the first prompt?
A. The user will be prompted to enter a different name.
B. The alert will display The name to be printed is " + name.toUpperCase().
C. The alert will display The name to be printed is WILLY SHAKESPEARE.
D. The alert will display The name to be printed is WILLY SHAKES.
Answer:
(a) The user will be prompted to enter a different name
Explanation:
Given code;
--------------------------------------------------------------------------------------------------------
var name = prompt("Enter the name to print on your tee-shirt");
while (name.length > 12) {
name = prompt("Too long. Enter a name with fewer than 12 characters.");
}
alert("The name to be printed is " + name.toUpperCase());
--------------------------------------------------------------------------------------------------------
=>The first line of the code prompts the user to enter some name to be printed on their tee-shirt, and the input from the user is saved in a variable called name.
=> In the while block, the name variable is checked. If the length of the value of the variable is greater than 12 then a new prompt that says "Too long. Enter a name with fewer than 12 characters" is displayed.
=> In the last line, if the name variable is checked and the length is less than 12, then an alert statement showing the name in uppercase is displayed with some prepended texts.
Now, if the user enters Willy Shakespeare at the first prompt, the while block will be executed since Willy Shakespeare has over 12 characters.
In other words, the prompt in the while block, asking the user to enter a different name will be displayed. i.e
"Too long. Enter a name with fewer than 12 characters"
QUESTION 6 Which of the following is a class A IPv4 address? a. 118.20.210.254 b. 183.16.17.30 c. 215.16.17.30 d. 255.255.0.0
Answer:
a. 118.20.210.254
Explanation:
Here are the few characteristics of Class A:
First bit of the first octet of class A is 0.
This class has 8 bits for network and 24 bits for hosts.
The default sub-net mask for class A IP address is 255.0.0.0
Lets see if the first bit of first octet of 118.20.210.254 address is 0.
118 in binary (8 bits) can be represented as : 1110110
To complete 8 bits add a 0 to the left.
01110110
First bit of the first octet of class A is 0 So this is class A address.
For option b the first octet is : 183 in the form of bits = 10110111 So it is not class A address
For option c the first octet is 215 in the form of bits = 11010111 So it is not class A address
For option d the first octet is 255 in the form of bits = 11111111. The first bit of first octet is not 0 so it is also not class A address.
Assuming a Stop-and-Wait system, if the bandwidth-delay product of a channel is 500 Mbps and 1 bit takes 25 milliseconds to make the roundtrip, what is the bandwidth-delay product? If the data packets are 2500 bits in length, what is the utilization?
Answer:
Bandwidth delay product = 2500 Kbits
Utilization = 0.02%
Explanation:
We proceed as follows;
From the question, we are given that
band width = 500 Mbps
The bandwidth-delay product is = 500 x 10^6 x 25 x 10^-3
= 2500 Kbits
The system can send 12500 Kbits during the time it takes for the data to go from the sender to the receiver and then back again.
However, the system sends only 2500 bits.
The the link utilization =
2500/(12500 x 10^3) = 0.02%
Write a program segment that simulates flipping a coin 25 times by generating and displaying 25 random integers, each of which is either 1 or 2
Answer:
//import the Random class
import java.util.Random;
//Begin class definition
public class CoinFlipper {
//The main method
public static void main(String []args){
//Create an object of the Random class
Random ran = new Random();
System.out.println("Result");
//Use the object and the number of times for simulation
//to call the flipCoin method
flipCoin(ran, 25);
} //End of main method
//Method to flip coin
public static void flipCoin(Random ran, int nooftimes){
//Create a loop to run as many times as specified in variable nooftimes
for(int i=1; i<=nooftimes; i++)
System.out.println(ran.nextInt(2) + 1);
}
} //End of class definition
====================================================
Sample Output:
Result
1
1
1
2
1
2
2
1
2
1
1
2
1
2
1
1
1
2
1
1
1
2
2
1
2
========================================================
Explanation:
The above code has been written in Java. It contains comments explaining every part of the code. Please go through the comments.
The sample output from the execution of the code is also given above.
The code is re-written as follows without comments.
import java.util.Random;
public class CoinFlipper {
public static void main(String []args){
Random ran = new Random();
System.out.println("Result");
flipCoin(ran, 25);
}
public static void flipCoin(Random ran, int nooftimes){
for(int i=1; i<=nooftimes; i++)
System.out.println(ran.nextInt(2) + 1);
}
}
A car can move, a crystal can grow, a fire alarm is sensitive and they are classified as non-living things. Explain?
Answer:
They are all controlled by something else. A car is controlled by humans. A crystal grows due to the temperature and climate. A fire alarm only rings when it senses smoke, which is caused by something else, usually humans.
The even_numbers function returns a space-separated string of all positive numbers that are divisible by 2, up to and including the maximum that's passed into the function. For example, even_numbers(6) returns “2 4 6”. Fill in the blank to make this work.
def even_numbers(maximum):
return_string = "" for x in ___: return_string += str(x) + " " return
return_string.strip() print(even_numbers(6)) # Should be 2 4 6 print(even_numbers(10)) # Should be 2 4 6 8 10 print(even_numbers(1)) # No numbers displayed print(even_numbers(3)) # Should be 2 print(even_numbers(0)) # No numbers displayed
Answer:
The correct form of the program in python is as follows
def even_numbers(maximum):
return_string = ""
for x in range(1,maximum+1):
if x % 2 == 0:
return_string+=str(x)+" "
return return_string.strip()
Explanation:
This line defines the method
def even_numbers(maximum):
This line initializes return_string to an empty string
return_string = ""
This line iterates through variable maximum
for x in range(1,maximum+1):
This line checks if the current number is even
if x % 2 == 0:
If yes, the string is updated
return_string+=str(x)+" "
This line returns the full string of even numbers
return return_string.strip()
When the method is tested with any of the following, it gives the desired result
print(even_numbers(6)), print(even_numbers(10)), print(even_numbers(1)), print(even_numbers(3)) and print(even_numbers(0))
A function prototype can always be omitted when: A function is defined before it is first invoked. A function does not return a value. A function is invoked before it is first defined. A function takes no arguments.
Answer:
A function is defined before it is first invoked.
Explanation:
A function prototype is a term in computer programming that is used as the declaration of a function that specifies function's name, parameters and return type. However, unlike function itself, which specifies what it does, a function prototype specifies function's interface only and not what it does.
Hence, A function prototype can always be omitted when: a function is defined before it is first invoked.
Jason has a part time job in the office of a construction company and is also a student at a community college. He often works on his homework during times when he is not busy at work because the office computer contains the software he needs to do his assignments and he hasn't been able to afford to purchase the software for his own personal computer. Which of these unacceptable uses typically included in a user access policy might he most likely be engaging in?
Complete Question:
Jason has a part time job in the office of a construction company and is also a student at a community college. He often works on his homework during times when he is not busy at work because the office computer contains the software he needs to do his assignments and he hasn't been able to afford to purchase the software for his own personal computer. Which of these unacceptable uses typically included in a user access policy might he most likely be engaging in?
1.Using the network to download software for personal use
2.Disclosing personal information about employees
3.Copying of copyrighted material
4.Using a network account for a purpose not specified by the owner’s job description
Answer:
4.Using a network account for a purpose not specified by the owner’s job description
Explanation:
The office computer is meant to be used for the owner's purpose only. By using the office computer to do his homework, even at a free hour, Jason is still violating his employer's asset for selfish purpose. Jason could obtain permission from his manager to use the office computer for his homework for a temporary period, until he could "afford to purchase the software for his own personal computer." The official permission can exempt him from being penalized for the violation. A written permission is more ideal in this case.
Complete the function ConvertToDecadesAndYears to convert totalYears to decades and years. Return decades and years using the TimeDecadesYears struct. Ex: 26 years is 2 decades and 6 years.
Answer:
It is a C++ program. The complete function ConvertToDecadesAndYears which takes totalYears as parameter and convert totalYears to decades and years is provided in the attached document.
Explanation:
The explanation is provided in the attached document.
The screenshot of the complete code along with its output is attached.
Imagine you have a 10-character string stored in the variable myString. You want to pull out the first five characters. Which of the following lines of code would successfully generate a slice of the 10-character string holding only the first five characters?
a. myString[5]
b. myString[:-5]
c. myString[0:6]
d. myString-15:-5]
e. myString[0:10:2]
Answer:
b. myString[:-5]
d. myString[-15:-5]
Explanation:
I believe you have a typo in d. It must be d. myString[-15:-5]
Slicing can be done:
myString[starting_index, stopping_index, step] (step is optional). If you do not specify the starting index, it will start from the 0 as in b. If you write a range that is not in the range, as in d, Python will replace it with either 0 or length of the string (In this case, it is replaced with 0 because the starting index must be smaller than stopping index)
a. myString[5] → This will give you the sixth character
b. myString[:-5] → This will give you the first five characters
c. myString[0:6] → This will give you the first six characters
d. myString-15:-5] → This will give you the first five characters
e. myString[0:10:2] → This will give you the first, third, fifth, seventh, and ninth characters
What will be displayed after code corresponding to the following pseudocode is run? Main Set OldPrice = 100 Set SalePrice = 70 Call BigSale(OldPrice, SalePrice) Write "A jacket that originally costs $ " + OldPrice Write "is on sale today for $ " + SalePrice End Program Subprogram BigSale(Cost, Sale As Ref) Set Sale = Cost * .80 Set Cost = Cost + 20 End Subprogram
Answer:
A jacket that originally costs $ 100 is on sale today for $ 80
Explanation:
Main : From here the execution of the program begins
Set OldPrice = 100 -> This line assigns 100 to the OldPrice variable
Set SalePrice = 70 -> This line assigns 70to the SalePrice variable
Call BigSale(OldPrice, SalePrice) -> This line calls BigSale method by passing OldPrice and SalePrice to that method
Write "A jacket that originally costs $ ", OldPrice -> This line prints/displays the line: "A jacket that originally costs $ " with the resultant value in OldPrice variable that is 100
Write "is on sale today for $ ", SalePrice -> This line prints/displays the line: "is on sale today for $ " with the resultant value in SalePrice variable that is 80
End Program -> the main program ends
Subprogram BigSale(Cost, Sale As Ref) -> this is a definition of BigSale method which has two parameters i.e. Cost and Sale. Note that the Sale is declared as reference type
Set Sale = Cost * .80 -> This line multiplies the value of Cost with 0.80 and assigns the result to Sale variable
Set Cost = Cost + 20 -> This line adds 20 to the value of Cost and assigns the result to Cost variable
End Subprogram -> the method ends
This is the example of call by reference. So when the method BigSale is called in Main by reference by passing argument SalePrice to it, then this call copies the reference of SalePrice argument into formal parameter Sale. Inside BigSale method the reference &Sale is used to access actual argument i.e. SalePrice which is used in BigSale(OldPrice, SalePrice) call. So any changes made to value of Sale will affect the value of SalePrice
So when the method BigSale is called two arguments are passed to it OldPrice argument and SalePrice is passed by reference.
The value of OldPrice is 100 and SalePrice is 70
Now when method BigSale is called, the reference &Sale is used to access actual argument SalePrice = 70
In the body of this method there are two statements:
Sale = Cost * .80;
Cost = Cost + 20;
So when these statement execute:
Sale = 100 * 0.80 = 80
Cost = 100 + 20 = 120
Any changes made to value of Sale will affect the value of SalePrice as it is passed by reference. So when the Write "A jacket that originally costs $ " + OldPrice Write "is on sale today for $ " + SalePrice statement executes, the value of OldPrice remains 100 same as it does not affect this passed argument, but SalePrice was passed by reference so the changes made to &Sale by statement in method BigSale i.e. Sale = Cost * .80; has changed the value of SalePrice from 70 to 80 because Sale = 100 * 0.80 = 80. So the output produced is:
A jacket that originally costs $ 100 is on sale today for $ 80
A security administrator is investigating a report that a user is receiving suspicious emails. The user's machine has an old functioning modem installed. Which of the following security concerns need to be identified and mitigated? (Select TWO).
a) Vishing
b) Whaling
c) Spear phishing
d) Pharming
e) War dialing
f) Hoaxing
Answer:
Spear Phishing and War Dialing
Explanation:
So let's tackle these one at a time.
Vishing is simply any type of message (i.e., email, text, phone call, etc.) that appears to be from a trusted source but is not.
Whaling is simply a spear phishing attack of a high-value target such as a CEO or someone with high-level access at a company.
Spear phishing is simply a targeted phishing attack, usually towards a specific person or group of people. (Phishing attack is simply a social attack to try and gain unauthorized access to a resource).
Pharming is an attack that attempts to redirect website traffic to a fake site.
War dialing is a technique to automatically scan a list of numbers in an area in attempt to search for exposed modems, computers, board systems, or fax machines, in order to breach the network.
Hoaxing is simply a social attack that describes a serious threat in attempts to retrieve unauthorized access or money from a victim. (Think microsoft tech support scams)
Now that we have defined these things, let's identify the possible threats that need to be reported.
(a) Vishing? The sec admin report doesn't mention the source of the message so we cannot associate this one
(b) Whaling? The sec admin report says a user, implying someone not high up in the company, but doesn't say it's not someone high up. This is possible.
(c) Spear phishing? The sec admin report says a user, implying that only this user is being targeted so this is definitely valid.
(d) Pharming? The sec admin report says nothing about site redirection.
(e) War dialing? The sec admin report doesn't say anything about unauthorized scanning; however, it mentions the user has an old functioning modem, so this is possible.
(f) Hoaxing? The sec admin report doesn't mention a pop up in the email or the content of the email so we are uncertain.
Thus with these considerations, the two threats that are identified and need mitigation are Spear phishing and War Dialing/Whaling. Note that we aren't positive of the war dialing or whaling, but a case could be made for either; however, given the modem information, the question seems to indicate war dialing.
What is the absolute pathname of the YUM configuration file? REMEMBER: An absolute pathname begins with a forward slash
Answer:
/etc/yum.conf
Explanation:
The absolute pathname for YUM is /etc/yum.conf. The configuration file For yum and related utilities can be found there. The file has one compulsory section, and this section can be used to place Yum options with global effect, it could also have one or more sections, that can enable you to set repository-specific options.
A continuous-time periodic signal x(t) is real valued and has a fundamental period T = 8. The nonzero Fourier series coefficients for x(t) are specified as
a_1 = a*_-1 = j, a_5 = a_-5 = 2.
Express x(t) in the form
x(t) = sigma^infinity_k=0 A_k cos(W_k t + phi_k).
Answer:
x(t) = −2 cos ( [tex]\frac{\pi }{4}t[/tex] − [tex]\frac{\pi }{2}[/tex] ) + 4 cos ( [tex]\frac{5\pi }{4}t[/tex] )
Explanation:
Given:
Fundamental period of real valued continuous-time periodic signal x(t) = T = 8
Non-zero Fourier series coefficients for x(t) :
a₁ = [tex]a^{*}_{-1}[/tex] = j
a₅ = [tex]a_{-5}[/tex] = 2
To find:
Express x(t) in the form
∞
x(t) = ∑ A[tex]_{k}[/tex] cos ( w[tex]_{k}[/tex] t + φ[tex]_{k}[/tex] )
[tex]_{k=0}[/tex]
Solution:
Compute fundamental frequency of the signal:
w₀ = 2 π / T
= 2 π / 8 Since T = 8
w₀ = π / 4
∞
∑ [tex]a_{k}e^{jw_{0}t }[/tex]
x(t) = k=⁻∞
= [tex]a_{1}e^{jw_{0} t} + a_{-1}e^{-jw_{0} t} + a_{5}e^{5jw_{0} t}+a_{-5}e^{-5jw_{0} t}[/tex]
= [tex]je^{j(\pi/4)t} - je^{-j(\pi/4)t} +2e^{(5\pi/4)t}+2e^{-(5\pi/4) t}[/tex]
= −2 sin ( [tex]\frac{\pi }{4}t[/tex] ) + 4 cos ( [tex]\frac{5\pi }{4}t[/tex] )
= −2 cos ( [tex]\frac{\pi }{4}t[/tex] − [tex]\frac{\pi }{2}[/tex] ) + 4 cos ( [tex]\frac{5\pi }{4}t[/tex] )
Use the get_seconds function to work out the amount of seconds in 2 hours and 30 minutes, then add this number to the amount of seconds in 45 minutes and 15 seconds. Then print the result.
Answer:
Since the get_seconds function is not given, I'll implement it myself;
The full program (get_seconds and main) written in python is as follows:
def get_seconds(hour,minute,seconds):
seconds = hour * 3600 + minute * 60 + seconds
return seconds
time1 = get_seconds(2,30,0)
time2 = get_seconds(0,45,15)
result = time1 + time2
print(result)
Explanation:
The get_seconds defines hour, minute and seconds as its arguments
This line defines the get_seconds function
def get_seconds(hour,minute,seconds):
This line calculates the second equivalent of the time passed to the function
seconds = hour * 3600 + minute * 60 + seconds
This line returns the the calculated seconds equivalent of time
return seconds
The main starts here
This line calculates the number of seconds in 2 hours and 30 minutes
time1 = get_seconds(2,30,0)
This line calculates the number of seconds in 45 minutes and 15 seconds
time2 = get_seconds(0,45,15)
This line adds both together
result = time1 + time2
This line prints the result
print(result)
An algorithm that could execute for an unknown amount of time because it depends on random numbers to exit a function may:_______
a. have a redundancy.
b. get caught in an infinite loop.
c. suffer from indefinite postponement.
d. issue a compiler error.
Answer:
c. suffer from indefinite postponement.
Explanation:
Algorithm is a set of rules that are followed in calculations or other problem solving operation by a computer. An algorithm may execute for unknown amount of time and it may suffer indefinite postponement. Algorithm depends on random numbers and it can execute continuously.