You are on page 1of 12

PRE TEST

DEVELOPMENT WEBSITE APP USING YII2 FRAMEWORK


1. Which of the following advanced OOP features is/are not supported by PHP?
i) Method overloading
ii) Multiple Inheritance
iii) Namespaces
iv) Object Cloning
A. All of the mentioned
B. None of the mentioned
C. i) and ii)
D. iii) and iv)
Answer: C
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
2. Which version of PHP introduced the advanced concepts of OOP?
A. PHP 4
B. PHP 5
C. PHP 5.3
D. PHP 6
Answer: B
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
3. Which one of the following is the right way to clone an object?
A. _clone(targetObject);
B. destinationObject = clone targetObject;
C. destinationObject = _clone(targetObject);
D. destinationObject = clone(targetObject);
Answer: B
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
4. The class from which the child class inherits is called..
i) Child class
ii) Parent class
iii) Super class
iv) Base class
A. Only i)
B. ii), iii) and iv)
C. Only iii)

D. ii) and iv)


Answer: D
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
5. Which of the following is/are true for an abstract class?
i) A class is declared abstract by prefacing the definition with the word abstract.
ii) A class is declare abstract by using the keyword implements.
iii) It is a class that really isnt supposed to ever be instantiated but instead serves as a
base class.
iv) Attempting to instantiate an abstract class results in an error.
A. Only ii)
B. All of the mentioned
C. ii) and iv)
D. ii), iii) and iv)
Answer: A
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
6. If one intends to create a model that will be assumed by a number of closely related
objects, which class must be used?
A. Normal class
B. Static class
C. Abstract class
D. Interface.
Answer: C
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
7. If your object must inherit behavior from a number of sources you must use a/an
A. Interface
B. Object
C. abstract class
D. static class.
Answer: A
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
8. Which method is used to tweak an objects cloning behavior?
A. clone()
B. __clone()
C. _clone

D. object_clone()
Answer: B
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
9. Which feature allows us to call more than one method or function of the class in
single instruction?
A. Typecasting
B. Method Including
C. Method adding
D. Method chaining
Answer: D
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
10. Which magic method is used to implement overloading in PHP?
A. __call
B. __invoke
C. __wakeup
D. __unset
Answer: A
(ORI: http://www.sanfoundry.com/php-questions-answers-advanced-object-orientedphp/)
11. Which method scope prevents a method from being overridden by a subclass?.
A. Abstract
B. Protected
C. Final
D. Static
Answer: C
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
12. Which of the following statements is/are true about Constructors in PHP?
i) PHP 4 introduced class constructors.
ii) Constructors can accept parameters.
iii) Constructors can call class methods or other functions.
iv) Class constructors can call on other constructors.
A. ii) and iii)
B. All of the mentioned
C. None of the mentioned
D. ii), iii) and iv)

Answer: B
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
13. PHP recognizes constructors by the name.
A. classname()
B. _construct()
C. function _construct()
D. function __construct()
Answer: D
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
14. Which version of PHP introduced the instanceof keyword?
A. PHP 4
B. PHP 5
C. PHP 5.3
D. PHP 6
Answer: B
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
15. Which one of the following functions is used to determine whether a class exists?
A. exist()
B. exist_class()
C. class_exist()
D. __exist()
Answer: C
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
16. Which one of the following functions is used to determine object type?
A. obj_type()
B. type()
C. is_a()
D. is_obj()
Answer: C
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
17. Which one of the following keyword is used to inherit our subclass into a superclass?
A. extends

B. implements
C. inherit
D. include
Answer: A
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
18. In the PHP code given below, what is/are the properties?
<?php
class Example {
public $name;
function Sample(){
echo "This is an example";
}
}
?>

A. echo This is an example;


