CodeIgniter

Q.1 What is Codeigniter?
Codeigniter is an open source framework for web application on PHP. It is loosely based on MVC pattern and it is similar to CakePHP.
Q.2 What are the most prominent features of Codeigniter?
1. It is an open source framework and free to use. 2. It is extremely light weighted. 3. It is based on Model View Controller (MVC) pattern. 4. It has full featured database classes and support for several platforms. 5. It is extensible. You can easily extend system by using your own libraries, helpers etc. 6. Excellent documentation.
Q.3 Explain Codeigniter architecture?
From technical point of view, CodeIgniter is dynamically instantiation, loosely coupled and has component singularity.
Q.4 Explain views in Codeigniter?
View folder contains all the markup files like header, footer, sidebar, etc. They can be reused by embedding them anywhere in controller file. They can't called directly, they have to be loaded in the controller's file.
Q.5 Explain controller in Codeigniter?
A controller is the intermediary between models and views to process HTTP request and generates a web page. It is the center of every request on your web application.
Q.6 What is basic Codeigniter URL structure?
Its structure is as follows, abc.com/class/function/ID
Q.7 Explain the components of the URL structure?
1. class represents controller class that needs to be invoked. 2. function is the method that is called. 3. ID is any additional segment that is passed to controllers.
Q.8 What is helper in Codeigniter?
Helpers are the group of functions in a particular category that assist you to perform specific functions.
Q.9 List the helpers in CodeIgniter?
1. URL Helpers: helping in creating links. 2. Text Helpers: perform various text formatting routines. 3. Cookies Helpers: set and read cookies.
Q.10 Explain Codeigniter Library?
CodeIgniter provides a rich set of libraries. It is an essential part of CodeIgniter as it increases the developing speed of an application.
Q.11 List the three methods to create a library?
1. Creating an entire new library 2. Extending native libraries 3. Replacing native libraries
Q.12 What is stable version of Codeigniter?
The stable version of Codeigniter is Version: 3.0.5.
Q.13 In which language Codeigniter is written?
The Codeigniter is Written in PHP.
Q.14 What are the features of Codeigniter?
1. Light Weight 2. CodeIgniter is Extensible 3. Full Featured database classes
Q.15 Explain Codeigniter file structure?
1. cache 2. Config 3. Controllers 4. core 5. errors 6. helpers 7. hooks
Q.16 Explain application flow chart in Codeigniter?
1. The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter. 2. The Router examines the HTTP request to determine what should be done with it. 3. If a cache file exists, it is sent directly to the browser, bypassing the normal system execution. 4. Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
Q.17 Explain MVC in Codeigniter?
MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.
Q.18 Can you extend native libraries in Codeigniter?
Yes, we can add some extended functionality to a native library by adding one or two methods.
Q.19 Who developed Codeigniter?
Codeigniter was developed by ellislab Inc.
Q.20 Why Codeigniter is called as loosely based MVC framework?
This is because we does not need to follow strict mvc pattern while creating application. We can also able to build with model only view and controllers are enough to built a application.
Q.21 What CLI means?
A command-line interface (CLI) processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor.
Q.22 What are the advantages of CLI?
1. If you know the commands, a CLI can be a lot faster and efficient than any other type of interface. 2. A CLI requires less memory to use in comparison to other interfaces. 3. A CLI doesn't require Windows and a low-resolution monitor can be used.
Q.23 What are the disadvantages of CLI?
Some disadvantages of the command line interface are a steep learning curve, small room for error, the large number of commands and the inability to figure something out through exploration.
Q.24 What are drivers in CodeIgniter?
Drivers are a special type of Library that has a parent class and any number of potential child classes. Drivers provide an elegant syntax in your controllers for libraries that benefit from or require being broken down into discrete classes.
Q.25 What is hooks in CodeIgniter?
CodeIgniter's Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files.
Q.26 What is PHP hook?
PHP or code hook is a specially defined part in the program code that can pass control to an add-on.
Q.27 Give a list of reserved names?
1. Controller. 2. CI_Base. 3. _ci_initialize. 4. Default. 5. index.
Q.28 What is views in CodeIgniter?
Views are special files used in CodeIgniter to store the markup outputted by the application, usually consisting of HTML and simple PHP tags.
Q.29 How do you load a view?
1. Create View. View files are created and managed in application/views directory. 2. Load View. Create a User. 3. Demo. 4. Conclusion. You can use PHP or HTML file to create the view and load it from the controller.
Q.30 How do I call CodeIgniter helper?
1. Contents. Create Custom Helper. 2. Create Custom Helper. 3. Load Helper in Controller. 4. Globally Load Helper. 5. Call Helper Function.
Q.31 What do you understand by Auto-loading Resources?
CodeIgniter comes with an “Auto-load” feature that permits libraries, helpers, and models to be initialized automatically every time the system runs.
Q.32 List items that can be loaded automatically?
1. Classes found in the libraries/ directory 2. Helper files found in the helpers/ directory 3. Custom config files found in the config/ directory 4. Language files found in the system/language/ directory 5. Models found in the models/ folder
Q.33 What are Common Functions?
CodeIgniter uses few functions for its operation that are globally defined, and are available to you at any point. These do not require loading any libraries or helpers.
Q.34 What does Compatibility Functions enable?
A set of compatibility functions that enable you to use functions what are otherwise natively available in PHP, but only in higher versions or depending on a certain extension.
Q.35 Explain Error Handling in codeigniter?
CodeIgniter lets you build error reporting into your applications using the functions described below. Additionally, it has an error logging class that permits error and debugging messages to be saved as text files.
Q.36 How Does Caching Work?
When a page is loaded for the first time, the cache file will be written to your application/cache folder. On subsequent page loads the cache file will be retrieved and sent to the requesting user’s browser. If it has expired, it will be deleted and refreshed before being sent to the browser.
Q.37 What does Profiler Class display?
The Profiler Class will display benchmark results, queries you have run, and $_POST data at the bottom of your pages. This information can be useful during development in order to help with debugging and optimization.
Q.38 Why should we run via the command-line?
1. Run your cron-jobs without needing to use wget or curl 2. Make your cron-jobs inaccessible from being loaded in the URL by checking the return value of is_cli(). 3. Make interactive “tasks” that can do things like set permissions, prune cache folders, run backups, etc. 4. Integrate with other applications in other languages.
Q.39 How to rename the application directory?
If you would like to rename your application directory you may do so as long as you open your main index.php file and set its name using the $application_folder variable
Q.40 How will you relocate your application directory?
To move your application directory to a different location on your server than your web root. To do so open your main index.php and set a full server path in the $application_folder variable
Q.41 What does the URIs contains?
1. Alpha-numeric text (latin characters only) 2. Tilde: ~ 3. Percent sign: % 4. Period: . 5. Colon: : 6. Underscore: _ 7. Dash: - 8. Space
Q.42 List the best practices for security?
1. Validate the data to ensure it conforms to the correct type, length, size, etc. 2. Filter the data as if it were tainted. 3. Escape the data before submitting it into your database or outputting it to a browser.
Q.43 Explain XSS Filtering?
This filter looks for commonly used techniques to embed malicious JavaScript into your data, or other types of code that attempt to hijack cookies or do other malicious things.
Q.44 What is CSRF?
CSRF stands for Cross-Site Request Forgery, which is the process of an attacker tricking their victim into unknowingly submitting a request.
Q.45 How to TextMate?
1. Open the Application Preferences 2. Click Advanced, and then the “Saving” tab 3. In “File Encoding”, select “UTF-8” 4. In “Line Endings”, select “LF”
Q.46 What is the Class names format?
Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not CamelCased.
Q.47 Explain the Variable names formatting?
Variables should contain only lowercase letters, use underscore separators, and be reasonably named to indicate their purpose and contents. Very short, non-word variables should only be used as iterators in for() loops.
Q.48 Can whitespace precede the opening PHP tag?
No whitespace can precede the opening PHP tag. Because the output is buffered, so whitespace in your files can cause output to begin before CodeIgniter outputs its content, leading to errors and an inability for CodeIgniter to send proper headers.
Q.49 List some SQL keywords?
SQL keywords are always capitalized: SELECT, INSERT, UPDATE, WHERE, AS, JOIN, ON, IN, etc.
Q.50 What is a Controller?
A Controller is simply a class file that is named in a way that can be associated with a URI.
Get Govt. Certified Take Test