wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MVC OOP PHP AJAX JAVASCRIPT

Total questions: 40

Worksheet time: 19mins

Name
Class
Date
1.

What does OOP stand for ?

a)

Object-Oriented Protocol

b)

Overhead Object Processing

c)

Object-Oriented Programming

d)

Object-Ordered Process

2.

what is a trait in OOP ?

a)

A class with only abstract methods

b)

A collection of methods that can be used in multiple classes

c)

A class that cannot be instantiated

d)

A class with no properties

3.

What is the purpose of the "__construct" method in PHP OOP?

a)

To create an instance of a class

b)

To destroy an instance of a class

c)

To initialize an object's properties when an object is created

d)

To define the class hierarchy

4.

What is the main purpose of an interface ?

a)

To define an abstract class

b)

To instantiate objects

c)

To implement multiple inheritance

d)

To declare a contract for classes to implement

5.

In MVC, what is the primary responsibility of the Model ?

a)

Managing the application's data and business logic

b)

Handling user input

c)

Presenting data to the user

d)

Handling user interface events

6.

What is the role of the View in MVC ?

a)

Managing application data

b)

Managing application flow

c)

Handling user input

d)

Displaying data to the user

7.

What does the Controller do in the MVC pattern ?

a)

Manages the presentation logic

b)

Represents the data model

c)

Handles user input, processes requests, and updates the model

d)

Renders the user interface

8.

What is the benefit of using MVC architecture in software development ?

a)

Limited flexibility in adapting to changing requirements

b)

Increased code duplication

c)

Improved code organization, separation of concerns, and maintainability

d)

Reduced scalability

9.

What is the significance of the "this" keyword in PHP OOP ?

a)

Refers to the current class

b)

Refers to the parent class

c)

Refers to the child class

d)

Refers to the current object instance

10.

What does PDO stand for ?

a)

PHP Database Organization

b)

PHP Database Objects

c)

Personal Data Objects

d)

Professional Database Operations

11.

Which method is used to execute a prepared statement in PDO ?

a)

fetch()

b)

run()

c)

executeStatement()

d)

execute()

12.

What is the purpose of prepared statements in PDO ?

a)

To improve database security by preventing SQL injection

b)

To execute SQL queries directly

c)

To retrieve data from the database

d)

To create database connections

13.

What does the fetch() method in PDO return by default ?

a)

A single column value

b)

An associative array of all columns

c)

A numeric array of all columns

d)

The entire result set as an object

14.

How does Bootstrap handle responsiveness for different devices ?

a)

By using separate CSS files for each device

b)

By dynamically adjusting the layout based on the device's screen size

c)

By relying on server-side scripting languages

d)

By ignoring responsiveness altogether

15.

What is the purpose of the Bootstrap grid system in terms of responsiveness ?

a)

To create responsive, flexible layouts

b)

To manage database records

c)

To handle server-side scripting

d)

To handle user authentication

16.

What does the .container class in Bootstrap do ?

a)

Creates a fixed-width container

b)

Creates a full-width container

c)

Centers the content horizontally

d)

All of the above

17.

How does Composer determine the location of the autoload file and class mappings ?

a)

By querying a remote server

b)

By reading the PHP configuration file

c)

By consulting a central Composer registry

d)


By analyzing the project's file structure


18.

What is the purpose of the composer.json file in a PHP project ?

a)

To store database credentials

b)

To define project dependencies and settings

c)

To execute shell commands

d)

To create user interfaces


19.

What is the PSR-4 autoloading standard in Composer used for ?

a)

Managing database schemas

b)

Defining coding styles

c)

Autoloading classes based on namespaces

d)

Configuring web servers

20.

Which Composer command generates the autoload files based on the PSR-4 autoloading standard?

a)

composer build

b)

composer dump

c)

composer generate

d)

composer dump-autoload

21.

Which PHP function is commonly used to handle file uploads ?

a)

file_get_contents()

b)

upload_file()

c)

move_uploaded_file()

d)

readfile()

22.

How can you limit the size of an uploaded file in PHP?

