Novartis Previous Years Solved Sample Placement Papers
-
What will be the output of the following PHP program?
A. 6 Answer: Option A
B. 5
C. 4
D. 3
-
Explanation: The function
count()
will return the number of elements in an array. The parameter 1 counts the array recursively, i.e., it will count all the elements of multidimensional arrays. -
What will be the output of the following PHP program?
A. Correct Answer
B. Is The
C. I Wonder
D. Which One Answer: Option D
-
Explanation: The
stripos()
function finds the position of the first occurrence of a string inside another string. In this case, it returns 7. -
Which of the following PHP functions can be used for generating unique ids?
A. md5()
B. uniqueid() Answer: Option B
C. mdid()
D. id()
-
Explanation: The function
uniqueid()
is used to generate a unique ID based on the microtime (current time in microseconds). The ID generated from the functionuniqueid()
is not optimal, as it is based on the system time. To generate an ID which is extremely difficult to predict, we can use themd5()
function. -
In the following PHP program, what is/are the properties?
A. function sample()
B. echo “This is an example”;
C. public $name; Answer: Option C
D. class Example
-
Explanation: Above code is an example of ‘classes’. Classes are the blueprints of objects. Classes are the programmer-defined data type, which includes the local methods and the local variables. Class is a collection of objects which has properties and behavior.
-
What will be the output of the following PHP code?
A. $GREETING
B. no output Answer: Option B
C. PHP is a scripting language
D. GREETING
-
Explanation: Constants do not need a $ before them, they are referenced by their variable names itself.
-
A function in PHP which starts with __ (double underscore) is known as __________
A. Default Function
B. User Defined Function
C. Inbuilt Function
D. Magic Function Answer: Option D
-
Explanation: PHP functions that start with a double underscore – a “__” – are called magic functions. They are functions that are always defined inside classes, and are not stand-alone functions.