0

Basic PHP Quiz - 1

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

In PHP, arrays may be sorted with which of the following functions?

php
  1. uksort()

  2. arsort()

  3. ksort()

  4. All of the above


Correct Option: D

PHP comments for a single line have the following syntax:

php
  1. /* comments /*

  2. #

  3. //

  4. ::

  5. A&B


Correct Option: E

Which of the following functions are used by PHP to find out what type a variable is?

php
  1. gettype()

  2. is_double()

  3. get_type()

  4. is_date()

  5. A&B


Correct Option: E

The three possible connection states in PHP are ________.

php
  1. normal

  2. aborted

  3. timeout

  4. All of the above


Correct Option: D

In PHP, the error control operator is ________.

php
  1. *

  2. %

  3. @

  4. &


Correct Option: C

In PHP, instructions are terminated with a _______.

php
  1. ;

  2. #

  3. !

  4. %>


Correct Option: A

AI Explanation

To answer this question, you need to understand the syntax of PHP.

In PHP, instructions are terminated with a semicolon (;). This is known as the statement terminator. It is used to separate different statements or instructions in PHP code.

Let's go through each option to understand why it is correct or incorrect:

Option A) ; - This option is correct because in PHP, instructions are terminated with a semicolon (;). Option B) # - This option is incorrect. In PHP, the # symbol is used for single-line comments, not for terminating instructions. Option C) ! - This option is incorrect. In PHP, the exclamation mark (!) is used for logical negation, not for terminating instructions. Option D) %> - This option is incorrect. The %> symbol is used in PHP for closing a block of PHP code when using the alternative syntax, but it is not used to terminate instructions.

The correct answer is option A) ; because in PHP, instructions are terminated with a semicolon (;).

What does PHP stand for?

php
  1. PHP: Hypertext Preprocessor

  2. Personal Home Page

  3. Private Home Page

  4. Personal Hypertext Processor


Correct Option: A

PHP server scripts are surrounded by delimiters, which?

php
  1. ...?>

  2. ...

  3. ...&>


Correct Option: B

How do you write "Hello World" in PHP

php
  1. "Hello World";

  2. echo "Hello World";

  3. Document.Write("Hello World");

  4. response.write("Hello World")


Correct Option: B

All variables in PHP start with which symbol?

php
  1. !

  2. $

  3. &

  4. #


Correct Option: B
php
  1. Class

  2. Method

  3. Object

  4. Variable


Correct Option: B
php
  1. preg_replace("like", "hate", "I like Eminem")

  2. preg_replace("/like/", "hate", "I like Eminem")

  3. preg_replace("/like/", "/hate/", "I like Eminem")

  4. preg_replace("hate", "like", "I like Eminem")


Correct Option: A
php
  1. c-client library

  2. GIF/PNG library

  3. Image Library

  4. GD library


Correct Option: D
php
  1. It requires short tags and this is not compatible with XML

  2. There is no problem

  3. This syntax doesn't even exist It requires a special PHP library that may not always be available


Correct Option: A
php
  1. Ends execution of the current switch structure

  2. Moves on to the next iteration of the current for, foreach, while, do-while or switch structure

  3. Ends execution of the current for, foreach, while, do-while or switch structure


Correct Option: C
php
  1. That won't hide any error 'coz you can't use .htaccess to control the PHP engine Bad idea, I want to see when errors occur

  2. That won't hide any error 'coz it's not the correct code

  3. Good idea, increases security


Correct Option: B
php
  1. tests whether $variable is a number and ends in 2

  2. tests whether $variable ends in 2

  3. tests whether $variable is a number and contains 2

  4. tests whether $variable is an even number


Correct Option: D
  1. Peer Review

  2. Expected value technique

  3. Delphi Technique

  4. Work Breakdown Structure (WBS)


Correct Option: C
- Hide questions