Variable names in php must start with

PHP Variables MCQs : This section focuses on "Variable" in PHP. These Multiple Choice Questions (MCQ) should be practiced to improve the PHP skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. Any variables declared in PHP must begin with a _____?

A. .
B. #
C. &
D. $

View Answer

2. A variable can have ________?

A. long descriptive names
B. short names
C. Both A and B
D. None of the above

View Answer

3. A variable name can only contain ____________?

A. alphanumeric characters
B. underscores
C. Both A and B
D. None of the above

View Answer

4. Variable names in PHP must start with ?

A. letter
B. underscore
C. no numbers
D. All of the above

View Answer

5. PHP variables are case-sensitive?

A. True
B. False
C. For "sum" variable it is case-sensitive
D. None of the above

View Answer

6. How many variable scope are there in php?

A. 2
B. 3
C. 1
D. 4

View Answer

7. What will be the output of the following PHP code?

A. $x + $y
B. 3
C. 1+2
D. 12

View Answer

8. What will be the output of the following PHP code?

A. 1.3
B. 1
C. 0
D. Error

View Answer

9. What will be the output of the following PHP code?

A. 2
B. 3
C. 4
D. 5

View Answer

10. What will be the output of the following PHP code?

A. 1
B. -1
C. 2
D. -2

View Answer

11. Variables are ________ for storing information.

A. decimal
B. storage
C. numbers
D. containers

View Answer

12. choose the incorrect variable name in php?

A. $_AGE
B. $18AGE
C. $AGE18
D. $_AGE18

View Answer

13. A variable declared _____ has a GLOBAL SCOPE?

A. outside program
B. inside function
C. outside function
D. None Of the Above

View Answer

14. A variable declared _____ has a LOCAL SCOPE?

A. outside program
B. inside function
C. outside function
D. None Of the Above

View Answer

15. Which of the following will be output of the following code?

 

A. 0
B. 1
C. No Output
D. Error

View Answer

16. Which of the following is NOT a superglobal variable ?

A. $_SERVER
B. $_GLOBAL
C. $_GET
D. $_POST

View Answer

17. Predict the output of the following code snippet :

A. 11,11,11
B. 10,11,11
C. 10,11,10
D. 10,10,10

View Answer

18. Predict the output of the following code snippet :

A. 10,20,10
B. 10,24,10
C. 10,20,20
D. 10,22,10

View Answer

19. Predict the output of the following code snippet :

A. 201010
B. 202010
C. 101010
D. 201020

View Answer

20. what $_SERVER variable do?

A. Will give the information about all the predefined variables to know the server information
B. To get the information about the files uploaded using POST methods
C. When the information is passed using POST methods
D. None of the above

View Answer



Also check :

  • PHP Print MCQ


Discussion

* You must be logged in to add comment.

Is PHP variable case

Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive.

What is PHP variable?

A variable in PHP is a name of memory location that holds data. In PHP, a variable is declared using $ sign followed by variable name. The main way to store information in the middle of a PHP program is by using a variable.

Which PHP variable name is invalid Mcq?

31) Which of the following variable name is invalid? Description: In PHP, a variable is declared using a $ sign followed by the variable name. A variable name must start with a letter or underscore (_) character. A PHP variable name cannot contain spaces.

Is PHP variable case

Answer: A) PHP variables are case-sensitive.