Sail E0 Webinar

MCQs

Total Questions : 30 | Page 3 of 3 pages
Question 21. Which one of the following function is capable of reading a specific number of characters form a file?
  1.    fgets()
  2.    fget()
  3.    fileget()
  4.    filegets()
 Discuss Question
Answer: Option A. -> fgets()


Its prototype is string fgets(resource handle [, int length]). If the optional length parameter is omitted, 1024 character is assumed.


Question 22. Which one of the following function operates similarly to fgets(), except that it also strips any HTML and PHP tags form the input?
  1.    fgetsh()
  2.    fgetsp()
  3.    fgetsa()
  4.    fgetss()
 Discuss Question
Answer: Option D. -> fgetss()


fgetss()


Question 23. Which one of the following function is capable of reading a file into a string variable?
  1.    file_contents()
  2.    file_get_contents()
  3.    file_content()
  4.    file_get_content()
 Discuss Question
Answer: Option B. -> file_get_contents()


file_get_contents()


Question 24. Which function sets the file filename's last-modified and last-accessed times?
  1.    sets()
  2.    set()
  3.    touch()
  4.    touched()
 Discuss Question
Answer: Option C. -> touch()


Its prototype is int touch(string filename [, int time [, int atime]]). It returns TRUE on success or FALSE on error.


Question 25. Which one of the following function outputs the contents of a string variable to the specified resource?
  1.    filewrite()
  2.    fwrite()
  3.    filewrites()
  4.    fwrites()
 Discuss Question
Answer: Option B. -> fwrite()


fwrite()


Question 26. What will be the output of the following PHP code?
< ?php
$str = "Hello World"
echo wordwrap($str,5,"\n");
?>
  1.    Hello World
  2.         HelloWorld
  3.         Hello world
  4.    World
 Discuss Question
Answer: Option B. ->      HelloWorld


The wordwrap() function wraps a string into new lines when it reaches a specific length.


Question 27. Which of the following PHP functions can be used for generating unique id's?
  1.    uniqueid()
  2.    id()
  3.    md5()
  4.    mdid()
 Discuss Question
Answer: Option A. -> uniqueid()


Many people use the md5() function for this, even though it's not exactly meant for this purpose. uniqueid() is the function that is to be used.


Question 28. What will be the output of the following PHP code?
< ?php
echo ord ("hi");
?>
  1.    106
  2.    103
  3.    104
  4.    209
 Discuss Question
Answer: Option C. -> 104


The ord() function returns the ASCII value of the first character of a string. The ASCII value of h is 104, thus 104 was displayed.


Question 29. Which one of the following functions can be used to compress a string?
  1.    zip_compress()
  2.    zip()
  3.    compress()
  4.    gzcompress()
 Discuss Question
Answer: Option D. -> gzcompress()


We will be able to achieve almost 50% size reduction using this function. The gzuncompress() function is used to uncompress the string.


Question 30. What will be the output of the following PHP code?
< ?php
echo "chr(52)";
?>
  1.    1
  2.    2
  3.    3
  4.    4
 Discuss Question
Answer: Option D. -> 4


The chr() function returns a character from the specified ASCII value. Since the ASCII value of 4 is 52, thus 4 was displayed.


Latest Videos

Latest Test Papers