Codeigniter MCQ Question & Answer | IDB Codeigniter mcq
![]() |
| codeigniter - youngheart tk |
1. Base URL can be changed from which configuration file:
- a. database
- b. config
- c. routes
- d. autoload
2. default controller can be set from which configuration file:
- a. database
- b. config
- c. routes
- d. autoload
3. Which configuration file is used to autoload resources?
- a. database
- b. config
- c. routes
- d. autoload
4. Which one is the business logic in codeigniter?
- a. model
- b. view
- c. controller
- d. helper
5. Which of the following in MVC can connect to database?
- a. model
- b. view
- c. controller
- d. helper
6. In CI, the closing tag of PHP is optional.
- a. true
- b. false
7. Which are false?
- a. all codeigniter class name should start with uppercase and rest of the name should be in lowercase.
- b. you can remap function calls by using a function in your controller called _remap()
- c. view file cannot call other view files
- d. you can pass data to a view file by using the third parameter of the load->view function.
8. Which variable name is incorrect?
- a. $Text
- b. $f
- c. $user id
- d.$text
- e. $some-test-here
9. The keywords true, false, null should always be in lowercase letter in codeigniter.
- a. true
- b. fasle
10. What kind of link is this:
- a. URI
- b. QueryString
- c. ftp link
11. The above URl is built on segments.
- A. true
- B. false
12. Which one will be treated as parameter in that URI?
- a. index.php
- b. somethingvone
- c. somethingvtwo
- d. somethingvthree
13. Which one will be treated as method in that URI?
- a. index.php
- b. somethingvone
- c. somethingvtwo
- d. somethingvthree
14. Which one will be treated as controller in that URI?
- a. index.php
- b. somethingvone
- c. somethingvtwo
- d. somethingvthree
15. Which one will control all the segments?
- a. index.php
- b. somethingvone
- c. somethingvtwo
- d. somethingvthree
16. Which are true:
- a. helper can only be loaded in controller and model. View cannot load helper
- b. we cannot load multiple helper by passing an array of values to the first parameter.
- c. Plugins are stored within system/application/plugins/ folder.
- d. all codeigniter core libraries have the prefix CI_
17. Libraries are created so that they can be reused whenever needed.
- a. true
- b. false
18. Benchmark can be added to model, view and controllers
- a. true
- b. false
- 19. You can display the amount of memory used by the system by calling:
- a. $this->benchmark->memory_use()
- b. $this->memory_use()
- c. $this->benchmark->memory_usage()
- d. $this->memory_usage()
20. Which one is not true
- a. we can set automatic filtering on by setting $config[‘global_xss_filtering’] to TRUE
- b. We can check image for safety in optional second parameter to the xss clean function
- c. The email class also serves as a wrapper class in CI
- d. email can only be sent from controller
21. Which function is use to set the value of form input box ?
- a. setvalue()
- b. set()
- c . set_value()
- d. Non of above
22. How many parameters are set_rules function ?
- a. 4
- b. 3
- (. 2
- d. 5
23.Which is extremely useful and even though also optional ?
- a. Model
- b. View
- c. Controller
- d. Non of above
24. Which refers to the system of numbering pages-a list of numbered links ?
a. Rotating
b. Pagination
c. Cropping
d. All of above
25. What correct line of coded loading a view ?
- a. $this->load->view(‘view_name’)
- b. $this->view(‘view_name’)
- c. $this->load(‘view_name’)
- d. $this->load->view_name(‘view’)
26. What work in almost exactly the same way as Helpers ?
- a. Helper
- b. Plugin
- c. Library
- d. All of above
27.Which class is used to calculate the time between two points in your application ?
- a. Profiling class
- b. Security class
- c. Benchmarking class
- d. Non of above
28.Which key word is used callback function ?
- a. _callback
- b. callback_
- c. _callback_
- d. Non of above
29. Which of the following is/are fasle:
- a. The third parameter in load->view function used for output buffering
- b. The default batch size for bcc is 500
- c. we can store data in session by calling set_userdata() method
- d. to validate form we use the form library in CI.
30. CI session contains the following:
- a. Session_ID
- b. users IP address
- c. user manager
- d. first activity timestamp
31. _______ is an Application Development Framework - a toolkit - for people who build web sites using PHP.
- A. Joomla
- B. Zend
- C. CodeIgniter
- D. Wordpress
32. Which statement is true about the View?
- A. A View is simply a class file that is named in a way that can be associated with a URI
- B. A view is simply a web page, or a page fragment, like a header, footer, sidebar, etc
- C. A view is simply a PHP Code, add a different type of function
33. Which statement is true about the Controller?
- A. A Controller is simply a class file that is named in a way that can be associated with a URI
- B. A Controller is simply a web page, or a page fragment, like a header, footer, sidebar, etc
- C. Models are PHP classes that are designed to work with information in your database
34. Which statement is true about the Modules?
- A. A Models is simply a class file that is named in a way that can be associated with a URI
- B. A Models is simply a web page, or a page fragment, like a header, footer, sidebar, etc
- C. Models are PHP classes that are designed to work with information in your database
35. Helper file is simply a collection of functions in a particular category.
- A. True
- B. Flase
36. How to load a helper file using the following function?
- A. $load->helper('name');
- B. $Loding->load->helper('name');
- C. $this->load->helper('name');
37. Which of the following line of code use to a send email?
A. library('email');
Mail details code here
$this->email->send();
B. $this->load->library('email');
Mail details code here
$this->email->send();
C. $this->load->email;
Mail details code here….
$this->email->send();
38. Which of the following code loads and initializes the database class based on your configuration settings?
- A. $this->load->DataFile();
- B. $this->load->DatabaseName();
- C. $this-> database();
- D. $this->load->database();
39. Which of the following code is example of query?
- A. $this->db-> ('SELECT name, title, email FROM my_table');
- B. $this->db->query('SELECT name, title, email FROM my_table');
- C. $query = $this->db->query('SELECT name, title, email FROM my_table');
40. Which class allows information to be retrieved, inserted, and updated in your database with minimal scripting?
- A. Active Record Class
- B. Helper class
- C. Database Class
- D. URI class
41. _________ Runs the selection query and returns the result. Can be used by itself to retrieve all records from a table.
A. $this->db->getAll()
B. $this->db->get()
C. $this->db->getQuery()
42. How to get the average age from a Employee table?
- A. $this->db->select_avg('age');
- B. $this->db->avg('age');
- C. $this->select_avg('age');
43. Base URL can be changed from which configuration file:
- A. database
- B. config
- C. routes
- D. autoload
44. default controller can be set from which configuration file:
- A. database
- B. config
- C. routes
- D. autoload
45. In CI, the closing tag of PHP is optional.
A true
B. false
Ans: A
46. Which function is use to set the value of form input box ?
- A. setvalue()
- B. set()
- C. set_value()
- D. Non of above
47. How to initialized upload class in our controller?
- A. $this->load->helper('upload');
- B. $this->load->Uploading('upload');
- C. $this->load->'upload';
- D. $this->load->library('upload');
48. Which function gives you to view file friendly syntax to get browser cookies?
- A. get_cookie()
- B. list_cookie()
- C. dis_cookie()
- D. set_cookie()
49. How to creates an opening form tag with a base URL built from your config preferences?
- A. echo form_fopen('email/send');
- B. echo form('email/send');
- C. echo form_open('email/send');
- D. echo open('email/send');
50. Which rules returns FALSE if the form element is empty?
- A. required
- B. compulsory
- C. Empty
51. Which rules returns FALSE if the form element contains anything other than alpha-numeric characters.?
- A. alpha
- B. numeric
- C. alpha_numeric
52. Which rules returns FALSE if the form element does not contain a valid email address.?
- A. email
- B. valid_email
- C. alpha_numeric
53. How to update data using Active Record Pattern?
- A. $this->db->updated('mytable', $object);
- B. $this->db->ActiveRecord('mytable', $object);
- C. $this->db->update('mytable', $object);
- D. $this->db->updateData('mytable', $object);
54. CodeIgniter is fairly restrictive regarding which characters it allows in your URI strings in order to help minimize the possibility that malicious data can be passed to your application.
- A. Alpha-numeric text
- B. Tilde: ~
- C. Period: .
- D. Hypen -
55. The _________ class permits you maintain a user's "state" and track their activity while they browse your site.
- A. loader
- B. Session
- C. Cookie
- D. Header
56. How to initializing the Session?
- A. $this->load->session();
- B. $this->library('session');
- C. $this->load->Session['session'];
- D. $this->load->library('session');
