Novell Previous Years Solved Sample Placement Papers
-
Which PHP function determines the last access time of a file?
A. filetime()
B. fileatime() Answer: Option B
C. filectime()
D. None of the above
- Solution: The fileatime() function in PHP is used to return the last access time of a file as a UNIX timestamp. On failure, the fileatime() returns false.
-
Which PHP function is capable of reading a specific number of characters from a file?
A. filegets()
B. fget()
C. fgets() Answer: Option C
D. None of the above
- Solution: The PHP fgets() function is used to read a single line from a file.
-
Which PHP function is used to find the position of the last occurrence of a substring inside another string?
A. strops()
B. strrpos() Answer: Option B
C. strtr()
D. None of the above
- Solution: The strrpos() is an in-built function of PHP that finds the position of the last occurrence of a substring inside another string. It is a case-sensitive function.
-
What will be the output of the following program?
<?php
echo "Welcome" . "to" . "the" . "javaTpoint.com";
?>
A. Welcome to the javaTpoint.com
B. Welcome, to, the, javaTpoint.com
C. WelcometothejavaTpoint.com Answer: Option C
D. Error
- Solution: In the echo statement, the . (dot) operator is used to join strings, resulting in "WelcometothejavaTpoint.com".
-
What will be the output of the following program?
<?php
echo "Welcome", "to", "the", "javaTpoint.com";
?>
A. Welcome to the javaTpoint.com
B. Welcome, to, the, javaTpoint.com
C. WelcometothejavaTpoint.com Answer: Option C
D. Error
- Solution: Multiple strings separated by a comma (,) in the echo statement are joined, resulting in "WelcometothejavaTpoint.com".
-
What will be the output of the following program?
<?php
$var1 = "Hello";
$var2 = "World";
echo $var1, $var2;
?>
A. HelloWorld Answer: Option A
B. Hello, World
C. Hello World
D. None of the above
- Solution: Multiple strings separated by a comma (,) in the echo statement result in "HelloWorld".
-
What will be the output of the following program?
<?php
$var1 = "Hello";
$var2 = "World";
echo "$var1$var2";
?>
A. HelloWorld Answer: Option A
B. "$var1$var2"
C. Hello World
D. None of the above
- Solution: When variables are inside double quotes, their values are substituted, resulting in "HelloWorld".
-
What will be the output of the following program?
<?php
$a;
if ($a)
{
echo "hi";
}
else
{
echo "How are you";
}
?>
A. Hi How are you
B. How are you Answer: Option B
C. Hi
D. None of the above
- Solution: The variable $a is uninitialized, so the if condition fails, and the else block prints "How are you".
-
What will be the output of the following program?
<?php
$a = 0;
while ($a++)
{
echo "$a";
}
echo $a;
?>
A. 0
B. 1 Answer: Option B
C. 01
D. None of the above
- Solution: Due to the post-increment, the condition is checked before incrementing. As the initial value 0 fails the condition, the loop does not execute, and 1 is printed.