Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Priscilla L.
Computer science major at Wellesley College
Tutor Satisfaction Guarantee
Javascript Programming
TutorMe
Question:

function test(input) { console.log(input+10); } What gets printed out when test(10) is called? What about test("hello")? Why is this allowed?

Priscilla L.
Answer:

test(10) prints "20". test("hello") prints "hello10". This is because Javascript is an untyped language. It doesn't compile statically or check types.

Java Programming
TutorMe
Question:

Compute the factorial of some number. Given n of 1 or more, return the factorial of n, which is n * (n-1) * (n-2) ... 1.

Priscilla L.
Answer:

public static int factorial(int n) { if (n==1) { return 1; } else return n*factorial(n-1); }

Computer Science (General)
TutorMe
Question:

Using Java, write a method that accomplishes the following: Given an array of integers, return the maximum value. Assume that the array is non-empty.

Priscilla L.
Answer:

public static int max(int[] numbers) { int max = numbers[0]; for (int i = 0; i < numbers.length; i++) { int num = numbers[i]; if (num > max) { max = num; } } return max; }

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