Advance PHP
1 of 4 sets
Chapter: OOP
1. --------is about writing procedures or functions that perform operations on the
data. Sol:
A. procedural programming
B. function programming
C. object oriented programming
D. class
Answer:A
m
2. while--------is about creating objects that containoboth data and functions. Sol:
. c
A. procedural programming
t e
B. function programming
a
C. object oriented programming
q M
D. method
c
Answer:C
M
3. A class is defined by using the---keyword, followed by the name of the class and
a pair
of curly braces ({}). All its properties and methods go inside the braces
Sol:
A. procedural programming
B. function programming
C. object oriented programming
D. class
Answer:D
4. ----are nothing without objects! We can create multiple objects from a class Sol:
A. procedural programming
B. function programming
C. object oriented programming
D. class
Answer:D
5. Each----has all the properties and methods defined in the class, but they will
have different property values.
A. object
B. $this
C. instanceof
D. class
Answer:A
6. -----of a class is created using the new keyword Sol:
A. object
B. $this
C. instanceof
D. class
Answer:A
7. The-----keyword refers to the current object, and is only available inside
methods Sol:
A. object
B. $this
C. instanceof
D. class
Answer:B
8. Objects of a class is created using the-----keyword Sol:
A. new
B. $this
C. instanceof
D. class
Answer:A
9. we change the value of the $name property? There are two ways: Inside the -----
&Outside the class
A. object
View all MCQ's at [Link]
B. $this
C. instanceof
D. class
Answer:D
10. You can use the----keyword to check if an object belongs to a specific class Sol:
A. object
B. $this
C. instanceof
D. class
Answer:C
11. A-----allows you to initialize an object's properties upon creation of the object
Sol:
A. constructor
B. in
C. instanceof
D. class
Answer:A
12. If you create a-----function, PHP will automatically call this function when you
create an object from a class.
A. __Construct()
B. ___Destruct()
C. oop
D. class
Answer:A
13. that the construct function starts with two underscores------- Sol:
A. __ ()
B. ___ ()
C. oop
D. class
Answer:A
View all MCQ's at [Link]
14. A------ is called when the object is destructed or the script is stopped or exited.
Sol:
A. constructor
B. destructor
C. oop
D. class
Answer:B
15. If you create a-----function, PHP will automatically call this function at the end
of the script
A. __Construct()
B. ___Destruct()
C. oop
D. class
Answer:B
16. Notice that the destruct function starts with------- Sol:
A. __Construct()
B. ___()
C. oop
D. class
Answer:B
17. -----function that is automatically called when you create an object from a class,
and a ---------function that is automatically called at the end of the script
A. __Construct() & __destruct()
B. ___Destruct()& input()
C. oop& procedure
D. class & object
Answer:A
18. ------stands for Object-Oriented Programming. Sol:
A. __Construct()
B. ___Destruct()
C. OOP
D. class
View all MCQ's at [Link]
Answer:C
19. -----and methods can have access modifiers which control where they can be
accessed Sol:
A. Properties
B. Destruct
C. OOP
D. class
Answer:A
20. -----the property or method can be accessed from everywhere. This is default
Sol:
A. Properties
B. public
C. protected
D. private
Answer:B
21. ------the property or method can be accessed within the class and by classes
derived from that class .
A. Properties
B. public
C. protected
D. private
Answer:C
22. ------the property or method can ONLY be accessed within the class Sol:
A. Properties
B. public
C. protected
D. private
Answer:D
23. --------in OOP When a class derives from another class. Sol:
A. inheritance
B. public
View all MCQ's at [Link]
C. protected
D. private
Answer:A
24. The-----will inherit all the public and protected properties and methods from
the parent class. In addition, it can have its own properties and methods.
A. inheritance
B. child class
C. protected
D. private
Answer:B
25. An inherited class is defined by using the------keyword Sol:
A. inheritance
B. public
C. extends
D. private
Answer:C
26. ---methods can be overridden by redefining the methods (use the same name) in
the child class.
A. inheritance
B. public
C. protected
D. private
Answer:A
27. The----keyword can be used to prevent class inheritance or to prevent method
overriding
A. final
B. constants
C. const
D. case-sensitive
Answer:A
28. ------cannot be changed once it is declared. Sol:
View all MCQ's at [Link]
A. final
B. constants
C. const
D. case-sensitive
Answer:B
29. Class constants can be useful if you need to define some-------data within a class
Sol:
A. final
B. constants
C. const
D. case-sensitive
Answer:B
30. A class constant is declared inside a class with the-----keyword. Sol:
A. final
B. constants
C. const
D. case-sensitive
Answer:C
31. Class constants are--------However, it is recommended to name the constants in
all uppercase letters.
A. final
B. constants
C. const
D. case-sensitive
Answer:D
32. We can access a-------from outside the class by using the class name followed by
the scope resolution operator (::) followed by the constant name
A. final
B. constant
C. const
D. case-sensitive
Answer:B
View all MCQ's at [Link]
33. -------classes and methods are when the parent class has a named method, but
need its child class(es) to fill out the tasks
A. abstract
B. child
C. interface
D. implement
Answer:A
34. An------class is a class that contains at least one abstract method Sol:
A. abstract
B. child
C. interface
D. implement
Answer:A
35. An------method is a method that is declared, but not implemented in the code.
Sol:
A. abstract
B. child
C. interface
D. implement
Answer:A
36. An abstract class or method is defined with the------keyword: Sol:
A. abstract
B. child
C. interface
D. implement
Answer:A
37. When inheriting from an------class, the child class method must be defined with
the same name
A. abstract
B. child
C. interface
D. implement
View all MCQ's at [Link]
Answer:A
38. if the-----method is defined as protected, the child class method must be defined
as either protected or public, but not private
A. abstract
B. child
C. interface
D. implement
Answer:A
39. The----class method must be defined with the same name and it re declares the
parent
abstract method
Sol:
A. abstract
B. child
C. interface
D. implement
Answer:B
40. The-----class method must be defined with the same or a less restricted access
modifier Sol:
A. abstract
B. child
C. interface
D. implement
Answer:B
41. The number of required arguments must be the same. However, the-----class
may have optional arguments in addition
A. abstract
B. child
C. interface
D. implement
Answer:B
View all MCQ's at [Link]
42. -----make it easy to use a variety of different classes in the same way. When one
or more classes use the same interface, it is referred to as "polymorphism"
A. abstract
B. child
C. interface
D. implement
Answer:C
43. Interfaces are declared with the------keyword. Sol:
A. abstract
B. child
C. interface
D. implement
Answer:C
44. ------cannot have properties, while abstract classes can Sol:
A. abstract
B. child
C. interface
D. implement
Answer:C
45. All------methods must be public, while abstract class methods is public or
protected Sol:
A. abstract
B. child
C. interface
D. implement
Answer:C
46. All methods in an-----are abstract, so they cannot be implemented in code and
the abstract keyword is not necessary
A. abstract
B. child
C. interface
D. implement
View all MCQ's at [Link]
Answer:A
47. -------keyword is used in interface Sol:
A. abstract
B. child
C. interface
D. implement
Answer:D
48. To implement an interface, a class must use the-------keyword. Sol:
A. abstract
B. child
C. interface
D. implement
Answer:D
49. A class that implements an interface must------all of the interface's methods.
Sol:
A. abstract
B. child
C. interface
D. implement
Answer:D
50. PHP only supports---------a child class can inherit only from one single parent.
A. abstract
B. child
C. interface
D. single inheritance
Answer:D
51. class needs to inherit multiple behaviors? OOP------is used to solve this
problem. Sol:
A. static
B. self
C. traits
View all MCQ's at [Link]
D. single inheritance
Answer:C
52. ------are used to declare methods that can be used in multiple classes. Traits can
have methods and abstract methods that can be used in multiple classes.
A. static
B. self
C. traits
D. single inheritance
Answer:C
53. Traits are declared with the----keyword Sol:
A. static
B. self
C. traits
D. single inheritance
Answer:C
54. ------methods can be called directly - without creating an instance of the class
first. Sol:
A. static
B. self
C. traits
D. single inheritance
Answer:A
55. Static methods are declared with the------keyword Sol:
A. static
B. self
C. traits
D. single inheritance
Answer:A
56. A class can have both static and non-static methods. A static method can be
accessed from a method in the same class using the-----keyword and double colon
(::)
View all MCQ's at [Link]
A. static
B. self
C. traits
D. single inheritance
Answer:B
57. ------properties can be called directly - without creating an instance of a class.
Sol:
A. static
B. self
C. traits
D. single inheritance
Answer:A
58. An iterable is any value which can be looped through with a-----loop. Sol:
A. foeach()
B. self
C. traits
D. single inheritance
Answer:A
59. The-----pseudo-type was introduced in PHP 7.1, and it can be used as a data
type for function arguments and function return values.
A. foeach()
B. self
C. iterable
D. single inheritance
Answer:C
60. The-----keyword can be used as a data type of a function argument or as the
return type of a function:
A. foeach()
B. self
C. iterable
D. single inheritance
Answer:C
View all MCQ's at [Link]
Chapter: Unit 2
61. ------is a superglobal that holds information regarding HTTP headers, path and
script location etc.
A. $_SERVER
B. SERVER_ADDR
C. SERVER_NAME
D. QUERY_STRING
Answer:A
62. All the server and execution environment related information is available in
this------ Sol:
A. associative array
B. SERVER_ADDR
C. SERVER_NAME
D. QUERY_STRING
Answer:A
63. -------This property of array returns The IP address of the server under which
the current script is executing.
A. $_SERVER
B. SERVER_ADDR
C. SERVER_NAME
D. QUERY_STRING
Answer:B
64. -------Name of server hostunder which the current script is executing Sol:
A. $_SERVER
B. SERVER_ADDR
C. SERVER_NAME
D. QUERY_STRING
Answer:C
65. -------A query string is the string of key=value pairs separated by & symbol and
appended to URL after ? symbol. For example,
[Link] URL returns trailing query string.
A. $_SERVER
View all MCQ's at [Link]
B. SERVER_ADDR
C. SERVER_NAME
D. QUERY_STRING
Answer:D
66. --------HTTP request method used for accessing a URL, such as POST, GET,
POST, PUT or DELETE.
A. REQUEST_METHOD
B. DOCUMENT_ROOT
C. REMOTE_ADDR
D. SERVER_PORT
Answer:A
67. -----------returns name of directory on server that is configured as document
root Sol:
A. REQUEST_METHOD
B. DOCUMENT_ROOT
C. REMOTE_ADDR
D. SERVER_PORT
Answer:B
68. ------------IP address of machine from which the user is viewing the current
page Sol:
A. REQUEST_METHOD
B. DOCUMENT_ROOT
C. REMOTE_ADDR
D. SERVER_PORT
Answer:C
69. -------port number on which the web server is listening to incoming request Sol:
A. REQUEST_METHOD
B. DOCUMENT_ROOT
C. REMOTE_ADDR
D. SERVER_PORT
Answer:D
View all MCQ's at [Link]
70. there are two ways the browser client can send information to the web server .
The -------------Method & The---------- Method
A. info and pre method
B. Get and post method
C. implement and extend method
D. none of these.
Answer:A
71. Before the browser sends the information to the server , it encodes it using a
scheme called URL.
A. yes
B. no
C. can not say
D. none of these.
Answer:A
72. After the information is encoded it is sent to the server Spaces are removed and
replaced with the + character and any other non alphanumeric characters are
replaced with a hexadecimal values.
A. yes
B. no
C. can not say
D. none of these.
Answer:A
73. The-----method sends the encoded user information appended to the page
request. The page and the encoded information are separated by the ? character
A. GET
B. ?
C. POST
D. QUERY_STRING
Answer:B
74. The-----method produces a long string that appears in your server logs, in the
browser's Location
A. GET
B. ?
View all MCQ's at [Link]
C. POST
D. QUERY_STRING
Answer:A
75. The-----method is restricted to send upto 1024 characters only Sol:
A. GET
B. ?
C. POST
D. QUERY_STRING
Answer:A
76. Never use-----method if you have password or other sensitive information to be
sent to the server.
A. GET
B. ?
C. POST
D. QUERY_STRING
Answer:A
77. ------can't be used to send binary data, like images or word documents, to the
server Sol:
A. GET
B. ?
C. POST
D. QUERY_STRING
Answer:A
78. The data sent by GET method can be accessed using-------environment
variable. Sol:
A. GET
B. ?
C. POST
D. QUERY_STRING
Answer:D
View all MCQ's at [Link]
79. The PHP provides-------associative array to access all the sent information
using GET method.
A. $_GET
B. $_POST
C. POST
D. QUERY_STRING
Answer:A
80. PHP------is a PHP super global variable which is used to collect form data after
submitting an HTML form with method="get".
A. $_GET
B. $_POST
C. POST
D. QUERY_STRING
Answer:A
81. The-----method transfers information via HTTP headers. Sol:
A. $_GET
B. $_POST
C. POST
D. QUERY_STRING
Answer:C
82. The information is encoded as described in case of GET method and put into a
header called-----------.
A. $_GET
B. $_POST
C. POST
D. QUERY_STRING
Answer:D
83. The----------method does not have any restriction on data size to be sent. Sol:
A. $_GET
B. $_POST
C. POST
D. QUERY_STRING
View all MCQ's at [Link]
Answer:C
84. The-----------method can be used to send ASCII as well as binary data Sol:
A. $_GET
B. $_POST
C. POST
D. QUERY_STRING
Answer:C
85. The PHP provides----------associative array to access all the sent information
using POST method.
A. $_GET
B. $_POST
C. POST
D. QUERY_STRING
Answer:B
86. PHP--------is a PHP super global variable which is used to collect form data
after submitting an HTML form with method="post". $_POST is also widely used
to pass variables
A. $_GET
B. $_POST
C. POST
D. QUERY_STRING
Answer:B
87. The-----method can retrieve information identified by the request-URl
(Uniform
Resource Identifier)
Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:D
View all MCQ's at [Link]
88. Use-----when you need the server, which controls URL generation of your
resources Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:C
89. ------is a secure method as its requests do not remain in browser history. Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:C
90. By the used of-------method You can keep the data private. Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:C
91. --------can't be used to send word documents or images. Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:D
92. ----------requests can be used only to retrieve data Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:D
View all MCQ's at [Link]
93. The----------method cannot be used for passing sensitive information like
usernames and passwords.
A. $_GET
B. $_POST
C. POST
D. GET
Answer:D
94. If you use------method, the browser appends the data to the URL Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:D
95. You cannot see------requests in browser history while You can see GET
requests in browser history
A. $_GET
B. $_POST
C. POST
D. GET
Answer:C
96. This------method is not compatible with some firewall setups. Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:C
97. In-------method, values are visible in the URL while in POST method, values
are NOT visible in the URL.
A. $_GET
B. $_POST
C. POST
D. GET
View all MCQ's at [Link]
Answer:D
98. ------has a limitation on the length of the values, generally 255 characters Sol:
A. $_GET
B. $_POST
C. POST
D. GET
Answer:D
99. -------has no limitation on the length of the values since they are submitted via
the body of HTTP.
A. $_GET
B. $_POST
C. POST
D. GET
Answer:C
100. GET method supports only string data types while-----method supports
different data types, such as string, numeric, binary, etc
A. $_GET
B. $_POST
C. POST
D. GET
Answer:C
View all MCQ's at [Link]