wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

TCS693 FSWD PHP Test 2023

Total questions: 54

Worksheet time: 41mins

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.

In php the keyword to be used before function name is

a)

Function

b)

Static

c)

function

d)

FUNCTION

5.

<?php

function add()

{

global $a=10;

echo $a;

}

add();

$a+=10;

?>

Output is

a)

10

b)

15

c)

20

d)

30

6.

$a="deepan";

$b="Deepan";

if(strcmp($a,$b))

{

echo "equal";

}

else{

echo " not equal";}

Output is

a)

Equal

b)

Not equal

c)

Error

d)

None

7.

What type of language is PHP

a)

Client Side

b)

Server Side

c)

Browser Side

d)

Web Side

8.

PHP is executed on

a)

The Server

b)

The Browser

c)

The Website

d)

The Machine

9.

We store small snippets of information inside what?

a)

Functions

b)

Loops

c)

If Statements

d)

Variables

10.

We create re-usable code blocks by placing them inside?

a)

Variables

b)

Parameters

c)

Code Blocks

d)

Functions

11.

Sometimes we only want certain code to execute if a condition is true. How do we test for that?

a)

Loop

b)

If Statement

c)

Integer

d)

Variable

12.

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

13.

What is a String?

a)

Text

b)

Number

c)

True

d)

Loop

14.

What is a Boolean

a)

It's Just Text

b)

It's a Number

c)

It's Just True

d)

It's True or False

15.

What if we want a block of code to execute several times?

a)

Use a Variable

b)

Use a Function

c)

Use a Loop

d)

Use a Leap

16.

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

a)

$colours[0];

b)

$colours[2];

c)

$colours[1]

d)

$colours[3];

17.

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

a)

$name;

b)

include $name;

c)

echo $name;

d)

echo $name

18.

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

a)

sayMyname();

b)

$sayMyName;

c)

$sayMyName();

d)

sayMyName("John")';

19.

What does i++ do ?

a)

Adds the text on to the end of i

b)

Adds i on to the end of something

c)

Adds i on to the existing value of i

d)

Adds 1 to the current value of iThis is a correct answer

20.

What type of variable is this: $isMale = false;

a)

Integer

b)

Boolean

c)

String

d)

char

21.

In an IF statement we can have 2 conditions tested. Which keyword allows this?

a)

Else

b)

if Else

c)

Else if

d)

OR

22.

$a = 4 ; $b = 6; $c = $a + $b; What is the value of variable "c" ?

a)

6

b)

8

c)

10

d)

None

23.

$a = "Ram"; $n = "Kumar"; $fullName = $f + $n; What is the value of $fulName

a)

RamKumar

b)

Ram Kumar

c)

Ram

d)

None

24.

$a = "Ram"; $n = "Kumar"; $fullName = $f . $n; What is the value of $fulName

a)

RamKumar

b)

Ram Kumar

c)

Kumar

d)

None

25.

function declarations can have (a)   assigned to them?

26.

Function calls can have____________ inside them.

a)

Parameters

b)

Arguments

c)

Variables

d)

Types

27.

$a = "Ram"; $n = "Kumar"; $fullName = $f + $n; What is the value of $fulName

a)

RamKumar

b)

Ram Kumar

c)

Ram

d)

None

28.

$a = "Ram"; $n = "Kumar"; $fullName = $f . $n; What is the value of $fulName

a)

RamKumar

b)

Ram Kumar

c)

Kumar

d)

None

29.

PHP is a ............

a)

Open Source Language

b)

Widely Used Language

c)

Server side scripting language

d)

All of the above

30.

Which of the following is used to create a session?

a)

session_destroy() function

b)

session_start() function

c)

$_SESSION[]

d)

isset() function

31.

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

a)

CREATE TABLE table_name (column_type column_name);

b)

CREATE table_name (column_type column_name);

c)

CREATE TABLE table_name (column_name column_type);

d)

CREATE table_name (column_name column_type);

32.

Which of the following is the use of strlen() function in PHP?

a)

The strlen() function returns both value and type of string

b)

The strlen() function returns the length of string

c)

The strlen() function returns the type of string

d)

The strlen() function returns the value of string

33.

Which of the following function is used to set cookie in PHP?

a)

createcookie()

b)

makecookie()

c)

set cookie()

d)

None of the above

34.

What will be the output of the following program?

<?php

$a = 15;

function show() {

$a = 20; echo "$a";

}

show();

echo "$a";

?>

a)

2020

b)

2015

c)

1515

d)

0

35.

How many Primary keys can have in a table?

a)

Only 1

b)

Only 2

c)

Depends on no of Columns

d)

Depends on DBA

36.

What ways to use WordPress?

a)

Content Management System (CMS)

b)

Blog

c)

Arcade

d)

All of the above

37.

Wordpress is a

a)

CMS

b)

Tool

c)

Programming Language

d)

Framework

38.

Which of the following function converts a string to all uppercase?

a)

upper()

b)

strtoupper()

c)

struppercase()

d)

uppercase()

39.

What will be the output of the following program?

<?php  

$var1 = "Hello";  

$var2 = "World";  

echo "$var1$var2";  

?>

a)

HelloWorld

b)

Hello World

c)

"$var1$var2"

d)

None of the above

40.

What will be the output of the following program?

<?php  

$a;  

if ($a)  

{  

echo "hi";  

}  

else  

{  

echo "How are you";  

}  

?>  

a)

How are you

b)

Hi How are you

c)

Hi

d)

None of the above

41.

Which of the following variable is used to generate random numbers using PHP?

a)

srand()

b)

random()

c)

rand()

d)

None of the above.

42.

What does PHP stand for?

a)

Personal Hypertext Processor

b)

Hypertext Preprocessor

c)

Private Home Page

43.

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

a)

Request.QueryString;

b)

$_GET[];

c)

Request.Form;

d)

None of the above

44.

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

a)

FALSE

b)

TRUE

45.

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

a)

$GLOBALS

b)

$_GET

c)

$_SERVER

d)

$_SESSION

46.

What is the step to create database?

a)

Open localhost/phpmyadmin/

b)

Open NetBeans/New Project/

c)

Open browser/Notepad++

47.

Who is the father of PHP?

a)

Drek Kolkevi

b)

Willam Makepiece

c)

List Barely

d)

Rasmus Lerdorf

48.

Which function is used to open a file

a)

fopen(filename, mode of opening file)

b)

fopen(file, mode of reading file)

c)

open(filename, mode of opening file)

d)

none

49.

if there is fopen function in program then there should always be

a)

fread()_

b)

fwrite()

c)

fclose()

d)

none

50.

!feof stands for

a)

file end of file

b)

not file end of file

c)

exlamatory file end of file

d)

none

51.

fread() reads contents of file

a)

word by word till eof

b)

paragraph by paragraph till end of file

c)

line by line till eof

d)

none

52.

When fwrite is used on already existing file the what will happen

a)

new contents added to previous file contents

b)

previous file contents deleted and new contents added

c)

error displayed

d)

none

53.

when you try to open a non existing file then

a)

error

b)

statement file not available

c)

question should i open new file in given name popped

d)

new file will be created in the given name

54.

Can values got from forms in html be given to php

a)

sometimes

b)

yes

c)

no

d)

none