Quiznetik

Advance PHP | Set 1

1. --------is about writing procedures or functions that perform operations on the data. Sol:

Correct : A. procedural programming

2. while--------is about creating objects that contain both data and functions. Sol:

Correct : C. object oriented programming

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:

Correct : D. class

4. ----are nothing without objects! We can create multiple objects from a class Sol:

Correct : D. class

5. Each----has all the properties and methods defined in the class, but they will have different property values. Sol:

Correct : A. object

6. -----of a class is created using the new keyword Sol:

Correct : A. object

7. The-----keyword refers to the current object, and is only available inside methods Sol:

Correct : B. $this

8. Objects of a class is created using the-----keyword Sol:

Correct : A. new

9. we change the value of the $name property? There are two ways: Inside the----- &Outside the class Sol:

Correct : D. class

10. You can use the----keyword to check if an object belongs to a specific class Sol:

Correct : C. instanceof

11. A-----allows you to initialize an object's properties upon creation of the object Sol:

Correct : A. constructor

12. If you create a-----function, PHP will automatically call this function when you create an object from a class. Sol:

Correct : A. __Construct()

13. that the construct function starts with two underscores------- Sol:

Correct : A. __ ()

14. A------ is called when the object is destructed or the script is stopped or exited. Sol:

Correct : B. destructor

15. If you create a-----function, PHP will automatically call this function at the end of the script Sol:

Correct : B. ___Destruct()

16. Notice that the destruct function starts with------- Sol:

Correct : 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 Sol:

Correct : A. __Construct() & __destruct()

18. ------stands for Object-Oriented Programming. Sol:

Correct : C. OOP

19. -----and methods can have access modifiers which control where they can be accessed Sol:

Correct : A. Properties

20. -----the property or method can be accessed from everywhere. This is default Sol:

Correct : B. public

21. ------the property or method can be accessed within the class and by classes derived from that class Sol:

Correct : C. protected

22. ------the property or method can ONLY be accessed within the class Sol:

Correct : D. private

23. --------in OOP When a class derives from another class. Sol:

Correct : A. inheritance

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. Sol:

Correct : B. child class

25. An inherited class is defined by using the------keyword Sol:

Correct : C. extends

26. ---methods can be overridden by redefining the methods (use the same name) in the child class. Sol:

Correct : A. inheritance

27. The----keyword can be used to prevent class inheritance or to prevent method overriding Sol:

Correct : A. final

28. ------cannot be changed once it is declared. Sol:

Correct : B. constants

29. Class constants can be useful if you need to define some-------data within a class Sol:

Correct : B. constants

30. A class constant is declared inside a class with the-----keyword. Sol:

Correct : C. const

31. Class constants are--------However, it is recommended to name the constants in all uppercase letters. Sol:

Correct : D. case-sensitive

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 Sol:

Correct : B. constant

33. -------classes and methods are when the parent class has a named method, but need its child class(es) to fill out the tasks Sol:

Correct : A. abstract

34. An------class is a class that contains at least one abstract method Sol:

Correct : A. abstract

35. An------method is a method that is declared, but not implemented in the code. Sol:

Correct : A. abstract

36. An abstract class or method is defined with the------keyword: Sol:

Correct : A. abstract

37. When inheriting from an------class, the child class method must be defined with the same name Sol:

Correct : A. abstract

38. if the-----method is defined as protected, the child class method must be defined as either protected or public, but not private Sol:

Correct : A. abstract

39. The----class method must be defined with the same name and it re declares the parent abstract method Sol:

Correct : B. child

40. The-----class method must be defined with the same or a less restricted access modifier Sol:

Correct : B. child

41. The number of required arguments must be the same. However, the-----class may have optional arguments in addition Sol:

Correct : B. child

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" Sol:

Correct : C. interface

43. Interfaces are declared with the------keyword. Sol:

Correct : C. interface

44. ------cannot have properties, while abstract classes can Sol:

Correct : C. interface

45. All------methods must be public, while abstract class methods is public or protected Sol:

Correct : C. interface

46. All methods in an-----are abstract, so they cannot be implemented in code and the abstract keyword is not necessary Sol:

Correct : A. abstract

47. -------keyword is used in interface Sol:

Correct : D. implement

48. To implement an interface, a class must use the-------keyword. Sol:

Correct : D. implement

49. A class that implements an interface must------all of the interface's methods. Sol:

Correct : D. implement

50. PHP only supports---------a child class can inherit only from one single Sol: parent.

Correct : D. single inheritance

51. class needs to inherit multiple behaviors? OOP------is used to solve this problem. Sol:

Correct : C. traits

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. Sol:

Correct : C. traits

53. Traits are declared with the----keyword Sol:

