Home »
MCQs
Yii PHP Framework Multiple-Choice Questions (MCQs)
Yii is an open source, object-oriented, component-based MVC PHP web application framework.
Yii PHP Framework MCQs: This section contains multiple-choice questions and answers on the various topics of Yii PHP Framework. Practice these MCQs to test and enhance your skills on Yii PHP Framework.
List of Yii PHP Framework MCQs
1. Yii is a ____ framework.
- PHP
- JavaScript
- Python
- Java
Answer: A) PHP
Explanation:
Yii is a PHP framework.
Discuss this Question
2. Which architecture does the Yii framework follows?
- MVVM
- MVC
- MVP
Answer: B) MVC
Explanation:
Yii framework follows MVC architecture.
Discuss this Question
3. Is Yii framework purely object-oriented?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, Yii framework is purely object-oriented.
Discuss this Question
4. Is the Yii framework an open-source framework?
- Yes
- No
Answer: A) Yes
Explanation:
Yii framework is an open-source framework.
Discuss this Question
5. Which code generation tool does Yii uses?
- Springboot
- CLI
- Code Igniters
- Gii
Answer: D) Gii
Explanation:
Gii is the code generation toolkit.
Discuss this Question
6. Does the Yii framework provides the feature of both RDBMS and NoSQL?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, the Yii framework provides the feature of both RDBMS and NoSQL.
Discuss this Question
7. Data structures are represented, and mechanisms for accessing and altering data are provided by ____.
- View
- Controller
- Model
Answer: C) Model
Explanation:
Data structures are represented, and mechanisms for accessing and altering data are provided by the model.
Discuss this Question
8. ____ is responsible for presenting the user interface, including presentation logic and data presentation.
- View
- Controller
- Model
Answer: A) View
Explanation:
View is responsible for presenting the user interface, including presentation logic and data presentation.
Discuss this Question
9. ____ handles user requests and coordinates the model's and view's interaction.
- View
- Controller
- Model
Answer: B) Controller
Explanation:
The controller handles user requests and coordinates the model's and view's interaction.
Discuss this Question
10. The ____ folder contains all.js and.css files mentioned on the web page.
- Assets
- Config
- Model
- View
Answer: A) Assets
Explanation:
The assets folder contains all.js and.css files mentioned on the web page.
Discuss this Question
11. The ____ folder includes all of the third-party packages that Composer manages.
- Model
- Config
- Mail
- Vendor
Answer: D) Vendor
Explanation:
The vendor folder includes all of the third-party packages that Composer manages.
Discuss this Question
12. ____ are the greatest location to define global constants.
- Widgets
- Moules
- Entry Scripts
- Composer
Answer: D) Entry Scripts
Explanation:
Entry scripts are the greatest location to define global constants.
Discuss this Question
13. The constant ____ is used to enable or deactivate debugging in a Yii application.
- YII_ENV
- YII DEBUG
- YII_ENABLE_ERROR_HANDLER
Answer: B) YII DEBUG
Explanation:
The constant YII DEBUG is used to enable or deactivate debugging in a Yii application.
Discuss this Question
14. When the variable YII DEBUG is set to ____, the program displays detailed error messages.
- True
- False
- None
Answer: A) True
Explanation:
When the variable YII DEBUG is set to true, the program displays detailed error messages.
Discuss this Question
15. ____ is a constant that specifies the environment in which a Yii application runs, such as "development" or "production."
- YII_ENV
- YII DEBUG
- YII_ENABLE_ERROR_HANDLER
Answer: A) YII_ENV
Explanation:
YII ENV is a constant that specifies the environment in which a Yii application runs, such as "development" or "production."
Discuss this Question
16. When YII ENABLE ERROR HANDLER is set to ____, PHP's default error handling method is utilized.
- True
- False
- None
Answer: B) False
Explanation:
When YII ENABLE ERROR HANDLER is set to false, PHP's default error handling method is utilized.
Discuss this Question
17. Which of the following is the controller's default action, and is commonly used to show a list of records?
- ActionShow()
- Actioncreate()
- ActionView()
- ActionIndex()
Answer: D) ActionIndex()
Explanation:
actionIndex() is the controller's default action, and is commonly used to show a list of records.
Discuss this Question
18. You can view a single record in detail with ____ action.
- Viewaction()
- Actionsee()
- actionView()
Answer: C) Actionsee()
Explanation:
You can view a single record in detail with actionview () action.
Discuss this Question
19. ____ Action is used for setting a new record.
- CreateAction()
- actionCreateNew()
- actionNew()
- actionCreate()
Answer: D) actionCreate()
Explanation:
actionCreate() is used for setting a new record.
Discuss this Question
20. A ____ in Yii is a mapping between a URL pattern and a controller action.
- Templating engine
- Route
- Controller
- Composer
Answer: B) Route
Explanation:
A route in Yii is a mapping between a URL pattern and a controller action.
Discuss this Question
21. Action ID can contain ____.
- English letter in lowercase
- Digits
- Hyphens
- Underscores
- All of the above
Answer: E) All of the above
Explanation:
Action ID can contain:
- English letter in lowercase
- Digits
- Hyphens
- Underscores
Discuss this Question
22. How many types of actions are there in the Yii framework?
- 5
- 4
- 3
- 2
Answer: D) 2
Explanation:
Two types of actions are there in the Yii framework: Inline and standalone.
Discuss this Question
23. Which of the following action is defined in the controller class?
- Inline
- Standalone
Answer: A) Inline
Explanation:
Inline actions are defined in the controller class.
Discuss this Question
24. In the Yii framework, an ____ method is a public method in a controller class that is in charge of processing a request and creating a response.
- Model
- Controller
- Action
Answer: C) Action
Explanation:
In the Yii framework, an action method is a public method in a controller class that is in charge of processing a request and creating a response.
Discuss this Question
25. A ____ is a class in the Yii framework that represents a data item and specifies the logic for communicating with data storage, such as a database.
- Model
- Controller
- Action
Answer: A) Model
Explanation:
A model is a class in the Yii framework that represents a data item and specifies the logic for communicating with data storage, such as a database.
Discuss this Question
26. Which of the following method updates data in the data store based on the circumstances stated?
- Update()
- UpdateAll()
- Validate()
Answer: B) UpdateAll()
Explanation:
UpdateAll() method, Updates data in the data store based on the circumstances stated.
Discuss this Question
27. In the Yii framework, ____ are used to describe which properties of a model should be evaluated during validation.
- Possibilities
- Events
- Cases
- Scenarios
Answer: D) Scenarios
Explanation:
In the Yii framework, scenarios are used to describe which properties of a model should be evaluated during validation.
Discuss this Question
28. A ____ is a piece of reusable client-side programming that includes HTML, CSS, and JS.
- View
- Widget
- Template
Answer: B) Widget
Explanation:
A widget is a piece of reusable client-side programming that includes HTML, CSS, and JS.
Discuss this Question
29. To utilize a widget, we use which of the following method?
- Widget ()
- Wid()
- Use_widget()
Answer: A) Widget()
Explanation:
To utilize a widget, use the "widget ()" function.
Discuss this Question
30. ____ are mini-applications that may be inserted into the main application and contain their controllers, models, views, and assets.
- Units
- Modules
- Components
- Template
Answer: B) Modules
Explanation:
Modules are mini-applications that may be inserted into the main application and contain their controllers, models, views, and assets.
Discuss this Question
31. When the module is being initialized, which of the following method is invoked?
- Initialized ()
- Start ()
- New ()
- Init ()
Answer: D) Init ()
Explanation:
When the module is being initialized, Init () method is invoked.
Discuss this Question
32. Which of the following function returns the module to which a component belongs?
- getModules()
- get()
- getModule()
Answer: C) getModule()
Explanation:
getModule() function returns the module to which a component belongs.
Discuss this Question
33. Which of the following function returns an array of all the modules declared in the application?
- getModules()
- get()
- getModule()
Answer: A) getModules()
Explanation:
getModules () function returns an array of all the modules declared in the application.
Discuss this Question
34. Is getModules () and getModule () both are same?
- Yes
- No
Answer: B) No
Explanation:
No, they are not the same, getModules () function returns an array of all the modules declared in the application, whereas the getModule() function returns the module to which a component belongs.
Discuss this Question
35. To render a view, ____ method is implemented.
- Render ()
- Use ()
- Display ()
- Create ()
Answer: A) Render ()
Explanation:
To render a view, the render() method is implemented.
Discuss this Question
36. ____ function is used to render a partial view, which is a view piece that may be reused across numerous pages.
- Render_limited()
- LimitedRender()
- renderPartial()
Answer: C) renderPartial()
Explanation:
renderPartial() function is used to render a partial view, which is a view piece that may be reused across numerous pages.
Discuss this Question
37. ____ in the Yii framework are static files such as JavaScript, CSS, pictures, and fonts that are used to improve an application's visual and interactive characteristics.
- Template
- Static
- Component
- Assets
Answer: D) Assets
Explanation:
Assets in the Yii framework are static files such as JavaScript, CSS, pictures, and fonts that are used to improve an application's visual and interactive characteristics.
Discuss this Question
38. ____ are third-party components that offer new features to your program.
- Extension
- Plugin
- Extender
Answer: A) Extension
Explanation:
Extension are third-party components that offer new features to your program.
Discuss this Question
39. Which of the following HTTP method is used to gather data without altering it in any way?
- GET
- POST
- PUT
- PATCH
Answer: A) GET
Explanation:
GET HTTP method is used to gather data without altering it in any way.
Discuss this Question
40. Which of the following HTTP method is employed in the creation of new resources as well as the update of current ones?
- GET
- POST
- PUT
Answer: B) POST
Explanation:
POST HTTP method is employed in the creation of new resources as well as the update of current ones.
Discuss this Question
41. Which of the following function is used to generate URLs for a certain activity?
- CreateURL()
- NewURL()
- InitURL()
Answer: A) CreateURL()
Explanation:
CreateURL() function is used to generate URLs for a certain activity.
Discuss this Question
42. Suppose you want to add new URL rules to the URL manager component, then which of the following method you will use?
- Rules_new()
- New_Rules()
- AddRules()
Answer: C) AddRules()
Explanation:
addRules() method, add new URL rules to the URL manager component.
Discuss this Question
43. ____ function generates the form's opening element and returns the HTML code for it.
- beginForm()
- endForm()
- Form()
Answer: A) beginForm()
Explanation:
beginForm() function generates the form's opening element and returns the HTML code for it.
Discuss this Question
44. ____ in the Yii framework is the process of determining if user-submitted data fits the needed criteria before it is stored in a database or utilized for other reasons.
- Authentication
- Data Validation
- Authorization
- Ad-hoc validation
Answer: B) Data Validation
Explanation:
Data validation in the Yii framework is the process of determining if user-submitted data fits the needed criteria before it is stored in a database or utilized for other reasons.
Discuss this Question
45. ____ are the classes that really do the validation.
- Controllers
- Model
- Validators
Answer: C) Validators
Explanation:
Validators are the classes that do the validation.
Discuss this Question
46. Validation is performed on a model using which of the following function?
- Check ()
- Confirm ()
- Validation ()
- Validate()
Answer: D) Validate()
Explanation:
Validation is performed on a model using the validate() function.
Discuss this Question
47. ____ in Yii framework refers to the process of verifying data without the use of a model.
- Authentication
- Data Validation
- Authorization
- Ad-hoc validation
Answer: D) Ad-hoc validation
Explanation:
Ad-hoc validation in the Yii framework refers to the process of verifying data without the use of a model.
Discuss this Question
48. How many types of custom validators are there in the Yii framework?
- 2
- 3
- 4
- 5
Answer: A) 2
Explanation:
There are two types of custom validators: Inline and standalone.
Discuss this Question
49. ____ is a feature in the Yii framework that allows you to validate form data on the client side using JavaScript and AJAX calls without having to reload the page.
- Authentication
- Data Validation
- AJAX Validation
- Ad-hoc validation
Answer: C) AJAX Validation
Explanation:
AJAX validation is a feature in the Yii framework that allows you to validate form data on the client side using JavaScript and AJAX calls without having to reload the page.
Discuss this Question
50. In the Yii framework, a ____ is a technique of storing data that is persistent over numerous requests.
- Session
- Cookies
- Response
- Request
Answer: A) Session
Explanation:
In the Yii framework, a session is a technique for storing data that is persistent over numerous requests.
Discuss this Question
51. ____ is a transient data storage technique in the Yii framework that may be used to transfer messages or data between requests.
- Persistent storage
- Cache
- Flash data
Answer: C) Flash data
Explanation:
Flash data is a transient data storage technique in the Yii framework that may be used to transfer messages or data between requests.
Discuss this Question
52. ____ are simple text files that are kept on the client side.
- Session
- Cookies
- Response
- Request
Answer: B) Cookies
Explanation:
Cookies are simple text files that are kept on the client side.
Discuss this Question
53. In the Yii framework, a ____ is a component that supplies data for a view, such as a grid view or list view.
- Storage
- Event
- Data widget
- Data provider
Answer: D) Data provider
Explanation:
In the Yii framework, a data provider is a component that supplies data for a view, such as a grid view or list view.
Discuss this Question
54. The ____ widget receives data from a data source and displays it as a table.
- ListView
- GridView
- TemplateView
Answer: B) GridView
Explanation:
The GridView widget receives data from a data source and displays it as a table.
Discuss this Question
55. A ____ is an entity that knows how to create and configure objects.
- Dependency injection
- Database access object
- Data widget
Answer: A) Dependency injection
Explanation:
A DI container (dependency injection) is an entity that knows how to create and configure objects.
Discuss this Question
56. What is DAO in Yii?
- Data access oriented
- Data active object
- Data access object
Answer: C) Data access object
Explanation:
DOA stands for data access object.
Discuss this Question
57. Which of the following databases does DOA supports?
- MySQL
- MSSQL
- SQLite
- MariaDB
- All of the above
Answer: E) All of the above
Explanation:
Following databases are supported by DOA:
- MySQL
- MSSQL
- SQLite
- MariaDB
- PostgreSQL
- ORACLE
- CUBRID
Discuss this Question
58. Yii ____ allows you to add more functionality to an object without changing its code.
- Activity
- Behaviours
- Active data
Answer: B) Behaviours
Explanation:
Yii behaviors allow you to add more functionality to an object without changing its code.
Discuss this Question
59. Which of the following lets you generate SQL queries programmatically?
- DOA
- Query Composer
- Query Generator
- Query builder
Answer: D) Query builder
Explanation:
The query builder lets you generate SQL queries programmatically.
Discuss this Question
60. Which NoSQL DB does the Active record class support?
- Redis
- Mongo
- Both
- Only A
- Only B
Answer: C) Both
Explanation:
Active record class support following NoSQL DB:
- Redis
- Mongo
Discuss this Question
61. Which of the following are the main component of DOA?
- Data provider
- Query
- Active record
- Command
- All of the above
Answer: E) All of the above
Explanation:
Following are the main component of DOA:
- Data provider
- Query
- Active record
- Command
Discuss this Question
62. Which of the following API Clears the cache of all data values?
- Delete()
- Del()
- Flush()
Answer: C) Flush()
Explanation:
Flush () clears the cache of all data values.
Discuss this Question
63. An alias begins with the ____ symbol.
- ~
- @
- $
- _
Answer: B) @
Explanation:
An alias begins with the @ symbol.
Discuss this Question
64. Does the Yii framework has a built-in error-handling feature?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, the Yii framework has a built-in error-handling feature.
Discuss this Question
65. ____ refers to the process of validating a user's identity.
- Localization
- Globalization
- Authorisation
- Authentication
Answer: D) Authentication
Explanation:
Authentication refers to the process of validating a user's identity.
Discuss this Question
66. What is ACF in the Yii framework?
- Active control feature
- Access control filter
- Active control filter
Answer: B) Access control filter
Explanation:
ACF stands for access control filter
Discuss this Question
67. The process of determining whether a user has sufficient authority to accomplish something is known as ____.
- Localization
- Globalization
- Authorisation
- Authentication
Answer: C) Authorisation
Explanation:
The process of determining whether a user has sufficient authority to accomplish something is known as authorization.
Discuss this Question