Breaking News

BCA 5th Sem: Web Based Programming (PHP) - MCQs

MCQs on PHP

BCA 5th Sem: Web Based Programming (PHP) - MCQs

Q1: What PHP stands for?

(a) Hypertext Preprocessor
(b) Pre Hypertext Processor
(c) Pre Hyper Processor
(d) Pre Hypertext Process


Q2: Which of the following is the best all-purpose way to compare two strings?

(a) Using the strpos function
(b) Using the == operator
(c) Using strcmp()
(d) Using strcasecmp()


Q3: Which of the following function formats a local time or date according to locale settings?

(a) strftime
(b) stritime
(c) strhtime
(d) strgtime


Q4: What will happen if you add a string to an integer using the + operator?

(a) The string is discarded and the integer is preserved
(b) The string gets converted to a number and is added to the integer
(c) The interpreter outputs a type mismatch error
(d) The integer is discarded and the string is preserved


Q5: What is the difference between print() and echo()?

(a) echo() can be used as part of an expression, while print() can’t
(b) print() can be used as part of an expression, while echo() can’t
(c) print() can be used in the CLI version of PHP, while echo() can’t
(d) echo() can be used in the CLI version of PHP, while print() can’t




Q6: You are provided a comma-separated list of string word, which function from the given list can create an array of strings value with a single call?

(a) strstr()
(b) extract()
(c) explode()
(d) strtok()


Q7: Which function is used to find number of elements in an array?

(a) count
(b) sizeof
(c) array_length
(d) length


Q8: The getdate() function returns

(a) An integer
(b) A floating-point number
(c) An array
(d) A string


Q9: Which of the following will not combine two strings $s1 and $s2 into a single string?

(a) $s1.$s2
(b) "{$s1}{$s2}"
(c) implode(' ', array($s1,$s2))
(d) $s1 + $s2


Q10: In PHP you may use either single quotes (' ') or double quotes (" ") for strings:

 (a) False
 (b) True



Answers:

1: (a) Hypertext PreProcessor
2: (c) Using strcmp()
3: (a) strftime
4: (b) The string gets converted to a number and is added to the integer
5: (b) print() can be used as part of an expression, while echo() can’t
6: (c) explode()
7: (a) count
8: (c) An array
9: (d) $s1 + $s2
10: (b) True