We'll use the loop function, if statement, and the compound operator for the code to modify an array's elements.
What is loop and compound operator?
Loop is function in all program language that iterates the statement under specific boundaries.
If statement is conditional statement that if the required condition are met then the program will execute.
Compound operator is combined two of operator to simplified code.
The code we will add to the given code is,
for (i = 0; i < dataPoints.length; ++i){
if (dataPoints[i] < controlValue)
dataPoints[i] *= 2;
}
This loop will running repeatedly until exceed dataPoints size.
The if statement will check dataPoints is less than controlValue or not, if yes then dataPoints will multiply it with compound operator *= 2.
Learn more about loop here:
brainly.com/question/26098908
#SPJ4
Suppose a subnet has a prefix 15.119.44.128/26. If an ISP owns a block of addresses starting at 15.119.44.64/26 and wants to form four (4) subnets of equal size, what prefixes of the form a.b.c.d/x should be used? Explain. How many hosts can each of the new subnet have?
Any IP address that can be seen within the subnet 15.119.44.128/26 and 15.119.44.191/26 network addresses.
The four equal subnets that can be derived from the subnet 15.119.44.64/26 are said to be:
15.119.44.64/28 15.119.44.80/28 15.119.44.96/2815.119.44.112/28.Why the subnet above?The appropriate host or subnet number and mask are used to determine the IP addresses in the subnet 15.119.44.128/26.
Note that the host formula is 2n -2, where n is the number of zeros on the place of the fourth octet and two is subtracted from the value signifying the network and broadcast addresses of the network address.
Therefore, The subnet is determined by the formula 2n, where n is the number of borrowed bits from the fourth octet.
Learn more about subnet from
https://brainly.com/question/14895074
#SPJ1
52 is same as 5x5 or 25
Answer:
25
Explanation:
Answer:
i would say none of them
bc 5 time 5 is 25 so they both dont equal to 52
hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Answer:
hhhhhhhhhhhhhhhhhiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Explanation:
Which phrase or phrases suggest a security issue in data mining?
Travis often BUYS BUSINESS BOOKS ONLINE. Recently, he LOGGED INTO THE WEBSITE to buy a marketing book. He noticed a part on the screen that RECOMMENDED BOOKS BASED ON HIS BROWNING HISTORY. Due to this recommendation, Travis could easily locate the book. A few days later, he FOUND BOOK RECOMMENDATIONS FROM UNKNOW SOURCES. Eventually, he STARTED GETTING SPAM EMAIL FROM THESE SOURCES.
Based on web search results, data mining security issues are related to the protection of data and its resources from unauthorized access, misuse, or theft. Some of the factors that can suggest a security issue in data mining are:
- Data provenance: The source and history of the data should be verified and traced to ensure its authenticity and integrity.
- Access controls: The identity of the person or system accessing the data should be verified and authorized to prevent unauthorized access.
- Data anonymization: The sensitive or private information in the data should be masked or removed to protect the privacy of individuals or entities.
- Data storage location: The location where the data is stored should be secure and compliant with the relevant laws and regulations.
- Distributed frameworks: The data should be encrypted and protected when it is transferred or processed across different nodes or systems.
Based on these factors, the phrase or phrases that suggest a security issue in data mining in your question are:
- FOUND BOOK RECOMMENDATIONS FROM UNKNOWN SOURCES
- STARTED GETTING SPAM EMAIL FROM THESE SOURCES
These phrases indicate that the data provenance and access controls were compromised, and that the data was exposed to unauthorized parties who could misuse it for malicious purposes.
What is the data type of the following variable?
name = "John Doe"
In computer programming, a variable is a storage location that holds a value or an identifier. A data type determines the type of data that can be stored in a variable. The data type of the following variable, name = "John Doe" is a string data type.
In programming, a string is a sequence of characters that is enclosed in quotes. The string data type can store any textual data such as names, words, or sentences.The string data type is used in programming languages such as Java, Python, C++, and many others. In Python, the string data type is denoted by enclosing the value in either single or double quotes.
For instance, "Hello World" and 'Hello World' are both strings.In conclusion, the data type of the variable name is string. When declaring variables in programming, it is important to assign them the correct data type, as it determines the operations that can be performed on them.
For more such questions on variable, click on:
https://brainly.com/question/28248724
#SPJ8
What is the output?
>>> password = "sdf#_356"
>>> password.isalnum()
>>>
Answer:
The output is False
Explanation:
How to fix "After a recent update to the DuckDuckGo Privacy Essentials Chrome browser extension, Lightning Experience users are reporting encountering the following errors when navigating various pages and records in their Salesforce org:
We can't display this page because your browser blocks cross-domain cookies
We can't display this page because your browser blocks cross-domain cookies, but you can view this page in Salesforce Classic. Click here to open this page in Salesforce Classic"?
In the salesforce url above, select the Lock icon. After that, select Cookies and then select the Blocked Cookies tab. Allow cookies from salesforce after that. Reloading the page will fix the problem.
"This page cannot be shown because your browser disables cross-domain cookies. Attempt once more using a different compatible browser." The fix is to add salesforce.com, force.com, and visualforce.com to your browser's list of websites that don't accept cookies. The Privacy & Security panel should be chosen. Select the Custom radio option next to Enhanced Tracking Protection. To choose which types of cookies to block, check the box next to Cookies and utilize the drop-down option. Cross-site tracking cookies, which includes social media cookies, are the default setting.
Learn more about browser here-
https://brainly.com/question/28504444
#SPJ4
Looking at the code below, what answer would the user need to give for the while loop to run?
System.out.println("Pick a number!");
int num = input.nextInt();
while(num > 7 && num < 9){
num--;
System.out.println(num);
}
9
2
7
8
The number that the user would need for the whole loop to run would be D. 8.
What integer is needed for the loop to run ?For the while loop to run, the user needs to input a number that satisfies the condition num > 7 && num < 9. This condition is only true for a single integer value:
num = 8
The loop will only run if the number is greater than 7 and less than 9 at the same time. There is only one integer that satisfies this condition: 8.
If the user inputs 8, the while loop will run.
Find out more on loops at https://brainly.com/question/19344465
#SPJ1
Which describes a market research report? Select all that apply.
A record of customer names
A summary of consumer buying behaviors
A projection of future consumer buying behaviors
An analysis of consumer interests
Answer:
A projection of consumer buying behaviors prediction comes in various ways. It can be through collecting information through primary or secondary research such as analyzing online actions, feedback analysis, focus groups, conversational marketing, and more.
1. Design a DC power supply for the Fan which have a rating of 12V/1A
To design a DC power supply for a fan with a rating of 12V/1A, you would need to follow these steps:
1. Determine the power requirements: The fan has a rating of 12V/1A, which means it requires a voltage of 12V and a current of 1A to operate.
2. Choose a transformer: Start by selecting a transformer that can provide the desired output voltage of 12V. Look for a transformer with a suitable secondary voltage rating of 12V.
3. Select a rectifier: To convert the AC voltage from the transformer to DC voltage, you need a rectifier. A commonly used rectifier is a bridge rectifier, which converts AC to pulsating DC.
4. Add a smoothing capacitor: Connect a smoothing capacitor across the output of the rectifier to reduce the ripple voltage and obtain a more stable DC output.
5. Regulate the voltage: If necessary, add a voltage regulator to ensure a constant output voltage of 12V. A popular choice is a linear voltage regulator such as the LM7812, which regulates the voltage to a fixed 12V.
6. Include current limiting: To prevent excessive current draw and protect the fan, you can add a current-limiting circuit using a resistor or a current-limiting IC.
7. Assemble the circuit: Connect the transformer, rectifier, smoothing capacitor, voltage regulator, and current-limiting circuitry according to the chosen design.
8. Test and troubleshoot: Once the circuit is assembled, test it with appropriate load conditions to ensure it provides a stable 12V output at 1A. Troubleshoot any issues that may arise during testing.
Note: It is essential to consider safety precautions when designing and building a power supply. Ensure proper insulation, grounding, and protection against short circuits or overloads.
For more such answers on design
https://brainly.com/question/29989001
#SPJ8
4. Why do animals move from one place to another?
Answer:
Animal move from one place to another in search of food and protect themselves from their enemies.They also move to escape from the harsh climate. Animal move from one place to another in search of food,water and shelter.
Answer:
Animals move one place to another because he search food and shelter
Help me with this digital Circuit please
A subset of electronics called digital circuits or digital electronics uses digital signals to carry out a variety of tasks and satisfy a range of needs.
Thus, These circuits receive input signals in digital form, which are expressed in binary form as 0s and 1s. Logical gates that carry out logical operations, including as AND, OR, NOT, NANAD, NOR, and XOR gates, are used in the construction of these circuits.
This format enables the circuit to change between states for exact output. The fundamental purpose of digital circuit systems is to address the shortcomings of analog systems, which are slower and may produce inaccurate output data.
On a single integrated circuit (IC), a number of logic gates are used to create a digital circuit. Any digital circuit's input consists of "0's" and "1's" in binary form. After processing raw digital data, a precise value is produced.
Thus, A subset of electronics called digital circuits or digital electronics uses digital signals to carry out a variety of tasks and satisfy a range of needs.
Learn more about Digital circuit, refer to the link:
https://brainly.com/question/24628790
#SPJ1
Ok so im going to list my question and then the work so far.
Here is the code so far:(THE PROBLEM WITH THE CODE IS THAT THE IM SUPPOSE TO USE FIND() TO REPEATEDLY CHANGE THE OCCURRENCE OF THE WORD "MASK" TO THE WORD "HAT" IN THE FILE BUT AM KIND OF LOST HAVE BEEN WORKING ON THIS FOR A WEEK AND A HALF) ALSO I CAN NOT use the replace method, count method, split method, range() function, or lists in your solution. HAVE BEEN TRYING TO FIND SUM WAY TO USE FIND() BUT AM COMING UP SHORT
CODE:
#Get input file name
fileOne = input("Enter the input file name :")
#Get output file name
fileTwo = input("Enter the output file name :")
'''Get a string that will be searched in the source file
to locate all occurrences of the string'''
targetString = input("Enter the target string :")
'''Get a string that will replace each occurrence of the target
string in the source file'''
replacementString = input("Enter the replacement string :")
files =input("Enter a file with the word 'mask':")
#Open the input file in read mode
f1 = open(fileOne,"r+")
#Read the content of input file
content =f1.read()
#Replace the target string with the replacement string
content =f1.find('mask')
print(files[0:content]+ "hat"+ files[content +content:len(files)])
#Open the output file in write mode
f1 = open(fileTwo,"w")
'''Write the content after all of the occurrences of the target
string have been found and replaced by the replacement string'''
f1.close()
Answer:
qwerty
Explanation:
qwerty
2. Consider a computer system called 3P2M in the following figure. The 3P2M system consists of three processors and two shared memories communicating over a shared bus, as shown in the following Figure. The system is operational as long as at least two processors can communicate with at least one of the two memories over the bus.
a) Construct the fault tree model of this system
b) Find all the minimal cut sets
c) Assume all the components fail exponentially with the following failure rates: processors (P1, P2, P3): 0.0001/hour; memories (M1, M2): 0.0001/hour; bus: 0.000001/hour. Find the system reliability at mission time t=100 hours.
1. The probability of the component surviving 200 hours is 0.9608 and still functioning after 400 hours is 0.8862.
2. Assuming all the components fail exponentially, the system's reliability at mission time t = 100 hours is 0.999985.
How to calculate system's reliability?1) To determine the probability that the component survives 200 hours, we need to use the survival function, which is the complement of the cumulative distribution function (CDF).
The CDF gives the probability that the component fails before or at time t, and is given by:
F(t) = 1 - e^(-∫z(u)du), where the integral is taken from 0 to t.
In this case, the failure rate function is z(t) = 2.0 × 10⁻⁶ t/hour for t > 0, so the integral becomes:
∫z(u)du = ∫2.0 × 10⁻⁶ u du = 10⁻⁶ u² + C,
where C is a constant of integration. Evaluating this integral from 0 to 200 hours:
∫0²⁰⁰ z(u)du = 10⁻⁶ (200)² = 0.04
So the CDF at 200 hours is:
F(200) = 1 - e^(-0.04) ≈ 0.0392
Therefore, the probability that the component survives 200 hours is:
P(T > 200) = 1 - F(200) ≈ 0.9608
To determine the probability that a component, which is functioning after 200 hours, is still functioning after 400 hours, we need to use the conditional probability formula:
P(T > 400 | T > 200) = P(T > 400 and T > 200) / P(T > 200)
The numerator represents the probability that the component survives beyond 400 hours given that it has already survived 200 hours, while the denominator represents the probability that the component survives beyond 200 hours.
The joint probability of surviving beyond 400 and 200 hours is:
P(T > 400 and T > 200) = P(T > 400)
since if the component survives beyond 400 hours, it necessarily also survives beyond 200 hours.
The probability of surviving beyond 400 hours is:
P(T > 400) = 1 - F(400) = 1 - (1 - e^(-∫z(u)du)) = e^(-∫z(u)du)
Using the same integral as before:
∫0⁴⁰⁰ z(u)du = 10⁻⁶ (400)² = 0.16
So:
P(T > 400) = e^(-0.16) ≈ 0.8521
The probability of surviving beyond 200 hours was found to be approximately 0.9608 in part (1).
Therefore, the probability that a component, which is functioning after 200 hours, is still functioning after 400 hours is:
P(T > 400 | T > 200) = P(T > 400 and T > 200) / P(T > 200)
= P(T > 400) / P(T > 200)
= (e^(-0.16)) / (0.9608)
≈ 0.8862
2) a) Fault tree model of the 3P2M system:
1
/ | \
P1 P2 P3
| | |
1| 1| 1|
| | |
B B B
| | |
1| 1| 1|
| | |
M1 M2 M1
\ / /
\ / /
1 1
where P1, P2, and P3 are the processors, M1 and M2 are the memories, B is the bus, and the numbers above the components represent their probabilities of not failing.
b) Minimal cut sets:
{P1, P2, M1}
{P1, P2, M2}
{P1, P3, M1}
{P1, P3, M2}
{P2, P3, M1}
{P2, P3, M2}
c) To calculate the system reliability, we can use the following formula:
R = e^(-λt)
where R is the system reliability, λ is the failure rate, and t is the mission time.
Using this formula, we can calculate the reliability of each component:
Processor: Rp = e^(-0.0001 × 100) = 0.9048
Memory: Rm = e^(-0.0001 × 100) = 0.9048
Bus: Rb = e^(-0.000001 × 100) = 0.9999
Next, use the minimal cut sets to calculate the system reliability. The minimal cut sets are:
{P1, M1, M2}
{P2, M1, M2}
{P3, M1, M2}
{P1, P2, M1}
{P1, P2, M2}
{P1, P3, M1}
{P1, P3, M2}
{P2, P3, M1}
{P2, P3, M2}
The system reliability can be calculated using the following formula:
Rsys = 1 - Σ(Ri × Π(Rj))
where Ri is the reliability of the i-th minimal cut set, and Π(Rj) is the product of the reliabilities of all components in the j-th minimal cut set.
Using this formula, calculate the system reliability:
Rsys = 1 - [(0.0952 × 0.0952 × 0.0952) + (0.0952 × 0.0952 × 0.0952) + (0.0952 × 0.0952 × 0.0952) + (0.9048 × 0.9048 × 0.0952) + (0.9048 × 0.9048 × 0.0952) + (0.9048 × 0.9048 × 0.0952) + (0.9048 × 0.9048 × 0.0952) + (0.9048 × 0.9048 × 0.0952) + (0.9048 × 0.9048 × 0.0952)]
Rsys = 0.999985
Therefore, the system reliability at mission time t=100 hours is approximately 0.999985.
Find out more on computer processor here: https://brainly.com/question/30270798
#SPJ1
A developer wants to take existing code written by another person and add some features specific to their needs. Which of the following software licensing models allows them to make changes and publish their own version?
Open-source
Proprietary
Subscription
Software-as-a-Service (SaaS)
Answer:
open-source
Explanation:
open-souce software allows any user to submit modifications of the source code
various sources of ict legislation
Answer:
oh ma ma my here it is
Explanation:
Legislation of ICT The purpose of legislation is to control and regulate the use of ICT. Different acts in result in different benefits to the end user or other people affected by the technology. ... Legislation protects people and ensures that there is no abuse by others to those investing in the technology
Convert the following to CNF: S→SS|AB|B A→aAAa B→ bBb|bb|Ꜫ C→ CC|a D→ aC|bb
To convert the given grammar into Chomsky Normal Form (CNF), we need to rewrite the rules and ensure that each production has only two non-terminals or one terminal on the right-hand side. Here is the converted CNF grammar:
1. S → SS | AB | B
2. A → AA
3. A → a
4. B → bBb | bb | ε
5. C → CC | a
6. D → aC | bb
Explanation:
1. The production S → SS has been retained as it is.
2. The production A → aAAa has been split into A → AA and A → a.
3. The production B → bBb has been split into B → bB and B → b.
4. The production B → bb has been kept as it is.
5. The production B → ε (empty string) has been denoted as B → ε.
6. The production C → CC has been retained as it is.
7. The production C → a has been kept as it is.
8. The production D → aC has been kept as it is.
9. The production D → bb has been kept as it is.
In summary, the given grammar has been converted into Chomsky Normal Form (CNF), where each production has either two non-terminals or one terminal on the right-hand side. This form is useful in various parsing and analysis algorithms.
For more questions on parsing, click on:
https://brainly.com/question/13211785
#SPJ8
Answer:
Explanation:
To convert the given grammar to Chomsky Normal Form (CNF), we need to follow a few steps:
Step 1: Eliminate ε-productions (productions that derive the empty string).
Step 2: Eliminate unit productions (productions of the form A → B).
Step 3: Convert long productions (productions with more than two non-terminals) into multiple productions.
Step 4: Convert terminals in remaining productions to new non-terminals.
Step 5: Ensure all productions are in the form A → BC (binary productions).
Applying these steps to the given grammar:
Step 1: Eliminate ε-productions
The given grammar doesn't have any ε-productions.
Step 2: Eliminate unit productions
The given grammar doesn't have any unit productions.
Step 3: Convert long productions
S → SS (Remains the same)
S → AB
A → aAAa
B → bBb
B → bb
C → CC
C → a
D → aC
D → bb
Step 4: Convert terminals
No changes are needed in this step as all terminals are already in the grammar.
Step 5: Ensure binary productions
The given grammar already consists of binary productions.
The converted grammar in Chomsky Normal Form (CNF) is:
S → SS | AB
A → aAAa
B → bBb | bb
C → CC | a
D → aC | bb
Note: The original grammar didn't include the production rules for the non-terminals 'S', 'C', and 'D'. I assumed the missing production rules based on the provided information.
How Charles Babbage Concept of
Computer has help the modern
Computer
English mathematician and inventor Charles Babbage is credited with having conceived the first automatic digital computer. During the mid-1830s Babbage developed plans for the Analytical Engine. Although it was never completed, the Analytical Engine would have had most of the basic elements of the present-day computer.
______ means locating a file among a set of file
Answer:
computer files
Explanation:
Complete each of the following sentences by
using the drop-down menus.
sound into
Audio digitization converts
sound.
Digital audio is stored in
The process of audio digitization converts the
sound wave into a series of
Answer:
something like
Explanation:
Audio digitization converts analogue
sound a sound wave
Digital audio is stored in binary
The process of audio digitization converts the
sound wave into a series of numbers.
Answer: 1 analog
2 digital 3 binary
4 zero and ones
Explanation:
The pinky finger on the right hand types _____.
S W 2 X
M J U 7
A Q Z 1 ~
; P 0 ' / [ ]
Answer and Explanation:
The answer is the fourth option: ; P 0 ' / [ ]
These keys line up to where the pinky finger on the right hand would be able to reach (comfortably) and press.
The hand should line up with the pinky placed on the ; key.
The right hand index finger should be on J (with the little bump on it), middle finger on K, ring finger on L, and pinky finger on ;.
The left hand index finger should be on F (with the little bump on it), middle finger on D, Left Side Ring Finger on S, and pinky finger on A.
#teamtrees #PAW (Plant And Water)
I hope this helps!
The pinky finger on the right-hand types ; P 0 ' / [ ]. These keys are placed so that the right hand's pinky finger could comfortably reach and press them. Thus, option D is correct.
The pinky on the; key should be in alignment with the hand. The pinky finger should be on; the middle finger on K, the ring finger on L, and the index finger on J on the right hand.
The pinky finger should be on A, the middle finger on D, the left side ring finger on S, and the index finger on F (the one with the small bump). The majority of the keyboard's keys, including the following ones, are controlled by the right pinky (little) finger, which is positioned over the ";" key.
Therefore, option D is the ideal selection.
Learn more about keyboard keys here:
https://brainly.com/question/33836881
#SPJ3
Your organization, which sells manufacturing parts to companies in 17 different countries, is in the process of migrating your inventory database to the cloud. This database stores raw data on available inventory at all of your company's warehouses globally. The database will be accessible from multiple cloud-based servers that reside on your cloud provider's hardware located in three regions around the world. Each redundant database will contain a fully synchronized copy of all data to accelerate customer access to the information, regardless of the customer's geographical location.What database trend is your company implementing
Answer:
Disributed database
Explanation:
A distributed database stores data on multiple servers sometimes placed in distinct geographical locations.
Addressing is an added feature on the Internet, and is not required for proper operation of the Internet, as packet switching is the principle communication feature. Group of answer choices True False
Answer:
True
Explanation:
The statement is true. Packet switching is a method that groups the data and transmit it over the digital network. It is basis for communication in the computer. When the two host decides to communicate the network creates a control function and data is transmitted. Addressing is an added and is not mandatory for the operations of the internet as packet switching.
Write a Python program whose inputs are three integers, and whose output is the smallest of the three values.
Input
7
15
3
Output
3
Answer:
def smallest_of_three(a, b, c):
return min(a, b, c)
print(smallest_of_three(7, 15, 3))
Explanation:
The above program takes three integers as inputs and returns the smallest of the three values using the min() function which takes an iterable of numbers as input and returns the smallest number in it. In this case, we pass the three integers a, b, and c as arguments to the min() function and it returns the smallest of the three.
what is computer animation?
Answer:
Animation means giving life to any object in computer graphics. It has the power of injecting energy and emotions into the most seemingly inanimate objects. Computer-assisted animation and computer-generated animation are two categories of computer animation. It can be presented via film or video.
Explanation:
Computer animation is the process used for digitally generating animated images. The more general term computer-generated imagery encompasses both static scenes and dynamic images, while computer animation only refers to moving images hope this helps plz mark branilest :P
Which of the following queries can have a fully Meets result?
Answer: we need the awnser key
Explanation:
What type of outline do most tv infomercials use?
The type of outline that most TV infomercials use, chronological. The correct option is D.
What is the TV infomercials?An infomercial is a type of advertising that uses a television program to inform viewers about a particular product or line of products. Infomercials are typically lengthier and more in-depth than conventional advertisements.
Infomercials are a type of long-form video that provides a thorough and entertaining explanation of an idea or product.
Some examples of popular infomercials include: Proactiv acne system featuring celebrities like Justin Bieber and Jessica Simpson.
Therefore, the correct option is D. chronological.
To learn more about TV infomercials, refer to the link:
https://brainly.com/question/9558049
#SPJ1
An array in c++ is decleared as ''float split[31][13][23] How many bytes does it occupy in memory?
Answer:
Size of array = size of each element * total number of elements
Explanation:
array occupies 38,332 bytes (or approximately 37.4 KB) of memory in C++
a support technician is installing a new sata hard drive on a new computer. what is the best type of cable connector the technician will plug in to supply power to the drive
Thee best type of cable connector the technician will plug in to supply power to the drive is a 15-pin connector.
What is a cable connector?The part you attach to the end of a cable so it can plug into a port or an interface of an electrical system is called a cable connector. Most connectors fall into one of two genders: male or female. Male connectors have one or more exposed pins, while female connectors have holes for the male pins to fit into.
Therefore, For computer visual output, there is a standard connector called the Video Graphics Array (VGA). The 15-pin connector was first used with the 1987 IBM PS/2 and its VGA graphics technology, and it later appeared on many monitors, projectors, and high-definition televisions.
Learn more about cable connector from
https://brainly.com/question/29387419
#SPJ1
I need help with coding in python!
class CommandLine:
def __init__(self):
self.root = Directory('', None)
self.current_path = self.root
def run(self):
command = input('>>> ')
while command.strip().lower() != 'exit':
split_command = command.split()
if len(split_command):
if split_command[0] == 'ls':
self.current_path.display()
if len(split_command) >= 2:
if split_command[0] == 'cd':
self.change_directory(split_command[1])
elif split_command[0] == 'makedir':
self.current_path.create_directory(split_command[1])
elif split_command[0] == 'fcreate':
self.current_path.create_file(split_command[1])
elif split_command[0] == 'fwrite':
self.current_path.file_write(split_command[1])
elif split_command[0] == 'fread':
self.current_path.file_read(split_command[1])
elif split_command[0] == 'fclose':
self.current_path.close_file(split_command[1])
elif split_command[0] == 'fopen':
self.current_path.open_file(split_command[1])
command = input('>>> ')
def change_directory(self, dir_name):
pass
class Directory:
def __init__(self, name, parent):
pass
def display(self):
pass
def create_file(self, file_name):
pass
def create_directory(self, dir_name):
pass
def file_write(self, file_name):
pass
def file_read(self, file_name):
pass
def close_file(self, file_name):
pass
def open_file(self, file_name):
pass
class File:
pass
if __name__ == '__main__':
cmd_line = CommandLine()
cmd_line.run()
You must keep track of your current directory, and then you must be able to execute the commands listed below.
(The commands are explicitly different from linux so that you don't accidentally execute them in the shell, except for ls and cd which are harmless.)
Command
ls
Lists contents of the directory
cd [dirname]
Change directory up or down one level.
makedir [dirname]
Make a directory
fcreate [filename]
Creates a file, sets it closed.
fwrite [filename]
Write to a file, only if it's open.
fread [filename]
Read a file, even if it's closed.
fclose [filename]
Close a file. Prevents write.
fopen [filename]
Open a file. Reset the contents
Answer:
B
Explanation: