Sunday, April 19, 2009

Odesk javascript questions

Go Here to view javascript odesk questions with answer

Odesk PHP 5 questions

Question:
What is true regarding this code?




a. setcookie will return false
b. setcookie will return true
c. setcookie will return null
d. Any of the above can happen

Answer: b

Question:
Which of the following is not a correct way of printing text in php5?


a. echo "Plain text";
?>
b.
c.
d. <#
echo "Plain text"
#>
Answer a;


Question:
Which of the following is not the correct way of starting a session?


a. session.auto_start
b. session_register()
c. session_initiate()
d. session_start()
Answer: c;


Question:
Which of the following functions do you need to implement HTTP Basic Authentication?


a. authenticate ()
b. header ()
c. basic_auth ()
d. None of the above
Answer: d;


Question:
Which of the following Command Line Interface constant is not defined in the CLI SAPI?


a. STDIN
b. STDOUT
c. STDPRT
d. STDERR

Answer: c;


Question:
Which of the following statements is correct with regard to final and abstract?


a. An abstract class cannot have final methods
b. An abstract class cannot have non abstract methods
c. A final class cannot have abstract methods
d. A final class cannot have final methods

Answer:

Question:
Which composite data types are supported by php?


a. Array
b. Enumeration
c. List
d. Object
e. Integer

Answer: a


Question:
The default value of register_globals in PHP is:


a. Off
b. On

Answer a


Question:
Which of the following is not a valid PHP connection status?


a. aborted
b. normal
c. open
d. timeout

Answer; c



Question:
Choose the correct statement:


a. include() includes and evaluates a specific file
b. require() includes and evaluates a specific file
c. include_once() includes and evaluates a specific file only if it has not been included before
d. require_once() includes and evaluates a specific file only if it has not been included before
e. All of the above

Answer e

Question:
If the session_cache_expire() is not set, then by default the session cache will expire after:


a. 1 hr
b. 2 hrs
c. 3 hrs
d. 4 hrs

Answer: 3


Question:
What will be the output of the following script?

$count=50;
function Argument()
{
$count++;
echo $count;
}
Argument();
?>


a. It will print 50
b. It will print 51
c. It will print 52
d. It will print 1

Answer 1;


Question:
State whether True or False

Paamayim Nekudotayim operator allows access only to the static members of a class?


a. True
b. False

Answer a

Question:
Which of the following statements is true with regard to comparisons in PHP5?


a. With "= =" operator, two object instances are equal if they have the same attributes and values, and are instances of a different class.
b. With "==" operator two object instances are equal if they have the same attributes and values, and are instances of the same class.
c. With (===) operator, object variables are identical if and only if they refer to the same instance of the same class.
d. With (===) operator, object variables are identical if and only if they refer to the different instance of the same class.

Answer c;

Question:
You have to upload a file using form post method:

1
2 Send this file:
3
4

What should be the code in line 3, if the file name to upload is "SalesFile"?


a.
b.
c.
d.

Answer a;


Question:
Which of the following built-in function assist in checking if actually the function exists or not?


a. exists
b. function_exists
c. fexists
d. isFunction
Answer b;



Question:
What will be the output of the following code?


$a = 0.0;

for ($i = 0; $i < 10; $i++)
$a += 0.1;

print "$a\n";

if ($a == 1.0)
print "Equals";
else
print "Not Equals";
?>


a. 0.9
Not Equals
b. 1
Equals
c. 1
Not Equals
d. 1.1
Not Equals
e. None of the above

Answer: c

Question:
What will be the output of the following code?

$i=4;
$j=30;
$k=0;
$k=$j++/$i++;
echo $i . " " . $j . " " . $k . " ";


a. 5 31 6
b. 5 31 6.2
c. 5 31 7
d. 4 31 7.5
e. 5 31 7.5

Answer e;




Question:
Which of the following is a not a correct way of commenting in php?


a. //PHP Comment
b. /*PHP Comment*/
c. #PHP Comment
d. /#PHP Comment
Answer d;




Question:
Following is a php code block:

$m=9;
$n=99;
$z=8;
$z=$n++/$m++ + --$z;
echo $z;

what will be the output?


a. 16
b. 18
c. 19
d. 20
e. 17
Answer 18;



