Yii

Yii

Build performance-oriented PHP apps with "Yes It Is!". Test your knowledge of Yii 2’s component-based architecture and advanced features with our 75+ MCQ challenge.


  1. What does the name 'Yii' stand for?

    • Yellow Integrated Interface
    • Yes It Is!
    • Yield Internal Index
    • Youth Interactive Integration
  2. Yii is primarily based on which architectural pattern?

    • Singleton
    • MVC (Model-View-Controller)
    • Observer
    • Factory
  3. Which PHP version is minimum for Yii 2.0?

    • PHP 5.3
    • PHP 5.4
    • PHP 7.0
    • PHP 8.0
  4. What is the entry script for a Yii web application?

    • main.php
    • index.php
    • app.php
    • yii.php
  5. Which tool is used for automatic code generation in Yii?

    • Composer
    • Gii
    • Artisan
    • Drush
  6. Which method is used to define validation rules in a Model?

    • validate()
    • rules()
    • check()
    • scenarios()
  7. In Active Record, which method saves a record to the database?

    • insert()
    • update()
    • save()
    • commit()
  8. What is the difference between render() and renderPartial()?

    • None
    • render() includes the layout, renderPartial() does not
    • render() is for Ajax
    • renderPartial() is for database
  9. Which method is used to fetch all records from a table using Active Record?

    • findAll()
    • find()->all()
    • getAll()
    • select('*')
  10. How do you define a 'one-to-many' relationship in a model?

    • hasOne()
    • hasMany()
    • belongsTo()
    • manyToMany()
  11. What is the Dependency Injection (DI) Container used for?

    • Storing user files
    • Instantiating and managing object dependencies
    • Creating database tables
    • Routing requests
  12. In RBAC, what is a 'Permission'?

    • A user role
    • The ability to perform a specific action
    • A database password
    • An API key
  13. Which class do you extend to create a RESTful API controller in Yii 2?

    • yii\web\Controller
    • yii\rest\ActiveController
    • yii\base\Action
    • yii\rest\Controller
  14. What is the purpose of the 'yii\base\Behavior' class?

    • To change the app CSS
    • To inject methods and events into other classes without inheritance
    • To handle Ajax
    • To manage migrations
  15. How do you trigger a custom event in a component?

    • \$this->run('event')
    • \$this->trigger('eventName')
    • event('name')
    • Yii::\$app->event()