Answer:
Option C. The path from start to finish that passes through all the tasks that are critical to completing the project in the shortest amount of time
is the correct answer.
Explanation:
Critical path is the term used in Project management.It can be known by determining the longest stretch for dependent activities and the time required for them to complete.A method known as "critical path method" is used for Project modelling.All types of projects including aerospace, software projects, engineering or plant maintenance need Critical method analysis for the modeling of project and estimation.I hope it will help you!
Hardcode the algorithms using if/else and loops not library calls. Write a program that allows the user to input a string and prints the number of vowels, consonants, numerical values 0-9, special symbols in the word. For this exercise assume ‘a’, ‘e’, ‘i’, ‘o’, ‘u’, and ‘y’ are vowels. Make sure to include capitol vowels. Special symbols → ~!@#$%^&*()_-=+?/" :;<> Please write a short paragraph, bullet points, or psuedocode describing your algorithm for solving the problem. For user input "Harry", the program should print 2 vowels and 3 consonants. For user input "Harry", the program should print "9&&qT" 2 consonants 2 Special Characters 1 numeric value]
Answer:
#include <iostream>
#include <string>
using namespace std;
int
stringLength (string str)
{
int i = 0;
int count = 0;
while (0 == 0)
{
if (str[i])
{
i++;
count++;
}
else
{
break;
}
}
return count;
}
int
main ()
{
string userinput;
cout << "Enter string ";
getline (cin, userinput);
int string_length = stringLength (userinput);
int vowels=0;int numeric=0;int consonants=0;int special = 0;
for (int i = 0; i < string_length; i++)
{
if (userinput[i] == 'a' ||
userinput[i] == 'e' ||
userinput[i] == 'i' ||
userinput[i] == 'o' ||
userinput[i] == 'u' ||
userinput[i] == 'y' ||
userinput[i] == 'A' ||
userinput[i] == 'E' ||
userinput[i] == 'I' ||
userinput[i] == 'O' || userinput[i] == 'U' || userinput[i] == 'Y')
{
vowels++;
}
else if (userinput[i] - 48 > 0 && userinput[i] - 48 <= 9)
{
numeric++;
}
else if (userinput[i] == '~' ||
userinput[i] == '!' ||
userinput[i] == '@' ||
userinput[i] == '#' ||
userinput[i] == '$' ||
userinput[i] == '%' ||
userinput[i] == '^' ||
userinput[i] == '&' ||
userinput[i] == '*' ||
userinput[i] == '(' ||
userinput[i] == ')' ||
userinput[i] == '_' ||
userinput[i] == '+' ||
userinput[i] == '-' ||
userinput[i] == '+' ||
userinput[i] == ':' ||
userinput[i] == ':' ||
userinput[i] == '?' ||
userinput[i] == '/' || userinput[i] == '<' || userinput[i] == '>')
{
special++;
}
else
{
consonants++;
}
}
cout << vowels << " vowels and " << consonants << " consonants and " << special
<< " special characters and " << numeric << " numbers." << endl;
return 0;
}
Explanation:
Create a string.Take input from user using getline.Write a function to find string length. Iterate through string index in an infinite while loop, check if index is true increase counter and index by 1, if its false break loop and return count.Loop through string using for loop and terminating conditions at index<string length.Create variable vowel,numeric,special,consonant and initialize with 0;For vowels add If statement with condition string[index]=="vowel" for all vowel using OR operator (||).If true increase vowel by 1.For special character add If statement with condition string[index]=="character " for all characters using OR operator (||).If true increase special by 1.For numeric add If statement with condition string[index]-48>0&& string[index]-48<=9 .If true increase vowel by 1.Else increase consonant by 1.Print all variable.Given the lists list1 and list2 that are of the same length, create a new list consisting of the last element of list1 followed by the last element of list2, followed by the second to last element of list1, followed by the second to last element of list2, and so on (in other words the new list should consist of alternating elements of the reverse of list1 and list2). For example, if list1 contained [1, 2, 3] and list2 contained [4, 5, 6], then the new list should contain [3, 6, 2, 5, 1, 4]. Associate the new list with the variable list3.
Answer:
list1 = [1, 2, 3]
list2 = [4, 5, 6]
list3 = []
newlist = []
for i in list1:
for j in list2:
if list1.index(i) == list2.index(j):
newlist.append(j)
newlist.append(i)
break
for i in reversed(newlist):
list3.append(i)
print(list3)
Explanation:
The programming language used is python.
List 1 and 2 are initialized, and two empty lists are initialized too, these two lists are going to be used in generating the new list.
Two FOR loops are used for both list one and two respectively, to iterate through their content, the IF statement and the break is placed within the for loop to ensure that there is no repetition.
The index of list 1 and list 2 are appended (added) to a new list one at a time.
The new list is then reversed and its content are added to list 3 to give the final solution.
NOTE: The reason a separate list was created was because the reversed() function does not return a list, so in order to get the list, it must be added to an empty list as you reverse it.
Python programming questions:
1. Assume the names variable references a list of strings. Write code that determines whether 'Dale' is in the names list. If it is, display the message 'Hello Dale'. Otherwise, display the message 'No Dale'.
2. Write a program that opens a specified text file then displays a list of all the unique words found in the file. Hint: Store each word as an element of a set.
3. Write a program that reads the contents of a text file. The program should create a dictionary in which the keys are the individual words found in the file and the values are the number of times each word appears. For example, if the word "the" appears 128 times, the dictionary would contain an element with 'the' as the key and 128 as the value. The program should either display the frequency of each word or create a second file containing a list of each word and its frequency.
Answer:
Following are the program in the Python Programming Language:
1.)
l=['Ruby','Dale','Kate']
n=input('Enter the name: ')
if(n in l):
print('Hello {}'.format(n))
else:
print('No {}'.format(n))
Output:
Enter the name: Dale
Hello Dale
2.)
file=open("text1.txt", "r+") #open file
str=file.read() #read file
txt=str.replace('\n', ' ') #replace spaces
word=txt.split(' ') #split words in ' '
for words in word: #set for loop
word2=' '
for i in range(len(words)): #set for loop
if(words[i].isalpha()): #set if statement
word2 += words[i].lower()
word[word.index(words)]=word2
while(' ' in word): #set while loop
word.remove(' ') #remove spaces
st=set(word)
print('The ', len(st),' unique words which appears in document are ' \
'(in no particular order): ')
for words in st: #set for loop
print('-', word)
file.close() #close file
3.)
file=open("text1.txt", "r+") #open file
str=file.read() #read file
txt=str.replace('\n', ' ') #replace spaces
word=txt.split(' ') #split words in ' '
for words in word: #set for loop
word2=' '
for i in range(len(words)): #set for loop
if(words[i].isalpha()): #set if statement
word2 += words[i].lower()
word[word.index(words)]=word2
while(' ' in word): #set while loop
word.remove(' ') #remove spaces
dic={} #set dictionary
for words in word: #set for loop
if(words not in dic): #set if statement
dic[words]=1
else:
dic[words] +=1
print('\033[4m' + 'word frequency' + '\033[0m')
for words in dic:
print(format(words, '15s'), format(dic[words], '5d'))
file.close() #close file
Explanation:
1.) Here, we define the list data type variable 'l' then, set the variable 'n' and assign value by get input from the user,
we set if conditional statement and pass condition is that the variable 'n' is in the variable l then, print message.otherwise, we print No message.
2.) Here, we define the variable "file" in which we open file and save that file in it.
Then, we set variable st which read the file then we set the variable in which we apply the replace().
Then. we set variable in which we split the by suing split()
2.) Here, we define the variable "file" in which we open file and save that file in it.
Then, we set variable st which read the file then we set the variable in which we apply the replace().
Then. we set variable in which we split the by suing split()
Then, we apply all that given in the question.
Write a java method called vowelCount that accepts a String as a parameter and produces/returns an array of integers representing the count of each vowel in the String. The array returned by your method should hold five elements: the first is the count of the 'A's, the second is the count of 'E's, the third 'I''s, the fourth 'O's and the fifth the number of 'U's. Your count should check for both upper and lower case versions.For example the call vowelCount("I think therefore I am") should return the array [1,3,3,1,0].Your main program should then allow the user to type in single lines, analyzing each line and print out its count. The program should stop when the user types the word "STOP" by itself.
Answer:AEIOU
Explanation:
Recovery point objectives of a recovery plan specify ________.
A. the capacity of backup servers in storing the necessary data
B. data structures and patterns of the data
C. how current the backup data should be
D. the maximum time allowed to recover from a catastrophic event
E. the minimum time after which response should be allowed in a catastrophic event
Answer:
The correct option to the following question is an option (D).
Explanation:
Because RPO(Recovery point objective) is the objective in which we getting the greatest level of the privacy. confidence and the important thing is security for our resources.
The best thing is that the center of activity of the RPO in on the data and the overall elasticity of the loss of your company.
Write a second constructor as indicated. Sample output:User1: Minutes: 0, Messages: 0User2: Minutes: 1000, Messages: 5000// ===== Code from file PhonePlan.java =====public class PhonePlan { private int freeMinutes; private int freeMessages; public PhonePlan() { freeMinutes = 0; freeMessages = 0; } // FIXME: Create a second constructor with numMinutes and numMessages parameters. /* Your solution goes here */ public void print() { System.out.println("Minutes: " + freeMinutes + ", Messages: " + freeMessages); return; }}
Answer:
The code to this question can be given as:
Second constructor code:
PhonePlan(int min,int messages) //define parameterized constructor and pass integer variables.
{
freeMinutes = min; //variable holds value of parameter.
freeMessages = messages; //variable holds value of parameter.
}
Explanation:
In the question, It is given that write a second constructor. So, the code for this question is given above that can be described as:
In this code, we define a parameterized constructor that is "PhonePlan()". In this constructor, we pass two integer variable that is min and message. The constructor name same as the class name and it does not return any value. In this constructor, we use the variable that is defined in the PhonePlan class which is "freeMinutes and freeMessages". This variable is used for holding the parameter variable value.
In the code above, the second constructor is added with numMinutes and numMessages parameters. Inside the constructor, the values of freeMinutes and freeMessages are initialized with the values passed as parameters.
The modified PhonePlan class with the second constructor that takes minutes and messages as parameters:
Write a second constructor, as instructed in the question. The code for this question is therefore given above and is as follows:
This code defines a constructor with parameters called "PhonePlan()". The two integer variables message and min are passed to this constructor. There is no value returned by the constructor, which has the same name as the class.
We use the variable "freeMinutes and freeMessages" from the PhonePlan class, which is defined in this constructor. This variable stores the value of the parameter variable.
Learn more about Constructor here:
https://brainly.com/question/32203928
#SPJ3
In Java; Set hasDigit to true if the 3-character passCode contains a digit. If you could tell me why the code I wrote isn't working I'd be thankful.import java.util.Scanner;public class CheckingPasscodes {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);boolean hasDigit;String passCode;hasDigit = false;passCode = scnr.next();let0 = userInput.charAt(0);let1 = userInput.charAt(1);let2 = userInput.charAt(2); if ((Character.isDigit(let0) || Character.isDigit(let1) || Character.isDigit(let2)){hasDigit = true;}if (hasDigit) {System.out.println("Has a digit.");}else {System.out.println("Has no digit.");}
Answer:
The correct program to this question can be given as:
Program:
//import package.
import java.util.Scanner; //scanner package.
public class CheckingPasscodes //define class.
{
//all the code run here.
public static void main (String [] args) //define main method
{
Scanner scnr = new Scanner(System.in); //create Scanner class Object
boolean hasDigit; //define variable.
String passCode; //define variable.
hasDigit = false; //assign value.
passCode = scnr.next(); //taking user input.
int let0 = passCode.charAt(0); //assign value in integer variable
int let1 = passCode.charAt(1); //assign value in integer variable
int let2 = passCode.charAt(2); //assign value in integer variable
//conditional statement.
if ((Character.isDigit(let0)||Character.isDigit(let1)||Character.isDigit(let2))) //if block
{
hasDigit = true; //assign value.
}
if (hasDigit) //if block
{
System.out.println("Has a digit."); //message.
}
else //else block
{
System.out.println("Has no digit."); //message.
}
}
}
Output:
AB1
Has a digit.
Explanation:
In the given question there are many mistakes so we provide the correct solution to this question that can be described as follows:
In above java program firstly, we import a package that is used for taking user input. Then we define a class that is "CheckingPasscodes" in this class we define the main method. In the main method, we create a scanner class object and define some variables that are "passCode and hasDigit". A variable passCode is used for user input. Then we define three integer variable that is "let0, let1, and let2". This variable uses a charAt() function that holds the index values and assign to these variables.Then we define conditional statements. In if block we check variables "let0, let1 and let2" value is equal to the number. so, we change the bool variable value that is "true".In second if block we check bool variable "hasDigit" value is true. so we print "Has a digit.". else we print "Has no digit.".To make corrections to your code, implies that we debug the code. The following are the reasons why your code is not working
Use of undeclared variables userInput, let0, let1 and let2Unbalanced parenthesis ( )Unbalance curly braces { }The corrections to your code are:
Declare let0, let1 and let2 as character variablesReplace userInput with passCode.Balance all parentheses and curly bracesThe complete correct code is as follows:
import java.util.Scanner;
public class CheckingPasscodes {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
boolean hasDigit;
String passCode;
hasDigit = false;
passCode = scnr.next();
char let0 = passCode.charAt(0);
char let1 = passCode.charAt(1);
char let2 = passCode.charAt(2);
if (Character.isDigit(let0) || Character.isDigit(let1) || Character.isDigit(let2)){
hasDigit = true;}
if (hasDigit) {
System.out.println("Has a digit.");}
else {System.out.println("Has no digit.");}
}
}
Read more about debugging at:
https://brainly.com/question/23527739
Consider the following classes: public class A { private int myNum; public A(int x) { myNum = x; } public int getNumber() { return myNum; } public String getLetters() { return "A"; } public String getMessage() { return this.getLetters() + "-" + this.getNumber(); } } public class AB extends A { public AB(int x) { super(x + 1); } public int getNumber() { return super.getNumber() + 1; } public String getLetters() { return "AB"; } } What is the output of the following code segment? A test = new AB(0); System.out.print(test.getMessage());
Answer:
The output of the given code is "AB-2".
Explanation:
The description of the java program can be given as:
In this program firstly we define a class that is "A". In this class, we define a private integer variable that is "myNum" and parameterized constructor and pass an integer variable that is "x" and use a private variable to holds the constructor variable value.Then we define three function that is "getNumber(), getLetters() and getMessage()" this function we returns values. Then we define another class that is "AB" which inherits the base class "A". In this class we define parameterized constructor and two methods that is "getNumber() and getLetters()". In the parameterized constructor and getNumber() method we use a super keyword that calls above(base class methods) and increases the value by 1. In getLetters() method we return value that is "AB". In calling time we create a class object that is "test", and call the AB class and pass value 0 in the parameter, and call the getMessage() method.That's why the output of this program is "AB-2".
Write a program that takes nouns and forms their plurals on the basis of these rules:
a. If noun ends in "y", remove the "y" and add "ies".
b. If noun ends in "s", "ch", or "sh", add "es".
c. In all other cases, just add "s".
Print each noun and its plural. Try the following data:
chair dairy boss circuis fly dog church clue dish
Answer:
def nounToplural(tex):
import re
text = tex.split()
new = []
for word in text:
if re.findall(r"y\b", word):
word = re.sub(r"y\b", 'ies' ,word)
new.append(word)
elif re.findall(r"ch\b", word):
word = re.sub(r"ch\b", 'ches' ,word)
new.append(word)
elif re.findall(r"sh\b", word):
word = re.sub(r"sh\b", 'shes' ,word)
new.append(word)
elif re.findall(r"s\b", word):
word = re.sub(r"s\b", 'ses' ,word)
new.append(word)
else:
word = word + 's'
new.append(word)
result = []
for i in text:
for j in new:
if new.index(j) == text.index(i):
result.append( (i,j) )
print(result)
str = "chair dairy boss circuis fly dog church clue dish"
nounToplural(str)
Explanation:
We made use or Regular Expressions which is simply a special sequence of characters that helps you match or find other strings or sets of strings, by using a specialized syntax held in a pattern.
Firstly, define the function and import the regular expression module, split the text into a list and create an empty list to hold the plural list.
For every word in the list we check with IF statements and regular expressions to find out what they end with.
if re.findall(r"y\b", word):
word = re.sub(r"y\b", 'ies' ,word)
new.append(word)
The above IF block checks if a noun ends with 'y', if it does it replaces the 'y' with 'ies' and ads it to the new list.
If it does not, ot moves to the next IF/ELIF block.
In the ELIF blocks carry out a a similar operation for "s", "ch", or "sh", in order to add "es".
Finally, 's' is added to all other cases using the ELSE block which traps any noun that did not fall under the IF or any of the ELIF blocks.
This last part of the code prints both list side by side and passes them to a new list result which is printed to the screen
result = []
for i in text:
for j in new:
if new.index(j) == text.index(i):
result.append( (i,j) )
print(result)
I called the function and passed the string you provided in your question and attached the result of the code.
c++ Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain less than 20 words.
Answer:
The following are the program in the C++ Programming Language:
#include <iostream> //header file
#include <string> //header file
#include <vector> //header file
//name space
using namespace std;
//main function
int main() {
vector<string> word; //set variable
vector<int> c; //set variable
int s, counts = 0; //set variable
string strng; //set variable
cout<<"Enter the size of string: "; //print message
cin >> s; //get input
cout<<"Enter the string: "; //print message
for(int i = 0; i < s; ++i) { //set for loop
cin >> strng; //get input
word.push_back(strng);
}
for(int i = 0; i < s; ++i) { //set for loop
counts = 0;
for(int j = 0;j<word.size();j++){ //set for loop
if(word[j] == word[i]){ //set if statement
counts++; //increament in counts
}
}
c.push_back(counts);
}
for(int i = 0; i < s; ++i) {
cout << word[i] << " " << c[i] << endl;//print result
}
return 0;
}
Output:
Enter the size of string: 2
Enter the string: hello sir
hello 1
sir 1
Explanation:
Here, we define three header files <iostream>, <String>, <vector> and namespace "std" after that we define main() method inside it.
Then, we set two vector type variables first one is string variable "word" and the second one is integer variable "c". Then we set two integer variable "s" and "counts" and variable "counts" assign to 0. Then, we get input from the user in variable "s" for the length of the loop. Then, we set for the loop inside it, we get input in the variable "strng" from the user. Then, we set the for loop for count the string repetition if any word comes again in the string then the value of count will increase. Finally, we set for a loop to print the result.In this exercise we have to write a C++ code requested in the statement, like this:
find the code in the attached image
We can write the code in a simple way like this below:
#include <iostream>
#include <string>
#include <vector>
using namespace std;
//main function
int main() {
vector<string> word; //set variable
vector<int> c; //set variable
int s, counts = 0; //set variable
string strng; //set variable
cout<<"Enter the size of string: "; //print message
cin >> s; //get input
cout<<"Enter the string: "; //print message
for(int i = 0; i < s; ++i) { //set for loop
cin >> strng; //get input
word.push_back(strng);
}
for(int i = 0; i < s; ++i) { //set for loop
counts = 0;
for(int j = 0;j<word.size();j++){ //set for loop
if(word[j] == word[i]){ //set if statement
counts++; //increament in counts
}
}
c.push_back(counts);
}
for(int i = 0; i < s; ++i) {
cout << word[i] << " " << c[i] << endl;//print result
}
return 0;
}
See more about C++ at brainly.com/question/19705654
Alison discovers that a system under her control has been infected with malware, which is using a key logger to report user keystrokes to a third party. What information security property is this malware attacking?
Mostly the spyware and malware protection for desktop and laptop or workstations are to protected with anti-virus regular updates. All workstation or desktop or laptops are to updated operating systems patches.
If any operating systems patched update to be schedule and checked regularly. Schedule scanning by virus scanner to be made for desktop and laptop or workstations in regular interval basis
There are third parties tools such as malware and ADWCLEANER are also available free scanner software through internet where end user can download and scanner so software will clean the malware.
Mostly end user do mistake keep the files in desktop. Most of the malware software will affect the desktop folder only.
It will also affect c:\users folder and register enter keys.
Write a function safeOpen() that takes one parameter, filename — a string giving the pathname of the file to be opened for reading. When safeOpen() is used to open a file, a reference to the opened file object should be returned if no exception is raised, just like for the open() function. If an exception is raised while trying to open the file, safeOpen() should return the value None
Final answer:
The safeOpen() function in Python is used to open a file while handling exceptions. It returns the file object on success, or None if an error occurs, thus ensuring that the program can continue to run without crashing.
Explanation:
The function safeOpen() is designed to handle file operations within a Python program safely by attempting to open a file and returning a file object if successful, or None if an exception occurs. This function makes use of Python's built-in exception handling mechanisms to provide a secure way of accessing files. Here's an example of how you can define the safeOpen() function:
def safeOpen(filename):
try:
file = open(filename, 'r')
return file
except Exception as e:
print("An error occurred: ", e)
return None
In this code snippet, the try block attempts to open the specified file in read mode. If the file is opened successfully, the file object is returned. If any exception, such as FileNotFoundError or PermissionError, is raised during the attempt, the except block is executed, printing out the error message and returning None.
A friend asks you for help writing a computer program to calculate the square yards of carpet needed for a dorm room. The statement "the living room floor is rectangular" is an example of a(n) . The length and width of the room are examples of information, which you can obtain as from the user.
Answer:
A friend asks you for help writing a computer program to calculate the square yards of carpet needed for a dorm room. The statement "the living room floor is rectangular" is an example of a(n) assumption . The length and width of the room are examples of known information, which you can obtain as input from the user.
Explanation:
The given question is a Problem statement.
Problem statement can be defined as the brief description of an issue that needs to be focused in order to reach the require goal.
So the parts that a problem statement may have include:
facts and figures (assumptions), that are known in the given scenario.data required (solution)to be calculated by focusing on present assumptions (given as input by the user).So the attributes to be filled into blanks of given statement are assumption, known, input.
i hope it will help you!
In an AND truth table.
a. All values must be true for the statement to be true
b.Either of the values must be true for the statement to be true
c. There are not enough arguments to process
d. None of the values must be true for the statement to be true
Which of the following search tool alternatives would be a helpful starting place when looking for income tax information?
a. the federal government main Web site
b. the Internal Revenue Service Web site
c. the Census Web site
d. the Small Business Association Web site
Answer:
1. A
2. B
Explanation:
1. For an AND truth table to output true, all it input must be true. If one or any of the input is false, the output will be false. The truth table for AND is written below:
INPUT INPUT OUTPUT
FALSE FALSE FALSE
FALSE TRUE FALSE
TRUE FALSE FALSE
TRUE TRUE TRUE
2. The Internal Revenue Service web site is a good search tool when looking for income tax information. The federal government main web site might look like a correct option but one must understand that the federal government will only make the policy while the Internal Revenue Service will implement the policy.
Two polygons are said to be similar if their corresponding angles are the same or if each pair of corresponding sides has the same ratio. Write the code to test if two rectangles are similar when the length and width of each are provided as integer values. For example:If the rectangles have lengths of 10 and 8, the ratio would be 1.25.
Here's a C++ program that reads two rectangles' lengths and widths as integer values and tests if they are similar:
#include <iostream>
#include <cmath>
using namespace std;
bool areSimilar(int length1, int width1, int length2, int width2) {
float lengthRatio = static_cast<float>(length1) / static_cast<float>(length2);
float widthRatio = static_cast<float>(width1) / static_cast<float>(width2);
return lengthRatio == widthRatio;
}
int main() {
int length1, width1, length2, width2;
cout << "Enter the length and width of the first rectangle: ";
cin >> length1 >> width1;
cout << "Enter the length and width of the second rectangle: ";
cin >> length2 >> width2;
if (areSimilar(length1, width1, length2, width2)) {
cout << "The two rectangles are similar." << endl;
} else {
cout << "The two rectangles are not similar." << endl;
}
return 0;
}
This program defines a function areSimilar that takes the lengths and widths of two rectangles as input and returns a boolean value indicating whether the rectangles are similar. The function calculates the ratios of the lengths and widths and checks if they are equal. If the ratios are equal, the rectangles are considered similar, and the function returns true. Otherwise, the rectangles are not similar, and the function returns false.
Using a WHILE loop write a program that asks the user to guess your favorite number. The program should end when the user guesses correctly, but otherwise provides hints for guessing higher or lower. Use the Try/Except/Else structure to ensure that the user enters numbers. Name this program guessNumber.py
Answer:
fav_number=26
guess=0
while 0==0:
try:
guess=int(input('Enter your guess: '))
except:
print ('You have entered an invalid value.')
else:
if guess == fav_number:
break
elif guess>fav_number:
print ('Try a smaller number.')
elif guess<fav_number:
print ('Try a larger number')
Explanation:
define a variable fav_number and set it to number. write an infinite while loop to read input from user. In try block get input from user, if user enters invalid input code in except block will be executed. For valid input
check if its greater than favorite number, if yes print try smaller number.check if its smaller than favorite number, if yes print try larger number.check if its equal to favorite number, break loop and exitLoop-tee-loop LOL
...
Not funneh...
A user who will spend considerable time using specific programs and is likely to become comfortable and familiar with the terminal's operation is called a:A) expert userB) system ownerC) casual userD) system builderE) none of these
Answer:
A) expert user
Explanation:
An expert user is an experienced user who has spent considerable time using specific application programs and, therefore, it is fair to assume that this user is likely to become comfortable and familiar with the terminal's operation.
A casual user is a less experienced computer user who will generally use a computer less frequently and thus is not likely to become comfortable and familiar with the terminal's operation.
System owners and system builders are not technically users.
Therefore, the answer is A) expert user
James is a recent college graduate and has six months of IT experience. He is thinking about pursuing a certification program in order to demonstrate that he is serious about IT. James is most interested in becoming a database designer. Another name for this career choice is database ____.
Answer: Database Architect
Explanation:
Database architect is a person whose duty involves management, designing and generation of huge electronic databases.Mostly database architect work in the field of computer system designing, data processing companies etc.The databases contain large amount of data and information which is organized and stored in certain form and category accordingly.According to the situation in question, alternate name for James's career is database architect. As database designing is related with information technology which includes managing, organizing data in certain pattern , table , etc and maintaining it .Write a program that reads the contents of a text file. The program should create a dictionary in which the keys are the individual words found in the file and the values are the number of times each word appears. For example, if the word "the" appears 128 times, the dictionary would contain an element with 'the' as the key and 128 as the value. The program should either display the frequency of each word or create a second file containing a list of each word and its frequency.
Answer:
Answer:
'''
This is script makes use of dictionaries to get all the words in a file and the
number of times they occur.
'''
#section 1
import string
dic = {}
textFile=open("Text.txt","r")
# Iterate over each line in the file
for line in textFile.readlines():
tex = line
tex = tex.lower()
tex=tex.translate(str.maketrans('', '', string.punctuation))#removes every punctuation
#section 2
new = tex.split()
for word in new:
if word not in dic.keys():
dic[word] = 1
else:
dic[word] = dic[word] + 1
for word in sorted(dic):
print(word, dic[word], '\n')
textFile.close()
Explanation:
The programming language used is python.
#section 1
The string module is imported because of the string operations that need o be performed. Also, an empty list is created to hold the words and the number of times that they occur and the file is opened in the read mode, because no new content is going to be added to the file.
A FOR loop is used to iterate through every line in the file and assigns each line to a variable one at a time, and each line is converted to lowercase and punctuation is stripped off every word in each line.
This processing is needed in order for the program o accurately deliver the number of occurrences for each individual word in the text.
#section 2
Each line is converted to a list using the split function, this is done so that a FOR loop can iterate over each word. The FOR loop, iterates over each word in the list and the IF statement checks if the word is already in the dictionary, if the word id in the dictionary, it increases the number of occurrences, if it is not in the dictionary, it adds it to the dictionary and assigns the number 1 to it.
The words are then sorted just to make it look more organised and the words and the number of times that they occur is printed to the screen.
Here's a Python program that reads the contents of a text file, creates a dictionary with word frequencies, and then displays the frequency of each word:
```python
def count_word_frequency(file_path):
word_frequency = {}
# Open the file for reading
with open(file_path, 'r') as file:
# Iterate through each line in the file
for line in file:
# Split the line into words
words = line.split()
# Iterate through each word
for word in words:
# Remove any punctuation characters
word = word.strip('.,!?;:"()[]{}')
# Convert the word to lowercase
word = word.lower()
# Increment the count for this word in the dictionary
word_frequency[word] = word_frequency.get(word, 0) + 1
return word_frequency
def display_word_frequency(word_frequency):
# Iterate through the dictionary and print each word and its frequency
for word, frequency in word_frequency.items():
print(f"{word}: {frequency}")
def main():
file_path = input("Enter the path to the text file: ")
word_frequency = count_word_frequency(file_path)
display_word_frequency(word_frequency)
if __name__ == "__main__":
main()
```
To use this program:
1. Save the code into a Python file (e.g., `word_frequency.py`).
2. Run the program.
3. Enter the path to the text file you want to analyze.
This program will read the text file, count the frequency of each word, and then display the frequency of each word in the console.
1. `count_word_frequency(file_path)` function:
- This function takes a file path as input.
- It initializes an empty dictionary called `word_frequency` to store word frequencies.
- It opens the file specified by the file path in read mode using a `with` statement, ensuring that the file is properly closed after reading.
- It iterates through each line in the file.
- For each line, it splits the line into individual words using the `split()` method.
- It then iterates through each word, strips any punctuation characters from the word, converts it to lowercase, and updates the count for that word in the `word_frequency` dictionary.
- If the word is not already in the dictionary, it initializes its count to 1; otherwise, it increments its count by 1.
- After processing all lines in the file, it returns the `word_frequency` dictionary containing the word frequencies.
2. `display_word_frequency(word_frequency)` function:
- This function takes the `word_frequency` dictionary as input.
- It iterates through the dictionary and prints each word along with its frequency.
3. `main()` function:
- This function serves as the entry point of the program.
- It prompts the user to enter the path to the text file they want to analyze.
- It calls the `count_word_frequency()` function with the provided file path to calculate word frequencies.
- It then calls the `display_word_frequency()` function to display the word frequencies to the user.
4. `if __name__ == "__main__":` block:
- This block ensures that the `main()` function is only executed when the script is run directly, not when it's imported as a module in another script.
Overall, this program reads a text file, counts the frequency of each word, and displays the frequency of each word to the user.
Which of the following is true about cloud computing?
a. Cloud firms have limited capacity to account for service spikes.
b. Cloud computing is not as green as traditional computing.
c. Cloud firms are often located in warehouse-style buildings designed for computers, not people.
d. Cloud firms are usually crammed inside inefficiently cooled downtown high-rises.
e. Cloud computing firms often have data centers that are not designed to pool and efficiently manage computing resources.
29. Android is a software product developed by Google that allows cell phone manufacturers to control hardware and establish standards for developing and executing applications on its platform. Android is thus an example of a(n) _____.
a. operating system
b. programming language
c. user interface
d. embedded system
e. database management system
Answer:
The correct option to the following question is option:
(C).
29. (A).
Explanation:
Cloud firms or companies are those that provides us the facilities to store our important data and kept it in safety, they also provides more facilities such as storage, networking, intelligence, database, etc.
Cloud computing are the facility in which we keep our data safe and confidential by saving our data in drives.
Operating System are software which manages the software as well as hardware also, that's why this option is correct
Compare and contrast the following codes of ethics, including a listing of their similarities and differences: The ACM Code of Ethics and Professional Conduct The Software Engineering Code of Ethics and Professional Practice The Australian Computer Society Code of Professional Conduct In a final paragraph, state which of these three you think is the best and why.
Answer:
Please see the explanation
Explanation:
ACM professional code has following characteristics:
Genaral moral Imperative- This further consists of:
Contribute to society and human well being
Avoid harm to others
Be honest and trustworthy
Honor property rights including copyrights and patent
Respect the privacy of other
2) Professional responsibilities
Acquire and maintain professional coompetence
Achieve the highest quality
Accept and provide appropriate professional review
Respect the existing laws
Access computing and communication resources only when authorized to do so.
3) Organizational leadership
Articulate social responsibilities of members of an organizational unit and encourage full acceptance of those responsibilities.
Manage personnel and resources to design and build information systems that enhance the quality of working life.
Ensure that users and those who will be affected by a system have their needs clearly articulated during the assessment and design of requirements; later the system must be validated to meet requirements.
Create opportunities for members of the organization to learn the principles and limitations of computer systems.
4) Compliance with Code
Uphold and promote the principles of this Code.
Treat violations of this code as inconsistent with membership in the ACM.
Software Engineering Code of Ethics and Professional Practice
In accordance with their commitment to the health, safety and welfare of the public, software engineers shall adhere to the following Eight Principles:
Public: Software engineers shall act consistently with the public interest.
Client and Employer: Software engineers shall act in a manner that is in the best interests of their client and employer, consistent with the public interest.
Product: Software engineers shall ensure that their products and related modifications meet the highest professional standards possible.
Judgement: Software engineers shall maintain integrity and independence in their professional judgment.
Management: Software engineering managers and leaders shall subscribe to and promote an ethical approach to the management of software development and maintenance.
Profession: Software engineers shall advance the integrity and reputation of the profession consistent with the public interest.
Colleagues: Software engineers shall be fair to and supportive of their colleagues.
Self: Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.
Australian Code of Professional Conduct
As an ACS member you must uphold and advance the honour, dignity and effectiveness of being a professional. This entails, in addition to being a good citizen and acting within the law, your conformance to the following ACS values.
1. The Primacy of the Public Interest
You will place the interests of the public above those of personal, business or sectional interests.
2. The Enhancement of Quality of Life
You will strive to enhance the quality of life of those affected by your work.
3. Honesty
You will be honest in your representation of skills, knowledge, services and products.
4. Competence
You will work competently and diligently for your stakeholders.
5. Professional Development
You will enhance your own professional development, and that of your staff.
6. Professionalism
You will enhance the integrity of the ACS and the respect of its members for each other.
In a situation of conflict between the values, The Primacy of the Public Interest takes precedence over the other values.
This Code of Professional Conduct is aimed specifically at you as an individual practitioner, and
is intended as a guideline for your acceptable professional conduct. It is applicable to all ACS
members regardless of their role or specific area of expertise in the ICT industry
All the three codes focus on the public interest, honestl, loyalty, ensuring quality of life, and professional development.
In Australian Code of conduct, in a situation of conflict between the values, The Primacy of the Public
Interest takes precedence over the other values, while there is no such thing in other two codes.
Software Engineering Code of Ethics and Professional Practice includes development of self, that is, Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession, which is not usually seen in other two codes.
8.8 Lab: Swapping variables Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is 3 8, then the output is 8 3 Your program must define and call a function. SwapValues returns the two values in swapped order. void SwapValues(int& userVal1, int& userVal2) zybooks c++ g
Answer:
Following are the program in c++ language
#include<iostream> // header file
using namespace std; // using namespace
void swapvalues(int& userVal1, int& userVal2);// fucnction declaration
int main() // main method
{
int x,y; // variable declaration
cout<<"Enter the two value before swapping:\n";
cin>>x>>y; // read the two input
cout<<"before swapping:";
cout<<x<<y; // display the value before swapping
swapvalues(x, y);
cout << "\nAfter swapping:";
cout<<x<<y; // display the value after swapping
return 0;
}
void swapvalues(int& userVal1, int& userVal2) // function definition
{
int t; // variable declaration
t = userVal1; // assign the value userval1 to variable t
userVal1 = userVal2; // assign the value userval2 to userval1
userVal2 = t; // assign the value of variable t to userval2
}
Output:
Enter the two value before swapping:
3
8
before swapping:3 8
After swapping :8 3
Explanation:
Following are the description of the program
Declared a variable "x" and "y" of type "int".Read a input by user in x and y .Display the values of variable x and y before the swapping.Call the function swapvalues() by passing the value of x and y.After calling the console moved In the definition of swapvalues() Function where it interchanged the value of variable userVal1 and userVal2 by using third variable "t".After interchanged the console moved to the main function and finally display the value of variable "x" and "y' after the swapping.Following are C++ programs on Swapping values:
Program:#include <iostream>//header file
using namespace std;
void SwapValues(int& userVal1, int& userVal2)//defining the method SwapValues that takes two integer variable
{
int t;//defining integer variable t
//performing the swapping
t=userVal1;//using t variable that holds userVal1 value
userVal1=userVal2;//using userVal1 variable that holds userVal2 value
userVal2=t;//holding the t value in userVal2
cout<<"After swapping value: "<<userVal1<<" "<<userVal2;//printing the swapped value
}
int main()//defining the main method
{
int x,y;//defining integer variable that inputs value
cout<<"Input first number: ";//print message
cin>>x;//input value
cout<<"Input second number: ";//print message
cin>>y;//input value
cout<<"Before swapping value: "<<x<<" "<<y<<endl;//printing value
SwapValues(x,y);//calling method SwapValues
return 0;
}
Program Explanation:
Defining the header file.Defining the method "SwapValues" that takes two integer variables "userVal1 and userVal2" inside the parameter.Inside the method, an integer variable "t" is declared that performs the swapping, and prints its value.Outside the method, the main method is declared that defines two integer variables "x,y" and input the value from the user-end.After that, we call the above method.Output:
Please find the attached file.
Find out more information about the swapping here:
brainly.com/question/19665043
write a program that converts a Fahrenheit temperature to Celsius. The design of this program is important as I want you to break your program into separate functions and have the main() function call these to do the work.
Answer:
See the code snippet in the explanation section
Explanation:
import java.util.Scanner;
public class Question {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter temperature in Fahrenheit: ");
int inputTemperature = scan.nextInt();
fahrenheitTemperatureToCelsius(inputTemperature);
}
public static void fahrenheitTemperatureToCelsius(int fahrenheitTemperature){
int celsiusTemperature = ((fahrenheitTemperature - 32)*5)/9;
System.out.println("Temperature in Celsius = " + temperature);
}
}
Suppose your company has decided that it needs to make certain busy servers faster. Processes in the workload spend 60% of their time using the CPU and 40% on I/O. To achieve an overall system speedup of 25%: a. How much faster does the CPU need to be? b. How much faster does the disk need to be?
Answer:
CPU need 50% much faster
disk need 100% much faster
Explanation:
given data
workload spend time CPU = 60%
workload spend time I/O = 40%
achieve overall system speedup = 25%
to find out
How much faster does CPU need and How much faster does the disk need
solution
we apply here Amdahl’s law for the overall speed of a computer that is express as
S = [tex]\frac{1}{(1-f)+ \frac{f}{k} }[/tex] .............................1
here f is fraction of work i.e 0.6 and S is overall speed i.e 100% + 25% = 125 % and k is speed up of component
so put all value in equation 1 we get
S = [tex]\frac{1}{(1-f)+ \frac{f}{k} }[/tex]
1.25 = [tex]\frac{1}{(1-0.6)+ \frac{0.6}{k} }[/tex]
solve we get
k = 1.5
so we can say CPU need 50% much faster
and
when f = 0.4 and S = 125 %
put the value in equation 1
S = [tex]\frac{1}{(1-f)+ \frac{f}{k} }[/tex]
1.25 = [tex]\frac{1}{(1-0.4)+ \frac{0.4}{k} }[/tex]
solve we get
k = 2
so here disk need 100% much faster
Final answer:
To achieve a 25% speedup in overall system performance, we use Amdahl's Law. The CPU must become 50% faster, while the disk must become 100% faster.
Explanation:
To achieve an overall system speedup of 25%, we can use the principle known as Amdahl's Law, which provides a way to calculate the improvement to overall system performance when only part of the system is improved. Given that processes spend 60% of their time on the CPU and 40% on I/O, we can define these as fractions of the total execution time (0.60 and 0.40 respectively).
To solve these related questions, we first need to turn the desired speedup into its equivalent 'slowness' fraction. If we want a speedup of 25%, the new execution time should be 1 / (1 + speedup), which is 1 / 1.25 or 0.80 of the original execution time. This is the target 'slowness' of the improved system.
For the CPU, which currently accounts for 60% of the execution time, its improved slowness should be S_CPU * 0.60 + 0.40 (unchanged I/O slowness) = 0.80. Solving for S_CPU, we get S_CPU = (0.80 - 0.40) / 0.60 = 2/3. Therefore, to achieve the overall improvement, the CPU needs to become 1/(2/3) = 1.5 times faster.
For the disk I/O, which accounts for 40% of the execution time, its improved slowness should be 0.60 (unchanged CPU slowness) + S_IO * 0.40 = 0.80. Solving for S_IO, we get S_IO = (0.80 - 0.60) / 0.40 = 1/2. Hence, to achieve the desired system speedup, the disk needs to be 1/(1/2) = 2 times faster.
In summary:
a. The CPU needs to be 50% fasterb. The disk needs to be 100% fasterWhich of the following is not an acceptable way to code a nested structure? Select one: a. nest a for loop inside a while loop b. nest an else clause within an elif clause c. nest an if statement inside a for loop d. nest a while loop inside an elif clause
Answer:
nest an else clause within an elif clause
Explanation:
in python Programming, we cannot nest an else clause within an elif clause. elif is actually else if condition. we cannot nest another else with in elif clause.
A Chief Information Security Officer (CISO) needs to establish a KRI for a particular system. The system holds archives of contracts that are no longer in use. The contracts contain intellectual property and have a data classification of non-public. Which of the following be the BEST risk indicator for this system?
(A) Average minutes of downtime per quarter
(B) Percent of patches applied in the past 30 days
(C) Count of login failures per week
(D) Number of accounts accessing the system per day
Which of the following is an attack that adds SQL statements to input data for the purpose of sending commands to a database management system?
Zombie attack
Man-in-the-middle attack
SQL injection
SQL spoofing
Answer: SQL Injection
Explanation:
The SQL injection is one of the type of attack which is used in the database management system for sending the commands by adding the structured query (SQL) language statement in the form of input data.
The SQL injection is the technique of code injection in which the SQL statement for the purpose of sending commands. It is widely used in the data driven applications. The various types of web applications and web pages are used the SQL injection and uses in the form of input in the SQL query and then it is executed in the database.Therefore, The SQL injection is the correct option.
Write a program to calculate student's average test scores and the grade. You may assume the following input data:
Jack Johnson 85 83 77 91 76
Lisa Aniston 80 90 95 93 48
Andy Cooper 78 81 11 90 73
Ravi Gupta 92 83 30 69 87
Bonny Blair 23 45 96 38 59
Danny Clark 60 85 45 39 67
Samantha Kennedy 77 31 52 74 83
Rabin Bronson 93 94 89 77 97
Sheila Sunny 79 85 28 93 82
Kiran Smith 85 72 49 75 63
Answer:
def gradeAverage():
grades = []
i = 0
while i < 5:
a = int(input('enter score ' + str(i + 1) + ': '))
grades.append(a)
i = i+1
#print(grades)
average = sum(grades)/len(grades)
#print(average)
return average
def lettergrade(a):
letter = 'A'
if a < 60:
letter = 'F'
elif 59 < a < 63:
letter = 'D-'
elif 62 < a < 67:
letter = 'D'
elif 66 < a < 70:
letter = 'D+'
elif 69 < a < 73:
letter = 'C-'
elif 72 < a < 77:
letter = 'C'
elif 76 < a < 80:
letter = 'C+'
elif 79 < a < 83:
letter = 'B-'
elif 82 < a < 87:
letter = 'B'
elif 86 < a < 90:
letter = 'B+'
elif 89 < a < 94:
letter = 'A-'
elif 93 < a < 101:
letter = 'A'
return letter
numOfStudents = int(input('How many students: '))
names = []
aver = []
grade =[]
while numOfStudents > 0:
studentName = input('Enter students name: ')
names.append(studentName)
a = gradeAverage()
aver.append(a)
grade.append(lettergrade(a))
numOfStudents = numOfStudents - 1
for name in names:
for score in aver:
for letter in grade:
if names.index(name) == aver.index(score) == grade.index(letter):
print('%s : Average = %d Letter Grade: %s \n' %(name, score, letter))
break
Explanation:
The programming language used is python.
Two functions were created, the first function gradeAverage() was used to calculate the average values of the scores.
The second function lettergrade(a) was used to get the letter grade i.e(A, A-, C, D, e.t.c.) and it takes its argument from the average.
The main block of code asks for how many students are there and prompts the user to input their names and scores for all the students.
It takes that data calculates the average and the letter grade and prints out the names of the students, their average and their letter grade.
Creating parts that are interchangeable in manufacturing terms is key to the ____ line
Answer:
Assembly line.
Explanation:
The interchangeable parts was a game-changing concept for the manufacturing industry during the Industrial Revolution.
It was first introduced by Eli Whitney, also the inventor of the Cotton Gin, and later was perfected by Henry Ford, who was the first to create a continuous moving assembly line. The Interchangeable parts are identical pieces created from a master model and are so similar to each other, that they can fit into any line of production of the same kind.
Thanks to these advances, the manufacturing process across all industries could be now faster, more cost-efficient, and profitable.
In Java :
Write code to print the location of any alphabetic character in the 2-character string passCode. Each alphabetic character detected should print a separate statement followed by a newline.Ex: If passCode is "9a", output is:Alphabetic at 1import java.util.Scanner;public class FindAlpha {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);String passCode;passCode = scnr.next();/*Your solution goes here */}}
Answer:
The code to this question can be given as:
Code:
//define code.
//conditional statements.
if (Character.isLetter(passCode.charAt(0))) //if block
{
System.out.println("Alphabetic at 0"); //print message.
}
if (Character.isLetter(passCode.charAt(1))) //if block
{
System.out.println("Alphabetic at 1"); //print message.
}
Explanation:
In this code, we define conditional statement and we use two if blocks. In both if blocks we use isLetter() function and charAt() function. The isLetter() function checks the inserted value is letter or not inside this function we use charAt() function that checks inserted value index 1 and 2 is the character or not.
In first if block we pass the user input value and check the condition that if the inserted value is a character and its index is 0 so, it will print Alphabetic at 0. In second if block we pass the user input value and check the condition that if the inserted value is a character and its index is 1 so, it will print Alphabetic at 1.The code segment is an illustration of conditional statements
Conditional statements are statements whose execution depends on the truth value of the condition.
The code segment in Java, where comments are used to explain each line is as follows:
//This checks if the first character is an alphabet.
if (Character.isLetter(passCode.charAt(0))){
//If yes, this prints alphabetic at 0
System.out.println("Alphabetic at 0");
}
//This checks if the second character is an alphabet.
if (Character.isLetter(passCode.charAt(1))){
//If yes, this prints alphabetic at 1
System.out.println("Alphabetic at 1");
}
Read more about similar programs at:
https://brainly.com/question/14391069