Today i am here with some sets of
PHP interview questions with answers for
PHP developers, to improve
web development skills. and prepare for interviews...
PHP Questions :
Que.1 When serializing and unserializing an object, which of the following precautions should you keep in mind? (Choose two)
A. Always escape member properties that contain user input.
B. If the object contains resource variables, use magic functions to restore the resources upon unserialization.
C. Use the magic functions to only save what is necessary.
D. Always use a transaction when saving the information to a database.
Que.2 Which of the following form element names can be used to create an array in PHP?
A. foo
B. [foo]
C. foo[]
D. foo[bar]
Que.3 What will the following script output?
$x = 3 - 5 % 3;
echo $x;
?>
A. 2
B. 1
C. Null
D. True
Que.4 Why must you call session_start() prior to any output?A. Because it is easy to forget if not placed at the top of your scripts.
B. Because you can no longer access the session data store after there has been output.
C. Because session_start() sets some HTTP headers.
D. Because calling session_start() causes the HTTP headers to be sent.
Que.5 Which of the following represents the proper way to set a session variable?
A. $_SESSION[‘foo’] = ‘bar’;
B. session_start();
C. session_set_save_handler (‘myopen’, ‘myclose’, ‘myread’,‘mywrite’, ‘mydelete’, ‘mygarbage’);
D. $foo = $_SESSION[‘foo’];
Que.6 Is it possible to pass data from PHP to JavaScript?
A. No, because PHP is server-side, and JavaScript is client-side.
B. No, because PHP is a loosely typed language.
C. Yes, because JavaScript executes before PHP.
D. Yes, because PHP can generate valid JavaScript
Que.7 Which of the following types can be used as an array key? (Select three.)
A. Integer
B. Floating-point
C. Array
D. Object
E. Boolean
Que. 8 Which types of form elements can be excluded from the HTTP request?
A. text, radio, and check box
B. text, submit, and hidden
C. submit and hidden
D. radio and check box
Que.9 Which of the following functions can be used to sort an array by its keys in descending order?
A. sort
B. rsort
C. ksort
D. krsort
Que.10 Which of the following represents the proper way to set a session variable?
A. $_SESSION[‘foo’] = ‘bar’;
B. session_start();
C. session_set_save_handler (‘myopen’, ‘myclose’, ‘myread’,
‘mywrite’, ‘mydelete’, ‘mygarbage’);
D. $foo = $_SESSION[‘foo’];
Answers :
Que.1 B and C
Que.2 C
Que.3 B
Que.4 C
Que.5 A
Que.6 D
Que.7 A,B and E
Que.8 D
Que.9 D
Que.10 A
Want More Questions CLICK THE LINKS BELOW
PHP
Multiple choice questions and answers-2
PHP
Multiple choice questions and answers-8
PHP
Multiple choice questions and answers-10
PHP
Multiple choice Questions and answers-11
PHP
Multiple choice Questions and answers-12
PHP
Multiple choice Questions and answers-13
Share your Experience or any suggestions with us in comment