Correct : C. traits

54. ------methods can be called directly - without creating an instance of the class first. Sol:

Correct : A. static

55. Static methods are declared with the------keyword Sol:

Correct : A. static

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 (::) Sol:

Correct : B. self

57. ------properties can be called directly - without creating an instance of a class. Sol:

Correct : A. static

58. An iterable is any value which can be looped through with a-----loop. Sol:

Correct : A. foeach()

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. Sol:

Correct : C. iterable

60. The-----keyword can be used as a data type of a function argument or as the return type of a function: Sol:

Correct : C. iterable

61. ------is a superglobal that holds information regarding HTTP headers, path and script location etc. Sol:

Correct : A. $_SERVER

62. All the server and execution environment related information is available in this------ Sol:

Correct : A. associative array

63. -------This property of array returns The IP address of the server under which the current script is executing. Sol:

Correct : B. SERVER_ADDR

64. -------Name of server hostunder which the current script is executing Sol:

Correct : C. SERVER_NAME

65. -------A query string is the string of key=value pairs separated by & symbol and appended to URL after ? symbol. For example, http://localhost/testscript?name=xyz&age=20 URL returns trailing query string. Sol:

Correct : D. QUERY_STRING

66. --------HTTP request method used for accessing a URL, such as POST, GET, POST, PUT or DELETE. Sol:

Correct : A. REQUEST_METHOD

67. -----------returns name of directory on server that is configured as document root Sol:

Correct : B. DOCUMENT_ROOT

68. ------------IP address of machine from which the user is viewing the current page Sol:

Correct : C. REMOTE_ADDR

69. -------port number on which the web server is listening to incoming request Sol:

Correct : D. SERVER_PORT

70. there are two ways the browser client can send information to the web server . The -------------Method & The---------- Method Sol:

Correct : A. info and pre method

71. Before the browser sends the information to the server , it encodes it using a scheme called URL. Sol:

Correct : A. yes

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. Sol:

Correct : A. yes

73. The-----method sends the encoded user information appended to the page request. The page and the encoded information are separated by the ? character Sol:

Correct : B. ?

74. The-----method produces a long string that appears in your server logs, in the browser's Location Sol:

Correct : A. GET

75. The-----method is restricted to send upto 1024 characters only Sol:

Correct : A. GET

76. Never use-----method if you have password or other sensitive information to be sent to the server. Sol:

Correct : A. GET

77. ------can't be used to send binary data, like images or word documents, to the server Sol:

Correct : A. GET

78. The data sent by GET method can be accessed using-------environment variable. Sol:

Correct : D. QUERY_STRING

79. The PHP provides-------associative array to access all the sent information using GET method. Sol:

Correct : A. $_GET

80. PHP------is a PHP super global variable which is used to collect form data after submitting an HTML form with method="get". Sol:

Correct : A. $_GET

81. The-----method transfers information via HTTP headers. Sol:

Correct : C. POST

82. The information is encoded as described in case of GET method and put into a header called-----------. Sol:

Correct : D. QUERY_STRING

83. The----------method does not have any restriction on data size to be sent. Sol:

Correct : C. POST

84. The-----------method can be used to send ASCII as well as binary data Sol:

Correct : C. POST

85. The PHP provides----------associative array to access all the sent information using POST method. Sol:

Correct : B. $_POST

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 Sol:

Correct : B. $_POST

87. The-----method can retrieve information identified by the request-URl (Uniform Resource Identifier) Sol:

Correct : D. GET

88. Use-----when you need the server, which controls URL generation of your resources Sol:

Correct : C. POST

89. ------is a secure method as its requests do not remain in browser history. Sol:

Correct : C. POST

90. By the used of-------method You can keep the data private. Sol:

Correct : C. POST

91. --------can't be used to send word documents or images. Sol:

Correct : D. GET

92. ----------requests can be used only to retrieve data Sol:

Correct : D. GET

93. The----------method cannot be used for passing sensitive information like usernames and passwords. Sol:

Correct : D. GET

94. If you use------method, the browser appends the data to the URL Sol:

Correct : D. GET

95. You cannot see------requests in browser history while You can see GET requests in browser history Sol:

Correct : C. POST

96. This------method is not compatible with some firewall setups. Sol:

Correct : C. POST

97. In-------method, values are visible in the URL while in POST method, values are NOT visible in the URL. Sol:

Correct : D. GET

98. ------has a limitation on the length of the values, generally 255 characters Sol:

Correct : D. GET

99. -------has no limitation on the length of the values since they are submitted via the body of HTTP. Sol:

Correct : C. POST

100. GET method supports only string data types while-----method supports different data types, such as string, numeric, binary, etc Sol:

Correct : C. POST