Appinventiv Php Developer Interview Questions

Appinventiv Php Developer Interview Questions
Download Appinventiv Php Developer Interview Questions PDF

Below are the list of Best Appinventiv Php Developer Interview Questions and Answers

In PHP @ is used to suppress error messages.When we add @ before any statement in php then if any runtime error will occur on that line, then the error handled by PHP

crypt(), Mcrypt(), hash() are used for encryption in PHP

Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications. XSS enables attackers to inject client-side script into web pages viewed by other users. A cross-site scripting vulnerability may be used by attackers to bypass access controls such as the same-origin policy.

You can find the datatype of a variable in PHP by using the Var_dump() and gettype() functions.

Some differences between GET and Post are:

GETPOST
It claims request parameter in URL StringIt claims request parameter in the request body
It is able to send a minute amount of dataIt is able to send a great amount of data
It can be cached and bookmarked.It is not able to cache and bookmarked
It is efficient for the view purposeIt is efficient for the update-purpose

An interface can be defined as a platform that permits users to develop programs that mention all public methods that need to be implemented by various classes. It does not involve any complexity or detail of methods used and implemented. An interface can also be defined as the next level of abstraction.

The main use of the interface is to maximize the potential of the reusability of code.

A CSRF token is known as a unique, secret, unpredictable value that is generated by the server-side application. It is transmitted to the client in a way that is included in a subsequent HTTP request made by the client. CSRF stands for Cross-site request forgery.

You can add CSRF token in ajax as follows:

In between head, tag put <meta name="csrf-token" content="{{csrf_token()}}"> and in Ajax, we have to add the following code: 

$.ajaxSetup({
   headers: {
     'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
   }
});

 

An abstract class can be defined by those classes which have at least one method as abstract. The abstract classes in PHP can be declared with a special keyword namely abstract. The main use of the abstract class is that all base classes which implement this class have to option of giving implementation of methods that are abstract already declared in the parent class.

Overriding and Overloading both are oops concepts.

In Overriding, a method of the parent class is defined in the child or derived class with the same name and parameters. Overriding comes in inheritance.

An example of Overriding in PHP.

<?php

class A {
   function showName() {
      return "Ajay";
   }
}

class B extends A {
   function showName() {
      return "Anil";
   }
}

$foo = new A;
$bar = new B;
echo($foo->myFoo()); //"Ajay"
echo($bar->myFoo()); //"Anil"
?>

In Overloading, there are multiple methods with the same name with different signatures or parameters. Overloading is done within the same class. Overloading is also called early binding or compile time polymorphism or static binding.

An example of Overloading in PHP

<?php 
class A{

function sum($a,$b){
	return $a+$b;

}

function sum($a,$b,$c){
	return $a+$b+$c;

}

}

$obj= new A;
$obj->sum(1,3); // 4
$obj->sum(1,3,5); // 9
?>

You can find the length of an array in PHP with the help of count() or sizeof() functions by passing array name as an argument.

You can use library function array_unique() for removing duplicated values for an array. Here is syntax to use it.

<?php
	$a=array("a"=>"home","b"=>"town","c"=>"town","php");
	print_r(array_unique($a));
?>


Both strstr() as well as stristr() in PHP are used for the purpose of finding the first occurrence of the string. The only difference between the two is while strstr() is case sensitive but on the other hand, stristr() is case insensitive.

Both GROUP and ORDER BY clauses are used for organizing data in MYSQL.

  • ORDER BY clause is used to sort the query result by specific columns.
  • GROUP BY clause is used to summarize unique combinations of columns values.

You can use subquery and IN clause to find the Second highest salary from a table in MySQL

SELECT max(salary) FROM Employee WHERE salary NOT IN (SELECT max(salary) FROM Employee);

A trigger can be defined as that stored procedure that executes when some particular event happens in SQL such as update, insert, delete, etc. On the other hand, a stored procedure is a piece of code purely defined by the user and is written in several local versions of PL or SQL. A stored procedure may return a value if it is made a function and can be invoked by calling it explicitly.

Inner Join: Inner Join can also be called the simple join. It allows the coder to filter the outcomes of the cartesian product by some predicate.

Self Join: It is used to join one single table with itself as there were two different tables.

Cross Join: This is the basic join, it is nothing but a cartesian product. This join method compares every single row of a table with every single row of the other table.

The software design pattern is a specification or set of rules for solving problems. It provides a reusable solution to a commonly occurring problem within a given context in software engineering.

Commonly design patterns are categorized into three types in which Few designed patterns are listed below:

  • Creational design pattern: The Singleton Design Pattern
  • Structural design pattern: The Decorator Design Pattern
  • Behavioral design pattern: The Command Design Pattern

Different types of data storage engines available in Mysql are:

  • MyISAM
  • InnoDB
  • MERGE
  • MEMORY (HEAP)
  • ARCHIVE
  • CSV
  • FEDERATED

Indexes can be defined as a process used to speed up the retrieval of data. These are a special kind of lookup tables that the search engine of the database can be used for the purpose of improving the speed of the data. It can be done by putting a pointer named Index to data in a table. It works similar to that of the index of any book.

In PHP5 or above, type hinting is a process used to specify the data type of a given argument. This is mainly used in a function declaration. Whenever the function is called, PHP checks if the arguments are of the type preferred by the user or not. If the argument is not of the specified type, the run time will display an error and the program will not execute.

Constructor in PHP is a unique function of a class that is automatically executed as any object of that class is created or instantiated and is also called magic function because, in PHP, the magic method starts usually with two underscore characters. In PHP4, we create constructor by class name it means the name of the constructor is the same as the class name but in PHP5, it has been modified to create constructor, it can be initialized by `__construct` keyword.

Since the constructor is a special function and it is automatically called when an object of a class is instantiated, so in that way we can take benefits of constructor by using it in our class. We can set up the object before using it or can start a session in the constructor so we don't have to start in every method of the class. You can write some line of code and start to instantiate an object to call class method then constructor called as the object is instantiated and code which is written in the constructor is executed automatically. Constructor with parameters looks like a regular method because you can pass the variable to the constructor as in regular method.

In computer terminologies, multithreading is that the capacity of a CPU or a single one core in multi-core to accommodate multiple threads of execution concurrently maintained by the operating system and approach differs from multiprocessing. In such an application, the threads distribute the resources of a single or multiple cores, which involve the computing units, caches, and the translation lookaside buffer (TLB).

XAMPP is a short form for cross-platform, Apache application, MySQL database, PHP, and Perl, consisting mainly of the Apache HTTP Server, MariaDB, and editors for scripts written in PHP and Perl programming languages. Since most of the web server deployments utilize almost exact elements as XAMPP, it performs transitioning from a local test server to a live server attainable.