TutorMe homepage

SIGN IN

Start Free Trial

Austin C.

Engineer, Freelance iOS Developer

Tutor Satisfaction Guarantee

Python Programming

TutorMe

Question:

Write an example of a class named "car" which has values of number of passengers, car model, and gas mileage. Write an init function for this class.

Austin C.

Answer:

$$ class\ \ Car:\\ \quad passengers = 0\\ \quad\ model = None\\\quad\ mpg = 0\\ \ \\\quad\ def\quad \_\_init\_\_(self,\ \ \_passengers : int,\ \ \_model: str,\ \ \_mpg: float):\\\quad\quad\ \ self.passengers = \_passengers\\\quad\quad\ \ \ self.model = \_model\\ \quad\quad\ \ \ self.mpg = \_mpg$$

iOS Programming

TutorMe

Question:

How do you lazily initialize a UIView in a View Controller? Write the code for this and explain why lazy initialization is a good practice.

Austin C.

Answer:

The code (Objective-C): $$-\quad(UIView *)myView$$ $$\{$$ $$\quad\quad\quad if(!\_myView) \{$$ $$\quad\quad\quad\quad\quad\quad \_myView = [[UIView\ \ alloc]\ \ initWithFrame: CGRectZero];$$ $$\quad\quad\quad\}$$ $$\quad\quad\quad return\ \ myView$$ $$\}$$ The code (Swift): $$lazy\ \ var\ \ myView: UIView= \{$$ $$\quad\quad\quad[unowned\ \ self]\ \ in$$ $$\quad\quad\quad return\ \ UIView(frame:\ \ CGRect.zero) $$ $$\}()$$ It is proper practice to use lazy initialization because we do not want to waste memory and processing time creating objects unless we are going to use the objects we create. Lazy initialization places the initialization of an object in its getter function, so the memory is allocated and the object is created once we call it in the code, and not before.

Calculus

TutorMe

Question:

What is the derivative of $$3\cdot ln(x^{2})$$? Show each step in the process of taking this derivative.

Austin C.

Answer:

The derivate of $$3\cdot ln(x^{2})$$ is $$\frac{6}{x}$$. This can be found by taking the following steps: 1. Use the chain rule to evaluate $$ln(x^{2})$$. a. Evaluate the integral inside: $$\frac{d}{dx}[x^{2}] = 2x$$. b. Evaluate the integral outside using the log rule: $$\frac{d}{dx}[ln(a)] = \frac{1}{a}$$. c. Multiply these together to get this result: $$\frac{d}{dx}[ln(x^{2})] = \frac{2x}{x^{2}} = \frac{2}{x}$$. 2. Multiply this by 3 to get the result: $$3\cdot \frac{2}{x} = \frac{6}{x}$$

Send a message explaining your

needs and Austin will reply soon.

needs and Austin will reply soon.

Contact Austin

Ready now? Request a lesson.

Start Session

FAQs

What is a lesson?

A lesson is virtual lesson space on our platform where you and a tutor can communicate.
You'll have the option to communicate using video/audio as well as text chat.
You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.

How do I begin a lesson?

If the tutor is currently online, you can click the "Start Session" button above.
If they are offline, you can always send them a message to schedule a lesson.

Who are TutorMe tutors?

Many of our tutors are current college students or recent graduates of top-tier universities
like MIT, Harvard and USC.
TutorMe has thousands of top-quality tutors available to work with you.

Made in California

© 2018 TutorMe.com, Inc.