Novell Previous Years Solved Sample Placement Papers
-
What will be the output of the following program?
<?php while() { echo "Hello World"; } ?>
A. Hello World
B. Infinite loop
C. No output
D. Error Answer: Option D
- Solution: The while loop is also called an Entry control loop because the condition is checked before entering the loop body. This means that first, the condition is checked. If the condition is true, the block of code will be executed. So, a while loop cannot be defined without a condition.
-
What will be the output of the following program?
<?php $var1="Hello World"; echo strrev("$var1"); ?>
A. dlroW olleH Answer: Option A
B. olleH dlroW
C. Hello dlroW
D. None of the above
- Solution: The strrev() function is a predefined function of PHP. As its name implies, it is used to reverse a string. It is one of the most basic string operations used by programmers and developers.
-
Which of the following function is used to compute the difference between two arrays in PHP?
A. diff_array
B. array_diff Answer: Option B
C. arrays_diff
D. diff_arrays
- Solution: The array_diff() function compares two or more arrays and returns an array with the keys and values from the first array, only if the value is not present in any of the other arrays.
-
What will be the output of the following program?
<?php $a = array(16, 5, 2); echo array_product($a); ?>
A. 160 Answer: Option A
B. 1652
C. 80
D. 32
- Solution: The array_product() function calculates the product of an array. It is an inbuilt function of PHP.
-
Which PHP function converts an English text datetime into a Unix timestamp?
A. str_to_time()
B. strtodate()
C. strtotime() Answer: Option C
D. None of the above
- Solution: The PHP strtotime() function is used to convert an English text datetime into a Unix timestamp.
-
Which of the following function in PHP returns the time of sunrise of a particular day and location?
A. date_sunrise() Answer: Option A
B. date-sunrise()
C. sunrise()
D. None of the above
- Solution: The date_sunrise() function is used to get the timing of sunrise of a particular day and location. This function returns the sunrise time of different locations.