Novell Previous Years Solved Sample Placement Papers
-
Which of the following is used for concatenation in PHP?
A. + (plus)
B. * (Asterisk)
C. . (dot) Answer: Option C
D. append()
- Solution: In PHP, the . (dot) operator is used for concatenation. Suppose there are two variables $a and $b, so the statement $a . $b will concatenate both $a and $b.
-
Which of the following starts with __ (double underscore) in PHP?
A. Inbuilt constants
B. User-defined constants
C. Magic constants Answer: Option C
D. Default constants
- Solution: Magic constants are the predefined constants in PHP which get changed on the basis of their use. They start with a double underscore (__) and end with a double underscore.
-
Which of the following is the use of strpos() function in PHP?
A. The strpos() function is used to search for the spaces in a string
B. The strpos() function is used to search for a number in a string
C. The strpos() function is used to search for a character/text in a string Answer: Option C
D. The strpos() function is used to search for a capitalize character in a string
- Solution: The strpos() function is an in-built function of PHP. It is used to find the position of the first occurrence of a string inside another string or substring in a string.
-
What does PEAR stand for?
A. PHP extension and application repository Answer: Option A
B. PHP enhancement and application reduce
C. PHP event and application repository
D. None of the above
- Solution: PEAR is a framework and repository for reusable PHP components. PEAR stands for PHP Extension and Application Repository. It contains all types of PHP code snippets and libraries.
-
Which of the following is the correct way to create a function in PHP?
A. Create myFunction()
B. New_function myFunction()
C. function myFunction() Answer: Option C
D. None of the above
-
Solution: The syntax to declare user-defined functions in PHP is:
function functionname() {
// code to be executed
} -
Which of the following PHP functions is used to generate a unique ID?
A. id()
B. mdid()
C. uniqueid() Answer: Option C
D. None of the above
-
Solution: The PHP function
uniqueid()
is used to generate a unique identifier. It is often used to create unique values for session IDs or other identifiers. -
Which of the following is the correct way of defining a variable in PHP?
A. $variable name = value;
B. $variable_name = value; Answer: Option B
C. $variable_name = value
D. $variable name as value;
-
Solution: In PHP, a variable is declared using a $ sign followed by the variable name. A PHP variable name cannot contain spaces.
Syntax:$variable_name = value;