Sunday 8 September 2013

Codeigniter objective interview question and answers

1).Code Igniter is a _____

a).Object Oriented Concept b).PHP Library without Web Server c).Application Development Framework d).Content Management System

2).Which of the following is not true about CodeIgniter

a).It is light weight b).It is fast c).It uses MVC d).It uses Delphi Modelling Techniques

3).The separation of logic and presentation can be seen in which of the following?

a).MVC approach b).Simpleton approach c).Master/Slave Model d).Semaphore Model

4).The urls generated by CodeIgniter are search-engine friendly and clean because they use

a).Query String approach b).Segment based approach c).Keyword based approach d). SEO based approach

5).One way to remove the index.php file in CodeIgniter is by using a

a).MVC file b).root file c)..htaccess file d).settings file

6).Which of the following cannot be used to extend CodeIgniter System
a).Library b).Helper c).System Hooks d).Jar files

7).The reason why CodeIgniter does not use a template engine is because
a).To reduce codebase b).To improve performance c).To reduce core files d).To reduce system files

8).Query string URLs cannot be used in CodeIgniter
a).True b).False c).Can be used in the latest version d). None

9).example.com/class/function/ID. The first segment in this example represents
a).Controller class b).Controller variable c).Library class d).Library variable

10).example.com/class/function/ID. The second segment in this example represents
a).Controller class b).Controller Function c).Library class d).Library Function

11).If you want a url like this, example.com/index.php/products/view/email.codeigniter what should you do?
a).Use a controller called do codeigniter b).Disable query strings
c).Use URL Suffix d). All of the above

12).In the url example.com/index.php/blog/ what is the controller name?
a).example b).index c).blog d).None

13).You usually save your controller in which of the following folder?
a).application/system/controllers b).application/controllers c).application d).application/helper

14).Your custom controller should
a).extend the child controller b). extend the super class c). extend the super controller d). extend the parent controller

15).In this url, example.com/index.php/products/shoes/sandals/123, shoes is
a).function b).controller name c).first variable d).None

16).To load a default controller what should you do?
a).Give the default controller name b).Always inherit the parent controller
c).specify this in application/config/routes.php d).Add a setting to application/config.php

17).The second segment of the URI typically determines
a).Which controller should be called b).which function in the controller gets called. C).which system library to load d).All of the above

18).If your controller contains a function named _remap() which of the following is true?
a).It will always get called regardless of what the URI contains. b).It overrides the normal behavior in which the URI determines which function to call c).CodeIgniter permits user to override normal behaviour through the use of the _remap() function d). All of the above

19).CodeIgniter has which output class that takes care of sending your final rendered data to the web browser automatically.
a).View class b).Output class c).Controller Class d).Routing Class


20).Which of the following is a private function in codeigniter?
a)._utility b).Utility c).utility_private d).private_utility

21).If you want to use a constructor in any of the Controllers, which of the following is necessary to achieve this?
a).parent::__construct(); b).child::__construct(); c).parent::controller(); d).super::controller()

22).Which of the following is a reserved name and hence cannot be used to name the controller:
a).CI_Base b).index c).Default d).All

23).A ____ is a web page or a page fragment like a header, footer etc
a).Controller b).Hook c).Teaser d).View

24).Which of the following is NOT true about Views?
a).views can flexibly be embedded within other views b).view must be loaded by a controller
c).views can be called directly d).views may or may not contain html

25).In the following, $this->load->view(‘name’); what does ‘name ‘ stand for?
a).config parameter b).view name c).parent view name d).controller class name

26). Which of the following is designed to work with information in your database?
a).Controller b).Model c).Sql Query d).Library

27).If you have a model class like this:
1
2
3
4
5
6
class User_model extends CI_Model
{    function __construct()
    {
        parent::__construct();
    }
}
What will be the file name when this class is saved as a model?
a).User_model b).user_model c).user_Model d).User_Model

28).If a model is located in a sub-folder like, application/models/blog/queries.php what is the right way to load this model?
a).$this->load->model(‘queries’);
b).$this->load->model(‘model/blog/queries’);
c).$this->load->model(‘blog/queries’);
d).$this->load->model(‘application/models/blog/queries’);

29).If you have a model called “Admissions”, what is the right way to access a function within this model if the model is assigned to a different object name like ‘fubar’?
a). $this->load->model(‘Admissions’, ‘fubar’); $this->fubar->function();
b). $this->load->model(‘Admissions’, ‘fubar’); $this->Admissions->function();
c). $this->load->model(‘Admissions’, ‘fubar’); $this->admin->function();
d). $this->load->model(‘Admissions’, ”); $this->fubar->function();

30).If you want to auto load a model what will you do?
a).Load it then and there using $this->load->model()
b).Load it when the parent model loads
c).Add the model to application/config/autoload.php
d).Remove the model from application/config/autoload.php

31).When a model is loaded
a).it is connected automatically to your database.
b).it does NOT connect automatically to your database.
c).it connects to database if you have set the config file properly
d).it connects ONLY if persistent connection is enabled

32). In the following database connectivity settings for a model, which of the following config is invalid?
1
2
3
4
5
6
7
8
9
10
$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$config['shared_pool_size'] = '200M';
$this->load->model('Model_name', '', $config);
a).$config['hostname']
b).$config['username']
c).$config['pconnect']
d).$config['shared_pool_size']
Answers to the above questions:
1
2
3
4
5
6
7
8
9
10
C
D
A
B
C
D
B
B
A
B
11
12
13
14
15
16
17
18
19
20
C
C
B
D
A
C
A
D
B
A
21
22
23
24
25
26
27
28
29
30
A
D
D
C
B
B
B
C
A
C
31
32








B
D








0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More