Вы находитесь на странице: 1из 10

Sub: PHP Faculty Name: Pritesh N Patel.

Multiple Choice Questions.

Questions: Answers:

1. What does PHP stand for?

a) Personal Home Pages

b) Private Home Page

c) Personal Hypertext Processor

d) Hypertext Pre-processor Ans : d

2. PHP server scripts are surrounded by delimiters, which?

a) <?php>...</?>

b)<?php…?>

c) <&>...</&>

d) <script>...</script> Ans : b

3. How do you write "Hello World" in PHP?

a) "Hello World";

b) echo "Hello World";

c) Document.Write("Hello World"); Ans : b

4. All variables in PHP start with which symbol?

a) $

b) !

c) & Ans : a

5. What is the correct way to end a PHP statement?

a) </php> b) New line

c) ; d) . Ans : c

6. The PHP syntax is most similar to:

a) Perl and C b) JavaScriptc) VBScript


Ans : a
7. How do you get information from a form that is submitted using the "get" method?

a) Request.Form;

b) Request.QueryString;

c) $_GET[]; Ans : c

8.When using the POST method, variables are displayed in the URL:

a) True

b) False Ans : b

9.In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:

a) True

b) False Ans : a

10.Include files must have the file extension ".inc"

a) False

b) True Ans : b

11.What is the correct way to include the file "time.inc" ?

a) <!--include file="time.inc"-->

b) <% include file="time.inc" %>

c) <?phpinclude_file("time.inc"); ?>

d) <?php require("time.inc"); ?> Ans : d

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

a) createmyFunction()

b) new_functionmyFunction()

c) functionmyFunction()

d) None of these Ans : c

13.What is the correct way to open the file "time.txt" as readable?

a) fopen("time.txt","r");b) open("time.txt");

c) fopen("time.txt","r+"); d) open("time.txt","read"); Ans : a


14.PHP allows you to send emails directly from a script

a) True

b) False Ans : a

15.What is the correct way to connect to a MySQL database?

a) dbopen("localhost");

b) mysql_open("localhost");

c) mysql_connect("localhost");

d) connect_mysql("localhost"); Ans:c

16.What is the correct way to add 1 to the $count variable?

a) $count++;

b) count++;

c) $count =+1

d) ++count Ans: a

17.What is a correct way to add a comment in PHP?

a) /*…*/

b) <!--…-->

c) *\..\*

d) <comment>…</comment> Ans : a

18.PHP can be run on Microsoft Windows IIS(Internet Information Server):

a) False

b) True Ans : b

19.In PHP, the die() and exit() functions do the exact same thing.

a) False

b) True Ans : b

20.Which one of these variables has an illegal name?

a) $my-Var

b) $myVar
c) $my_Var

d) None of these Ans : a

21.What does SQL stand for?

a) Structured Query Language

b) Structured Question Language

c) Strong Question Language

d) None of these Ans :a

22.Which SQL statement is used to extract data from a database?

a) OPEN

b) SELECT

c) GET

d) EXTRACT Ans :b

23.Which SQL statement is used to update data in a database?

a) MODIFY

b) SAVE AS

c) SAVE

d) UPDATE Ans : d

24. Which SQL statement is used to delete data from a database?

a) DELETE

b) COLLAPSE

c) REMOVE

d) None of these Ans : a

25.Which SQL statement is used to insert new data in a database?

a) INSERT NEW

b) ADD RECORD
c) ADD NEW

d) INSERT INTO Ans : d

26.With SQL, how do you select a column named "FirstName" from a table named "Persons"?

a) EXTRACT FirstName FROM Persons

b) SELECT Persons.FirstName

c) SELECT FirstName FROM Persons

d) None of these Ans : c

27.With SQL, how do you select all the columns from a table named "Persons"?

a) SELECT Persons

b) SELECT *.Persons

c) SELECT [all] FROM Persons

d) SELECT * FROM Persons Ans : d

28.With SQL, how do you select all the records from a table named "Persons" where the value of the
column "FirstName" is "Peter"?

a) SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'

b) SELECT * FROM Persons WHERE FirstName='Peter'

c) SELECT [all] FROM Persons WHERE FirstName='Peter'

d) SELECT * FROM Persons WHERE FirstName<>'Peter' Ans : b

