Upwork Test Answer Magento Skill Test Part 01

Upwork Test Answers of Magento Skill Test Part 01Question: 01
What is true regarding $a + $b where both of them are arrays?

a. Duplicated keys are NOT overwritten
b. $b is appended to $a
c. The + operator is overloaded
d. This produces a syntax error
Answer: a. and b.


Question: 02
You have two strings, which you want to concatenate.

$str1 = ‘Have a ‘;
$str2 = ‘Nice Day’;

The fastest way would be:

a. $str1.Concat($str2);
b. $str1.$str2;
c. “$str1$str2”;
d. None of the above
Answer: b. $str1.$str2;


Question: 03
Which of the following pair have non-associative equal precedence?
a. +,-
b. ==,!=
C. «,»
d. &=,|=
Answer: b. ==,!=


Question: 04
Which of the following variables is not related to file uploads?
a. max_file_size
b. max_execution_time
c. post_max_size
d. max_input_time
Answer: b. max_execution_time


Question: 05
You have a 2D array in PHP:

$array = array(array(141,151,161), 2,3, array(101, 202, 303));
You want to display all the values in the array The correct way is:

a.
function DisplayArray($array) {
   foreach ($array as $value) {
      if (array_valid($value)) {
         DisplayArray($value);
      } else {
         echo $value. “<br>”;
      }
   }
}
DisplayArray($array);

b.
function DisplayArray($array) {
   for ($array as $value) {
      if (valid_array($value)) {
         DisplayArray($value);
      } else {
         echo $value. “<br>”;
      }
   }
}
DisplayArray($array);

c.
function DisplayArray($array) {
   for ($array as $value) {
      if (is_array($value)) {
         DisplayArray($value);
      } else {
         echo $value. “&ltbr>”;
      }
   }
}
DisplayArray($array);

d.
function DisplayArray($array) {
   foreach ($array as $value) {
      if (is_array($value)) {
         DisplayArray($value);
      } else {
         echo $value “&ltbr>”;
      }
   }
}
DisplayArray($array);
Answer: d.


Question: 06
Multiple select/load is possible with:
a. Checkbox
b. Select
c. File
d. All of the above
Answer: b. Select


Question: 07
The following php variables are declared:

$company = ‘ABS Ltd’;
$$company =‘, Sydney’;

Which of the following is not a correct way of printing ‘ABS Ltd. Sydney’?

a. echo “$company $$company”;
b. echo “$company ${$company}”;
c. echo “$company ${‘ABS Ltd‘}“;
d. echo “$company {$$company}”;
Answer: a. echo “$company $$company”;


Question: 08
We have two variable definitions:

1. 023
2. x23

Choose the correct options:

a. 1 is octal
b. 2 is hexadecimal
c. 2 is octal
d. 1 is hexadecimal
Answer: a., b. and d.


Question: 09
Which of the following is a predefined constant?
a. TRUE
b. FALSE
c. NULL
d. _FILE_
e. CONSTANT
Answer: d. _FILE_


Question: 10
Which of the following variable names are invalid?
a. $var_1
b. $var1
c. $var-1
d. $var/1
e. $vl
Answer: c. and d.


Question: 11
Which of the following are not considered as boolean False?
a. FALSE
b. 0
c. “0”
d. “FALSE”
e. 1
f. NULL
Answer: d. and e.


Question: 12
Which of the following regular expressions can be used to check the validity of an e-mail addresss?
a. ^[^@ ]+@[^@ ]+\.[“@ ]+$
b. ^[^@ ]+@[^@ ]+[^@ ]+$
c. $[^@ ]+@[^@ ]+\[^@ ]+^
d. $[^@ ]+@[^@ ]+[^@ ]+^
Answer: a. ^[^@ ]+@[^@ ]+\.[“@ ]+$


Question: 13
Which of the following type cast is not correct?

$fig=23;
$varbl= (real) $fig;
$varb2 = (double) $flg;
$varb3 = (decimal) $flg;
$varb4 = (bool) $fig;

a. real
b. double
c. decimal
d. boolean
Answer: a. real


Question: 14
Which of the following statements is not true with regard to abstract classes in php5?
a. Abstract classes are introduced in PHP5
b. A class with a single abstract method must be declared abstract
c. Abstract class can contain non abstract methods
d. Abstract method must have method definition and can have optional empty braces following it
Answer: d. Abstract method must have method definition and can have optional empty braces following it


Question: 15
What do you infer from the following code?

$str = ‘Dear Customer,\nThanks for your query. We will reply very soon\n Regards,\n Customer Service Agent’;
print $str;

a. Only first \n character will be recognised and new line will be inserted
b. Last \n will not be recognised and only first two parts will come in new lines
c. All the \n will work and text will be printed on respective new lines.
d. All will be printed on one line irrespective of the \n.
Answer: d. All will be printed on one line irrespective of the \n.


Question: 16
Which of the following characters are taken care of by htmlspecialchars?
a. <
b. >
c. single quote
d. double quote
e. &
f. All of the above
Answer: f. All of the above


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

$a = 10;
if($a > 5 OR < 15)
echo “true”;
else
echo “false”

