Monday, 26 October 2015

CakePHP Interview Questions and Answers for experienced

CakePHP Interview Questions and Answers for experienced



Question: What Is The Current Stable Version Of CakePHP?
3.1.1 / 6 October 2015

Question: What are the System requirement for cakephp3.0
PHP 5.4.16 or greater.
mbstring extension
intl extension
MySQL (5.1.10 or greater)


Question: What Is The Name Of Cakephp Database Configuration File Name And Its Location
FileName: database.php.default
Location: /app/config/database.php.default


Question: What is First cakphpe file loaded in application?
bootstrap.php
Also, We can change its file through index.php file which loaded earlier.


Question: What Is The Use Of Security.Salt And Security.CipherSeed In Cakephp?
The Security.salt is used for generating hashes.
The Security.cipherseed is used for encrypt/decrypt strings.
You can change the above values from /app/Config/core.php.

Question: What Is Default Function For A Controller?
index() function


Question: Which Function Is Executed Before Every Action In The Controller?
beforeFilter() function


Question: List Some Of The Features In CakePHP?
  1. MVC architecture
  2. Built-in validations
  3. Caching
  4. Scaffolding
  5. Auth & ACL
  6. CSRF protection via Security Component.


Question: What Is Scaffolding In Cakephp?
Scaffolding is a technical way that allows a developer to define and create a basic application that can create, retrieve, update and delete objects.


Question: How To Add Scaffolding In Your Application?
var $scaffold;
Add above In Controller Question: What Is A Behavior?
Behaviors in CakePHP are associated with Models.


Question: How To Include Components In Controller?
public $components = array('Emails', 'ImageUploader');


Question: What is callback functions in Cakephp? Please explain?
Callback functions are simple functions which called automatically when are defined by the core cakephp.
Suppose you are inserting record in your database. Now you have two requirement.
1. Validate the data before inserting into database.
2. Want to do some changes after inserting into database.


Question: How callback functions works in CakePHP?
/** In controller**/
$userData = array();
$this->User->InsertRecord($userData );
/** In controller**/

/** In model **/
function InsertRecord($userData){
    $this->save($userData);
}

function beforeSave(){
}

function AfterSave(){
}
/** In model **/



Question: What are associations in CakePHP? What are different types of associations?
Associations are the terms which means getting the data from database which are in different tables.


Relationship Association Type Example in Single Line
one to one hasOne A user has one profile.
one to many hasMany A user can have multiple recipes.
many to one belongsTo Many recipes belong to a user.
many to many hasAndBelongsToMany Recipes have, and belong to, many ingredients.

When Models's save function going to called, beforeSave will be called then AfterSave.




Question: How To Get Current URL In CakePHP?
echo $this->here;

Question: Which Methods Are Used To Create And Destroy Model Associations?
bindModel() used to create Model Associations
unbindModel() used to destroy Model Associations


Question: What Is The Use Of RequestAction Method?
Its used to a call controller action from any location and returns data from the that action.


Question: How Can We Use Ajax In Cakephp?
Use ajax helper.


Question: What Is The Default Extension Of view files In Cakephp?
.ctp



Question: What Is folder structure of cakePHP?
What Is folder structure of cakePHP




Question: How to set Meta title from view files?
$this->set("title_for_layout", "This is page meta title");




Friday, 23 October 2015

Object Oriented JavaScript interview questions and answers for experienced

Object Oriented JavaScript interview questions and answers for experienced


Question: Is JavaScript case sensitive?
Yes, JavaScript is a case sensitive..


Question:What are different Data-Types of JavaScript?
Following are different data-type in JavaScript.
  1. String
  2. Number
  3. Boolean
  4. Function
  5. Object
  6. Null
  7. Undefined



Question: What is an Object?
The object is a collection of properties & each property associated with the name-value pairs.
The object can contain any data types (numbers, string, arrays, object etc.).


Question: What are different two ways of creating an object?
Object Literals: This is the most common way to create the object with object literal.
For Example:
var emptyObj= {};

Object Constructor: It is way to create object using object constructor and the constructor is used to initialize new object.
For Example:
Var obj = new Object();


Question: What is scope variable in JavaScript?
The scope is set of objects which can be variables and function.
"Scope variable" can be have global scope variable and local scope variable.



Question: Give an example creating Global variable
Global variable: A variable which can be variable from any where of the page.
Following are different two ways.
First Way Declare the JavaScript variable at the top of JavaScript code and out of function & objects.
var globalVariable1 ='This is global variable 1'

Second WayDeclare a varaible without "var" in Function.
function testfunction(){
    globalVariable2 ='This is global variable 2'
}



Question: Give an example creating Global variable
Local variable: A variable which can be local and can't access globally.
When we declare a local varriable, Its local and can't access globally. It must create using "var" keyword.
function testfunction1(){
    var localVariable ='This is local variable '
}


Question: What is public, private and static variables in JavaScript?
Public Varaible: A variable which associate to object and is publicily available with object.
For Example:
function funcName1 (name) {
 this.publicVar='1'; 
}

Private Variable: A variable which associate to object and is limited available.
For Example:
function funcName2 (name) {
 var privateVar='1'; 
}

Static variable: A static member is shared by all instances of the class as well as the class itself and only stored in one place.
For Example:
function funcName3 (name) {
 
}
// Static property
funcName3.name = "Web Technology Experts Notes";



Question: How to achieve inheritance in JavaScript
"Pseudo classical inheritance" and "Prototype inheritance"


Question: What is closure in JavaScript?
When we create the JavaScript function within another function and the inner function freely access all the variable of outer function.


Question: What is prototype in JavaScript?
All the JavaScript objects has an object and its property called prototype & it is used to add and the custom functions and property. See Following example in which we create a property and function.
var empInstance = new employee();
empInstance.deportment = "Information Technology";
empInstance.listemployee = function(){

}