30.The OR operator displays a record if ANY conditions listed are true. The AND operator displays a
record if ALL of the conditions listed are true.

a) False

b) True Ans : b

21. A web page or an image loading is an event.

a)True

b)False ans : a

22. _____is actions that can be detected by JavaScript.

a)Click

b)Action
c)Event

d)Load ans : c

23.Java scripts execute without preliminary compilation.

a)True

b)False ans : a

24. The HTML ______ tag is used to insert a JavaScript into an HTML page.

a)<scripting>

b)<script>

c)<javascript>

d)None of these ans : b

25. JavaScript is Case Sensitive

a)True

b)False ans : a

26. _______ is a special variable, which can hold more than one value, at a time.

a)Array b)Class

c)Structure d)None of these ans : a

27. The _______ object is used to manipulate a stored piece of text.

A)Text b) String

c)Number d)ASCII ans : b

28. Default statement is must in switch case.

a)True

b)False ans : b

29.What is the correct JavaScript syntax to write "Hello World"?

a) "Hello World";

b) ("Hello World");
c) document.write("Hello World");

d) response.write("Hello World"); Ans : c

30.Where is the correct place to insert a JavaScript?

a) Both the <head> section and the <body> section are correct

b) The <body> section

c) The <head> section

d) None of these Ans : a

31. PHP code is executed on the _______, and the plain HTML result is sent on to the ______.

a) Server, Browser b) Server, Client

c) Server, Server d) None of these ans : a

32. _______ function is used to return the length of string.

a) strlength() b) str()

c) len() d) strlen() ans : d

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

Echo strpos(“Hello World”,’World”);

a) 6 b)7

c)5 d)None of these ans : b

34. SSI stands for _____.

a) Script Side Includes b) Server Script Includes

c) Server Side Includes d) None of these ans : c

35. ____ is a key is used to uniquely identify the rows in the tables.

a) Foreign b) Primary

c) Auto Increment d) None of these ans : b

36. The ____ function is used to set a cookie.

a) getcookie() b) fetchcookie()

c) setcookie() d) setcokie() ans : c


37. A PHP _____ variable is used to store the information about, or change settings for a user
session.

a) Session b) Cookie

c) Section d) None of these ans : a

38. Which is the correct syntax of DATE()?

a) date(format) b) date(timestamp)

c) date(format,timestamp) d) None of these ans : c

39. What does HTML stand for?

a) Home Tool Markup Language

b) Hyper Text Markup Language

c) Hyperlinks and Text Markup Language ans : b

40. What is full form of ASP & JSP?

a) Active Server Pages, Java Server Pages

b) Action Server Pages, Java Server Pages

c) Active Server Pages, Just Server Pages

d) None of these ans : a

41. Which SQL keyword is used to sort the result-set?

a) ORDER b) SORT

c) ORDER BY d) SORT BY ans : c

42. With SQL, how can you return all the records from a table named "Persons" sorted descending
by "FirstName"?

a) SELECT * FROM Persons SORT BY 'FirstName' DESC

b) SELECT * FROM Persons SORT 'FirstName' DESC


c) SELECT * FROM Persons ORDER FirstName DESC

d) SELECT * FROM Persons ORDER BY FirstName DESC ans : d

43. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?

a) UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'

b) MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen

c) MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'

d) UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen' ans : d

44. What is Java Script?

a) Program b) Scripting Language

c) Tool d) None of these ans : b

45. Local variables are destroyed when you exit the function.

a) True b) False ans : a

46. Which event will be occur when user enter or leave the page?

a) OnFocus, OnBlur b) OnFocus, OnChange

c) OnLoad, OnUnload d) None of these ans : c

47. The _______ statement is used in conjunction with the aggregate functions to group the result-
set by one or more columns.

a) Group By b) Order By

c) Both a & B d) None of these ans : a

48. The _______ keyword is used in an SQL statement to query data from two or more tables.

a) Connect b) Join

c) SelfJoin d) GroupTable ans : b

49. If x+=y then what will be the similar statement?

a) y = y + x; b) x = x + y;

c) x = y; d) None of these; ans : b


50. Which method is secured for securing data in PHP?

a) $_POST b) $_GET

c) Both a & b d) None of these ans : a

Вам также может понравиться