Upwork Test Answers of Magento Skill Test Part 02
Question: 41
You need to keep an eye on the existing number of objects of a given class without introducing a non-class member variable.Which of the following makes this happen?
a. Add a member variable that gets incremented in the default constructor and decremented in the destructor
b. Add a local variable that gets incremented in each constructor and decremented in the destructor
c. Add a static member variable that gets incremented in each constructor and decremented in the destructor
d. This cannot be accomplished since the creation of objects is being done dynamically via “new”
Answer: c. Add a static member variable that gets incremented in each constructor and decremented in the destructor


Question: 42
Which of the following multithreaded servers allow PHP as a plug-in?
a. Netscape FastTrack
b. Microsoft’s Internet Information Server
c. O’Reilly’s WebSite Pro
d. All of the above
Answer: d. All of the above


Question: 43
Which of the following is used to maintain the value of a variable over different pages?
a. static
b. global
c. session_register()
d. None of the above
Answer: c. session_register()


Question: 45
Which of the following variable declarations within a class is invalid in PHP5?
a. private $type = ‘moderate’;
b. internal $term = 3;
c. public $amnt = ‘500’;
d. protected $name = ‘Quantas Private Limited’;
Answer: b. internal $term = 3;


Question: 46
Consider the following two statements:

1 while (expr) statement
2 while (expr): statement endwhile;

Which of the following are true in context of the given statements?

a. 1 is correct and 2 is wrong
b. 1 is wrong and 2 is correct
c. Both 1 & 2 are wrong
d. Both 1 & 2 are correct
Answer: b. 1 is wrong and 2 is correct


Question: 47
You have defined three variables $to, $subject, and $body to send an email. Which of the following methods would you use for sending an email?
a. mail($to,$subject,$body)
b. sendmail($to,$subject,$body)
c. mail(to,subject,body)
d. sendmail(to,subject,body)
Answer: a. mail($to,$subject,$body)


Question: 48
What is the output of the following code?

function vec_add (&Sa, Sb) {
   $a[X] += $b[’x’];
   $a[y] += $b[’y’];
   $a[Z] += $b['Z'];
}
$a = array (x => 3, y => 2, z => 5);
$b = array (x => 9, y => 3, z => -7);

vec_add (&$a, $b);
print_r ($a);

a. Array
(
[X] => 9
[y] => 3
[Z] => -7
b. Array
[x] => 3
[y] => 2
[z] => 5
c. Array
[xJ =>12
[yJ => 5
[z] => -2
d. Error
e. None of the above
Answer: c.


Question: 49
In your PHP application you need to open a file. You want the application to issue a warning and continue execution, in case the file is not found The ideal function to be used is:
a. include()
b. require()
c. nowarn()
d. getFile(false)
Answer: a. include()


Question: 50
(many answers); Which of the the following are PHP file upload related functions?
a. upload_file()
b. is_uploaded_file()
c. move_uploaded_file()
d. Noneoftheabove
Answer: b. and c.


Question: 51
Which of the following attribute is needed for file upload via form?
a. enctype=”multipart/formdata”
b. enctype=”singlepart/data’
c. enctype=»file”
d. enctype=»form-data/file”
Answer: a. enctype=”multipart/formdata”


Question: 52
Variable/functions in PHP don’t work directly with:
a. echo()
b. isset()
c. print()
d. All of the above
Answer: a. echo()


Question: 53
Which of the following is a PHP resource?
a. Domxml document
b. Odbc link
c. File
d. Allot the above
Answer: c. File


Question: 54
The inbuilt function to get the number of parameters passed is:
a. arg_num()
b. func_args_count()
c. func_num_args()
d. None of the above
Answer: c. func_num_args()


Question: 55
For the following code:

function Expenses() {
   function Salary() {
      function Loan() {
         function Balance() {
         }
      }
   }
}

Which of the following sequence will run successfully?

a. Expenses();Salary();Loan; Balance();
b. Salary();Expenses();Loan(); Balance();
c. Expenses();Salary();Balance();Loan();
d. Balance();Loan();Salary(); Expenses();
Answer: a. Expenses();Salary();Loan; Balance();


Question: 56
What will be the output of the following code?
echo 30 * 5.7
a. 150.7
b. 1507
c. 171
d. you can’t concatenate integers
e. error will occur
Answer: c. 171


Question: 57
Which of the following is correct with regard to echo and print?
a. echo is a construct and print is a function
b. echo is a function and print is a construct
c. Both are functions
d. Both are constructs
Answer: d. Both are constructs


Question: 58
Which of the following is not a file related function in PHP?
a. fclose
b. fopen
c. fwrite
d. fgets
e. fappend
Answer: e. fappend


Question: 59
Which of the following variables are supported by ‘str_replace’ function?
a. Integer
b. String
c. Boolean
d. Array
Answer: b. and d.


Question: 60
Which of the following are useful for method overloading?
a. _call,_get,_set
b. _get,_set,_load
c. _get,_set,_isset
d. _overload
Answer: c. _get,_set,_isset


Question: 61
What will be the output of the following code?
var_dump (3*4);
a. int(3*4)
b. int(12)
c. 3*4
d. 12
e. None of the above
Answer: b. int(12)


Question: 62
You need to count the number of parameters given in the URL by a POST operation. The correct way is:
a. count($POST_VARS);
b. count($POST_VARS_PARAM);
c. count($_POST);
d. count($HTTP_POST_PARAM);
Answer: c. count($_POST);


Question: 63
Consider the following class:

1 class Insurance
2 {
3 function clsName()
4 {
5 echo get_class($this);
6 }
7 }
8 $cl = new Insurance();
9 Scl->clsName();
10 lnsurance::clsName();

Which of the following Lines should be commented to print the class name without errors?

a. Line 8 and 9
b. Line 10
c. Line 9 and 10
d. All the three lines 8,9, and 10 should be left as it is.
Answer: b. Line 10


Question: 64
Which of the following statement is not correct for PHP?
a. it is a server side scripting language
b. A php file may contain text, html tags or scripts
c. it can run on windows and Linux systems only
d. it is compatible with most of the common servers used today
Answer: b. A php file may contain text, html tags or scripts


Question: 65
Which of the following functions output text?
a. echo()
b. print()
c. println()
d. display()
Answer: a. echo()


Question: 66
Which of the following crypto ¡n PHP returns longest hash value?
a. md5()
b. shalo
c. crc32()
d. All return same length hash
Answer: a. md5()


Question: 67
The value of a local variable of a function has to be retained over multiple calls to that function. How should that variable be declared?
a. local
b. global
c. static
d. None of the above
Answer: b. global


Question: 68
Does PHP provide the goto keyword in latest version?
a. Yes
b. No
Answer: a. Yes 

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

Don't Miss A Single Updates

Remember to check your email account to confirm your subscription.

Blogger
Disqus
Post a comment ➜

No Comment