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

UNIT 4

UNIT 4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

UNIT 4

UNIT 4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

1.

What is the correct way to declare a variable in PHP

var myVariable

=myVariable

variable myVariable

int myVariable

2.Which of the following is a valid PHP variable name

variable

=variable name

variable name

variable name

3.What is the scope of a global variable in PHP

Global variables are only accessible within functions in which they are declared

=Global variables are accessible throughout the entire script


Global variables are only accessible in the file where they are defined

Global variables are accessible only within the function they are declared

4.Which of the following correctly accesses a global variable inside a function

=global myVariable

use myVariable

external myVariable

import myVariable

5. What is the default value of an uninitialized variable in PHP

=NULL

false
undefined

6.Which built-in function is used to find the length of a string in PHP

=strlen()

length()

size()

strsize()

7.Which PHP function is used to check if a variable is set and is not NULL

=isset()

isnull()

defined()

notnull()

}
8.What does the empty() function do in PHP

=It checks if a variable has no value

It removes all elements from an array

It sets a variable to NULL

It returns the size of an empty array

9. Which built-in function can be used to round a floating-point number to the nearest integer in
PHP

=round()

ceil()

floor()

int()

10.What does the explode() function do in PHP

=It splits a string into an array by a specified delimiter

It merges an array into a string with a specified separator

It removes whitespace from the beginning and end of a string


It checks if a string contains a specific substring

11.Which PHP function is used to validate if an email address is valid

is_email()

validate_email()

=filter_var()

check_email()

12.How can you check if a form field is empty in PHP

is_null()

=empty()

is_empty()

check_empty()

}
13.Which function can be used to strip tags from a string to prevent HTML injection in PHP

=strip_tags()

remove_tags()

anitize_string()

clean_string()

14.How do you validate if a form input is an integer in PHP

is_integer()

validate_integer()

=filter_var()

check_integer()

15.Which PHP function is used to trim whitespace from the beginning and end of a string
{

=trim()

strip()

clean()

remove()

16.What does XML stand for

=eXtensible Markup Language

eXtra Modern Language

eXecutable Markup Language

eXtreme Model Language

17.Which of the following is a valid XML element name

{
<123element>

<element-name>

<element name>

<element@name>

18.What is the purpose of the XML declaration at the beginning of an XML document

=To specify the version of XML and the encoding used

To define the document's root element

To specify the document's schema

To include external files

19.Which XML element is used to define a root element

<root>

<document>

<xml>

=There is no specific element; the root element is simply the first element in the document

}
20.What is an XML attribute used for

=To provide additional information about an element

To define the structure of the XML document

To specify the encoding of the XML document

To include comments in the XML document

21.What is the main purpose of a Document Type Definition in XML

=To define the structure and allowed elements of an XML document

To specify the visual style of XML data

To transform XML data into HTML

To encrypt XML data for security

22.What is the primary difference between DTD and XML Schema

=DTD is used for defining the structure of XML documents, while XML Schema also supports data
types and more complex validations

DTD supports more complex data types than XML Schema

XML Schema is used for styling XML data, while DTD defines the document's structure

There is no significant difference; they are interchangeable

23.Which XML Schema element is used to define a simple type

{
<xs:element>

<xs:complexType>

=<xs:simpleType>

<xs:attribute>

24. How do you define an element with optional occurrence in XML Schema

=Using minOccurs=0

Using optional=true

sing occurrence=none

Using occurs=0

25.Which of the following XML Schema elements is used to define an attribute for an element

=<xs:attribute>

<xs:element>
<xs:complexType>

<xs:simpleType>

26.What is the primary function of an XML parser

To convert XML documents into a different format

=To read and interpret XML documents according to the XML standard

To format XML documents for better readability

To encrypt XML documents for security

27.Which of the following is an example of an XML parser library in Java

=SAXParser

XMLParser

DOMParser

JSONParser

28.What is the primary purpose of XML validation

To ensure that XML documents are formatted correctly

=To confirm that XML documents conform to a specified structure or schema

To transform XML documents into HTML

To compress XML documents for storage


}

29.Which XML parsing method reads XML documents in a forward only manner

DOM

=SAX

XSLT

XQuer

30.What is XSLT used for in XML

To validate XML documents against a schema

=To transform XML documents into different formats like HTML or plain text

To parse XML documents and extract data

To define the structure of XML documents

You might also like