Font size
WorksheetsPHP_BCA-III
Total questions: 50
Worksheet time: 25mins
Which tag is used for php
<?php
?>
<style>
<php ?>
<php
/php>
What are the two types of array in php
Indexed, sequence
Associative, sequence
Indexed, associative
None
$a=array("Timmy","Jimmy");
Is an example of
Indexed array
Associative array
Sequence array
None
function add(&a)
{
$a=10;
echo $a;}
$a=33;
This is an example for
Call by value
Call by reference
Both of the above
None
<?php
function add()
{
global $a=10;
echo $a;
}
add();
$a+=10;
?>
Output is
10
15
20
30
$a="IT is favorite department";
$b=sub_string($a,"bes",7,14);
echo $b;
Output is
IT is best department
IT is bes department
Error
IT is favorite department
Choose the correct option About HTML elements
Elements in HTML describes the way of presenting the content in the browser.
All elements must have atleast one attribute associated with it.
Element names are case in-sensitive
None of the above
Which one of the following is a form element?
text box.
radio button.
submit button.
All of these.
Choose the correct option.
Default method in HTML is GET or POST
Use of method attribute determines by which method the datas in the form will be submitted.
Method can be POST or GET.
Default method in HTML is GET.
Which of the following tag is used for drop down list?
<dropdown>
<select>
<option>
<salect>
What is the output of the PHP code.
<?php
$a=0;
$a = 5>2 ?$b=6 : $b=8;
print("$a $a");?>
6
66
68
88
What is the output of the PHP code.
<?php
if(4>5)
{print("Hurray..");}
print("yes");
?>
Yes
hurray..yes
Hurray..Yes
none of the above
What is the output of the PHP code.
<?php
if(-5) {
print("Germany\n");
}
if(' ')
{ print("Texas\n"); }
printf("ZING");
?>
ZING
Germany ZING
Germany Texas ZING
error
What will be the output of the following PHP code?
< ?php
$total = "25 students";
$more = "students 10";
$total = $total + $more;
echo "$total" ;?>
Error
35 students
35
25
How do I print out the values of the variable "name" ?
$name;
include $name;
echo $name;
echo $name
function sayMyName(name) {} ; - How do I call that function
sayMyname();
$sayMyName;
$sayMyName();
sayMyName("John")';
What is the correct output of the given code <?php
$NUM1 = 3;
$NUM2 = 4;
$NUM3 = $NUM1 ** $NUM2;
echo $NUM3;
?>
12
81
Garbage Value
None of the above
Which of the following are comparison operators in PHP?
A. ==
B. !=
C. ===
D. <
A and B
C and D
A,B and C
A,B,C and D
What is the Output?
<?php
#echo "Hello World"
echo "#Hello World";
?>
Hello World #Hello World
Hello World
#Hello World
Error
What is the Output
<?php
$color=red;
echo "$color";
?>
red
$color
No answer
Error
When using the POST method, variables are displayed in the URL:
TRUE
FALSE
Who is known as father of PHP
Rasmus Lerdorf
Brendan Eich
Hakon Wium Lie
Which of the following is not true?
PHP can be used to develop web applications.
PHP makes a website dynamic
PHP can not be embedded into html.
_______ is a concatenation operator in php
+ (plus)
+=
. (dot)
PHP is a case sensitive
TRUE
FALSE
Create a cookie named "username".
setcookie = ("username", "John", time() + (86400 * 30), "/");
setcookie("username", "John", time() + (86400 * 30), "/");
session("username", "John", time() + (86400 * 30), "/");
setsession("username", "John", time() + (86400 * 30), "/");
Create a session variable named "favcolor".
$session["favcolor"] = "green";
$_SESSION["favcolor"] = "green";
$_SESSION["favcolor"] ["green"];
$SESSION["favcolor"] ="green";
PHP is executed on
The Server
The Browser
The Website
The Machine
What type of language is PHP
Client Side
Server Side
Browser Side
Web Side
What is a integer?
It's a Whole Number
It's a Decimal Number
It's a True or False Declaration
It's a String of Text
$colours = array("black, blue, Red, Green") - How do I access "Red" ?
$colours[0];
$colours[2];
$colours[1]
$colours[3];
What is the correct way to end a PHP statement?
New Line
</php>
;
.
How do you get information from a form that is submitted using the "get" method?
Request.QueryString;
Request.Form;
$_GET[];
In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:
True
False
What is the correct way to open the file "time.txt" as readable?
fopen("time.txt","r");
fopen("time.txt","r+");
open("time.txt");
open("time.txt","read");
PHP allows you to send emails directly from a script
False
True
Which superglobal variable holds information about headers, paths, and script locations?
$_GET
$_SESSION
$_SERVER
$GLOBALS
PHP can be run on Microsoft Windows IIS(Internet Information Server):
False
True
The die() and exit() functions do the exact same thing.
True
False
Which one of these variables has an illegal name?
$my-Var
$myVar
$my_Var
How do you create a cookie in PHP?
setcookie()
makecookie()
createcookie()
What
does PHP stand for?
Private
Home Page
Hypertext
Preprocessor
Pretext
Hypertext Processor
Preprocessor
Home Page
Which
version of PHP introduced Try/catch Exception?
PHP 4
PHP 3
PHP 6
PHP 5 and later
Which
of the following function of String object is used to match a regular
expression against a string?
concat()
match()
search()
replace()
Which
one of the following databases has PHP supported almost since the beginning?
Oracle
Database
SQL
SQL+
MySQL
Which
one of the following statements is used to create a table?
CREATE
TABLE table_name (column_name column_type);
CREATE
table_name (column_type column_name);
CREATE
table_name (column_name column_type);
CREATE
TABLE table_name (column_type column_name);
Which
one of the following statements instantiates the mysqli class?
mysqli
= new mysqli()
$mysqli
= new mysqli()
$mysqli->new.mysqli()
mysqli->new.mysqli()
Top 5 Websites Developed in PHP
Yahoo
Wordpress
Mailchimp
Flickr
Javascript is ______ side scripting language
server
client
Which of the following is used to create a session?
A - session_start() function
B - $_SESSION[]
C - isset() function
D - session_destroy() function
