You are on page 1of 9

fsp quiz-4 Total points 16/20

Email *

badhri.82102031@srit.org

NAME:

Badhri S

1. What is PHP? * 1/1

a) PHP is an open-source programming language

d) All of the mentioned

c) PHP is a server-side scripting language

b) PHP is used to develop dynamic and interactive websites

2. Who is the father of PHP? 1/1

a) Drek Kolkevi

b) Rasmus Lerdorf

c) Willam Makepiece

d) List Barely
3. What does PHP stand for? * 1/1

a) PHP stands for Preprocessor Home Page

d) PHP stands for Personal Hyper Processor

c) PHP stands for Hypertext Preprocessor

b) PHP stands for Pretext Hypertext Processor

4. Which of the following is the correct syntax to write a PHP code? 0/1

a) <?php ?>

b) < php >

c) < ? php ?>

d) <? ?>

Correct answer

d) <? ?>

5. Which of the following is the correct way to add a comment in PHP 1/1
code?

a) #

b) //

c) /* */

d) All of the mentioned


6. Which of the following is the default file extension of PHP files? 1/1

a) .php

b) .ph

c) .xml

d) .html

7. How to define a function in PHP? * 1/1

d) data type functionName(parameters) {function body}

b) function {function body}

a) functionName(parameters) {function body}

c) function functionName(parameters) {function body}


8.What will be the output of the following PHP code? * 1/1

<?php

$x = 10;

$y = 20;

if ($x > $y && 1||1)

print "1000 PHP MCQ" ;

else

print "Welcome to Sanfoundry";

?>

c) 1000 PHP MCQ

b) Welcome to Sanfoundry

d) error

a) no output

9. Which is the right way of declaring a variable in PHP? 1/1

a) $3hello

b) $_hello

c) $this

d) $5_Hello
10. What will be the output of the following PHP program? 0/1

<?php

$fruits = array ("apple", "orange", array ("pear", "mango"),"banana");

echo (count($fruits, 1));

?>

a) 6

b) 5

c) 4

d) 3

Correct answer

a) 6

11 Which of the following is used to display the output in PHP? 1/1

a.echo

b.write

c. print

d. Both (a) and (c)


12 Which of the following is used for concatenation in PHP? 1/1

+ (plus)

* (Asterisk)

. (dot)

append()

13) Which of the following is the correct way to create a function in PHP? * 1/1

function myFunction ()

Create myFunction()

None of the above

New_function myFunction()

14.Which of the following function in PHP can be used to test the type of 1/1
any variable?

a. showtype()

b. gettype()

c. settype()

d. None of the above


15.What is the use of fopen() function in PHP? * 0/1

c. The fopen() function is used to open files in PHP

b. The fopen() function is used to open remote server

a. The fopen() function is used to open folders in PHP

d. None of the above

Correct answer

c. The fopen() function is used to open files in PHP

16. Which of the following is the correct way to open the file "sample.txt" *1/1
as readable?

fopen("sample.txt", "r+");

fopen("sample.txt", "r");

fopen("sample.txt");

fopen("sample.txt", "read");

17. Which of the following is a built-in function in PHP that adds a value *1/1
to the end of an array?

a. array_push()

b. inend_array()

c. into_array()

d. None of the above


18. What will be the output of the following program? * 1/1
<?php
$a;
if ($a) {
echo "hi";
}
else
{ echo "How are you";
} ?>

d. None of the above

a. Hi How are you

b. How are you

c. Hi

19..<?php 0/1

$a = array(16, 5, 2);

echo array_product($a);

?>

a.160

b.1652

c80

d.32

Correct answer

a.160
20.Which of the following is the correct way to print "Hello World" in PHP? * 1/1

None of the above.

echo "Hello World";

write("Hello World")

Hello World";write("Hello World");echo "Hello World";None of the above

This form was created inside of Sri Ramakrishna Institute of Technology. Report Abuse

Forms

You might also like