a)

Using the max_upload_size configuration directive

b)

By setting the upload_max_filesize directive in php.ini

c)

Applying the file_size_limit attribute in the HTML form

d)

By using the limit_upload_size() PHP function

23.

Which superglobal array in PHP contains information about an uploaded file ?

a)

$_POST

b)

$_GET

c)

$_FILES

d)

$_REQUEST

24.

Which hashing algorithm is commonly recommended for password hashing in PHP?

a)

MD5

b)

SHA-1

c)

SHA-256

d)

Base64

25.

How can you verify a password against its hashed counterpart in PHP ?

a)

Using the password_compare() function

b)

By decrypting the hashed password

c)

By comparing the raw password with the hashed password

d)

With the hash_equals() function

26.

What is the primary advantage of using Ajax in web applications?

a)

Simplifies HTML coding

b)

Enhances server-side processing

c)

Ensures compatibility with Internet Explorer only

d)

Reduces page reloads and improves user experience

27.

What is the purpose of the XMLHttpRequest's responseText property in Ajax?

a)

It contains the raw binary data received from the server.

b)

It holds the response data as a string.

c)

It specifies the content type of the response.

d)

It controls the timeout for the Ajax request.

28.

What is JSON, and how is it commonly used in Ajax?

a)

JavaScript Object Notation; used for styling HTML elements

b)

Java Serialized Object Notation; used for server-side scripting

c)

JSON is not related to Ajax.

d)

JavaScript Object Notation; used for exchanging data with the server in a lightweight format

29.

What is the purpose of client-side validation in comparison to backend validation?

a)

To improve server response time

b)

To provide a better user experience

c)

To enforce data validation rules

d)

To authenticate user credentials

30.

Which PHP function is commonly used for validating email addresses on the backend?

a)

validate_email()

b)

filter_var()

c)

check_email()

d)

email_validation()

31.

How can you prevent SQL injection attacks when processing user input in PHP with PDO?

a)

Use JavaScript to sanitize user input

b)

Apply client-side validation only

c)

Use parameterized queries and prepared statements

d)

Escaping user input using the htmlspecialchars() function

32.

What is the purpose of the filter_input() function in PHP?

a)

To filter input data based on predefined rules

b)

To create a secure connection to the database

c)

To decode JSON-encoded data

d)

To validate and sanitize user input

33.

How can you enforce a minimum length for a user's password in PHP validation?

a)

Using the strlen() function

b)

By applying a regular expression

c)

Only client-side validation can enforce password length

d)

With the password_length() function

34.

How can you protect against CSRF attacks?

a)

Using strong passwords

b)

Implementing CAPTCHA

c)

Using CSRF tokens

d)

Disabling cookies

35.

What is the primary goal of an XSS attack?

a)

To compromise user data or session information

b)

To improve website aesthetics

c)

To manipulate server-side code

d)

To enhance website responsiveness

36.

In the context of XSS, what is the purpose of input validation?

a)

To encrypt user input

b)

To ensure that user input adheres to a specified format or range

c)

To execute arbitrary code

d)

To enhance user interface design

37.

How can you prevent users from bypassing front-end validation and submitting malicious data?

a)

By disabling JavaScript in the browser

b)

By using a strong encryption algorithm

c)

By relying solely on HTML5 validation attributes

d)

By implementing server-side validation

38.

in UML class diagram, what does an association line between two classes represent?

a)

A dynamic relationship between the classes

b)

A method call between the classes

c)

A static relationship between the classes

d)

A physical connection between the classes

39.

What does the <<extend>> stereotype indicate in a use case diagram?

a)

It represents an inclusion relationship between use cases.

b)

It indicates a generalization relationship between actors.

c)

It signifies an extension relationship between use cases.

d)

It represents the starting point of a use case.

40.

What is the purpose of the 'generalization' relationship in a use case diagram?

a)

It signifies an extension between use cases.

b)

It represents a specialized use case inheriting from a more general use case.

c)

It indicates the inclusion of one use case within another.

d)

It denotes a dependency between actors.