- PHP Tutorial
- PHP - Home
- PHP - Introduction
- PHP - Environment Setup
- PHP - Syntax Overview
- PHP - Variable Types
- PHP - Constants
- PHP - Operator Types
- PHP - Decision Making
- PHP - Loop Types
- PHP - Arrays
- PHP - Strings
- PHP - Web Concepts
- PHP - GET & POST
- PHP - File Inclusion
- PHP - Files & I/O
- PHP - Functions
- PHP - Cookies
- PHP - Sessions
- PHP - Sending Emails
- PHP - File Uploading
- PHP - Coding Standard
- Advanced PHP
- PHP - Predefined Variables
- PHP - Regular Expression
- PHP - Error Handling
- PHP - Bugs Debugging
- PHP - Date & Time
- PHP & MySQL
- PHP & AJAX
- PHP & XML
- PHP - Object Oriented
- PHP - For C Developers
- PHP - For PERL Developers
- PHP Form Examples
- PHP - Form Introduction
- PHP - Validation Example
- PHP - Complete Form
- PHP login Examples
- PHP - Login Example
- PHP - Facebook Login
- PHP - Paypal Integration
- PHP - MySQL Login
- PHP AJAX Examples
- PHP - AJAX Search
- PHP - AJAX XML Parser
- PHP - AJAX Auto Complete Search
- PHP - AJAX RSS Feed Example
- PHP XML Example
- PHP - XML Introduction
- PHP - Simple XML
- PHP - Simple XML GET
- PHP - SAX Parser Example
- PHP - DOM Parser Example
- PHP Frame Works
- PHP - Frame Works
- PHP - Core PHP vs Frame Works
- PHP Design Patterns
- PHP - Design Patterns
- PHP Function Reference
- PHP - Built-In Functions
- PHP Useful Resources
- PHP - Questions & Answers
- PHP - Useful Resources
- PHP - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to PHP. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - Which of the following is correct about PHP?
A - PHP can access cookies variables and set cookies.
B - Using PHP, you can restrict users to access some pages of your website.
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following type of variables are whole numbers, without a decimal point, like 4195?
Answer : A
Explanation
Integers: are whole numbers, without a decimal point, like 4195.
Q 3 - Which of the following magic constant of PHP returns function name?
Answer : C
Explanation
_FUNCTION_ − The function name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the function name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.
Q 4 - Which of the following array represents an array with strings as index?
Answer : B
Explanation
Associative array − An array with strings as index. This stores element values in association with key values rather than in a strict linear index order.
Q 5 - Which of the following function is used to get environment variables in PHP?
Answer : D
Explanation
PHP provides a function getenv() to access the value of all the environment variables.
Q 6 - Doubly quoted strings are treated almost literally, whereas singly quoted strings replace variables with their values as well as specially interpreting certain character sequences.
Answer : B
Explanation
Singly quoted strings are treated almost literally, whereas doubly quoted strings replace variables with their values as well as specially interpreting certain character sequences.
Q 7 - Which of the following is used to access session variables in PHP?
Answer : B
Explanation
Session variables are stored in associative array called $_SESSION[]. These variables can be accessed during lifetime of a session.
Q 8 - Which of the following provides the error code associated with this file upload?
Answer : A
Explanation
$_FILES['file']['error'] − it provides the error code associated with this file upload.
Q 9 - Which of the following gives a string containing PHP script file name in which it is called?
Answer : A
Explanation
$_PHP_SELF − A string containing PHP script file name in which it is called.
Q 10 - final keyword prevents child classes from overriding a method by prefixing the definition with final?
Answer : A
Explanation
PHP 5 introduces the final keyword, which prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended.