PHP ZCE mock test, interview preparation, daily lessons under chalk talk

Friday, February 24, 2012

Output of the following code?

What will be the output of the below code?

<?php
$qpt = 'Eat to live, but not live to eat';
echo preg_match("/^to/",$qpt);
?>


a)1
b)2
c)0
d)Null


Solution: c)0

Wednesday, February 1, 2012

Delete the content without resetting the auto increment?

Which of the following command will delete the entire contents of a table without resetting the auto increment value?

a) drop table <tablename>
b) delete from <tablename>
c) truncate table <tablename>
d) remove table <tablename>



I think the answer should be
b) delete from <tablename>

because truncate resets the auto increment id value to 1.
Please share if your answer differs...