Enable contrast version

# Tutor profile: Surbhi G.

Inactive
Surbhi G.
Expert Online Tutor for 3 years, Ex-Software Engineer at Broadcom, Software Engineering Graduate from BITS PIlani
Tutor Satisfaction Guarantee

## Questions

### Subject:Python Programming

TutorMe
Question:

What are functions and how do we write functions in python?

Inactive
Surbhi G.

Functions are nothing but a set of related code lines that perform a task. They are extremely helpful as you do not have to write same code of lines multiple times if you want to perform similar tasks, rather we can make use of functions in multiple ways to perform similar tasks. For example, if you want to do some tax calculations and you have the set of laws coded or defined in the function then you can just pass in some information to the function like the income, savings etc every time and the function will return the total tax to be paid each time. Example code of a simple function which wishes birthday to you or your friends def wish birthday(name): print("Many many happy returns of the day to you... ", name) print("May you live long and prosperous life") with birthday("Alyssa") This will print "Many many happy returns of the day to you... Alyssa" "May you live long and prosperous life" on screen

### Subject:Java Programming

TutorMe
Question:

What are arrays and how do we use arrays in Java?

Inactive
Surbhi G.

Arrays is a simple data structure that can store multiple objects of the same data type. Its nothing but an ordered collection of items i.e. each element in an array is stored at a known index (or position number) Example code on how to create arrays: 1. int arr[]; 2. arr = new int; Line 1: Here a is the array data structure, the type an of is an int array. Square brackets [] mean its an array. Line 2: We instantiate this array arr to an array which can store 5 integers Example code on how do we use arrays: 1. arr = 3; 2. arr = 8; 3. arr = 7; Index or position of elements in the array begins with 0 Line 1: Here we are setting the 0th position element as 3 Line 2: Here we are setting the 1st position element as 8 Line 3: Here we are setting the 4th position element as 7

### Subject:C++ Programming

TutorMe
Question:

How do loops work and how can we write loops in c++ programming?

Inactive
Surbhi G.

Every kind of loop whether "for loop" or "while loop" or "do while loop" in c++ is divided in these three essential tasks: [Take example: for(int i =0; i<5; i++) { cout<<"Hello";} ] 1. Variable initialization -- Setting an initial value to a counter variable whose value will be used in the loop condition to start the loop. [In above example, i=0 is the variable initialization] 2. Loop condition -- Setting loop condition using the value of the above counter variable. The loop runs as long as this loop condition holds true. If the loop condition becomes false, the loop stops running. [In above example, I <5 is the loop condition] 3. Variable change -- The variable which we initialized in the beginning of the loop must change inside the loop as we do multiple iterations in the loop so that we reach to a point when the value of the variable changes such that the loop condition based on that value of the variable becomes false. [In above example, i++ which means i=i+1 is the variable change] This is how using the loop condition we set a starting condition, run the loop multiple times, change the value of the variable of the loop condition each time and then eventually end the loop when the value of the variable in the loop condition no longer matches the true loop condition. [In above example, the code will print Hello 5 times on screen]

## Contact tutor

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