PHP Yii MCQ Questions & Answers
Yii MCQs : This section focuses on "Yii" PHP Framework. These Multiple Choice Questions (MCQ) should be practiced to improve the PHP Yii skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. Which of the following is true about Yii?
A. The Yii framework is an open-source PHP framework for rapidly-developing, modern Web applications
B. Yii is built around the Model-View-Controller composite pattern
C. Yii provides secure and professional features to create robust projects rapidly
D. All of the above
View Answer
Ans : D
Explanation: The Yii[ji:] framework is an open-source PHP framework for rapidly-developing, modern Web applications. It is built around the Model-View-Controller composite pattern.Yii provides secure and professional features to create robust projects rapidly.
2. Which of the following is not a feature of Yii?
A. Yii implements the MVC architectural pattern
B. It is extremely extensible.
C. Yii provides single-tier caching support.
D. Yii provides RESTful API development support.
View Answer
Ans : C
Explanation: Yii provides multi-tier caching support.
3. The r parameter in the URL stands for ?
A. response
B. route
C. render
D. requires
View Answer
Ans : B
Explanation: The r parameter in the URL stands for route. The route's default format is controllerID/actionID.
4. Which folder contains all the third-party packages managed by Composer?
A. Vendor
B. Views
C. Web
D. Config
View Answer
Ans : A
Explanation: Vendor : This folder contains all the third-party packages managed by Composer.
5. Which folder entry point from web?
A. Tests
B. View
C. Web
D. Config
View Answer
Ans : C
Explanation: Web : The entry point from web.
6. The global constants should be defined at the __________ of an entry script.
A. end
B. beginning
C. middle
D. anywhere in the script
View Answer
Ans : B
Explanation: The global constants should be defined at the beginning of an entry script in order to take effect when other PHP files are included.
7. To create a model, you should extend the?
A. yiiderivedModel class
B. baseModel class
C. derivedModel class
D. yiiaseModel class
View Answer
Ans : D
Explanation: To create a model, you should extend the yiiaseModel class or its subclasses.
8. A ________ is a reusable client-side code, which contains HTML, CSS, and JS.
A. Widget
B. Models
C. Modules
D. Views
View Answer
Ans : A
Explanation: A widget is a reusable client-side code, which contains HTML, CSS, and JS. This code includes minimal logic and is wrapped in a yiiaseWidget object.
9. The _______ function should normalize the widget properties.
A. run()
B. render()
C. init()
D. widget()
View Answer
Ans : C
Explanation: The init() function should normalize the widget properties.
10. To use a widget in a View, you should call the yiiaseWidget::widget() function.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, To use a widget in a View, you should call the yiiaseWidget::widget() function.
11. A ________ is an entity that has its own models, views, controllers, and possibly other modules.
A. Widget
B. Module
C. Models
D. Views
View Answer
Ans : B
Explanation: A module is an entity that has its own models, views, controllers, and possibly other modules. It is practically an application inside the application
12. Yii manages assets in ?
A. asset blocks
B. asset views
C. asset trigger
D. asset bundles
View Answer
Ans : D
Explanation: An asset is a file (css, js, video, audio or image, etc.) that may be referenced in a web page. Yii manages assets in asset bundles.
13. Which of the following is true about External Assets?
A. The assets are located in a web accessible directory
B. The assets are located in the directory that cannot be directly accessed via web.
C. The assets are located on another web server.
D. None of the above
View Answer
Ans : C
Explanation: External Assets : The assets are located on another web server.
14. Which assestbundles Includes the yii.js file?
A. yiiwebJqueryAsset
B. yiiwebYiiAsset
C. yiiootstrapBootstrapAsset
D. yiijuiJuiAsset
View Answer
Ans : B
Explanation: yiiwebYiiAsset : Includes the yii.js file, which implements a mechanism of organizing JS code in modules
15. Yii is equipped with a Web-based code generation tool called
A. Yii
B. Gii
C. Zii
D. Cii
View Answer
Ans : B
Explanation: Yii is equipped with a Web-based code generation tool called Gii.
16. when you write a new widget, which class you are extending?
A. Widget
B. CWidget
C. CForm
D. CControl
View Answer
Ans : B
Explanation: when you write a new widget, which class you are extending Cwidget.
17. Which represents a query criteria, such as conditions, ordering by, limit/offset?
A. Query
B. CQuery
C. CDbCriteria
D. None of the above
View Answer
Ans : C
Explanation: CDbCriteria represents a query criteria, such as conditions, ordering by, limit/offset
18. To access a database table, we first need to define an AR class by extending
A. CActive
B. ActiveRecord
C. CController
D. CActiveRecord
View Answer
Ans : D
Explanation: To access a database table, we first need to define an AR class by extending CActiveRecord.
19. The asset manager in Yii converts assets in extended syntax into CSS and JS, automatically.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, The asset manager in Yii converts assets in extended syntax into CSS and JS, automatically.
20. Cookies are plain text files stored on the client side.
A. TRUE
B. FALSE
C. Can be true or false
D. Can not say
View Answer
Ans : A
Explanation: True, Cookies are plain text files stored on the client side. You can use them for tracking purpose.
Discussion