2609 Quiz 2
what is the magic method used for constructors in PHP?
__construct
what is a class in php?
a blueprint for creating objects
used to store info to track different characteristics related to the user, while the cache is used to make the loading of web pages faster.
cookies
_______ stores information such as user preferences, while _______ will keep resource files such as audio, video or flash files.
cookies ; cache
which keyword is used to indicate that a class extends another class in PHP?
extends
session has security issues and is not preferred for storing sensitive data
false
which of the following is not a visibility modifier in PHP?
final visibility modifiers are: public, private, protected
benefit of using OOP in PHP
increased reusability of code
cookies are stored in ________
local machine
sessions are stored in...
local server/server
which keyword is used to create a new object in php
new
in php, can a subclass inherit multiple classes?
no
cookies end ________
on the lifetime set by the user
function used to start a session in php
session_start()
used to store sensitive data such as credentials
sessions
what is more secured cookies or sessions?
sessions
function used to enable cookies in php
setcookie()
which of the ff is not an access modifier that can be used with inheritance in PHP
static
what is inheritance in OOP?
the ability to extend a class to create a new class with additional features
what is encapsulation in OOP?
the ability to hide data within an object
what is polymorphism in OOP?
the ability to use a single interface to represent multiple different types
cookies and sessions are the same thing and can be used interchangeably in web development
true
cookies expire after some time but cache is kept in the client's machine until they are removed manually by the user
true
encapsulation in OOP means that a class should only expose necessary information to the outside world
true
in OOP a constructor is a special method that is called when an object is created
true
in OOP, an object is an instance of a class
true
in object oriented programming, an object is a blueprint for creating classes
true
it is good practice to keep each php class in a separate file
true
make sure you call the setcookie() function before any output generated by your script otherwise cookie will not set
true
overloading in OOP refers to the ability to define multiple methods with the same name but different parameters
true
polymorphism in OOP refers to the ability of objects to have multiple forms or types.
true
which of the ff is an example of encapsulation in php
using a private visibility modifier to hide a property
which of the ff is used to retrieve stored cookie data
$S_COOKIE
cookies usually takes _______ file size
4KB
which of the following is not a pillar of OOP
a. polymorphism b. all of the above c. inheritance d. encapsulation e. class ans: e. class
session will be ended when _____
a. user logs out b. user quits browser c. it reaches 30th day d. it reaches time set by user ans = b. user quits browser d. it reaches time set by user
which of the following is not a benefit if inheritance in PHP?
a.) code reusability b.) flexibility and customization c.) reduced development time d.) improved code security ans: d.) improved code security
what is an object in PHP?
an instance of a class
a collection of data downloaded to help display a web page
cache (?)