0

Basic PHP Quiz - 5

Description: Basic PHP Quiz - 5
Number of Questions: 10
Created by:
Tags: php
Attempted 0/10 Correct 0 Score 0

Include files must have the file extension ".inc"

php
  1. True

  2. False


Correct Option: B

In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:

php
  1. True

  2. False


Correct Option: A
php
  1. function myFunction()

  2. new_function myFunction()

  3. create myFunction()


Correct Option: A
php
  1. mysql_open("localhost");

  2. connect_mysql("localhost");

  3. dbopen("localhost");

  4. mysql_connect("localhost");


Correct Option: D

What is the correct way to add 1 to the $count variable?

php
  1. count++;

  2. $count++;

  3. ++count

  4. $count =+1


Correct Option: B

AI Explanation

To add 1 to the $count variable, the correct way is option B: $count++.

Explanation:

  • Option A: count++ is incorrect because it is missing the $ sign, which is required to reference a variable in most programming languages.
  • Option B: $count++ is correct because it uses the $ sign to reference the variable count and the ++ operator to increment its value by 1.
  • Option C: ++count is also correct, as it increments the value of count by 1 before using it in any other expression.
  • Option D: $count =+1 is incorrect because it uses the assignment operator = instead of the addition operator +. The correct way to increment a variable by 1 using the assignment operator would be $count += 1.

PHP can be run on Microsoft Windows IIS(Internet Information Server):

php
  1. True

  2. False


Correct Option: A

In PHP 5, MySQL support is enabled by default:

php
  1. True

  2. False


Correct Option: B

Which one of these variables has an illegal name?

php
  1. $my-Var

  2. $myVar

  3. $my_Var


Correct Option: A
- Hide questions