Answer:
file = open('My_data.txt', 'w')
file.write('This file contains data')
Explanation:
Required
The correct syntax to write to file
From the question, we understand that we are to write to file and not append to the file.
This implies that the access mode will be w which stands for write
The first line of (a), (b) and (c) is correct.
(d) is incorrect
Solving further,
Only values of type string (i.e. str) can be written to file
With this, we can conclude that:
(a) is correct because 'This file contains data' is of type string
(b) and (c) are incorrect because, in (b), the value is of type integer and in (c), the type is list
Implement a class Rectangle. Provide a constructor to construct a rectangle with a given width and height, member functions get_perimeter and get_area that compute the perimeter and area, and a member function void resize(double factor) that resizes the rectangle by multiplying the width and height by the given factor
Answer:
Explanation:
The following code is written in Java. It creates the Rectangle class with the height and width variables. The constructor takes these variables as parameters to create Rectangle objects. It creates the get_perimeter method that sums up two of each side in order to get the perimeter of the Rectangle. A get_area method multiplies the height by the width to get the area. Finally, a resize method takes in a double factor variable and multiplies the height and the width by the factor to get a resized Rectangle object.
class Rectangle {
double height, width;
public Rectangle(double height, double width) {
this.height = height;
this.width = width;
}
public double get_perimeter() {
return (this.height + this.height + this.width + this.width);
}
public double get_area() {
return (this.height * this.width);
}
public void resize(double factor) {
this.height *= factor;
this.width *= factor;
}
}
When parameters are passed between the calling code and the called function, formal and actual parameters are matched by: a.
Answer:
their relative positions in the parameter and argument lists.
Explanation:
In Computer programming, a variable can be defined as a placeholder or container for holding a piece of information that can be modified or edited.
Basically, variable stores information which is passed from the location of the method call directly to the method that is called by the program.
For example, they can serve as a model for a function; when used as an input, such as for passing a value to a function and when used as an output, such as for retrieving a value from the same function. Therefore, when you create variables in a function, you can can set the values for their parameters.
A parameter can be defined as a value that must be passed into a function, subroutine or procedure when it is called.
Generally, when parameters are passed between a calling code and the called function, formal and actual parameters are usually matched by their relative positions in the parameter and argument lists.
A formal parameter is simply an identifier declared in a method so as to represent the value that is being passed by a caller into the method.
An actual parameter refers to the actual value that is being passed by a caller into the method i.e the variables or values that are passed while a function is being called.
Write a recursive method named digitSum that accepts an integer as a parameter and returns the sum of its digits. For example, calling digitSum(1729) should return 1 7 2 9, which is 19. If the number is negative, return the negation of the value. For example, calling digitSum(-1729) should return -19.
Answer:
The function in Python is as follows:
def digitSum( n ):
if n == 0:
return 0
if n>0:
return (n % 10 + digitSum(int(n / 10)))
else:
return -1 * (abs(n) % 10 + digitSum(int(abs(n) / 10)))
Explanation:
This defines the method
def digitSum( n ):
This returns 0 if the number is 0
if n == 0:
return 0
If the number is greater than 0, this recursively sum up the digits
if n>0:
return (n % 10 + digitSum(int(n / 10)))
If the number is lesser than 0, this recursively sum up the absolute value of the digits (i.e. the positive equivalent). The result is then negated
else:
return -1 * (abs(n) % 10 + digitSum(int(abs(n) / 10)))
write two eaxmple of operating system
Answer:
Some examples include versions of Microsoft Windows (like Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP), Apple's macOS (formerly OS X)
Explanation:
Answer:
windows 10 macOs window xp window 8
Abstract: Design, implement, explain, test, and debug a simple, but complete command- line interpreter named cli.
Detail: Design, implement, document, test and run a simple shell, known here as a command-line interpreter (cli). This tool is invoked via the cli command plus possible arguments. Commands are OS commands to be executed. Multiple commands are separated from one another by commas, and each may in turn require further arguments. Cli 'knows' a list of commands a-priori; they are predefined. When invoked, cli checks, whether the first argument is an included command. If so, cli confirms this via a brief message. If not, a contrary message is emitted, stating this is not one the predefined commands. After the message, cli executes all commands in the order listed. After executing the last command, cli prints the current working directory, i.e. it acts as if the pwd command had been issued. Sample runs are shown further below.
Multiple commands of cli must be separated from one another by commas. Possible parameters of any one command are separated from the command itself (and from possible further parameters) by white space. White space consists of blanks, tabs, or a combination, but at least 1 blank space. Here some sample runs with single and multiple commands; outputs are not shown here: .
/cli pwd looks like Unix command pwd; is your sw .
/cli rm -f temp, mv temp ../temp1 ditto: input to your running homework 5
./cli ls -la another "single unix command"
./cli rm a.out, gcc sys.c, cp a.out cli
Cli starts out identifying itself, also naming you the author, and the release date. Then cli prints the list of all predefine commands. Finally, cli executes all commands input after the cli invocation. For your own debug effort, test your solution with numerous correct and also wrong inputs, including commas omitted, multiple commas, leading commas, illegals commands, other symbols instead of commas etc. No need to show or hand-in your test and debug work.
The output of the cli command "cli pwd" or "./cli pwd" should be as shown below, assuming your current working directory is ./classes Sac State/csc139. Here is the output of a sample run with a single command line argument:
herbertmayer$ ./cli pwd
hgm cli 4/12/2020
Legal commands: cd exec exit gcc Is man more mv rm pwd sh touch which $path
2 strings passed to argv[]
next string is 'pwd'
new string is 'pwd
1st cind 'pwd' is one of predefined
/Users/herbertmayer/herb/academia/classes Sac State/csc139
Here the output of another sample run, also with a single cli command:
herbertmayer$ ./cli ls
hgm cli 4/12/2020
Legal commands: cd exec exit gcc ls man more mv rm pwd sh touch which Spath
2 strings passed to argv[]
next string is 'ls'
new string is 'ls!
1st cmd 'is' is one of predefined. admin cli.c sac state yyy
backup 1 24 2020 docs sac state hw
backup 3 9 2020 grades sac state xxx
cli 1 notes
/Users/herbertmayer/herb/academia/classes Sac State/csc139
Interpretation of commands that cli handles can proceed through system(), executed from inside your C/C++ program cli.
List of all commands supported by your cli:
char * cmds [ ] = {
"cd",
"exec",
"exit",
"gcc",
"ls",
"man",
"more",
"mv",
"Im
"pwd"
"sh",
"touch",
"which",
"Spath"
What you turn in:
1. The source program of your homework solution; well commented, preferably one single source file.
2. Four progressively more complex executions of your correctly working cli program, showing all user inputs and corresponding output responses.
Answer:
that is very long question ask a profesional
Explanation:
Which output device would a teacher use to show
a movie to the class? Check all of the boxes that
apply.
braille embosser
3D printer
speakers
projector
DONE
Answer:
projector
Explanation:
The output device that would be used would be a projector. From the available options, this is the only option capable of showing a movie to the class. A projector "projects" (in other words sends an image) the movie that was inputted into the machine onto a screen. This allows a video image to be shown on the screen which the entire class can see. Speakers only output audio, 3D printers output physical objects, and a braille embosser only outputs braille onto paper.
Answer:
prejector and speakers
Explanation:
2.
When parking on hills or an unlevel surface, make sure your
is engaged when you leave the vehicle.
A. turn signal
B. accelerator
C. brake pedal
D. parking brake
Answer:
D. parking brake
Explanation:
Create a new Java class called AverageWeight. Create two arrays: an array to hold 3 different names and an array to hold their weights. Use Scanner to prompt for their name and weight and store in correct array. Compute and print the average of the weights entered using printf command. Use a loop to traverse and print the elements of each array or use Arrays class method to print. Submit your code.
//import the Scanner class
import java.util.Scanner;
//begin class definition
public class AverageWeight{
//declare the main method
public static void main(String []args){
//declare the names array
String [] names = new String [3];
//declare the weights array
double [] weights = new double [3];
//Create an object of the Scanner class
Scanner input = new Scanner(System.in);
//create a loop to ask for the names and weights.
for(int i = 0; i< names.length; i++){
System.out.println("Enter name " + (i+1));
names[i] = input.next();
System.out.println("Enter weight " + (i+1));
weights[i] = input.nextDouble();
}
//find the sum of the weights
double sum = 0.0;
for(int j = 0; j< weights.length; j++){
sum += weights[j];
}
//find the average
double average = sum / weights.length;
//print out the average of the weights
System.out.printf("%s%f \n", "The average of the weights is ", average);
//print out the elements of the names array
System.out.println("Names : ");
System.out.print("{ ");
for(int i = 0; i< names.length; i++){
System.out.print(names[i] + " ");
}
System.out.print(" }");
//print out the elements of the weights array
System.out.println();
System.out.println();
System.out.println("Weights : ");
System.out.print("{ ");
for(int i = 0; i< weights.length; i++){
System.out.print(weights[i] + " ");
}
System.out.print(" }");
} //end of main method
} //end of class definition
Sample Output>> Enter name 1
Peter
>> Enter weight 1
12.0
>> Enter name 2
Joe
>> Enter weight 2
23.4
>> Enter name 3
Paul
>> Enter weight 3
23.9
The average of the weights is 19.766667
Names :
{ Peter Joe Paul }
Weights :
{ 12.0 23.4 23.9 }
Explanation:The code contains comments explaining important lines.
The source code file has been attached to this response.
A sample output has also been provided.
State ant two reasons why information should be saved on the computer.
Having duplicate copies of your most important information saved in a remote location keeps it safe in case anything goes badly wrong with your computer. When you think about it there are a number of ways files can be lost unexpectedly.
Expectation on Information Technology Fundamental
You can expect to develop an understanding of information systems, programming languages, information management and artificial intelligence, leaving your studies with the ability to apply your knowledge to solve problems.
Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lower even number. Hint: Use an if statement and the % operator to detect if n is odd, decrementing n if so. Enter an integer: 7 Sequence: 64 20 (2) If n is negative, output 0, Hint: Use an if statement to check if n is negative. If so, just set n = 0. Enter an integer: -1 Sequence: 0 Show transcribed image text (1) Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lower even number. Hint: Use an if statement and the % operator to detect if n is odd, decrementing n if so. Enter an integer: 7 Sequence: 64 20 (2) If n is negative, output 0, Hint: Use an if statement to check if n is negative. If so, just set n = 0. Enter an integer: -1 Sequence: 0
Answer:
The program in Python is as follows:
n = int(input("Enter an integer: "))
if n < 0:
n = 0
print("Sequence:",end=" ")
for i in range(n,-1,-1):
if i%2 == 0:
print(i,end = " ")
Explanation:
This gets input for n
n = int(input("Enter an integer: "))
This sets n to 0 if n is negative
if n < 0:
n = 0
This prints the string "Sequence"
print("Sequence:",end=" ")
This iterates from n to 0
for i in range(n,-1,-1):
This check if current iteration value is even
if i%2 == 0:
If yes, the number is printed
print(i,end = " ")
Es el conjunto de manifestaciones materiales, intelectuales y espirituales que distinguen a un pueblo a)Civilización b)Cultura c)Tradiciones d)Costumbres
Answer:
a)Civilización
Explanation:
To iterate through (access all the entries of) a two-dimensional arrays you
need for loops. (Enter the number of for loops needed).
Answer: You would need two loops to iterate through both dimensions
Explanation:
matrix = [[1,2,3,4,5],
[6,7,8,9,10],
[11,12,13,14,15]]
for rows in matrix:
for numbers in rows:
print(numbers)
The first loop cycles through all the immediate subjects in it, which are the three lists. The second loop calls the for loop variable and iterates through each individual subject because they are lists. So the first loop iterates through the 1st dimension (the lists) and the seconds loop iterates through the 2nd dimension (the numbers in the lists).
To iterate through (access all the entries of) a two-dimensional arrays you need two for loops.
What is an array?A collection of identically typed items, such as characters, integers, and floating-point numbers, are kept together in an array, a form of data structure.
A key or index that can be used to retrieve or change the value kept in that location identifies each element in the array.
Depending on how many indices or keys are used to identify the elements, arrays can be one-dimensional, two-dimensional, or multi-dimensional.
Two nested for loops are often required to iterate over a two-dimensional array: one to loop through the rows, and the other to loop through the columns.
As a result, two for loops would be required to access every entry in a two-dimensional array.
Thus, the answer is two for loops are required.
For more details regarding an array, visit:
https://brainly.com/question/19570024
#SPJ6
Write the names of different types of communication.
Answer:
There are four types of communication: verbal, nonverbal, written and visual.
Why do we use functions?
To stop the program from repeating.
To test for true and false.
To simplify code.
To ask the user for input.
What is the difference between encryption and hashing?
Hashing and Encryption have different functions. Encryption includes encryption and decryption process while hashing is a one-way process that changes data into the message digest which is irreversible. ...
Hashing algorithm. A hash can simply be defined as a number generated from a string of text. ...
Encryption. ...
The difference between hashing and encryption. ...
Encryption and Hashing are both ways in which information is secured. The
differences between Encryption and Hashing include the following:
Encryption is a two- way process which involves encoding and decoding
while Hashing is a one way process which involves encoding.
Encrypted information can be retrieved through decoding and getting a
plain text while Hashed information can't be retrieved as a plain text but as
hash value.
Read more about Encryption and hashing here https://brainly.com/question/9979590
To convert microseconds to nanoseconds: a. Take the reciprocal of the number of microseconds. b. Multiply the number of microseconds by 0.001. c. Multiply the number of microseconds by 0.000001. d. Multiply the number of microseconds by 1,000. e. Multiply the number of microseconds by 1,000,000.
Answer: D. Multiply the number of microseconds by 1,000.
Explanation:
In order to convert microseconds to nanoseconds, it should be noted that one should multiply the number of microseconds by 1,000.
For example, if we want to convert 12 microseconds to nanoseconds. This will be:
= 12 × 1000
= 12000 nanoseconds.
Therefore, with regards to the information given above, the correct option is D.
You are in the process of configuring a new computer. The motherboard has four memory slots and supports dual-channel memory. You install two memory modules. When you boot the computer, the BIOS recognizes both modules, but the memory is not configured to run in dual-channel mode. What should you do
Answer:
Place the modules in the appropriate slots on the motherboard.
Explanation:
You must install memory in the correct slots to use dual-channel memory. The two slots may be next to one other or alternate depending on the motherboard. For the correct configuration, consult the motherboard manual. Dual-channel support is primarily determined by the motherboard (e.g., the memory controller), rather than the memory. With Rambus RAM, continuity modules are employed; if they were necessary on this system, none of the memory would have been identified. Memory timing is based on the CAS latency. If the system is unstable with the current memory timing settings, you may want to change the timing.
How do you get off of the comments after you look at them wit out going all the way off the app?
To avoid legal issues and set clear guidelines and expectations for employees, employers should put which of the following in place?
Group of answer choices
Answer: social media policy
Explanation:
In order to avoid legal issues and also set clear guidelines and expectations for the employees in an organization, it is required that employers should put a social media policy in place.
A social media policy refers to a document which outlines how an organization and the employees will behave and conduct themselves online. This helps to checkmate and curtail the activities of the employees so that there won't be a detrimental effect on the organization.
How do you answer a question that's already been answered?
If you are writing an article on your favorite cuisine, which form of illustration would best fit the article?
Bill needs to make a presentation in which he has to represent data in the form of a pyramid. Which feature or menu option of a word processing program should Bill use?
Answer:
images
Explanation:
Adding images to the text gives it more life and makes the topic interesting
Which of the following is primarily operated by a touchscreen?
Mobile device
Notebook
Desktop
Network
Answer: The correct answer is Mobile device
Explanation:
A Mobile device is any portable equipment that can be easily connected to an internet. Example of mobile devices include; smart phones, palmtop, smart watch and other computer gadgets. The use of touchscreen for input or output on mobile devices can not be overemphasized. Mobile devices are handy and can be used for making work easy. As such, in order to effectively use mobile devices, touchscreen can be primarily used.
You are in the process of implementing a network access protection (NAP) infrastructure to increase your network's security. You are currently configuring the remediation network that non-compliant clients will connect to in order to become compliant. The remediation network needs to be isolated from the secure network. Which technology should you implement to accomplish this task
Answer:
Network Segmentation
Explanation:
The best technology to implement in this scenario would be Network Segmentation. This allows you to divide a network into various different segments or subnets. Therefore, this allows you to isolate the remediation network from the secure network since each individual subnet that is created acts as its own network. This also allows you to individually implement policies to each one so that not every network has the same access or permissions to specific data, traffic, speeds, etc. This would solve the issues that you are having and add multiple benefits.
The smalled valid zip code is 00501. The largest valid zip code is 89049. A program asks the user to enter a zip code and stores it in zip as an integer. So a zip code of 07307 would be stored as 7307. This means the smallest integer value allowed in zip is 501 and the largest integer value allowed in zip is 89049. Write a while loop that looks for BAD zip code values and asks the user for another zip code in that case. The loop will continue to execute as long as the user enters bad zip codes. Once they enter a good zip code the progam will display Thank you. The first line of code that asks for the zip code is below. You don't have to write this line, only the loop that comes after it.
Answer:
The program in Python is as follows:
zipp = int(input("Zip Code: "))
while (zipp > 89049 or zipp < 501):
print("Bad zip code")
zipp = int(input("Zip Code: "))
print("Thank you")
Explanation:
This gets input for the zip code [The given first line is missing from the question. So I had to put mine]
zipp = int(input("Zip Code: "))
This loop is repeated until the user enters a zip code between 501 and 89049 (inclusive)
while (zipp > 89049 or zipp < 501):
This prints bad zip code
print("Bad zip code")
This gets input for another zip code
zipp = int(input("Zip Code: "))
This prints thank you when the loop is exited (i.e. when a valid zip code is entered)
print("Thank you")
Which Product is an example of Interface convergence?
- a key chain with a bottle opener
- a pencil with a flashlight
- a passenger car that uses the same engine as a racing car
- a tablet device that can be connected to a standard keyboard
Answer:
a tablet device that can be connected to a standard keyboard
Explanation:
Komunikasi, dengan program ini kita juga bisa berkomunikasi dengan pengguna lain.Program ini sudah dirancang untuk bisa saling bertukar informasi dalam bentuk jaringan dimana orang lain bisa membuka lembar kerja kita dari terminal (komputer) yang berlainan,bahkan ia juga bisa melakukan perubahan pada lembar kerja yang sama pada saat yang bersamaan pula. Kata pengguna lain dapat disebut dengan kata:_____________
Answer:
what language is this?
Explanation:
What happens when in Word 2016 when the home ribbon tab is clicked on?
Answer: The home tab is opened up.
Explanation:
When using Word 2016 and the home ribbon tab is clicked on, the home tab is opened up. This tab houses the very basic functions of the word document, a lot of which have to be used if even a simple document needs to be typed.
This tab allows you to change the font as well as the font size and color. The page alignment is also set here as well as the text direction. Even headings can be customized here.
There are a lot more functions but the high level point is that the home tab is where the most basic of functions are, as shown in the attachment.
Design a base class, Road, with the following members:
.
Attributes for storing the road's name, number of lanes, and maximum speed limit.
A three-parameter constructor to initialize the three attributes
Accessors and Mutators (Gets and Sets) for each attribute.
Input Validation: You should ensure that the number of lanes is always a value greater
than 0, and that the maximum speed limit is a value between 0 and 100 MPH. This input
validation should apply to both the 3-parameter constructor and the individual accessor
functions
A display function that prints the road's information in a single line format
Design a derived class, TollRoad, which inherits from Road. It should have the following members:
.
An attribute for storing the toll for using the road.
A 4-parameter constructor to initialize the three attributes of the base class, as well as
the toll
Accessor and Mutator methods for the toll.
Input Validation: You should ensure that the toll is a value greater than 0.0. This validation
should apply to both the 4-parameter constructor as well as the individual accessor
An overridden display function that displays the information of the TollRoad in a two-line
format, where the first line displays basic Road information, and a second line specifies
the current toll
I've attached my Java implementation.
What is a document?
a information about a computer file, distinct from the information it contains
a set of information gathered together
a two- to four-letter string set to the right of the dot in a filename; this designates the type of information in the file
a computer file representing a specific text item
Answer:
A document is a written, drawn, presented, or memorialized representation of thought, often the manifestation of non-fictional, as well as fictional, content. The word originates from the Latin Documentum, which denotes a "teaching" or "lesson": the verb doceō denotes "to teach" In general, a document (noun) is a record or the capturing of some event or thing so that the information will not be lost. A document is a form of information. A document can be put into an electronic form and stored in a computer as one or more files. Often a single document becomes a single file.