0% found this document useful (0 votes)
5 views

WEB PHP MCQ

The document consists of multiple-choice questions covering various aspects of PHP programming, including syntax, functions, control structures, and error handling. Each unit presents a set of questions designed to test knowledge on specific PHP topics, such as variable types, array handling, and built-in functions. The questions are structured to assess understanding of PHP concepts and their applications.

Uploaded by

gugtenterf0irsi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

WEB PHP MCQ

The document consists of multiple-choice questions covering various aspects of PHP programming, including syntax, functions, control structures, and error handling. Each unit presents a set of questions designed to test knowledge on specific PHP topics, such as variable types, array handling, and built-in functions. The questions are structured to assess understanding of PHP concepts and their applications.

Uploaded by

gugtenterf0irsi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

UNIT - 01

1. The _______________ syntax of the language specifies such things as what variable names
look like, what characters are used for comments, and how program statements are
separated from each other.
A. Highest-level
B. Lowest-level
C. Slow-level
D. Fast-level

2. What does PHP stand for?


A. Pretext Hypertext Processor
B. Hypertext Preprocessor
C. Preprocessor Home Page
D. Personal Home Paging

3. PHP is an example of ___________ scripting language.


A. Browser-side
B. Client-side
C. In-side
D. Server-side

4. PHP mascot is a/an ___________.


A. Elephant
B. Fish
C. Cat
D. Rhinoceros

5. Which of the following is NOT an application of PHP?


A. PHP can handle forms, that is, gather data from files, save data to a file, through email you
can send data, return data to the user.
B. Allows to add, delete, modify elements within your database through PHP.
C. Can access cookies variables and set cookies.
D. You cannot restrict users to access some pages of your website.

6. Which of the following corresponds to the characteristic(s) of PHP?


A. Loosely typed language
B. Web server support
C. Platform independence
D. All of the above

7. Which of the following is the default file extension of PHP?


A. .hphp
B. .php
C. .xml
D. .html

8. Which of the following starts with __ (double underscore) in PHP?


A. Inbuilt constants
B. User-defined constants
C. Magic constants
D. Default constants

9. _____________ is a cross-platform application that can run on Windows, Linux, and macOS.
A. HAMP
B. Hadoop
C. XAMPP
D. WampServer

10. Variables in PHP are case-sensitive.


A. True
B. False

11. The PHP var_dump() function returns the ___________.


A. Value only
B. Datatype only
C. Datatype and value both
D. None of the above

12. _____________ operator is used to assign the value to a variable.


A. Logical
B. Assignment
C. Unary
D. Equivalent

13. In PHP, the variables start with _____?


A. &
B. $
C. #
D. %

14. Which of the following is not a variable scope in PHP?


A. Extern
B. Local
C. Static
D. Global

15. PHP ____________ operators are used to combine conditional statements.


A. Assignment
B. Arithmetic
C. Array
D. Logical

UNIT-02
Here are the questions with their options:

1. _____________ statements are the set of commands used to perform different actions
based on different conditions.
A. Assignment
B. Operational
C. Conditional
D. Indictive

2. A ____________ statement allows a program to evaluate an expression and attempt to


match the expression’s value to a case label.
A. Case
B. Labelling
C. Levelling
D. Switch

3. _____________ statement is executed whether condition is true or false. It executes one


block of code if the specified condition is true and another block of code if the condition is
false.
A. Do-while
B. While
C. If-else
D. Switch

4. Two broad types of control structures are branching and __________.


A. Looping
B. Structuring
C. Coding
D. None of the above

5. Which of the following is/are decision making statement(s) in PHP?


A. If...else statement
B. Else if
C. Switch
D. All of the above

6. ___________ statement loops through a block of code for each element in an array.
A. For
B. For each
C. Each
D. Each block

7. The loop that executes a block of code repeatedly until the condition is false. Once the
condition gets false, it exits from the body of the loop.
A. While
B. Switch
C. Case
D. If

8. ____________ loop is called as an entry control loop because the condition is checked
before entering the loop body.
A. Do-while
B. If
C. For each
D. While
9. Which of the following loops uses a semicolon to terminate the loop?
A. while
B. do-while loop
C. for
D. for each

10. Supposing that the developer has to develop a program and knows in advance how many
times the script should run. The developer will be using
A. Switch
B. For each
C. For loop
D. None of the above