Question:
Which of the following is the correct way of specifying default value?


a. function GetDiscount($Type = "Special") { . . . }
b. function GetDiscount(Type := "Special") { . . . }
c. function GetDiscount($Type := "Special") { . . . }
d. function GetDiscount($Type : "Special") { . . . }

Answre a;


Question:
With reference to the following php script:

print 'Text Line1'
print 'Text Line2'
?>

What will be the output on running the script?


a. Text Line1Text Line2
b. Text Line1 Text Line2
c. 'Text Line1'
d. 'Text Line2'
e. Error message will be printed
Answer e;


Question:
What will be the ouput of the following code?

for ($i = 0; $i < 5; ++$i)
{
if ($i == 2)
continue;
print "$i\n";
}
?>


a. 0
1
2
3
4
5
b. 0
1
3
4
c. 2
d. 0
1
2
4
e. None of the above


Answer b;


Question:
Late PHP versions support remote file accessing for the functions:


a. include()
b. include_once()
c. require_once()
d. Both a and b
e. Both b and c


Answer: e;


Question:
You have designed a user login form as follows:


User Name:

Password:




How can you access the username entered by the user in the 'Validate.php' webpage?


a. $var= $_POST['username'];
b. $var= $_REQUEST['username'];
c. import_request_variables('p', 'p_');
$var= $p_username;
d. All of the above

Answer: d


Question:
Which of the following does not represent logical AND operator in PHP?


a. &
b. &&
c. And
d. AND

Answer: a


Question:
Which of the following is not true for a persistent connection?


a. These are not closed even after the execution of the script
b. These are mainly used to increase the efficiency of the system
c. These can't be converted to non-persistent connections
d. These are preferably not used in the scripts involving transactions
Answer c;

Question:
Which of the following are invalid data types in PHP?


a. string
b. integer
c. float
d. char
e. array
f. object
Answer d



Question:
The Manager and Office classes are as follows:

class Manager{
function printName() {
echo "Manager";
}
}
class Office{
function getManager() {
return new Manager();
}
}

$ofc = new Office();
???

?>

Which of the following should replace '???' to obtain the value of printName() function?


a. $ofc->getManager()->printName();
b. new Office()->getManager()->printName();
c. $ofc->getManager->printName;
d. Office::getManager()::printName();
Answer a


Question:
The classes are defined as follows:
abstract class BaseCls{
protected abstract function getName();
}

class ChildCls extends BaseCls{

}

Which of the following implementations of getName() is invalid in ChildCls?


a. protected function getName(){}
b. function getName(){}
c. private function getName(){}
d. public function getName(){}

Answer d;


Question:
Which of the following variable declarations within a class is invalid in PHP5?


a. private $type = 'moderate';
b. var $term =3;
c. public $amnt = '500';
d. protected $name = 'Quantas Private Limited';
Answer: b;

Question:
What will be the output of following code?

$arr = "a";
$arr[0]="b";
echo $arr;
echo $arr[0];


a. ab
b. $arr is undefined
c. bb
d. Parse error

Answer c

Question:
For the following code:



the output will be:


a. 171
b. Expressions can't be used with echo statements
c. 150.7
d. 30 * 5.7
Answer a;

Question:
What is the result of the following expression?

5+2 * 4+6


a. 70
b. 19
c. 34
d. 21
Anwer: b



Question:
What will be the output of following code?

$var = 1 + "-1.3e3";
echo $var;


a. -1299
b. 1
c. 1-1.3e3
d. Error:cannot add integer and string

An swer: a

Question:
What will be the output of following code?

$var1="a";
$$var1="b";
echo "$var1 $a";


a. a b
b. $var1 $a
c. Error: $a is undefined
d. Error: Parse error in line 2 ($$var1 = "b")

Answer a


Question:
What is the output of the following code?

$a = 500;
$b = 200;

echo $a % 2
* $b;
?>


a. 100
b. 200
c. 500
d. 0
e. Syntax error


Anwer 0;

Question:
What will be the ouput of the following code?


if (-1)
print "true";
else
print "false";
?>


a. true
b. false

Answer a



Question:
What will be the output of the following code?

echo 12 . 6;


