Subjects
PRICING
COURSES
SIGN IN
Start Free Trial
Prachi K.
Application Developer at JP Morgan Chase & Co. Mumbai
Tutor Satisfaction Guarantee
SQL Programming
TutorMe
Question:

What is the difference between truncate and delete?

Prachi K.
Answer:

1) Truncate is a DDL command whereas delete is DML. 2) Where clause can not be used with truncate command whereas can be used with delete command. 3) Truncate removes all the rows from the table whereas delete removes rows based on where condition. If where the condition is not specified, it will delete all rows. 4) Truncate acquire a lock on the whole table whereas delete applies a lock on each row. 5) Truncate uses less transaction space as compared to delete statement. 6) Rollback is not possible in case of truncate.

Java Programming
TutorMe
Question:

Why a string literal should be used first in calling for equals method rather than calling equals method on an object. i .e String myString=myObject.getSomeStringValue(); if("MyString".equals(myString)) { //some Logic }

Prachi K.
Answer:

Considering the above example. String myString=myObject.getSomeStringValue(); if("MyString".equals(myString)) { //some Logic } Let's try to use it the other way round i.e calling equals method on object then our code will be : String myString=myObject.getSomeStringValue(); if(myString.equals(""MyString")) { //some Logic } Now as can be seen We are calling equals method on myString object which we do not know if contains some value or is null because while calling String myString=myObject.getSomeStringValue(); this piece of code it may have returned null value, now when we call equals method on null object we will get NullPointerException. So now we have two options either to handle the NullPointerException or to call equals method on string literal because that would not be null any time. So in order to write clean code and handling exceptions, it is a better way to call equals method on String literals.

C Programming
TutorMe
Question:

What are the pointers in C?

Prachi K.
Answer:

Pointers are the variables that store the address of another variable and it is said that they point to that variable whose address is stored in it, hence called as pointers. We can change the value of a variable either by actually referring to that variable or either by using the pointer. We define a pointer using * symbol, whenever * is found in the declaration of any variable that variable should be considered a pointer. ex- int * p; We can get the address of any variable by using &. ex- int x=0; int *p=&x; Here we can say that p is a pointer to x. Address of x is stored in p. And Here we can change the value of x in 2 ways as : 1) x=1 (the usual way) 2) *p=1; (Using the pointer to the variable). * symbol is used to get the value of the variable pointer is referring to. If we would have written p=1; here we would have changed p's pointing and p would not be anymore pointing to x. So remember to use * with pointer, If a pointer in C is assigned to NULL, it means it is pointing to nothing

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