Enable contrast version

Tutor profile: Pooya P.

Inactive
Pooya P.
CS Developer/Tutor for More Than 7 Years
Tutor Satisfaction Guarantee

Questions

Subject: Python Programming

TutorMe
Question:

class ABC: def __init__(self): self.a = 0 class DEF(ABC): def __init__(self): self.b = 1 def main(): obj = DEF() print(obj.a,obj.b) main() What is the output of the above program: A)0 1 B) Error because class B inherits A but variable x isn’t inherited C) 0 0 D) Error because when an object is created, the argument must be passed like Derived_Test(1)

Inactive
Pooya P.
Answer:

Option B is correct. In __init__(self) of DEF, there is no method calling of super class ABC __init__(self), hence variable a is not inherited to class DEF. To make the variable a inherited in class DEF, The following method of DEF should be changed to inherit the variable a: def __init__(self): ABC.__init__(self) self.b

Subject: iOS Programming

TutorMe
Question:

what is the output of this program var thing = "cars" let closure = { [thing] in print("I love \(thing)") } thing = "airplanes" closure() Options A) airplanes B) I love cars C) I love airplanes D) I love cars I love airplanes

Inactive
Pooya P.
Answer:

Answer is : B Explanation: Closures capture the state of the variable. When the closure is declared it will store the state of the variables which are declared above it. The variable value inside the closure does not change if the same variable value changes outside of the closure.

Subject: C++ Programming

TutorMe
Question:

What will be the output of the following question: class Person{ private: string name; int age; public: void getName(){ cout<<"the name is "<<this->name; } }; class PersonA: Person{ private: int ID; public: void printName(){ cout<<"the name is"<< this->name; } }; int main(){ PersonA obj; obj.printName(); }

Inactive
Pooya P.
Answer:

This will give a compile-time error as private members of the super class will not be accessed in child class. This problem can be corrected by calling the getName of Person class in the printName() method of PersonA class. void printName(){ cout<<getName(); }

Contact tutor

Send a message explaining your
needs and Pooya will reply soon.
Contact Pooya

Request lesson

Ready now? Request a lesson.
Start Lesson

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 Lesson" 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.