My Internship Interview Summary

I recently participated in some PHP internship interview. I summarize some common questions here.

First, the interviewer will let you do some self-introduction, you can talk about your experience, what projects done before, then the interviewer is likely to continue this topic, asking them in your project done, which is the most challenging or let you impressive technical issues is, and how to solve it.

About system designs, what to consider before you the design of the system. About PV (A page view or page impression is a request to load a single web page of an Internet site.), UV(Unique visitors refers to the number of distinct individuals requesting pages from the website during a given period, regardless of how often they visit.).

Optimize the database performance

How do you design a database field

Difference between VARCHAR and CHAR

VARCHAR is variable-length. CHAR is fixed length. If your content is a fixed size, you'll get better performance with CHAR. Refernce MySQL: The CHAR and VARCHAR Types.

About NoSQL Databases

What is NoSQL?

NoSQL encompasses a wide variety of different database technologies that were developed in response to a rise in the volume of data stored about users, objects and products, the frequency in which this data is accessed, and performance and processing needs. Relational databases, on the other hand, were not designed to cope with the scale and agility challenges that face modern applications, nor were they built to take advantage of the cheap storage and processing power available today.

The Benefits of NoSQL

When compared to relational databases, NoSQL databases are more scalable and provide superior performance, and their data model addresses several issues that the relational model is not designed to address:

  • Large volumes of structured, semi-structured, and unstructured data
  • Agile sprints, quick iteration, and frequent code pushes
  • Object-oriented programming that is easy to use and flexible
  • Efficient, scale-out architecture instead of expensive, monolithic architecture

There are 3 type of visibility available in php for controlling your property or method.

public scope to make that variable/function available from anywhere, other classes and instances of the object.

Public Visibility in PHP Classes

Public visiblity is least restricted visibility available in php. If you will not define the visibity factor with your method or property then public will be by defautl applied. Public methods or variables can be accessible from anywhere.For example, It can be accessible from using object(outside the class), or inside the class, or in child class. Following is the example of the public visibility in php classes:

class test
{
    public $abc;
    public $xyz;
    public
    function xyz() {}
}

$objA = new test();
echo $objA->abc; //accessible from outside
$objA->xyz(); //public method of the class test

So in above example class test is the very basic class. In this class every thing is open. Mininum restriction in the class is to access its properyt and methods using object outside the class.

private scope when you want your variable/function to be visible in its own class only.

Private Visibility in PHP Classes

Private method or properties can only be accessible withing the class. You can not access private variable or function of the class by making object out side the class. But you can use private function and property within the class using $this object. Private visibility in php classes is used when you do not want your property or function to be exposed outside the class. Following example of Private visibility in php classes.

class test
{
    public $abc;
    private $xyz;

    public function pubDo($a) {
        echo $a;
    }

    private function privDo($b) {
        echo $b;
    }

    public function pubPrivDo() {
        $this->xyz = 1;
        $this->privDo(1);
    }
}

$objT      = new test();
$objT->abc = 3; //Works fine
$objT->xyz = 1; //Throw fatal error of visibility
$objT->pubDo("test"); //Print "test"
$objT->privDo(1); //Fatal error of visibility
$objT->pubPrivDo(); //Within this method private function privDo and variable xyz is called using $this variable.

protected scope when you want to make your variable/function visible in all classes that extend current class including the parent class.

Protected Visibility in PHP Classes

Protected visibility in php classes are only useful in case of inheritance and interface. We will discuss in dept of interfaces and inheritance in other chapter of this tutorial. Protected method or variable can be accessible either within class or child class. Here we will take very basic example:

class parent
{
    protected $pr;
    public $a
    protected function testParent() {
        echo this is test;
    }
}

class child extends parent
{
    public function testChild() {
        $this->testParent(); //will work because it
    }
}

$objParent = new parent();
$objParent->testParent(); //Throw error
$objChild  = new Child();
$objChild->setChild(); //work because test child will call test parent.

If you will take anaylze above section you can found that method testParent() is not accessible from object of class. But it is accessible in child class.

Always use correct visibility in php classes to keep your structure healthy. Do not use code like this. It is break all visibility of your php class.

class test
{
    public function method($method) {
        $this->$method();
    }

    private function abc() {
        //Do Something
    }

    protected function xyz() {
        //do something
    }
}

$objT = new test();
$objT->method('abc');
$objT->method('xyz');

Reference PHP: Classes and Objects.

Algorithm

Basic knowledge

Data Structure Algorithm Concept
List Breadth-first search Bit manipulation
Binary Tree Depth-first search Singleton Design Pattern
Forest data structures Binary search Factory Method Design Pattern
Stack Merge Sort Memory (stack and heap)
Queue Quick Sort Recursive
Vector / Array List Insert or search of tree O Mark
Hash table

Difference between POST and GET

GET requests a representation of the specified resource. Note that GET should not be used for operations that cause side-effects, such as using it for taking actions in web applications. One reason for this is that GET may be used arbitrarily by robots or crawlers, which should not need to consider the side effects that a request should cause.

Server use Request.QueryString method get value, Less secure, less efficient, less transmission capacity(lass than 2KB)

POST submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both.

Server use Request.Form method get value, More secure, more efficient, more transmission capacity.

Cookies and Sessions

Sessions are server-side files that contain user information, while Cookies are client-side files that contain user information. Sessions have a unique identifier that maps them to specific users. This identifier can be passed in the URL or saved into a session cookie.

Some params in php.ini file.

The interview is almost over, do you have any questions for me?
How could I have done a better interview?

0.00 avg. rating (0% score) - 0 votes