11. In the XML style, you normally embed PHP in a document through what is commonly called a
PHP statement, but is actually an ____________.
A. XML header
B. XML footer
C. XML docs
D. XML directive

12. Line breaks are allowed within the XML processing directive.
A. True
B. False

13. ______________ tag has been invented to allow client-side scripting within HTML pages.
A. .aspx
B. .php
C. Script
D. Embed

14. SGML stands for


A. Simple Generalized Mark-up Language
B. Standard Generalized Mark-up Language
C. Simple General Machine Language
D. Standardized General Machine Language

15. An XML processing directive is a command embedded in an XML document for some
application to process.
A. True
B. False

UNIT – 03

Here are the questions with their options:

1. PHP array is an ___________ map and contains value on the basis of key.
A. Isolated
B. Ordered
C. Unordered
D. Emergent
2. A class is a template for objects, and an object is an instance of a class.
A. True
B. False

3. Which of the following function gets the name of the class of the given object?
A. get_class()
B. name_class()
C. classname_get()
D. none of the above

4. ____________ function checks if all of the characters in the provided string, text, are
lowercase letters.
A. type_lower()
B. lower()
C. str_lower()
D. ctype_lower()

5. Which of the following is used to create a PHP array?


A. arr() function
B. ary() function
C. array() function
D. arrays() function

6. Ceil() function rounds fractions down and floor() function rounds fractions up.
A. True
B. False

7. The _________ function changes the permissions of the specified file and returns true on
success and false on failure.
A. chdir()
B. chmod()
C. permit()
D. chperm()

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


A. The strlen() function returns the type of string.
B. The strlen() function returns the length of string.
C. The strlen() function returns the value of string.
D. The strlen() function returns both value and type of string.

9. Which of the following function is used to get the ASCII value of a character in PHP?
A. val()
B. asc()
C. ascii()
D. chr()

10. Syntax errors are caught by the compiler.


A. True
B. False

11. __________ error occurs when the PHP compiler understands the PHP code but it recognizes
an undeclared function. This means that function is called without the definition of function.
A. Parse
B. Semantic
C. Fatal
D. Syntax

12. Which of the following is/are error(s) that can be handled by PHP error handling functions?
A. Parse errors
B. Fatal error
C. Syntax Error
D. All of the above

13. Which of the following statement is/are true for the date and time functions in PHP?
A. Allow you to get the date and time from the server where your PHP scripts are running.
B. Allow you to format the date and time in many different ways.
C. Allow you to modify the date.
D. All of the above

14. ____________ extension is used to read/retrieve the contents of an XML document.


A. XMLReader
B. XMLReading
C. ReadXML
D. RetrieveXML

