wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PHP_BCA-III

Total questions: 50

Worksheet time: 25mins

Name
Class
Date
1.

Which tag is used for php

a)

<?php

?>

b)

<style>

c)

<php ?>

d)

<php

/php>

2.

What are the two types of array in php

a)

Indexed, sequence

b)

Associative, sequence

c)

Indexed, associative

d)

None

3.

$a=array("Timmy","Jimmy");

Is an example of

a)

Indexed array

b)

Associative array

c)

Sequence array

d)

None

4.

function add(&a)

{

$a=10;

echo $a;}

$a=33;

This is an example for

a)

Call by value

b)

Call by reference

c)

Both of the above

d)

None

5.

<?php

function add()

{

global $a=10;

echo $a;

}

add();

$a+=10;

?>

Output is

a)

10

b)

15

c)

20

d)

30

6.

$a="IT is favorite department";

$b=sub_string($a,"bes",7,14);

echo $b;

Output is

a)

IT is best department

b)

IT is bes department

c)

Error

d)

IT is favorite department

7.

Choose the correct option About HTML elements

a)

Elements in HTML describes the way of presenting the content in the browser.

b)

All elements must have atleast one attribute associated with it.

c)

Element names are case in-sensitive

d)

None of the above

8.

Which one of the following is a form element?

a)

text box.

b)

radio button.

c)

submit button.

d)

All of these.

9.

Choose the correct option.

a)

Default method in HTML is GET or POST

b)

Use of method attribute determines by which method the datas in the form will be submitted.

c)

Method can be POST or GET.

d)

Default method in HTML is GET.

10.

Which of the following tag is used for drop down list?

a)

<dropdown>

b)

<select>

c)

<option>

d)

<salect>

11.

What is the output of the PHP code.

<?php

$a=0;

$a = 5>2 ?$b=6 : $b=8;

print("$a $a");?>

a)

6

b)

66

c)

68

d)

88

12.

What is the output of the PHP code.

<?php

if(4>5)

{print("Hurray..");}

print("yes");

?>

a)

Yes

b)

hurray..yes

c)

Hurray..Yes

d)

none of the above

13.

What is the output of the PHP code.

<?php

if(-5) {

print("Germany\n");

}


if(' ')


{ print("Texas\n"); }


printf("ZING");

?>

a)

ZING

b)

Germany ZING

c)

Germany Texas ZING

d)

error

14.

What will be the output of the following PHP code?

< ?php

$total = "25 students";

$more = "students 10";

$total = $total + $more;

echo "$total" ;?>

a)

Error

b)

35 students

c)

35

d)

25

15.

How do I print out the values of the variable "name" ?

a)

$name;

b)

include $name;

c)

echo $name;

d)

echo $name

16.

function sayMyName(name) {} ; - How do I call that function

a)

sayMyname();

b)

$sayMyName;

c)

$sayMyName();

d)

sayMyName("John")';

17.

What is the correct output of the given code <?php

$NUM1 = 3;

$NUM2 = 4;

$NUM3 = $NUM1 ** $NUM2;

echo $NUM3;

?>

a)

12

b)

81

c)

Garbage Value

d)

None of the above

18.

Which of the following are comparison operators in PHP?

A. ==

B. !=

C. ===

D. <

a)

A and B

b)

C and D

c)

A,B and C

d)

A,B,C and D

19.

What is the Output?

<?php

#echo "Hello World"

echo "#Hello World";

?>

a)

Hello World #Hello World

b)

Hello World

c)

#Hello World

d)

Error

20.

What is the Output


<?php

$color=red;

echo "$color";

?>

a)

red

b)

$color

c)

No answer

d)

Error

21.

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

a)

TRUE

b)

FALSE

22.

Who is known as father of PHP

a)

Rasmus Lerdorf

b)

Brendan Eich

c)

Hakon Wium Lie

23.

Which of the following is not true?

a)

PHP can be used to develop web applications.

b)

PHP makes a website dynamic

c)

PHP can not be embedded into html.

24.

_______ is a concatenation operator in php

a)

+ (plus)

b)

+=

c)

. (dot)

25.

PHP is a case sensitive

a)

TRUE

b)

FALSE

26.

Create a cookie named "username".

a)

setcookie = ("username", "John", time() + (86400 * 30), "/");

b)

setcookie("username", "John", time() + (86400 * 30), "/");

c)

session("username", "John", time() + (86400 * 30), "/");

d)

setsession("username", "John", time() + (86400 * 30), "/");

27.

Create a session variable named "favcolor".

a)

$session["favcolor"] = "green";

b)

$_SESSION["favcolor"] = "green";

c)

$_SESSION["favcolor"] ["green"];

d)

$SESSION["favcolor"] ="green";

28.

PHP is executed on

a)

The Server

b)

The Browser

c)

The Website

d)

The Machine

29.

What type of language is PHP

a)

Client Side

b)

Server Side

c)

Browser Side

d)

Web Side

30.

What is a integer?

a)

It's a Whole Number

b)

It's a Decimal Number

c)

It's a True or False Declaration

d)

It's a String of Text

31.

$colours = array("black, blue, Red, Green") - How do I access "Red" ?

a)

$colours[0];

b)

$colours[2];

c)

$colours[1]

d)

$colours[3];

32.

What is the correct way to end a PHP statement?

a)

New Line

b)

</php>

c)

;

d)

.

33.

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

a)

Request.QueryString;

b)

Request.Form;

c)

$_GET[];

34.

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

a)

True

b)

False

35.

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

a)

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

b)

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

c)

open("time.txt");

d)

open("time.txt","read");

36.

PHP allows you to send emails directly from a script

a)

False

b)

True

37.

Which superglobal variable holds information about headers, paths, and script locations?

a)

$_GET

b)

$_SESSION

c)

$_SERVER

d)

$GLOBALS

38.

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

a)

False

b)

True

39.

The die() and exit() functions do the exact same thing.

a)

True

b)

False

40.

Which one of these variables has an illegal name?

a)

$my-Var

b)

$myVar

c)

$my_Var

41.

How do you create a cookie in PHP?

a)

setcookie()

b)

makecookie()

c)

createcookie()

42.

What

does PHP stand for?

a)

Private

Home Page

b)

Hypertext

Preprocessor

c)

Pretext

Hypertext Processor

d)

Preprocessor

Home Page

43.

Which

version of PHP introduced Try/catch Exception?

a)

PHP 4

b)

PHP 3

c)

PHP 6

d)

PHP 5 and later

44.

Which

of the following function of String object is used to match a regular

expression against a string?

a)

concat()

b)

match()

c)

search()

d)

replace()

45.

Which

one of the following databases has PHP supported almost since the beginning?

a)

Oracle

Database

b)

SQL

c)

SQL+

d)

MySQL

46.

Which

one of the following statements is used to create a table?

a)

CREATE

TABLE table_name (column_name column_type);

b)

CREATE

table_name (column_type column_name);

c)

CREATE

table_name (column_name column_type);

d)

CREATE

TABLE table_name (column_type column_name);

47.

Which

one of the following statements instantiates the mysqli class?

a)

mysqli

= new mysqli()

b)

$mysqli

= new mysqli()

c)

$mysqli->new.mysqli()

d)

mysqli->new.mysqli()

48.

Top 5 Websites Developed in PHP

a)

Facebook

b)

Yahoo

c)

Wordpress

d)

Mailchimp

e)

Flickr

49.

Javascript is ______ side scripting language

a)

server

b)

client

50.

Which of the following is used to create a session?

a)

A - session_start() function

b)

B - $_SESSION[]

c)

C - isset() function

d)

D - session_destroy() function