lms prelim quiz Flashcards
What does PHP stands for?
Hypertext Preprocessor
Which PHP statement will give output $x on the screen?
a. echo “/$x”;
b. echo “$x”;
c. echo “$x;”;
d. echo “$$x”;
b. echo “$x”
Which of the following is the correct way to add a comment in PHP code?
a. /**/
b. #
c. All of the Method
c.
What is the port use by MySQL?
3306
What version of PHP introduced the advanced concepts of OOP?
PHP 5
<?php
$a = “$winner”;
$b = “/$looser”;
echo $a, $b;
?>
a. /$looser
b. $winner/$loosesr
c./
d. $looser
c
Which of the following statements will output Hello World on the screen?
i) echo (“Hello World”);
ii) print (“Hello World”);
iii) printf(“Hello World”);
iv) sprintf(“Hello World”);
a. i),ii), iii) and iv)
b.i), ii), and iii)
c. i) and ii)
d. i), ii), and iv)
b
What will be the output of the following PHP code?
<?php
define(“GREETING”, “PHP is a scripting language”);
echo $GREETING;
?>
no output
What is used to end a statement in PHP
semicolon
Which of the following PHP functions can be used to get the current memory usaage?
a. memory_get_usage()
b. get_peak_usage()
c. get_usage()
d. memory_get_peak_usage()
a. memory_get_usage()
Which of the following is not a variable scope in PHP
a. Static
b. Global
c. Loal
d. Extern
D. extern
Which of the following is used for concatenation in PHP
a. .(dot)
b. append()
c. +(plus)
d. *(askterisk)
a. .(dot)
String values in PHP must be enclosed within
Double quotes and single quotes
Which is the right way of declaring a variable in PHP?
a. $_hello
b. $3hello
c. $5_Hello
d.$this
a. $_hello
What is the default file extension of PHP file?
.php
<?php
$i = 5;
while (–$i > 0 && ++$i)
{
print $i;
}
?>
a. 54321
b. 5
c. error
d. 5555555…infinitely
d. 5555555…infinitely
What does PDO stands for?
PHP Data Object
What will be the output of the following PHP program?
<?php
define(“VAR_NAME”, “test”);
${VAR_NAME} = “value”;
echo VAR_NAME;
echo ${VAR_NAME};
?>
a. test
b.testvalue
c. error, constant value cannot be changed
d. testtest
b. testvalue
What will be the output of the following PHP code?
<?php
$a = 12;
–$a;
echo $a++
?>
a. 12
b. 11
c. 10
d. error
b. 11
it is used to display the output in PHP
Print
echo
What will be the output of the following PHP code?
<?php
$total = “25 students”;
$more = 10;
$total = $total + $more;
echo $total;
?>
a. 35 Students
b. 35
c. Error
d. 25 students
b. 35
What will be the output of the following PHP code?
<?php
$a =”clue”;
$a = “get”;
echo “$a”;
?>
a. get
b. false
c. true
d. clueget
d. clueget
What is the port 443?
https
Which of the following is the correct syntax to write a PHP code?
a. <? ?>
b. < php >
c. <?php ?>
d. <? php ?>
c. <?php ?>
What wil be the output of the following PHP code?
<?php
$color = “maroon”;
$var = $color[2];
echo “$var”;
?>
a. r
b. $var
c. a
d. Error
a. r
what symbol or syntax is a newline character?
\n
A function in PHP which starts with __(doube underscore) is known as ______
Magic Function
What is the IP Address of localhost?
127.0.0.1
Variable name in PHP starts with ______
$
Which of the following we servers are required to run the PHP script?
a. IIS
b. Apache and PHP
c. XAMPP
d. Any of mentioned
a. IIS
Which of the following is/are the code editors in PHP?
a. Notepad++
b. All of the above
c. Adobe Dreamweaver
d. VS Code
e. Notepad
b. All of the above
<?php
$x = 10;
$y = 20;
if ($x > $y && 1||1)
print “I am PhilSCAn”;
else
print “Welcome to PhilSCA”;
?>
a. I am PhilSCAn
b. no output
c. Welcome to PhilSCA
d. Welcome to PhilSCA
a. I am PhilSCAn
What is PHP?
a. All of the mentioned
b. PHP is an open-source programming language
c. PHP is a server-side scripting language
d. PHP is used to develop dynamic and interactive websites
a. All of the mentioned
What is the correct way to create a function in PHP?
function myFunction()
Who is the father of PHP?
Rasmus Lerdorf
What is the function is used to destroy a variable in PHP?
unset()
What will be the output of the following PHP code?
<?php
$a = 5;
$b = 5;
echoo ($a === $B);
?>
a. 5===5
b. Error
c. 1
d. False
c. 1
How to define a function in PHP?
a. function functionName(parameters)
{function body}
b. function {function body}
c. data type
function Name(parameters)
{function body}
d. functionName (parameters)
{function body}
a. function functionName(parameters)
{function body}
What will be the output of the following PHP code?
$a = 10;
echo ++$a;
echo $a++
echo $a;
echo $a++
?>
a. 11121213
b. 11111112
c. 11111213
d. 11111212
c. 11111213
What will be the output of the following PHP code?
$foo = ‘Bob’;
$bar = $foo;
$bar = “My name is $bar”;
echo $bar;
echo $foo;
?>
a. My name is BobMy name is Bob
b. My name is Bob Bob
c. Error
d. My name is BobBob
a. My name is BobMy name is Bob
String values in PHP must be encosed within
Double and Single quotes
<?php
$x = 4;
$y = 3
$z = 1;
$z = $z + $x + $y;
echo “$z”;
?>
a. 8
b. $z
c. 15
d. 1
a. 8
What is the use of isset() function in PHP?
a. The isset() function is used to check whether the cariable is string or not
b. The isset() function is used to check whether variable is set or not
c. None of the above
d.The isset() function is used to check wheter the variable is free or not
b. The isset() function is used to check whether variable is set or not
<?php
$mcg = 1;
switch (print $mcg)
{
case 2:
print “HTML”;
break;
Case 1:
print “CSS”;
break;
default:
print “JavaScript”;
}
?>
a. 1CSS
b. error
c. 1HTML
d. 1JavaScript
a. 1CSS
<?php
function constant()
{
define (“GREETING”, “Welcome to PhilSCA”
echo greeting
}
?>
a. GREETING
b. ERROR
c. Welcome to PhilSCA
d. greeting
c. Welcome to PhilSCA