Professional Documents
Culture Documents
• URL
• IP
• Server
• DNS
2) PHP stands for.
• Hypertext Preprocessor
• Pretext Hypertext Preprocessor
• Personal Home Preprocessor
• None of the above
3) We will need a way to transfer our website files from the
local computer to the remote web server. We do this by using
• Web server
• Web site
• FTP
• Web browser
4) Variable name in PHP starts with
• !
• $
• &
• #
5) Which of the following is not a variable scope in PHP
• Extern
• Local
• Static
• Global
6) What will be the output of the following code
<?php
$cars = array ("Volvo", "BMW", "Toyota");
echo "My car is a {$cars [0]}";
?>
• My car is a Toyota
• My car is a BMW
• Error
• My Car is a Volvo
7) Which of the following is correct to add a comment in PHP
• &………&
• //……….
• /*……..*/
• Both (2) and (3)
8) Which of the following is known as the key to object-
oriented programming
• Polymorphism
• Data Abstraction
• Orthogonality
• Encapsulation
9) The Practice of separating the user from the true inner
workings of an application through well-known interfaces is
known as
• Abstraction
• Encapsulation
• Polymorphism
• Inheritance
10) which of the following is used to display output in PHP
• echo
• write
• print
• both (1) and (3)
11) Which of the following is the use of srtlen() function in PHP
• Returns the type of a string
• Returns the length of a string
• Returns the value of a string
• Returns both value and type of a string
•
12) A computer software system for organizing and facilitating
collaborative creation of documents and other content,
especially for loading a website is
• SMS
• CSM
• CMS
• GSM
13) A warning is displayed and the script continues to run
• None
• With include
•
• With require
14) What is the description of error level E_ERROR?
• Fatal Compile-time error
• Compile-time error
• Near-Fatal error
• Fatal run-time error
15) Which of the following is used for concatenation in PHP
• *
• .
• +
• Append
16) How do you create a cookie in PHP?
• makecookie ()
• setcookie ()
• createcookie ()
• None
17) Which of the following web-server is used for PHP scripts
• Cassini
• Tomcat
• IIS
• Apache
18) Which of the following starts with double underscore ( __ )
in PHP
• Magic constants
• Default constants
• User-defined constants
• Inbuilt constants
19) Work by creating a unique id (UID) for each visitor and
storing variables base on this UID
• Sessions
•
• None
• Cookies
20) …….. is software used by an end user to access the web
• Web Server
• Web site
• The Web
• A Web browser
21) ……… is a technology which facilitates a disciplined
approach to designing computer programs that enhance the
functionality and appearance of the Web pages.
• CSS
• HTML
• Java Script
• Bootstrap
22) an error is displayed and the script stops.
• None
•
• With require
• With include
23) How do you get information from a form that is submitted
using the "get" method?
• []Get_$
• Request.Query string
• Request.Form
• None
24) What will be the output of the following PHP code?
<?php
$a = 10; $b = 10;
if ($a = 5)
$b-- ;
print $a; print $b--;
?>
• 109
• 1010
• Error
• 59
25) Which of the following is the correct way to create a
function in PHP
• create myFunction ()
• New_function myFuntion ()
• function myfunction ()
• None of the above
26) What will be the output of the following PHP code?
<?php
$x = 10;
$y = 10;
If ($x > $y && 1 || 1)
Print "1000 PHP MCQ";
else
print "Welcome to Sanfoundary";
?>
<?php
define("VAR_NAME", "test");
${VAR_NAME} = "value";
echo VAR_NAME;
echo ${VAR_NAME};
?>
• test
• testtest
• testvalue
• error, constant value cannot be changed
49) Set of related web pages served from a single web domain,
hosted on one or more web servers
• the web
• web site
• web server
• A web browser
50) What is the correct way to open the file "time.txt" as
readable?
• open ("time.txt","read");
• fopen ("time.txt","r");
• fopen ("time.txt","r+");
• open ("time.txt");
51) Used to insert, update, delete, and view the data in
database objects
• none
• Control Language (CL)
• Data Definition Language (DDL)
• Data Manipulation Language (DML)
52) We use to end sessions:
• set($_SESSION[name])
• set($_SESSION['name'])
• unset($_SESSION['name'])
• unset($_SESSION[name])
53) If the directive session.cookie_lifetime is set to 3600, the
cookie will be live until
• 3600 hrs
• 3600 min
• 3600 sec
• The browser is restarted
54) PHP allows you to send emails directly from a script
• True
•
• False
• None
55) Which superglobal variable holds information about
headers, paths, and script locations?
• $_SERVER
• $_GLOBALS
• $_GET
• $_SESSION
56) Which of the following type of variables have only two
possible values either true or false?
• Doubles
• Integers
• Strings
• Booleans
57) The bootstrap grid system works across multiple devices in
order to
• Add interactivity to website
• Add responsiveness to website
• None
• Add supportiveness to website
58) If your object must inherit behavior from a number of
sources you must use a/an
• Object
• Interface
• Abstract class
• Static class
59) What is the correct way to add 1 to the $count variable?
• count++;
• ++count
• $count =+ 1
• $count++;
60) Which of the following keyword is used to inherit our
subclass into a superclass?
• include
• implements
• extends
• inherit
61) Which two predefined variables are used to retrieve
information from forms?
• $_GET & $_SET
• $__GET & $__SET
• $GET & $SET
• GET & SET
62) PHP can be run on Microsoft Windows IIS (Internet
Information Server):
• False
•
• None
• True
63) When you use the $_POST variable to collect data, the data
in visible to
• None
• Everyone
• Only you
• Selected few
64) The die() and exit() functions do the exact same thing
• False
• True
•
• None
65) Which one of these variables has an illegal name
• $myVar
• $my_Var
• $my-var
• All of them
66) What will be the output of the following PHP code?
<?php
$x = 5;
$y = 10;
function fun()
{
$y = $GLOBALS['x'] + $GLOBALS['y'];
}
fun();
echo $y;
?>
• 5
• Error
• 10
• 15
67) What will be the output of the following PHP code?
<?php
$username = "jasoN";
if (ereg ("([^a-z])" , $username))
echo "Username must be all lowercase!";
else
echo "Username is all lowercase!";
?>
• Error
• None of the above
• bool(true)
• bool(false)
71) Used to create and modify database objects
• Control Language (CL)
• Data Definition Language (DDL)
• None
• Data Manipulation Language (DML)
72) What will be the output of the following PHP code?
<?php
$x = 1;
$y = 2;
if (++$x == $y++)
{
echo "true ", $y, $x;
}
?>
• true 22
• No output
• true 33
• true 23
73) What will be the output of the following PHP code?
<?php
echo "This", "was", "a", "bad", "idea";
?>
• Thiswasabadidea
• error
• This was a bad idea
• This, was, a, bad, idea