TutorMe homepage
Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Amit M.
Software Developement Industry 24+ (BofA, Accenture, Amdocs), recent 3 years as faculty in university
Tutor Satisfaction Guarantee
SQL Programming
TutorMe
Question:

Employee table has 3 columns as below: emp_id int, company varchar(20), salary money Write a query to get the list of all employees (working for any company) whose salary is higher than highest salary of an employee working for Citicorp

Amit M.
Answer:

select emp_id, company, salary from Employee where salary > (select max(salary) from Employee where company = "Citicorp")

Java Programming
TutorMe
Question:

You have a Class A with 2 child Classes B and C. Class has method draw() which is then overloaded in Class B and C both. You can use one object variable which can have an object of either class A, or class B or class C but you will only know at runtime. You need to ensure that depending on which Class object is stored in this variable draw() method of that Class only should be called.

Amit M.
Answer:

This is known as polymorphism and it can be managed as below: Class A { void draw() {} } Class B { void draw() {} } Class C { void draw() {} } Class D { public static void main() { A a = A(); // instantiate class A call_draw(a); a = B(); // instantiate class B and store in the same object variable a (base class object // can store child class object) call_draw(a); a = C(); // instantiate class C and store in same object variable call_draw(a); } void call_draw(A a) { a.draw(); // this will call draw() method from class A or B or C depending on which class // object is passed } }

C Programming
TutorMe
Question:

In the recursive function if you don't want to lose the value of a local variable from the one call to the next, how would you declare such a variable?

Amit M.
Answer:

you would declare such local variable using static keyword because when a variable is defined as static, memory allocated to that variable remain intact until the program completes the execution. Hence when a recursive function call is made, the value in the variable will not be lost.

Send a message explaining your
needs and Amit will reply soon.
Contact Amit
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.