lms prelim quiz Flashcards

1
Q

What does PHP stands for?

A

Hypertext Preprocessor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which PHP statement will give output $x on the screen?

a. echo “/$x”;
b. echo “$x”;
c. echo “$x;”;
d. echo “$$x”;

A

b. echo “$x”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which of the following is the correct way to add a comment in PHP code?

a. /**/
b. #
c. All of the Method

A

c.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the port use by MySQL?

A

3306

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What version of PHP introduced the advanced concepts of OOP?

A

PHP 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

<?php
$a = “$winner”;
$b = “/$looser”;
echo $a, $b;
?>

a. /$looser
b. $winner/$loosesr
c./
d. $looser

A

c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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)

A

b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What will be the output of the following PHP code?

<?php
define(“GREETING”, “PHP is a scripting language”);
echo $GREETING;
?>

A

no output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is used to end a statement in PHP

A

semicolon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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

a. memory_get_usage()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which of the following is not a variable scope in PHP

a. Static
b. Global
c. Loal
d. Extern

A

D. extern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the following is used for concatenation in PHP

a. .(dot)
b. append()
c. +(plus)
d. *(askterisk)

A

a. .(dot)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

String values in PHP must be enclosed within

A

Double quotes and single quotes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which is the right way of declaring a variable in PHP?

a. $_hello
b. $3hello
c. $5_Hello
d.$this

A

a. $_hello

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the default file extension of PHP file?

A

.php

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

<?php
$i = 5;
while (–$i > 0 && ++$i)
{
print $i;
}
?>

a. 54321
b. 5
c. error
d. 5555555…infinitely

A

d. 5555555…infinitely

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does PDO stands for?

A

PHP Data Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

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

A

b. testvalue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What will be the output of the following PHP code?
<?php
$a = 12;
–$a;
echo $a++
?>

a. 12
b. 11
c. 10
d. error

A

b. 11

20
Q

it is used to display the output in PHP

A

Print
echo

21
Q

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

A

b. 35

22
Q

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

A

d. clueget

23
Q

What is the port 443?

A

https

24
Q

Which of the following is the correct syntax to write a PHP code?
a. <? ?>
b. < php >
c. <?php ?>
d. <? php ?>

A

c. <?php ?>

25
Q

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

a. r

26
Q

what symbol or syntax is a newline character?

A

\n

27
Q

A function in PHP which starts with __(doube underscore) is known as ______

A

Magic Function

28
Q

What is the IP Address of localhost?

A

127.0.0.1

29
Q
A
30
Q

Variable name in PHP starts with ______

A

$

31
Q

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

a. IIS

32
Q

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

A

b. All of the above

33
Q

<?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

a. I am PhilSCAn

34
Q

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

a. All of the mentioned

35
Q

What is the correct way to create a function in PHP?

A

function myFunction()

36
Q

Who is the father of PHP?

A

Rasmus Lerdorf

37
Q

What is the function is used to destroy a variable in PHP?

A

unset()

38
Q

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

A

c. 1

39
Q

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

a. function functionName(parameters)
{function body}

40
Q

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

A

c. 11111213

41
Q

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

a. My name is BobMy name is Bob

42
Q

String values in PHP must be encosed within

A

Double and Single quotes

43
Q

<?php
$x = 4;
$y = 3
$z = 1;
$z = $z + $x + $y;
echo “$z”;
?>

a. 8
b. $z
c. 15
d. 1

A

a. 8

44
Q

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

A

b. The isset() function is used to check whether variable is set or not

45
Q

<?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

a. 1CSS

46
Q

<?php
function constant()
{
define (“GREETING”, “Welcome to PhilSCA”
echo greeting
}
?>

a. GREETING
b. ERROR
c. Welcome to PhilSCA
d. greeting

A

c. Welcome to PhilSCA