a. true
b. false
c. No output
d. Parse Error
Answer: d. Parse Error


Question: 18
If expire parameter of setCookie function is not specified then:
a. Cookie will never expire
b. Cookie will expire with closure of the browser
c. Cookie will expire with within 30 minutes
d. Cookie will expire in 24 hours
Answer: b. Cookie will expire with closure of the browser


Question: 19
You need to check the size of a file in PHP function.

$size=X(filename);
Which function will suitably replace ‘X’ ?

a. filesize
b. size
c. sizeofFile
d. getSize
Answer: a. filesize


Question: 20
Which of the following text manipulation functions is supported by PHP?
a. strtoupper()
b. ucfirst()
c. strtolower()
d. str_split()
e. All of the above
Answer: e. All of the above


Question: 21
Which of the following is a correct declaration?
a. static $varb = array(1 ,‘var, 3);
b. static $varb = 1+(2*9O);
c. static $varb = sqrt(81);
d. static $varb = new Object;
Answer: a. static $varb = array(1 ,‘var, 3);


Question: 22
You wrote following script to check for the right category:

1<?php
2 $cate=5
3 …
4 …
5
6 if ($cate==5)
7 {
8 ?>
9 Correct category!
10 <?php
11 } else {
12 ?>
13 Incorrect category!
14 <?php
15 }
16 ?>

What will be the output of the program if value of’cate’ remains 5?

a. Correct category!
b. Incorrect category!
c. Error due to use of invalid operator in line 6:”if ($cate=5)»
d. Error due to incorrect syntax at line 8, 10, 12 and 14
Answer: a. Correct category!


Question: 23
If visibility is not defined for a method/member then it is treated as public static.
a. True
b. False
Answer: b. False


Question: 24
Which of the following statements is incorrect with regard to interfaces?
a. A class can implement multiple interfaces
b. An abstract class cannot implement multiple interlaces
c. An interlace can extend multiple interfaces
d. Methods with same name, arguments, and sequence can exist in the different interlaces implemented by a class
Answer: a., c. and d.


Question: 25
Which of the following is a Ternary Operator?
a. &
b. =
c. : ?
d. ? :
e. +=
f. &&
Answer: d. ? :


Question: 26
Which of the following are the valid PHP data types?
a. resource
b. null
c. boolean
d. string
e. Both a and c
f. Both c and d
g. All of the above
Answer: f. Both c and d


Question: 27
You are using sessions and session_register() to register objects. These objects are serialized automatically at the end of each PHP page and are de-serialized automatically on each of the following pages Is this true or false?
a. True
b. False
Answer: b. False


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

$Rent = 250;
function Expenses($Other) {
   $Rent = 250 + $Other;
   return $Rent;
}

Expenses(50),
echo $Rent;

a. 300
b. 250
c. 200
d. Program will not compile
Answer: b. 250


Question: 29
What will be the result of the following expression:
6+4 * 9-3
a. 60
b. 87
c. 39
d. 30
Answer: c. 39


Question: 30
Does php 5 support exceptions?
a. Yes
b. No
Answer: a. Yes


Question: 31
Which of the following printing construct/function accepts multiple parameters?
a. echo
b. print
c. printf
d. Allof the above
Answer: a. and c.


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

$var = 10;
function fn() {
   $var=20;
   return $var;
}
Fn();
echo $var;

a. 10
b. 20
c. Undefined Variable
d. Syntax Error
Answer: a. 10


Question: 33
Which of the following is not true regarding XForms?
a. PHP provides support for XForm
b. It can be used on PDF documents
c. The data is sent in XML format
d. The action and method parameters are defined in the body
Answer: a. PHP provides support for XForm


Question: 34
How would you start a session?
a. session(start);
b. session();
c. session_start();
d. begin_sesion();
Answer: c. session_start();


Question: 35
How would you store order number (34) in an OrderCookie’?
a. setcookie(«OrderCookie”, 34);
b. makeCookie(”OrderCookie”, 34);
c. Cookie(«OrderCookie”, 34);
d. OrderCookie(34);
Answer: a. setcookie(«OrderCookie”, 34);


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

function fn(&$var) {
   $var = $var - ($var/l0*5);
   return $var;
)
echo fn(100);

a.100
b. 50
c. 98
d. Error message
e. None of the above
Answer: d. Error message


Question: 37
What will be the result of following operation?
print 4 << 5;
a. 3
b. 128
c. 120
d. 6
Answer: b. 128


Question: 38
Which of the following is not supported in PHP5?
a. Type Hinting
b. Reflection
c. Magic Methods
d. Muftiple Inheritance
e. Object Cloning
Answer: d. Muftiple Inheritance


Question: 39
Which of the following is not a valid PHP parser tag?
a. script
b. ?p
c. %
d. ?php
Answer: a. script


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

$a=10;
echo “Value of a =$a”;

a. Value of a=10
b. Value of a=$a
c. Undefined
d. Syntax Error
Answer: a. Value of a=10


[ You can see another post for getting top score in oDesk exam >> oDesk Test Answer Magento Skill Test Part 02 ]

Don't Miss A Single Updates

Remember to check your email account to confirm your subscription.

Blogger
Disqus
Post a comment ➜

No Comment