Jnr PHP/Codeigniter Developer Interview Questions & Answers
Download PDF

Jnr PHP/Codeigniter Developer Frequently Asked Questions in various Jnr PHP/Codeigniter Developer job interviews by interviewer. The set of questions are here to ensures that you offer a perfect answer posed to you. So get preparation for your new job interview

61 Jnr PHP/Codeigniter Developer Questions and Answers:

Jnr PHP/Codeigniter Developer Interview Questions Table of Contents:

Jnr PHP/Codeigniter Developer Job Interview Questions and Answers
Jnr PHP/Codeigniter Developer Job Interview Questions and Answers
The type of cookie which is stored permanently on the browser. A persistent cookie can be used for tracking long-term information.

2 :: Tell me do you use Composer? If yes, what benefits have you found in it?

Using Composer is a tool for dependency management. The candidate can declare the libraries your product relies on and Composer will manage the installation and updating of the libraries. The benefit is a consistent way of managing the libraries depended on so less time is spent managing the libraries.

3 :: Tell me does PHP support multiple inheritance?

No. But class can implement multiple interfaces. Multiple inheritance is partially possible using traits.

4 :: Do you know what is Polymorphism?

It is the basic principle of OOP. You can define base class (may be abstract) Animals and it can then be extended by other classes like Dog, Cat and take part of the behaviour from the parent class.

5 :: Tell us can you send an Ajax request to another domain?

It is not possible to send an Ajax request if the protocol or host are different. This is called CORS and is checked by the browser.
unset() sets a variable to “undefined” while unlink() deletes a file we pass to it from the file system.

7 :: Tell me will comparison of string "10" and integer 11 work in PHP?

Yes, it will, because PHP is not a typed language and it will try to convert variable types before comparison.

8 :: Tell us can you extend a Final defined class?

No, you cannot extend a Final defined class. A Final class or method declaration prevents child class or method overriding.
Unlink() deletes the given file from the file system. Where unset() makes a variable undefined from memory.

10 :: Tell me what is Memcache?

Technology that caches objects in memory and the application can get to them really fast. It is the basis in scaling larger PHP application.

11 :: Tell me what’s the difference between the include() and require() functions?

They both include a specific file but on require the process exits with a fatal error if the file can’t be included, while include statement may still pass and jump to the next step in the execution.

12 :: Explain me what’s the full form of PHP?

Original form is Personal Home Page. However, according to the PHP manual, it is PHP: Hypertext Preprocessor.

13 :: List out different types of the hook point in Codeigniter?

Different types of hook point in Codeigniter includes

☛ post_controller_constructor
☛ pre_controller
☛ post_sytem
☛ pre_system
☛ cache_override
☛ display_override
☛ post_controller

14 :: Explain how can we get the browser properties using PHP?

Simple answer is using $_SERVER['HTTP_USER_AGENT']. Not so simple is that we need to take into account proxy servers and other situations. In total, this information is defined in 3 $_SERVER variables.

15 :: Explain me in PHP what is the difference between a Class and an Interface?

Interface defines the methods and their parameters. Class can then implement the interface (or multiple interfaces) and needs to define such methods. So interface defines outline and class-specific behaviour.

16 :: What is routing in Codeigniter?

In CodeIgniter, the way PHP files served is different rather than accessing it directly from the browser. This process is called routing. Routing in CodeIgniter gives you freedom to customize the default URL pattern to use our own URL pattern according to the requirement. So, whenever there is a request made and matches our URL pattern it will automatically direct to the specified controller and function.

17 :: Tell me how you can extend the class in Codeigniter?

To extend the native input class in CodeIgniter, you have to build a file named application/core/MY_Input.php and declare your class with

Class MY_Input extends CI_Input {

}

18 :: Tell us what are the __construct() and __destruct() methods in a PHP class?

All objects in PHP have Constructor and Destructor methods built-in. The Constructor method is called immediately after a new instance of the class is being created, and it’s used to initialize class properties. The Destructor method takes no parameters.

Understanding these two in PHP means that the candidate knows the very basics of OOP in PHP.

19 :: Tell me the different types of errors in PHP?

Those are Notices, Warnings and Fatal errors are the types of errors in PHP. Notices represents non-critical errors. Warnings are more serious errors but they do not result in script termination. Fatal errors are critical errors i.e. calling a non-existent function or class. These errors cause the immediate termination of the script.

20 :: Tell me what are the 3 scope levels available in PHP and how would you define them?

☛ Private – Visible only in its own class
☛ Public – Visible to any other code accessing the class
☛ Protected – Visible only to classes parent(s) and classes that extend the current class

This is important for any PHP developer to know because it shows an understanding that building applications is more than just being able to write code. One must also have an understanding about privileges and accessibility of that code. There are times protected variables or methods are extremely important, and an understanding of scope is needed to protect the integrity of the data in your application along with provide a clear path through the code.
In HTML, there is no Codeigniter way, as such it is a PHP server side framework. Just use an absolute path to your resources to link images/CSS/JavaScript from a view in CodeIgniter

/css/styles.css

/js/query.php

/img/news/566.gpg

22 :: Explain echo vs. print statement?

echo() and print() are functions in PHP, both output strings. Function echo() can take multiple expressions whereas print() cannot. Moreover print() returns true or false based on success or failure whereas echo doesn't.

23 :: Tell me what are PSRs? Choose 1 and briefly describe it?

PSRs are PHP Standards Recommendations that aim at standardising common aspects of PHP Development.

An example of a PSR is PSR-2, which is a coding style guide.

24 :: Tell me what are the main error types in PHP and how do they differ?

In PHP there are three main type of errors:

☛ Notices – Simple, non-critical errors that are occurred during the script execution. An example of a Notice would be accessing an undefined variable.

☛ Warnings – more important errors than Notices, however the scripts continue the execution. An example would be include() a file that does not exist.

☛ Fatal – this type of error causes a termination of the script execution when it occurs. An example of a Fatal error would be accessing a property of a non-existent object or require() a non-existent file.

25 :: Tell me how you can prevent CodeIgniter from CSRF?

There are several ways to protect CodeIgniter from CSRF, one way of doing is to use a hidden field in each form on the website. This hidden field is referred as CSRF token; it is nothing but a random value that alters with each HTTP request sent. As soon as it is inserted in the website forms, it gets saved in the user’s session as well. So, when the form is submitted by the users, the website checks whether it is the same as the one saved in the session. If it is same then, the request is legitimate.
Jnr PHP/Codeigniter Developer Interview Questions and Answers
61 Jnr PHP/Codeigniter Developer Interview Questions and Answers