a. 12 . 6
b. 126
c. 12.6
d. Error: You cannot add integers through the concatenation operator(.)

Answer: 126



Question:
Consider the following sample code:

$x = 0xFFFE;
$y = 2;
$z = $x && $y;

What will be the value of $z?


a. 0
b. 1
c. 2
d. 3
e. 4

Answer: 1

Sunday, February 22, 2009

To integrate escrow payment method in a website

Go to the site.

https://ecart.escrow.com/tools/confirmlink.asp


create a html code and change this code according to your requirement.
visite escrow.com for more info.




A short example is given below:


<form method="post" action="https://www.escrow.com/ecart/StartTransaction.asp">
<input name="pid" value="5665" type="hidden">
<input name="item" value="Item Name" type="hidden">
<input name="desc" value="Description" type="hidden">
<input name="qty" value="1" type="hidden">
<input name="price" value="100" type="hidden">
<input name="ship" value="5" type="hidden">
<input name="type" value="GM" type="hidden">
<input name="submit" value="Buy It Now" type="submit">


Note: Please change the value of the hidden according to your requirement then it will work fine.

Thursday, February 19, 2009

How to rename localhost to anyname you want

If you want to rename to your localhost to any name like http://yourname/

Go to C:WINDOWS/system32/drivers/etc there you can see a file named hosts open this in notepad
find localhost
copy this line
paste this in the second line just rename localhost to any name you want open your browser it will work then

for more go to www.bhuwans.com

Saturday, February 14, 2009

How to use ffmpeg

How to user ffmpeg

You can use ffmpeg to convert video file like mpeg, avi to flv like you tube.
I Php this is very just check in your server that ffmpeg is enable or not if this is not enable dont hesitate to tell your sever provider or
your client to enable that you are ready to use that.

To check whether ffmpeg is enable just user in the a test file if ffmpeg is there then that shows it is enable.


just use
exec("/usr/bin/ffmpeg -y -i test.mpeg -s 446x336 -ar 44100 -ab 12 test.flv") to make flv

and

exect("usr/bin/ffmpeg -i test.mpeg -an -ss 00:00:00 -t 00:00:01 -r 1 -y -s 120x72 test.jpg");

to make thumbnail of that video


After that to play flv just go to site
http://www.flowplayer.org/documentation/configuration.html

and read how to use flowplyer, download latest flowplayer from here and enjoy making youtube like feature.

Thursday, February 12, 2009

make youtube better

YouTube decided, after much begging from users, to add a high-definition viewing option to its videos. This button would allow users with faster

Internet connections to watch higher-quality versions of the same videos already on the Web site.

Many videos are being uploaded in higher-quality resolution, due in part to the increase in technology. Camera's like the lower-end Xacti and the Aiptek HD line allow users to create high-quality videos without spending a lot on equipment.

Unfortunately, there is still one problem with these higher-quality videos, and that is embedding. When you embed the higher-quality version of a YouTube video on a blog or website, it will playback in lower quality, with no options to up the settings.

Luckily, there is a solution to this, and it is not very difficult or technical. This technique will allow you to embed HD and high quality YouTube videos in your blog or website for optimal playback.

Step 1: Locate a video that you want to embed and click the high-quality button under it to make sure it actually increases in quality - a video that was recorded at a poor setting will have no difference, so you won't be able to tell if you embedded it correctly.

Step 2: Copy the embed code for the video. It is located on the right side of the screen, below the video description area - it says 'EMBED'.

Step 3: Create a new post on your blog or where ever it is you'd like to embed the video. Paste the copied embed code into the post.

Now look through the code for the EMBED URL and the SRC URL. At the end of these two lines, you will need to copy and paste this code into it - &ap=%2526fmt%3D18. This code is similar to the now-famous fmt=18 code, and will tell the player to use the high-definition version of the video.

Here is an example of the code:

value="http://www.youtube.com/v/HT1gL7YB-cU&hl=ja&fs=1&ap=%2526fmt%3D18" src="http://www.youtube.com/v/HT1gL7YB-cU&hl=ja&fs=1&ap=%2526fmt%3D18"

search any php code at www.bhuwans.com

You can search any code of php, and any cms.
www.bhuwans.com