PHP 1

COEP
Lets Crack Online Exam

IT Interview Exam Paper: PHP 1

Subject: PHP 1

Part 1: List for questions and answers of PHP


Q1. What does PHP stand for? 

I) Personal Home Page 

ii) Hypertext Preprocessor 

iii) Pretext Hypertext Processor 

iv) Preprocessor Home Page

A) Both i) and iii)

B) Both ii) and iv)

C) Only ii)

D) Both i) and ii)

 

Q2. PHP files have a default file extension of..

A) .html

B) .xml

C) .php

D) .ph

 

Q3. A PHP script should start with ___ and end with ___:

A) < php >

B) < ? Php ?>

C) <? ?>

D) <?Php ?>

 

Q4. Which of the following is/are a PHP code editor? 

I) Notepad

ii) Notepad++ 

iii) Adobe Dreamweaver 

iv) PDT

A) Only iv)

B) i), ii) and iii)

C) Only iii)

D) All of the mentioned

 

Q5. Which of the following must be installed on your computer so as to run PHP script?

I) Adobe Dreamweaver 

ii) PHP 

iii) Apache

iv) IIS

A) All of the mentioned

B) Only ii)

C) ii) and iii)

D) ii), iii) and iv)

 

Q6. Which version of PHP introduced Try/catch Exception?

A) PHP 4

B) PHP 5

C) PHP 5.3

D) PHP 6 

 

Q7. We can use ___ to comment a single line?

I) /? 

Ii) //

iii) # 

iv) /* */

A) Only ii)

B) i), iii) and iv)

C) ii), iii) and iv)

D) Both ii) and iv)

 

Q8. Which of the following php statement/statements will store 111 in variable num? 

I) int $num = 111; 

ii) int mum = 111;

iii) $num = 111; 

iv) 111 = $num;

A) Both i) and ii)

B) All of the mentioned

C) Only iii)

D) Only i)

 

Q9. What will be the output of the following php code?

1.<?Php 

2.$num = 1; 

3.$num1 = 2;

4.print $num . “+”. $num1;5.?>

A) 3

B) 1+2

C) 1.+.2

D) Error

 

Q10. What will be the output of the following php code? 

1.<?Php 

2.$num = “1”; 

3.$num1 = “2”;

4.print $num+$num1; 5.?>

A) 3

B) 1+2

C) Error

D) 12

 

Q11. Which of following variables can be assigned a value to it? 

I) $3hello

ii) $_hello 

iii) $this

Iv) $This

A) All of the mentioned

B) Only ii)

C) ii), iii) and iv)

D) ii) and iv) 

 

Q12. What will be the output of the following code? 

1.<?Php 

2.$foo = ‘Bob’; 

3.$bar = &$foo;

4.$bar = “My name is $bar”; 

5.echo $bar;

6.echo$foo;

7.?>

A) Error

B) My name is bobbob

C) My name is bobmy name is Bob

D) My name is Bob Bob

 

Q13. Which of the following PHP 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) and ii)

B) i), ii) and iii)

C) All of the mentioned

D) i), ii) and iv)

 

Q14. What will be the output of the following PHP code?

1.<?Php

2.$color = “maroon”;

3.$var = $color[2];

4.echo “$var”;

5.?>

A) a

B) Error

C) $var

D) r

 

Q15. What will be the output of the following PHP code? 

1.<?Php 

2.$score = 1234;

3.$scoreboard = (array) $score; 

4.echo $scoreboard[0];?>

A) 1

B) Error

C) 1234

D) 2

 

Q16. What will be the output of the following PHP code?

1.<?Php

2.$total = “25 Students”;

3.$more = 10;4.$total = $total + $more;

5.echo “$total”;

6.?>

A) Error

B) 35 students

C) 35

D) 25 students 

 

Q17. Which of the below statements is equivalent to $add += $add ?

A) $add = $add

B) $add = $add +$add

C) $add = $add + 1

D) $add = $add + $add + 1

 

Q18. Which statement will output $x on the screen?

A) echo “\$x”;

B) echo “$$x”;

C) echo “/$x”;

D) echo “$x;”;

 

Q19. What will be the output of the following code?

1.<?Php

2.function track() {

3.static $count = 0;

4.$count++;

5.echo $count;

6.}

7.track();

8.track();

9.track();

10.?>

A) 123

B) 111

C) 000

D) 011

 

Q20. What will be the output of the following PHP code?

1.<?Php

2.$a = “clue”;

3.$a .= “get”;

4.echo “$a”;

5.?>

A) get

B) true

C) false

D) clueget 

 

Part 1: List for questions and answers of PHP

 

Q1. Answer: d

 

Q2. Answer: c

 

Q3. Answer: d

 

Q4. Answer: b

 

Q5. Answer: d

 

Q6. Answer: b

 

Q7. Answer: c

 

Q8. Answer: c

 

Q9. Answer: b

 

Q10. Answer: a

 

Q11. Answer: d

 

Q12. Answer: c

 

Q13. Answer: b

 

Q14. Answer: d

 

Q15. Answer: c

 

Q16. Answer: c

 

Q17. Answer: b

 

Q18. Answer: a

 

Q19. Answer: a

 

Q20. Answer: d