Font size
WorksheetsTCS693 FSWD PHP Test 2023
Total questions: 54
Worksheet time: 41mins
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
In php the keyword to be used before function name is
Function
Static
function
FUNCTION
<?php
function add()
{
global $a=10;
echo $a;
}
add();
$a+=10;
?>
Output is
10
15
20
30
$a="deepan";
$b="Deepan";
if(strcmp($a,$b))
{
echo "equal";
}
else{
echo " not equal";}
Output is
Equal
Not equal
Error
None
What type of language is PHP
Client Side
Server Side
Browser Side
Web Side
PHP is executed on
The Server
The Browser
The Website
The Machine
We store small snippets of information inside what?
Functions
Loops
If Statements
Variables
We create re-usable code blocks by placing them inside?
Variables
Parameters
Code Blocks
Functions
Sometimes we only want certain code to execute if a condition is true. How do we test for that?
Loop
If Statement
Integer
Variable
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
What is a String?
Text
Number
True
Loop
What is a Boolean
It's Just Text
It's a Number
It's Just True
It's True or False
What if we want a block of code to execute several times?
Use a Variable
Use a Function
Use a Loop
Use a Leap
$colours = array("black, blue, Red, Green") - How do I access "Red" ?
$colours[0];
$colours[2];
$colours[1]
$colours[3];
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 tat function
sayMyname();
$sayMyName;
$sayMyName();
sayMyName("John")';
What does i++ do ?
Adds the text on to the end of i
Adds i on to the end of something
Adds i on to the existing value of i
Adds 1 to the current value of iThis is a correct answer
What type of variable is this: $isMale = false;
Integer
Boolean
String
char
In an IF statement we can have 2 conditions tested. Which keyword allows this?
Else
if Else
Else if
OR
$a = 4 ; $b = 6; $c = $a + $b; What is the value of variable "c" ?
6
8
10
None
$a = "Ram"; $n = "Kumar"; $fullName = $f + $n; What is the value of $fulName
RamKumar
Ram Kumar
Ram
None
$a = "Ram"; $n = "Kumar"; $fullName = $f . $n; What is the value of $fulName
RamKumar
Ram Kumar
Kumar
None
function declarations can have (a) assigned to them?
Function calls can have____________ inside them.
Parameters
Arguments
Variables
Types
$a = "Ram"; $n = "Kumar"; $fullName = $f + $n; What is the value of $fulName
RamKumar
Ram Kumar
Ram
None
$a = "Ram"; $n = "Kumar"; $fullName = $f . $n; What is the value of $fulName
RamKumar
Ram Kumar
Kumar
None
PHP is a ............
Open Source Language
Widely Used Language
Server side scripting language
All of the above
Which of the following is used to create a session?
session_destroy() function
session_start() function
$_SESSION[]
isset() function
Which one of the following statements is used to create a table?
CREATE TABLE table_name (column_type column_name);
CREATE table_name (column_type column_name);
CREATE TABLE table_name (column_name column_type);
CREATE table_name (column_name column_type);
Which of the following is the use of strlen() function in PHP?
The strlen() function returns both value and type of string
The strlen() function returns the length of string
The strlen() function returns the type of string
The strlen() function returns the value of string
Which of the following function is used to set cookie in PHP?
createcookie()
makecookie()
set cookie()
None of the above
What will be the output of the following program?
<?php
$a = 15;
function show() {
$a = 20; echo "$a";
}
show();
echo "$a";
?>
2020
2015
1515
0
How many Primary keys can have in a table?
Only 1
Only 2
Depends on no of Columns
Depends on DBA
What ways to use WordPress?
Content Management System (CMS)
Blog
Arcade
All of the above
Wordpress is a
CMS
Tool
Programming Language
Framework
Which of the following function converts a string to all uppercase?
upper()
strtoupper()
struppercase()
uppercase()
What will be the output of the following program?
<?php
$var1 = "Hello";
$var2 = "World";
echo "$var1$var2";
?>
HelloWorld
Hello World
"$var1$var2"
None of the above
What will be the output of the following program?
<?php
$a;
if ($a)
{
echo "hi";
}
else
{
echo "How are you";
}
?>
How are you
Hi How are you
Hi
None of the above
Which of the following variable is used to generate random numbers using PHP?
srand()
random()
rand()
None of the above.
What does PHP stand for?
Personal Hypertext Processor
Hypertext Preprocessor
Private Home Page
How do you get information from a form that is submitted using the "get" method?
Request.QueryString;
$_GET[];
Request.Form;
None of the above
In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:
FALSE
TRUE
Which superglobal variable holds information about headers, paths, and script locations?
$GLOBALS
$_GET
$_SERVER
$_SESSION
What is the step to create database?
Open localhost/phpmyadmin/
Open NetBeans/New Project/
Open browser/Notepad++
Who is the father of PHP?
Drek Kolkevi
Willam Makepiece
List Barely
Rasmus Lerdorf
Which function is used to open a file
fopen(filename, mode of opening file)
fopen(file, mode of reading file)
open(filename, mode of opening file)
none
if there is fopen function in program then there should always be
fread()_
fwrite()
fclose()
none
!feof stands for
file end of file
not file end of file
exlamatory file end of file
none
fread() reads contents of file
word by word till eof
paragraph by paragraph till end of file
line by line till eof
none
When fwrite is used on already existing file the what will happen
new contents added to previous file contents
previous file contents deleted and new contents added
error displayed
none
when you try to open a non existing file then
error
statement file not available
question should i open new file in given name popped
new file will be created in the given name
Can values got from forms in html be given to php
sometimes
yes
no
none
