NEW
Font size
WorksheetsMVC OOP PHP AJAX JAVASCRIPT
Total questions: 40
Worksheet time: 19mins
What does OOP stand for ?
Object-Oriented Protocol
Overhead Object Processing
Object-Oriented Programming
Object-Ordered Process
what is a trait in OOP ?
A class with only abstract methods
A collection of methods that can be used in multiple classes
A class that cannot be instantiated
A class with no properties
What is the purpose of the "__construct" method in PHP OOP?
To create an instance of a class
To destroy an instance of a class
To initialize an object's properties when an object is created
To define the class hierarchy
What is the main purpose of an interface ?
To define an abstract class
To instantiate objects
To implement multiple inheritance
To declare a contract for classes to implement
In MVC, what is the primary responsibility of the Model ?
Managing the application's data and business logic
Handling user input
Presenting data to the user
Handling user interface events
What is the role of the View in MVC ?
Managing application data
Managing application flow
Handling user input
Displaying data to the user
What does the Controller do in the MVC pattern ?
Manages the presentation logic
Represents the data model
Handles user input, processes requests, and updates the model
Renders the user interface
What is the benefit of using MVC architecture in software development ?
Limited flexibility in adapting to changing requirements
Increased code duplication
Improved code organization, separation of concerns, and maintainability
Reduced scalability
What is the significance of the "this" keyword in PHP OOP ?
Refers to the current class
Refers to the parent class
Refers to the child class
Refers to the current object instance
What does PDO stand for ?
PHP Database Organization
PHP Database Objects
Personal Data Objects
Professional Database Operations
Which method is used to execute a prepared statement in PDO ?
fetch()
run()
executeStatement()
execute()
What is the purpose of prepared statements in PDO ?
To improve database security by preventing SQL injection
To execute SQL queries directly
To retrieve data from the database
To create database connections
What does the fetch() method in PDO return by default ?
A single column value
An associative array of all columns
A numeric array of all columns
The entire result set as an object
How does Bootstrap handle responsiveness for different devices ?
By using separate CSS files for each device
By dynamically adjusting the layout based on the device's screen size
By relying on server-side scripting languages
By ignoring responsiveness altogether
What is the purpose of the Bootstrap grid system in terms of responsiveness ?
To create responsive, flexible layouts
To manage database records
To handle server-side scripting
To handle user authentication
What does the .container class in Bootstrap do ?
Creates a fixed-width container
Creates a full-width container
Centers the content horizontally
All of the above
How does Composer determine the location of the autoload file and class mappings ?
By querying a remote server
By reading the PHP configuration file
By consulting a central Composer registry
By analyzing the project's file structure
What is the purpose of the composer.json file in a PHP project ?
To store database credentials
To define project dependencies and settings
To execute shell commands
To create user interfaces
What is the PSR-4 autoloading standard in Composer used for ?
Managing database schemas
Defining coding styles
Autoloading classes based on namespaces
Configuring web servers
Which Composer command generates the autoload files based on the PSR-4 autoloading standard?
composer build
composer dump
composer generate
composer dump-autoload
Which PHP function is commonly used to handle file uploads ?
file_get_contents()
upload_file()
move_uploaded_file()
readfile()
How can you limit the size of an uploaded file in PHP?
Using the max_upload_size configuration directive
By setting the upload_max_filesize directive in php.ini
Applying the file_size_limit attribute in the HTML form
By using the limit_upload_size() PHP function
Which superglobal array in PHP contains information about an uploaded file ?
$_POST
$_GET
$_FILES
$_REQUEST
Which hashing algorithm is commonly recommended for password hashing in PHP?
MD5
SHA-1
SHA-256
Base64
How can you verify a password against its hashed counterpart in PHP ?
Using the password_compare() function
By decrypting the hashed password
By comparing the raw password with the hashed password
With the hash_equals() function
What is the primary advantage of using Ajax in web applications?
Simplifies HTML coding
Enhances server-side processing
Ensures compatibility with Internet Explorer only
Reduces page reloads and improves user experience
What is the purpose of the XMLHttpRequest's responseText property in Ajax?
It contains the raw binary data received from the server.
It holds the response data as a string.
It specifies the content type of the response.
It controls the timeout for the Ajax request.
What is JSON, and how is it commonly used in Ajax?
JavaScript Object Notation; used for styling HTML elements
Java Serialized Object Notation; used for server-side scripting
JSON is not related to Ajax.
JavaScript Object Notation; used for exchanging data with the server in a lightweight format
What is the purpose of client-side validation in comparison to backend validation?
To improve server response time
To provide a better user experience
To enforce data validation rules
To authenticate user credentials
Which PHP function is commonly used for validating email addresses on the backend?
validate_email()
filter_var()
check_email()
email_validation()
How can you prevent SQL injection attacks when processing user input in PHP with PDO?
Use JavaScript to sanitize user input
Apply client-side validation only
Use parameterized queries and prepared statements
Escaping user input using the htmlspecialchars() function
What is the purpose of the filter_input() function in PHP?
To filter input data based on predefined rules
To create a secure connection to the database
To decode JSON-encoded data
To validate and sanitize user input
How can you enforce a minimum length for a user's password in PHP validation?
Using the strlen() function
By applying a regular expression
Only client-side validation can enforce password length
With the password_length() function
How can you protect against CSRF attacks?
Using strong passwords
Implementing CAPTCHA
Using CSRF tokens
Disabling cookies
What is the primary goal of an XSS attack?
To compromise user data or session information
To improve website aesthetics
To manipulate server-side code
To enhance website responsiveness
In the context of XSS, what is the purpose of input validation?
To encrypt user input
To ensure that user input adheres to a specified format or range
To execute arbitrary code
To enhance user interface design
How can you prevent users from bypassing front-end validation and submitting malicious data?
By disabling JavaScript in the browser
By using a strong encryption algorithm
By relying solely on HTML5 validation attributes
By implementing server-side validation
in UML class diagram, what does an association line between two classes represent?
A dynamic relationship between the classes
A method call between the classes
A static relationship between the classes
A physical connection between the classes
What does the <<extend>> stereotype indicate in a use case diagram?
It represents an inclusion relationship between use cases.
It indicates a generalization relationship between actors.
It signifies an extension relationship between use cases.
It represents the starting point of a use case.
What is the purpose of the 'generalization' relationship in a use case diagram?
It signifies an extension between use cases.
It represents a specialized use case inheriting from a more general use case.
It indicates the inclusion of one use case within another.
It denotes a dependency between actors.
