CakePHP MCQ Questions & Answers
CakePHP MCQs : This section focuses on "CakePHP" of PHP Framework. These Multiple Choice Questions (MCQ) should be practiced to improve the CakePHP 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 cakephp?
A. CakePHP is an open source MVC framework.
B. CakePHP makes developing, deploying and maintaining applications much easier.
C. CakePHP has a number of libraries to reduce the overload of most common tasks.
D. All of the above
View Answer
Ans : D
Explanation: CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.
2. The view uses ___________ to generate the response body and headers.
A. Helpers
B. Cells
C. Helpers and Cells
D. None of the above
View Answer
Ans : C
Explanation: The view uses Helpers and Cells to generate the response body and headers.
3. Which methods cannot be accessed with routing?
A. Public
B. Private
C. Protected
D. Both B and C
View Answer
Ans : D
Explanation: The /users /view maps to the view() method of the UsersController out of the box. Protected or private methods cannot be accessed with routing.
4. Which function is used to read the configuration for the environment you need and build your application?
A. environment()
B. env()
C. config.env()
D. config.environment()
View Answer
Ans : B
Explanation: You can make use of env() function to read the configuration for the environment you need and build your application.
5. Can we use extension .ctp while providing the name of the View file?
A. Yes
B. No
C. Can be yes or no
D. Can not say
View Answer
Ans : B
Explanation: Don’t use extension .ctp while providing the name of the View file.
6. The _______ method will take the name of the database table as an argument.
A. put()
B. set()
C. get()
D. select()
View Answer
Ans : C
Explanation: The get() method will take the name of the database table as an argument.
7. Which allows you to authenticate users based on form POST data?
A. FormAuthenticate
B. BasicAuthenticate
C. DigestAuthenticate
D. All of the above
View Answer
Ans : A
Explanation: FormAuthenticate : It allows you to authenticate users based on form POST data. Usually, this is a login form that users enter information into. This is default authentication method.
8. What is the data type for exceptionRenderer?
A. int
B. bool
C. array
D. string
View Answer
Ans : D
Explanation: The class responsible for rendering uncaught exceptions. If you choose a custom class, you should place the file for that class in src/Error. This class needs to implement a render() method.
9. The log() function is provided by the?
A. Logging
B. LogTrait
C. datalog
D. cronjob
View Answer
Ans : B
Explanation: The log() function is provided by the LogTrait, which is the common ancestor for almost all CakePHP classes.
10. Which of email transports can be used in CakeEmail?
A. Only Mail and Smtp
B. Mail, Smtp and your own
C. Only Mail
D. Only Smtp
View Answer
Ans : B
Explanation: Mail, Smtp and your own of email transports can be used in CakeEmail
Discussion