গত পর্বে আমরা ওডেস্ক রেডিনেস ও এইচটিএমএল টেস্ট এর উত্তর গুলো দেখেচিলাম আজ চলুন দেখে নেই পিএইচপি টেস্ট এর আপডেট সেপ্টেম্বর ২০১৪ এর উত্তর গুলো।
oDesk PHP Test Answer 2014
1.Does PHP 5 support exceptions?
- Yes
- No
2.For the following code: <?php function Expenses() { function Salary() { } function Loan() { function Balance() { } } } ?> Which of the following sequence will run successfully?
- Expenses();Salary();Loan();Balance();
- Salary();Expenses();Loan();Balance();
- Expenses();Salary();Balance();Loan();
- Balance();Loan();Salary();Expenses();
3.What function should you use to join array elements with a glue string?
- join_st
- implode
- connect
- make_array
- None of these
4.What is the best practice for running MySQL queries in PHP? Consider the risk of SQL injection.
- Use mysql_query() and variables: for example: $input = $_POST['user_input']; mysql_query("INSERT INTO table (column) VALUES ('" . $input . "')");
- Use PDO prepared statements and parameterized queries: for example: $input= $_POST["user-input"] $stmt = $pdo->prepare('INSERT INTO table (column) VALUES (":input"); $stmt->execute(array(':input' => $input));
- Use mysql_query() and string escaped variables: for example: $input= $_POST["user-input"] $input_safe = mysql_real_escape_string($input); mysql_query("INSERT INTO table (column) VALUES ('" . $input. "')");
- Use mysql_query() and variables with a blacklisting check: for example: $blacklist = array("DROP","INSERT","DELETE"); $input= $_POST["user-input"] if (!$array_search($blacklist))) mysql_query("INSERT INTO table (column) VALUES ('" . $input. "')");
5.What is the best way to change the key without changing the value of a PHP array element?
- $arr[$newkey] = $oldkey; unset($arr[$oldkey]);
- $arr[$newkey] = $arr[$oldkey]; unset($arr[$oldkey]);
- $newkey = $arr[$oldkey];unset($arr[$oldkey]);
- $arr[$newkey] = $oldkey.GetValue(); unset($arr[$oldkey]);
6.What is the correct line to use within the php.ini file, to specify that 128MB would be the maximum amount of memory that a script may use?
- memory_limit = 128M
- limit_memory = 128M
- memory_limit: 128M
- limit_memory: 128M
7.What is the correct way to send a SMTP (Simple Mail Transfer Protocol) email using PHP?
- s.sendmail($EmailAddress, [$MessageBody], msg.as_string())
- sendmail($EmailAddress, "Subject", $MessageBody);
- mail($EmailAddress, "Subject", $MessageBody);
- <a href="mailto:$EmailAddress">$MessageBody</a>
8.What is the string concatenation operator in PHP?
- +
- ||
- .
- |||
- None of these
9.What will be the output of the following code? <? echo 5 * 6 / 2 + 2 * 3; ?>
- 1
- 20
- 21
- 23
- 34
10.What enctype is required for file uploads to work?
- multipart/form-data
- multipart
- file
- application/octect-stream
- None of these
এমন আরও সম্পূর্ণ সেট টেস্ট এর উত্তর পাবেন এখানে
যেকোনো প্রয়জনে Facebook এ আমরা।
Vai matro 10ta kno?