1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
n200080 [17]
2 years ago
15

Assume your sketch has a variable named silo, which stores an object that is defined by a class you have created. The name of th

e class is Cylinder. The Cylinder class has a method named volume, which calculates the volume of a cylinder using its property values and returns the calculated value. Which line of code is the correct line to use the silo variable, calculate volume, and store that value in a new variable.
a. let v = [silo volume];
b. let v = volume(silo);
c. let v = silo.volume();
d. let v = silo[volume];
e. let v = cylinder.volume(radius, height);
Computers and Technology
1 answer:
yulyashka [42]2 years ago
7 0

Answer:

c. let v = silo.volume();

Explanation:

When you create and initialize a new object you pass through that object's class constructor. The constructor is in charge of initializing all the necessary variables for that class including radius and height. Once you save the object in a specific variable (silo) you need to call the class methods through that variable, using the '.' command. Therefore, in this scenario, in order to call the volume() method you would need to call it from the silo object and save it to the v variable, using the following statement.

let v = silo.volume();

You might be interested in
Pick the 3 correct Python functions that parse and output only the date and time part of each log in log.txt as follows.
Mila [183]

Answer:

1, 4, 5

Explanation:

parse2:

. In this case it's passing "r" as an argument, which really does absolutely nothing, because whenever you call open("file.txt") it defaults to reading mode, so all you're doing is explicitly passing the "r". So let's look at the first line. Whenever you call str.split() without any arguments, by default it splits it by empty text, and filters any empty text. So str.split() is not the same as str.split(" ") although it has similar behavior. "     ".split(" ") will output ['', '', '', '', '', ''], while "     ".split() will output []. So in this case the line.split() will split the string '10.1.2.1 - car [01/Mar/2022:13:05:05  +0900] "GET /python HTTP/1.0" 200 2222' into the list<em> ['10.1.2.1', '-', 'car', '[01/Mar/2022:13:05:05', '+0900]', '"GET', '/python', 'HTTP/1.0"', '200', '2222'].</em> As you can see the the data is split into two pieces of text, AND they include the brackets in both strings. So when it gets the 3 index and strips it of the "[]" it will have the incomplete date

parse3:

 In this instance the "r" does nothing as mentioned before the "r" is already defaulted whenever you call open("file.txt") so open("file.txt") is the same as open("file.txt", "r"). So in this case we won't be working left to right, we're going inside the brackets first, kind of like in math you don't don't work left to right in equation 3 + 3(2+3). You work in the brackets first (inside brackets you do left to right). So the first piece of code to run is the line.split("[" or "]"). I actually kind of misspoke here. Technically the "[" or "]" runs first because this doesn't do what you may think it does. The or will only return one value. this is not splitting the line by both "[" and "]". The, or will evaluate which is true from left to right, and if it is true, it returns that. Since strings are evaluated on their length to determine if they're true. the "[" will evaluate to true, because any string that is not empty is true, if a string is empty it's false. So the "[" will evaluate to true this the "[" or "]" will evaluate to "[". So after that the code will run line.split("[") which makes the list: <em>['10.1.2.1 - car ', '01/Mar/2022:13:05:05  +0900] "GET /python HTTP/1.0" 200 2222']</em>. Now the [3:5] will splice the list so that it returns a list with the elements at index 3 (including 3) to 5 (excluding 5). This returns the list: [], because the previous list only has 2 elements. There are no elements at index 3 to 5 (excluding 5). So when you join the list by " ", you'll get an empty string

parse4:

  So I'm actually a bit confused here, I thought the "r+" would open the file in read-writing mode, but maybe this is a different version of python I have no idea, so I'm going to assume it is reading/writing mode, which just means you can read and write to the file. Anyways when you split the line by doing line.split(), as mentioned before it will split by empty spaces and filter any empty spaces. This line will return: <em>['10.1.2.1', '-', 'car', '[01/Mar/2022:13:05:05', '+0900]', '"GET', '/python', 'HTTP/1.0"', '200', '2222']</em>. and then you splice the list from indexes 3 to 5 (excluding 5). This will return the list: <em>['[01/Mar/2022:13:05:05', '+0900]']</em> which has the two pieces of information you need for the date. Now it joins them by a space which will output: '[01/Mar/2022:13:05:05 +0900]'. Now when you strip the "[]" you get the string: '01/Mar/2022:13:05:05 +0900' which is the correct output!

parse 5:

 So in this example it's using re.split. And the re.split is splitting by "[" or "]" which is what re.split can be used for, to split by multiple strings, which may be confused by string.split("[" or "]") which is not the same thing as explained above what the latter does. Also the reason there is a backslash in front of the [ and ] is to escape it, because normally those two characters would be used to define a set, but by using a \ in front of it, you're essentially telling regex to interpret it literally. So in splitting the string by "[" and "]" you'll get the list: <em>['10.1.2.1 - car ', '01/Mar/2022:13:05:05  +0900', ' "GET /python HTTP/1.0" 200 2222']</em> which has 3 elements, since it was split by the [ and the ]. The second element has the date, so all you need to do is index the list using the index 1, which is exactly what the code does

8 0
1 year ago
. How does Word indicate a possible instances of inconsistent formatting?: *
REY [17]

Answer:b)With a wavy blue underline

Explanation:Wavy blue lines in the Word document is for representing that the Format consistency checker is in working/on mode .It can identify the inconsistent format instances for the correction while the user is writing the text.

Other options are incorrect because wavy red line is for incorrect spelling of any word and wavy green line signifies the grammatical mistake .The function is available for the format inconsistency as wavy blue line in Word .Thus, the correct option is option(b).

5 0
2 years ago
It is okay to perform experiments without your teacher's permission. This shows creativity.
katrin2010 [14]
It would be False, because if you were to mess up it can result in something going bad.
5 0
3 years ago
After you create an array variable, you still need to ____ memory space.
Svetllana [295]
This is a little tricky. I would say reserve. It would help to know what programming language and class this is for because a lot of times when you create an array variable the memory is put onto the stack and you as the programmer do not reserve memory space. Now on the other hand, if you are programming in C and you want to create an array variable and put it on the heap then you would reserve memory space on the heap.
6 0
3 years ago
"Which hash algorithm's primary design feature is two different and independent parallel chains of computation, the results of w
Galina-37 [17]

Answer:

Option C i.e., RIPEMD is the correct option for the following question.

Explanation:

Because RIPEMD is the algorithm that is used for the hash primary design characteristic which has two independent and unlike parallel chains of the calculation and computation and the outputs of which are then linked to the process at the end. It is also used for the safe process of replacing the 128-bit hash method.

Other options are wrong because these are not related to the following statement.

5 0
2 years ago
Other questions:
  • When desktop publishing software can interact with another software program, the two are said to
    6·1 answer
  • Don is the superintendent of the county school system. What task might Don
    8·1 answer
  • The faster alcohol is consumed, the faster it reaches the __________.
    9·2 answers
  • You can use the ____ utility to zero in on the service or other program that is slowing down startup. 1. gpupdate 2. MSconfig 3.
    9·1 answer
  • While doing online research you enter this keyword search with a truncation character: man* Which of the following would not be
    15·1 answer
  • What is the price of a k1 speed birthday party?
    7·2 answers
  • Amazon SWF is restricts you to use a specific programming language when setting up a work flow
    8·1 answer
  • Please help. 15 points!!!!
    8·2 answers
  • Define artificial intelligence?​
    15·2 answers
  • If the fluid level in a battery is below the separators<br> should be added but never add
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!