B. public $name;
C. class Example
D. function sample()
Answer: B
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
19. Which keyword is used to refer to properties or methods within the class itself?
A. private
B. public
C. protected
D. $this
Answer: D
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
20. Which keyword allows class members (methods and properties) to be used without
needing to instantiate a new instance of the class?
A. protected
B. final
C. static
D. private
Answer: C
(ORI : http://www.sanfoundry.com/php-questions-answers-basics-of-object-orientedphp-2/)
21. A controller dont have any default action

A. True
B. False
Answer: B
(ORI : http://techtalim.blogspot.co.id/2016/04/yii-mcq-questions-with-answer-foridb.html)
22. The prefix of any method name of a controller is
A. function
B. method
C. action
D. index
Answer: C
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
23. A filter can also be an instance of
A. CFilter
B. CController
C. CDatabase
D. CModel
Answer: A
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
24. Which models are used to store data collected from user input?
A. Active Record Model
B. Form Model
C. Widget
D. CModel
Answer: B
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
25. To create a text input field, we can call
A. CHtml::textField();
B. CForm::textField()
C. CModel::textField()
D. $form->textField
Answer: D
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)

26. ______________generates a label associated with the specified model attribute


A. $form->labelEx
B. CHtml::Label
C. CHtml::activeLabel()
D. activeLabel
Answer: A
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
27. Which is/are ways that not allow you to work with databases?
A. Active Record
B. ADO
C. Query Builder
D. SQL via DAO
Answer: B
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
28. Which class represents for search from database?
A. CDbConnection
B. SQLConnection
C. DBConnection
D. CDbCriteria
Answer: D
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
29. To finish the update data which method need to call?
A. Add()
B. Save()
C. Insert()
D. Insertion()
Answer: B
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
30. To read data in a database table, which methods we need to call?
A. find()
B. findAll()
C. read()

D. readByPk()
E. E. findByAttributes()
Answer: A, B, E
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
31. Which is correct ?
A. Chtml::Error()
B. CHtml::error()
C. form->error()
Answer: C
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
32. Which is correct ?
A. $form->hiddenField()
B. CHtml ->hiddenField()
C. CHtml:: hiddenField()
D. none of the above
Answer: A
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
33. Which is correct ?
A. $form-> submitButton ()
B. CHtml -> submitButton ()
C. CHtml::submitButton()
D. none of the above
Answer: C
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
34. Which represents a query criteria, such as conditions, ordering by, limit/offset?
A. Query
B. CDbCriteria
C. CQuery
Answer: B
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
35. AR Meaning

A. Auto Read
B. Active Rules
C. All Records
D. Active Records
Answer: D
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
36. ____method use to delete a row of data ?
A. delete()
B. remove()
C. truncate()
D. All of them
Answer: A
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
37. The validation is based on the rules specified in the ______method of the AR class?
A. rules()
B. Validation()
C. Check()
Answer: A
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
38. when you createa new object of widget class, what is you have to write?
A. Widget
B. CWidget
C. $this->beginWidget()
D. $this->Widget()
Answer: C
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
39. What is the first parameter of widget object
A. CActiveForm
B. id
C. htmlOptions
D. enableAjaxValidation
Answer: A

(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
40. By default Ajax Validation is false
A. Right
B. Wrong
Answer: A
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
41. Yii is equipped with a Web-based code generation tool called
A. Yii
B. Gii
C. Zii
D. CI
Answer: B
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
42. Which keyword allows class members (methods and properties) to be used without
needing to instantiate a new instance of the class?
A. CUserIdentity
B. CUserAuthentication
C. UserIdentity
Answer: A
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
43. UserIdentity class is located at
A. protected\extention
B. protected\controller
C. protected\components
Answer: C
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
44. Which is correct
A. this->Error_Username_Invalid
B. this->ERROR_USERNAME_INVALID
C. self:: error_username_invalid
D. self::ERROR_USERNAME_INVALID

Answer: D
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
45. By default Yii has only one demo user
A. true
B. false
Answer: B
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
46. Only digit are support in text field for this which validation rules have to apply
A. alphanumeric
B. integer
C. numeric
D. numerical
Answer: D
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
47. Where you have to define the relations method
A. controller
B. view
C. module
D. components
E. None of the above
Answer: E
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
48. What is correct?
A. public $layout='/layouts/aaa;
B. public $layout='//layouts/aaa/;
C. public $layout='/layouts/aaa/;
D. public $layout='//layouts/aaa;
Answer: D
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
49. By which symbol in access rule define only login user can access an action
A. *

B. @
C. #
D. none of the above
Answer: B
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)
50. Which method is incorrect
A. $this->render
B. $this->renderPartial
C. $this-> loadModel
D. $this-> performAjaxValidation
E. $this->Validation
Answer: E
(ORI : https://asamamun.wordpress.com/2015/03/28/test-your-knowledge-in-yii-mcqquiz/)

You might also like