15. In PHP call by reference, in order to pass value as a reference, you need to use
_____________ symbol before the argument name.
A. hash (#)
B. ampersand (&)
C. sigil ($)
D. power (^)

UNIT – 04

Here are the answers for the self-assessment questions with options:

1. Which of the following statement(s) is/are true for a variable in PHP?


A. In PHP, a variable is an identifier which holds a value.
B. In PHP language, a variable can hold a string, a number, or various objects like a function
or a class.
C. Variable is a reference to a computer memory, where the value is stored.
D. All of the above.

2. In PHP, a variable name must start with a letter or __________ character.


A. Underscore (_)
B. Hash(#)
C. Power(^)
D. Double quotes (“)

3. In order to define a static variable, the ______________ keyword is used.


A. Stat
B. Non-variable
C. Static
D. No change

4. A PHP session is easily started by making a call to the _________ function.


A. session_go()
B. session_init()
C. session_start()
D. session_due()

5. PHP maintains an array where it stores all the global variables that we defined in an
application. Such an array is called __________ array.
A. Static
B. Global
C. Random
D. Fixed

6. $_SERVER is a PHP super global variable which holds information about _______.
A. Headers
B. Paths
C. Script locations
D. All of the above

7. Which of the following statement(s) is valid for global variables?


A. Global variables refer to any variable that is defined outside of the function.
B. Global variables can be accessed from any part of the script, that is, inside and outside of
the function.
C. Global variables can be declared just like other variables but it must be declared outside of
function definition.
D. All of the above

8. __________ function accepts variable reference and base parameters to return an integer by
converting variable type with respect to the base.
A. Intern ()
B. Internal ()
C. Include ()
D. Interval ()

9. ___________ function will print the array of data with more information to the browser such
as its length, type information.
A. var_dump()
B. dump()
C. echo()
D. printer()

10. ___________ function in PHP converts the value of a variable into a storable data format,
whereas, ________ is used to convert the storable data format back to its original form.
A. store (), unstore()
B. serialize(), unserialize()
C. convert (), unconvert()
D. varst(), dvarst()
11. Anonymous function is a function without any user-defined name. Such a function is also
called ___________ function.
A. Lambda
B. Variable
C. Anon
D. Close

12. The date_format() function returns ___________ which represents the date formatted
according to the specified format on successful formatting; otherwise, it returns false on
failure.
A. String
B. Character
C. ASCII
D. Float

13. Which function is used to return the date information?


A. date()
B. getdate()
C. time_date()
D. None of the above

14. The checkdate() function accepts _____________ as parameters and verifies whether it is a
Gregorian date or not.
A. Month of a date
B. Day of a date
C. Year of a date
D. All of the above

15. Which of the following statement is true for the date_timezone_set() function?
A. It accepts a DateTime object as a parameter.
B. It accepts a timezone object as parameter.
C. It sets the specified timezone to the given DateTime
D. All of the above

UNIT – 05

Here are the answers with options for the self-assessment questions:

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


A. upper ()
B. uppercase ()
C. struppercase()
D. strtoupper()

2. String values in PHP must be enclosed within


A. Double Quotes
B. Single Quotes
C. Both (a) and (b)
D. None of the above
3. Which of the following is the use of strlen() function in PHP?
A. The strlen() function returns the type of string
B. The strlen() function returns the length of string
C. The strlen() function returns the value of string
D. The strlen() function returns both value and type of string

4. Which of the following function is used to get the ASCII value of a character in PHP?
A. val()
B. asc()
C. ascii()
D. chr()

5. _____________ function removes whitespace and other predefined characters from the left
side of a string.
A. strim()
B. lefttrim()
C. ltrim()
D. lftrim()

6. The statement that aptly indicates the feature(s) for substr_count() function:
A. It counts the number of times a substring occurs in the given string.
B. It is a built-in function.
C. It is a case-sensitive function.
D. All of the above

7. Which of the following is the correct way to print "Hello World" in PHP?
A. "Hello World";
B. write ("Hello World");
C. echo "Hello World";
D. None of the above

8. The _____________ function is used to get the reverse version of any string.
A. strrev()
B. strrevs()
C. rev()
D. revstrr()

9. Which of the following statement(s) is true regarding the abs() function in PHP?
A. It is an inbuilt function in PHP which is used to return the absolute (positive) value of a
number.
B. It is identical to what we call modulus in mathematics.
C. Accepts single parameter value which holds the number whose absolute value you want
to find.
D. All of the above

10. The baseconvert() function is used to convert a:


A. String argument into floats
B. String argument into numbers
C. String argument into Boolean
D. String argument into arrays
11. The ______________ function returns square root of the given argument.
A. sqrt()
B. squareroot()
C. sqroot()
D. square()

12. ______________ function rounds the fractions up while __________ function rounds the
fractions down.
A. floor(), ceil()
B. ceil(), floor()
C. RoundUp(), RoundDown()
D. FracUp(), FracDown()

13. PHP offers 1000’s of built-in functions. The functions that offer a mechanism for the
developer to do some sort of mathematical calculations or similar stuff are:
A. Math functions
B. Formula functions
C. Calculate functions
D. Compute functions

14. The pi() function in PHP was introduced in


A. PHP 5 version
B. PHP 7 version
C. PHP 8 version
D. PHP 4+ version

15. Which of the following statement is/are true for pow() function in PHP?
A. It was introduced in PHP 4+ version.
B. It accepts two arguments say x and y. It calculates x raised to the power of y.
C. The return type is integer or float which depends upon the nature of the argument.
D. All of the above

UNIT – 06

Here are the answers with options for the self-assessment questions:

1. The statement that is true for PHP arrays is


A. An array is a series of elements of the same type placed in contiguous memory locations.
B. An array can be individually referenced by adding an index to a unique identifier.
C. An array is a type of data structure that allows us to store multiple elements of similar
data type under a single variable.
D. All of the above

2. By default, the index of an array in PHP starts from ______?


A. 0
B. 1
C. -1
D. 2
3. An array which contains single or multiple arrays within it and can be accessed via multiple
indices is
A. single-dimensional array
B. multi-dimensional array
C. Both A and B
D. None of the above

4. ____________ construct helps to initialize an array, building it from its arguments.


A. array()
B. initarray()
C. helloarray()
D. arry()

5. The array with a string index where instead of linear storage, each value can be assigned a
specific key is
A. Indexed array
B. Multi-dimensional array
C. Associative array
D. None of the above

6. Which of the following is also called as an array of arrays?


A. Multi-dimensional array
B. Single-dimensional array
C. Two-way array
D. Three-way array

7. An array is a series of elements of the same type placed in _____________ memory


locations that can be individually referenced by adding an index to a unique identifier.
A. Contiguous
B. Non-contiguous
C. Temporary
D. Indefinite

8. The indexed arrays used to store any type of elements have default index starting at
_________.
A. One
B. Zero
C. Two
D. Infinite

9. In array traversal, the ____________ function is invoked to restore the array pointer to the
first element in the array.
A. Reach
B. First
C. Reset
D. Support

10. The indexed arrays can be used to store any type of elements, but an index is always
a_________.
A. String
B. Date
C. Alphanumeric
D. Number

11. Array_merge function merges __________ into one array.


A. Two arrays
B. Three arrays
C. More than three arrays
D. Merges array with a string

12. Which function displays structured information about variables including its type and value?
A. Asort()
B. Ksort()
C. Sort()
D. Var_dump()

13. Which of the following statement represents arrays in PHP?


A. Arrays are helpful to create a list of elements of similar types.
B. Arrays can be accessed using their index or key.
C. Array is an ordered map.
D. All of the above.

14. ____________ function takes an array as input and splits that array into smaller chunks of
the given size.
A. array_break()
B. array_chunk()
C. array_crop()
D. array_cut()

15. Sorting of ___________ arrays includes arranging elements according to the keys or values.
A. Associative
B. Numeric
C. Indexed
D. Definite

UNIT - 07

Here are the answers with options for the self-assessment questions:

1. The process of converting the facts into meaningful information is termed as


A. Data processing
B. Data converging
C. Data analyzing
D. Data deduplication

2. A(n) ______________ database is one that can be dispersed or replicated among different
points in a network.
A. optical
B. analytical
C. distributed
D. back-end
3. MySQL database is of type
A. Access Jet Database Engine
B. Object-relational DBMS
C. General Public
D. Single platform database

4. A database is defined as “A collection of ____________ data items that can be processed by


one or more application programs”.
A. interrelated
B. non-related
C. sampling
D. factual

5. The database classification can be done on the basis of type of their content(s) like,
A. bibliographic
B. document-text
C. statistical
D. all of the above

6. The rows in the database table are called as ____________ that contain all the database
information.
A. Attributes
B. records
C. lines
D. links

7. ____________ database is one that is congruent with the data defined in object classes and
subclasses.
A. Convergent
B. Object-oriented programming
C. Class
D. Insecure

8. Columns in the database table are called____________.


A. records
B. aids
C. fields
D. links

9. MySQL is the most popular database system used with PHP. Which of the following
statement(s) is/are true for MySQL?
A. MySQL is a database system that runs on a server
B. MySQL uses standard SQL
C. MySQL compiles on a number of platforms
D. All of the above

10. The MySQL extension’s function names, parameters, error handling, and so on are
completely different from those of the other database extensions.
A. True
B. False
11. In MySQLi extension, the ‘i’ is abbreviation that stands for
A. impact
B. included
C. injected
D. improved

12. PDO is a PHP extension used for connecting to MySQL databases. Here, PDO stands for
A. PHP Data Obstacles
B. PHP Database Orientation
C. PHP Database Objects
D. PHP Data Objects

13. HTML form is a document which stores information of a user on a web server using
interactive controls.
A. True
B. False

14. Which of the following statement(s) is/are true?


A. XAMPP stands for cross-platform, Apache, MySQL, PHP, and Perl.
B. XAMPP is among the simple light-weight local servers for website development.
C. In PHP, we can connect to the database using localhost XAMPP web server.
D. All of the above

15. PHP ___________ method is a PHP super global variable which is used to collect data after
submitting the HTML form.
A. $_POSTING
B. $_POST
C. $_POSTAGE
D. $_SUPER

UNIT – 08

Here are the answers for the self-assessment questions:

1. ____________ Graphics are the representation of images as an array of pixels.


A. Raster
B. Vector
C. Line
D. Coordinate

2. ____________ graphics use geometrical primitives such as points, lines, curves, or polygons
to represent images.
A. Raster
B. Vector
C. Line
D. Coordinate

3. Which of the following is an attribute in the tag?


A. atl
B. agt
C. sco
D. src
4. Image files are composed of digital data in one of these formats that can be rasterized for
use on a computer display or printer. An image file format may store data in __________
format(s).
A. Uncompressed
B. Compressed
C. Vector
D. All of the above

5. Which of the following is/are major consideration(s) to choose the necessary file type?
A. Compression quality
B. Transparency
C. Documents
D. All of the above

6. A standard web page containing text and graphics is created through a series of HTTP
requests from the web browser, each answered by a response from the web server.
A. True
B. False

7. GD library is used for dynamic image creation. GD here stands for


A. Graph Designing
B. Graphic Design
C. Graphic Doppler
D. Graph Doppling

8. An image is a rectangle of ____________ of various colours.


A. Pixels
B. Values
C. Formats
D. Vertices

9. Imagecreatetruecolor() function is used instead of imagecreate() function because


imagecreatetruecolor() function creates high-quality images.
A. True
B. False

10. Imagecolorallocate() function is another inbuilt PHP function mainly used to implement a
new color to an image. It returns the color of an image in an RGB format which stands for
A. Red, Green, Black
B. Red, Green, Brown
C. Red, Green, Blue
D. Red, Green, Blended

11. In the imagepolygon() function syntax as “imagepolygon(Gd Image $image, array $points, int
$num_points, int $colour)”, the parameter that defines the total number of points or vertices
in the polygon is
A. array $points
B. $num_points
C. $image
D. $colour
12. In order to add the text in a TrueType font to an image, the function that can be used is:
A. Imagefontheight()
B. Imagettf()
C. Imagetext()
D. Imagettftext()

13. The function imagefontheight() retrieves the font height and returns the ___________ height
of a character in the specified font.
A. Pixels
B. Format
C. Vertice
D. Upper

14. _____________ Function helps to scale an image using the given new width and height.
A. Imagescalar()
B. Scaleimage()
C. Imagescale()
D. imgscl()

15. Which of the following function(s) can be used to resize the image in PHP?
A. ImageCopyResized()
B. ImageCopyResampled()
C. Imagescale()
D. All of the above

UNIT -09

Here are the answers for the self-assessment questions:

1. PDF stands for _______________.


A. Portable Document File
B. Portable Document Format
C. Portable Design Format
D. Portable Design File

2. ______________ is a data format that can be used to describe documents.


A. FPDF
B. TPDF
C. XPDF
D. PDF

3. Which of the following is/are true statement(s) for PDF?


A. PDF is commonly used as a format to exchange data, either complete pages that need to
be printed or advertisements that need to be included in a publication.
B. Popular for soft proofing and reviewing content, because there are applications that allow
you to make annotations on the PDF pages.
C. Adobe is the developer of PDF and has the capability to market software to create, edit,
and visualize PDF files.
D. All of the above

4. Which of the following is NOT an advantage of PDF?


A. PDF files can be device independent
B. PDF files can contain multimedia elements
C. PDF does not support cross-platform standard
D. PDF supports security

5. ______________ is a set of PHP code you include in your scripts with the require function, so
it doesn’t require any server-side configuration or support, meaning you can use it even
without support from your host.
A. FPDF library
B. XPDF library
C. Workgroup library
D. Session library

6. The addpage(orientation, paper size, rotation) is used for adding a page in a PDF using PHP.
The orientation attribute here can take ______________ layouts.
A. portrait
B. landscape
C. both
D. none of the above

7. In the setDrawColor(r,g,b) function, the “rgb” stands for


A. Red, golden, black
B. Red, green, brown
C. Red, green, blue
D. Red, green, black

8. The AliasNbPages([string alias]) defines


A. an alias for the margin of PDF pages.
B. an alias for the total number of pages.
C. an alias for the orientation of PDF pages.
D. an alias for the layout of PDF pages.

9. In the function, Settextcolor(int r , int g, int b), the minimum and maximum value taken by ‘r’,
‘g’ or ‘b’ can be
A. 0 and 255
B. 1 and 255
C. 0 and 125
D. 1 and 125

10. Which of the following is/are way(s) to alter the appearance of the text?
A. Bold
B. Underline
C. Italics
D. All of the above

11. ____________ function creates an internal link and returns its identifier.
A. setlink()
B. addLink()
C. internlink()
D. linker()
12. _______________ method is used to track the overall page count in the PDF document
before it is sent to the browser.
A. AliasNbPages()
B. trackPages()
C. PageCounter()
D. trackCount()

13. PHP helps to add images and graphics to the PDF pages using the inbuilt function such as
_______________.
A. imageSetting()
B. setImage()
C. imagePixel()
D. image()

14. In PHP, it is not possible to navigate across PDF pages.


A. True
B. False

15. The syntax, image(file, x, y, w, h, type, link) is used to insert an image in a PDF. The type
attribute can take _________ files.
A. JPG
B. GIF
C. PNG
D. All of the above

UNIT -10

Here are the answers for the self-assessment questions:

1. XML stands for


A. Extensible Markup Language
B. Extensible Makeup Language
C. Extendable Markup Language
D. Extendable Makeup Language

2. ______________ is a markup language and file format for storing, transmitting, and
reconstructing arbitrary data.
A. Orbit
B. XML
C. R programming
D. HTTP

3. Which of the following statement is/are true for an XML document?


A. An XML document is plain text.
B. Contains tags delimited by < and >.
C. Defines a set of rules for encoding documents in a format that is both human-readable
and machine-readable.
D. All the above.

4. ___________ is a markup language itself while ___________ provides a framework for


defining markup languages.
A. HTML, XML
B. XML, HTML
C. HTTP, XML
D. XML, HTTP

5. HTML is case insensitive while XML is case sensitive.


A. True
B. False

6. ___________ includes both a transformation language (XSLT) and a formatting language.


A. Extendable Style sheet Language
B. Extensible Style sheet Language
C. Extensible Stylus Setting Language
D. Extendible Stylus Setting Language

7. XML was designed to be a software and hardware independent tool used to transport and
store data, with focus on what data is.
A. True
B. False

8. Which of the following statement is/are true for XML?


A. XML is a programming language like C++ or Java.
B. XML is a markup specification language.
C. XML is case sensitive.
D. All the above.

9. The users can define their own tags in XML.


A. True
B. False

10. XML provides easy communication of the hierarchy of data elements using the ________
structure.
A. linked list
B. queue
C. tree
D. graph

11. The term DOM stands for


A. Distant Object Model
B. Document Object Model
C. Document Orbit Model
D. Development Object Model

12. Which of the following statement is/are true for DOM?


A. It is a cross platform and language neutral standard that defines how to access and
manipulate data in HTML, XHTML or XML.
B. DOM XML is used to access and manipulate XML documents.
C. It views the XML document as a tree-structure.
D. All the above.

13. ______________ is a language for transforming XML documents into different XML, HTML,
or any other format.
A. XSMT
B. XMTL
C. XSLT
D. XMIT

14. _____________ function is used for converting an XML string into an object, then output the
keys and elements of the object.
A. simplexml_convert_string()
B. simplexml_loadstring()
C. simplexml_output_string()
D. simplexml_set_string()

15. An XML parser is a program that translates the XML document into an XML DOM object.
A. True
B. False

UNIT – 11

Here are the answers for the self-assessment questions:

1. Which of the following is/are ways to include file in PHP?


A. include
B. requirement
C. inclusion
D. None of the above

2. ____________ generates a fatal error, i.e., E_COMPILE_ERROR, and stops the execution of
the script.
A. Include
B. Require
C. feof
D. fputs

3. The use of ________ does not stop the execution of the script even if any error occurs.
A. include
B. require
C. feof
D. fputs

4. ______ function reads a file and writes it to the output buffer.


A. fopen()
B. fclose()
C. readfile()
D. fread()

5. Which of the following statement is/are true for fopen()?


A. A better method to open files.
B. This function gives you more options than the readfile() function.
C. The first parameter of fopen() contains the name of the file to be opened and the second
parameter specifies in which mode the file should be opened.
D. All the above.
6. _____________ function is used to close an open file.
A. fclose()
B. fopen()
C. fclosure()
D. fopening()

7. The function used to read a single character from a file is _________.


A. fgetf()
B. fgetr()
C. fgetc()
D. sgetc()

8. Which of the following statement is TRUE for require?


A. Stop the execution of the script when an error occurs.
B. Gives a fatal error, (E_COMPILE_ERROR) along with the warning.
C. Mostly used when the file is mandatory for the application.
D. All the above.

9. The ___________ function is used to read a single line from a file.


A. fgets()
B. fgetc()
C. fgetr()
D. fgetf()

10. The _________ function is an inbuilt function in PHP which is used to remove the content
from the file by emptying it.
A. set()
B. link()
C. unset()
D. unlink()

11. ____________ function is used to write content of the string into file.
A. fwriter()
B. fwrite()
C. fcontent()
D. fstring()

12. When a file is opened in write mode, all the existing data in the file is erased and new data
can be written to the file using the fwrite() function.
A. True
B. False

13. The unset() command takes the ____________ as input and removes that element from the
array.
A. array key
B. array pointer
C. array element
D. array bound

14. Which of the following statement is/are TRUE for fputs() function?
A. It is an alias of the fwrite() function.
B. An inbuilt function which is used to write to an open file.
C. Returns the number of bytes written on success.
D. All the above.

15. Which of the following statement(s) aptly describes unlink() function?


A. Accepts only one argument, the file name.
B. Similar to UNIX C unlink() function.
C. Can be used to delete any file, completely erasing it from a directory so that the file no
longer exists.
D. All the above

UNIT -12

Here are the questions with their options:

1. ___________ is a PHP super global that can be used to collect the form data.
A. $_GETCH
B. $_POST
C. $_GETTING
D. $_GETFL

2. Which of the following statement is TRUE for POST method?


A. Data will be re-submitted (the browser should alert the user that the data are about to be
re-submitted).
B. Uses multipart encoding for binary data.
C. Parameters are not saved in browser history.
D. All the above.

3. Which of the following statement reflects, POST is better method than GET?
A. GET is more secure compared to POST.
B. Data is sent as a part of the URL in GET.
C. POST can be used for sending passwords or other sensitive information.
D. None of the above.

4. In ____________ method, data is not displayed in the URL.


A. POST
B. GET
C. GETCH
D. POSTCH

5. A _____________ is a document containing blank fields, that the user can fill the data or
user can select the data.
A. Form
B. Format
C. Formal
D. Session

6. ______ method can be used for sending data to the server.


A. POSTF
B. GET
C. GETF
D. POSTCH

7. In _____________ method, the parameters remain in the browser history.


A. GETF
B. POSTF
C. POSTCH
D. GET

8. The __________ method involves using the ASCII characters.


A. GETCH
B. GET
C. POST
D. POSTF

9. Which of the following statement is FALSE for GET method?


A. GET has no limitation. It allows using binary data.
B. Variables are displayed in the URL; it is possible to bookmark the page.
C. GET may be used for sending non-sensitive data.
D. All the above.

10. _____________ is a super global variable that returns the filename of the currently
executing script.
A. $_SERVER["PHP_SELFLESS"]
B. $_SERVER["PHP_SELF"]
C. $_SERVERFUL["PHP_SELF"]
D. $_SERVERLESS["PHP_SELF"]

11. Which of the following statement is/are TRUE for htmlspecialchars()?


A. Converts special characters to HTML entities.
B. Replaces HTML characters like < and > with &lt; and &gt;.
C. Prevents attackers from exploiting the code by injecting HTML or Javascript code (Cross-
site Scripting attacks) in forms.
D. All the above.

12. For form validation, you need to check whether the form has been submitted using
$_SERVER["REQUEST_METHOD"].
A. True
B. False

13. Which of the following statement is/are TRUE for PHP form validation?
A. It is the backend validation method.
B. It is also called as server-side validation.
C. It prevents entering invalid data into the input field.
D. All the above.

14. Which of the following correspond to the rules for creating form validation?
A. All the Input Fields must be required.
B. Email Address must be a valid format containing the "@" symbol.
C. The password must contain a combination of one uppercase & lowercase letter, a number,
special characters, and a minimum length of 8 characters. It will not accept any white spaces.
D. All the above.

15. Using the forms, the data can be collected from the user and can be sent directly to the
server through PHP scripting. The <form> element has two important attributes: action and
method.
A. True
B. False

UNIT -13

Here are the questions with their options:

1. Which of the following statement is TRUE for the session variables?


A. Session variables store the user information to be used across multiple pages (e.g.
username, favorite color, etc).
B. Session variables last until the user closes the browser.
C. Session variables hold information about one single user, and are available to all pages in
one application.
D. All the above.

2. The full form for SIDs is


A. Session Identifiers
B. Service Identifiers
C. Scope Identifiers
D. Set Identifiers

3. A ___________ is a way to store information (in variables) to be used across multiple pages.
A. Scope
B. Setter
C. Session
D. Spare

4. ______________ is a unique number which is used to identify every user in a session-based


environment.
A. Service Identifiers
B. Session Identifiers
C. Scope Identifiers
D. Set Identifiers

5. _________________ is a PHP global variable that is used for setting the session variable.
A. $_SETSESSION
B. $_SESSION
C. $_SESSION_GLOBAL
D. $_SESSIONSETUP

6. The session_start() function creates a session or resumes the current one based on a session
identifier passed via a ________ request, or passed via a cookie.
A. GET
B. GETCHS
C. GETCH
D. GETTS

7. The session_destroy() function is used to completely destroy a session.


A. True
B. False

8. Which of the following statement is correct for session_unset()?


A. It deletes only the variables from session and session still exists.
B. Only data is truncated.
C. The syntax for the unset() is bool session_unset(void).
D. All the above.

9. The function used to destroy all the data associated with the current session is _________.
A. session_unset()
B. session_current()
C. session_destroy()
D. currentsession_destroy()

10. The cookie is created at the server side and saved to the client browser. Each time when the
client sends a request to the server, the cookie is embedded with the request.
A. True
B. False

11. A cookie in PHP is a small file with a maximum size of 4KB that the __________ stores on the
client computer.
A. Web browser
B. Web server
C. Network
D. Cacher

12. Which of the following is not a parameter in setcookie() function?


A. Name
B. Value
C. Timer
D. Path

13. ___________ function is used to check whether a cookie is set or not?


A. isset()
B. unset()
C. cookie_set()
D. cookieset_check()

14. You cannot delete a cookie by calling setcookie() function with the cookie name and any
value.
A. True
B. False

15. ___________ parameter is used to set the expiry timestamp of the cookie after which the
cookie can’t be accessed.
A. Timer
B. Session
C. Timestamping
D. Expiry

UNIT -14
Here are the questions with their options:

1. MySQL database is of type


A. Access Jet Database Engine
B. Object-relational DBMS
C. General Public
D. Single platform database

2. ______________ database is one that is congruent with the data defined in object classes
and subclasses.
A. Convergent
B. Object-oriented programming
C. Class
D. Insecure

3. MySQL is the most popular database system used with PHP. Which of the following
statement(s) is/are true for MySQL?
A. MySQL is a database system that runs on a server
B. MySQL uses standard SQL
C. MySQL compiles on several platforms
D. All the above

4. The MySQL extension’s function names, parameters, error handling, and so on are
completely different from those of the other database extensions.
A. True
B. False

5. In MySQLi extension, the ‘i’ is abbreviation that stands for


A. Impact
B. Included
C. Injected
D. Improved

6. Which of the following statement(s) is/are true?


A. XAMPP stands for cross-platform, Apache, MySQL, PHP, and Perl.
B. XAMPP is among the simple light-weight local servers for website development.
C. In PHP, we can connect to database using localhost XAMPP web server.
D. All the above.

7. PHP provides an additional set of predefined arrays containing variables from the web server,
the environment, and user input. The new arrays are called as_____________.
A. Varglobal
B. Subglobals
C. Superglobals
D. Preset globals
8. ________ is an associative array of items uploaded to the current script via the HTTP POST
method.
A. $_DELETE
B. $_SETTING
C. $_FILES
D. $_GET

9. ____________ is an associative array consisting of the contents of $_GET, $_POST, and


$_COOKIE.
A. $_REQUEST
B. $_SET
C. $_DELETE
D. $_SETTING

10. Which of the following statement is TRUE for the $_SERVER?


A. This is an array containing information such as headers, paths, and script locations.
B. The entries in this array are created by the web server.
C. There is no guarantee that every web server will provide any of these.
D. All the above.

11. ___________ is a programmer-defined data type, which includes local functions as well as
local data.
A. Class
B. Pointer
C. Degree
D. Inheritance

12. An object is also called as a(n) ________.


A. Class
B. Instance
C. Extraction
D. Domain

13. Which of the following statement aptly indicates the member variables?
A. Member variables are defined inside a class.
B. The data will be invisible to the outside of the class and can be accessed via member
functions.
C. Member variables are also called attributes of the object once an object is created.
D. All the above.

14. Polymorphism is an object-oriented concept where the same function can be used for
different purposes.
A. True
B. False

15. Any representation of data in which the implementation details are hidden represents
_____________.
A. Data extraction
B. Data exclusion
C. Data abstraction
D. Data surfacing

You might also like