Top 10 AJAX Interview Questions and Answers

What is AJAX?
Full form of AJAX is Asynchronous JavaScript And XML.
AJAX facilitate web pages to be updated asynchronously by exchanging data with a web server in the background. It can update the webpage without reloading the whole page.

What are the main components that are used by AJAX?
AJAX components are :
1-A browser built-in XMLHttpRequest object
2-JavaScript and HTML DOM

What is XMLHttpRequest Object?
The XMLHttpRequest object can be used to request data from a web server without refreshing the whole page. It can send data to the server in the background and can ask and receive data in the background.

What is the request type used by XMLHttpRequest Object?
open(): It specifies the kind of request GET or POST
send(): Sends the GET request to the server
send(string): Sends the POST request to the server

Give an Example of a jQuery AJAX call.
A POST method AJAX example in jQuery:

var empId = $("ul .emp").first().attr("id");
var request = $.ajax({
url: "myajaxcall.php",
type: "POST",
data: {id : empId},
dataType: "json"
});

request.done(function(response) {
console.log(response);
});

request.fail(function(jqXHR, ajax_status) {
alert( "Request failed: " + ajax_status );
});

What is the difference between xhr.status and xhr.readyState?
xhr .status: used to determine whether the request was successful or not.
xhr.readyState: the state of the request.’
xhr.readyState zero(0) means “has not yet been sent”
xhr.readyState zero(4) means “complete and response received”
The server provides the status, while the user agent provides the readyState.

Spread the love

Top 10 Codeigniter Interview Questions and Answers for Experienced

1- What is hook?
CodeIgniter’s Hooks feature modify the core functionalitis of the framework without changing the core files. For example, If you want to run a script right before your controllers get loaded, or right after or at any other location, you can use Hook.
2- How many types of hooks are there in Code Igniter?
There are 7 availabe hook points:
pre_system :
Called very early during system execution. Only the benchmark and hooks class have been loaded at this point. No routing or other processes have happened.
pre_controller :
Called prior to controllers being called. All base classes, routing, and security checks have been done.
post_controller_constructor:
Called after controller is instantiated, but prior to any method calls happening.
post_controller:
Called after the controller is executed.
display_override:
Overrides the _display() method, used to send the finalized page to the web browser at the end of system execution. This permits you to use your own display methodology. Note that you will need to reference the CI superobject with $this->CI->get_instance() and then the finalized data will be available by calling $this->CI->output->get_output().
cache_override:
Enables you to call your own method instead of the _display_cache() method in the Output Library. This permits you to use your own cache display mechanism.
post_system:
Called after the final rendered page is sent to the browser, at the end of system execution after the finalized data is sent to the browser.
Creating a hook :
$my_hook=array(
‘class’ => ‘YourClassname’,
‘function’ => ‘your_function_name’,
'filename' => 'your_filename.php',
‘params’ => array(‘p1’, ‘p2’)
'filepath' => 'hooks',  
            );
$hook[‘pre_controller’] = $my_hook;

3- Can we use multiple call to same hook?
Yes , we can use multiple call to same hook. Then We have to use multidimentional array:
$hook[‘pre_controller’][]= $hook_one;
$hook[‘pre_controller’][]= $hook_two;
4- What are the benifites of using hook in an application?
-We can modify core functionalitis without touching the core files.
-We can generate derired output without changing the view files.
-we can make a hook for recurring calls , like including footer and header in each function, without calling them in each controller function.
-we can create a script to minify the code before excecution take place.
-We can easily implement security checks, privacy, session, cache using hooks and can seperate these implementation from the main functionalitis.
5- WHat is HMVC?
HMVC is a Modular version of MVC. In this system we can implement modules for particular purpose. We may have put out controller , views and model in different modules. All these modules will be available in modules folder in application. HMVC stands for Hierarchical Model View Controller.
6- What is a module?
A module is a part of application and a full featured block which is implemented on HMVC pattern. A module contains its own Model, View and Controller. Although these resources can be shared with other modules.
7- What is difference between Library and Helper?
A CodeIgniter helper is a set of related global functions, you can call them any where in application. Once you load the helper file you can directly call the function. Basically the helper is procedural.
But a Library is a class, which you need to make an instance of the class. Once the library is loaded, we need to use $this operator to call the Library function. This is Object Oriented.
8- What is Routes in Code Igniter Framework?
Routing is the communication between URI and Controller. Routing decides the controller calls and parameters in code igniter. We can overwrite the routing rules in routes.php file.
9- How to use or enable libraries CodeIgniter?
We can initialize the library in controllers as given below:
$this->load->library('my_library_class');
10- Why CodeIgniter is a loosely coupled mvc framework?
CodeIgniter is called a loosely coupled mvc because, it provides unlimited flexibility to developers. It allows us to write and execute our custom codes, library, helpers. We can use call model and controllers functions in views and also can write custom code on views. It works like a core php when some one is going to manipulate it and on the other side it provide a modular structure to our application, XSS and CSRF functionalitis. It provides us lots of inbuilt library and also compatible with many more custome libraries. It never restricts us to write and execute any code.
Spread the love

CSS Interview Questions and Answers

What is CSS?
CSS stands for Cascading Style Sheet. CSS is applied to HTML page to improve the design, color, and attributes of HTML elements.

What are the selectors in CSS?
Selectors are the references to HTML block, on what the CSS rules to be applied. We can have class, id, HTML tag etc.

How to create a style sheet?
Create a plain text file and named it with .css extension, like “style.css”

How can we link a style sheet to an HTML page?
We can link a seperate style sheet in a html page, using LINK tag, inside HEAD of html. For example


What is inline CSS?
When CSS rules applied to elements in the tag itself using style attribute of DOM. This is not a good practice.

Why inline CSS is not good for a website?
It affects the DOM visibility on search engines. In line, CSS is treated as content by search engines and that is not good for the health of site also. Also lowers the page speed.

What are the common attributes of HTML elements?
Most common attributes of HTML elements are :
-style
-title
-height
-width
-src
-alt
-href
-bg-color

What is !important?
It is used to apply the CSS rule forcefully. It ignores any other rule written for the selector.

What is viewport?
The viewport is the screen size of the device, that used to view the webpage. It refers to the visible area or resolution of the screen.

What is a responsive web page?
A webpage which is compatible with all the devices and screen size is responsive. A responsive web page adjusts content according to the screen size and manages the content in the different layout defined for the devices. We have many CSS frameworks that can be used to create a responsive webpage. For example Bootstrap.

What is media query?
A media query is the conditional rules to apply on a webpage. We use @media and some condition, and when the condition occurs, rule starts working. We use @media for printing, responsive, device detection etc.

What are the benefits of external style sheet?
Benefits of External Style Sheet:
– Clean and Clear structure
– A common rule for similar elements
– All the rules are placed in a single file so we can modify it easily or can add new rules.
– Since HTML DOM tree is clear so it will boost the page speed as well as search engine visibility.

What is a class?
A class is an attribute of HTML elements. We can put some value in class attribute and then we can apply CSS rules on these classes. We can reuse these classes in other HTML elements.

What is ID?
ID is an attribute of HTML elements.A web page can have many IDs but no two IDs can be same. ID should be unique.

How to import CSS rules from another style sheet?
Yes, we can import CSS rules from another style sheet. For example :

@import url("assets/css/style.css");

What are most commonly used CSS framework?
There is a number of frameworks available for CSS rules. Some of them are as:
-Bootstrap
-Foundation
-Skeleton
-Kube

In how many ways can we apply the style to HTML?
We can directly write CSS rules in tags, that is inline CSS rule.
We can write CSS rule in “style” tag in an HTML page.
We can add a separate style sheet.

What is z-index in CSS rule?
z-index is the position of an element in the z-axis of coordinate.This specifies which element should appear on top.

What is display in CSS rule?
the display is for visibility and layout options. We can set any type of display options for any element. If we set to display as “none”, It will not render on view, but It will be a part of HTML DOM.

Spread the love

Interview Questions on jQuery

What is jQuery?
jQuery is a Javascript library that uses the usage of Javascript very easily. We can handle events, manage CSS properties, DOM element, animation and many more utilities using jQuery library. It is an opensource. It is used by Microsoft, Google, IBM and almost the big players in software industries.

What are selectors?
jQuery selectors are the tool to identify the HTML elements and to manipulate properties. for example:

$(".name") : Class selector
$('#logo') : ID selector
$("button") : tag selector
$(this) : current dom selector

What are the selectors that we use in jQuery?
We use the following selectors in jQuery:
-Tag
-Class
-Id
-all (*)
We can derive more selectors using these main selectors.

What is an event?
An event is a user action. When a user interacts using UI it has to make many clicks, drag, drop, mouse over, change drop-down, keypress actions, these actions are recognized by jQuery.

What are the common events that user make?
Most common events make by users are :
-click
-mouseover
-keypress
-keydown
-change
-input
-drag
-drop
-blur
-dblclick (double click)
-mouseenter

Must Read :

What is toggle()?
toggle() is a function which provides switching functionality between two actions, functions, properties etc. Suppose we can show and hide an element using toggle function.

What is callback?
A callback is a function that is called after when execution finished. We have to specify which function we have to call after a particular execution.

What is alert()?
alert() is used as a callback to show some warning, notification or error.

$("button").click(function(){
        alert("Clicked on button");
});

What is chaining in jQuery?
Chaining is calling of multiple functions in a single statement. for example :

$(".button").css("color", "#ececec").slideUp(1000).slideDown(2000).hide();

How to get value or text of an HTML element?
Since we know jQuery can manipulate HTML DOM, we can use functions to get value, text or html block inside an HTML element. For example

$('.first_name').val();  
//geting value in input box having class as first_name
$('p').html();   //getting html inside a 'p' tag
$('textarea').text();  //getting text inside a textarea

How can we set values for HTML element?
very similar to getting the value, we can set values to elements. For example:

$('.first_name').val('Interview Sortout Blogs');  
//geting value in input box having class as first_name
$('p').html('My blog is based on interview');  
 //getting html inside a 'p' tag
$('textarea').text('This blog is awesome. You are doing a verygood job,Interview Sortout');  //getting text inside a textarea

How to add or remove class from a HTML element?
jQuery have functions to add or to remove classes from an HTML elements. Please see the following examples:

$('button').addClass('btn-danger');
$('button').removeClass('btn-danger');

How to check that an element has a class?
We can use function hasClass().If class found it returns true, other wise returns false.

if($('button').hasClass('btn-danger')){
 alert('Button class is btn-danger');
}

What append() and prepend() functions do?
append() function , adds an HTML block after(at the end) a selector. For example :

$('p').append('Interview Sortout');

prepend() method, adds a block before or at the beginning of the selector. Example:

$('p').prepend('Interview Sortout');

What does parent() method do?
parent() method select the direct parent or immediate ancestor that is next to selector.

What does parents() method do?
parents() select all ancestors , the elements including parent of parent.

What childre() do?
children() method select the immediate child of the selector.

What does find() method do?
find() method search for the selector passed and selects from all the children of selector.

What does siblings() method do?
sibling() method returns all the elements having parralle relationship with selector. We can call them siblings.

How to call AJAX in jQuery?
An AJAX call example in jQuery:

var $post = $.ajax({
  url: "example.php",
  type: "POST",
  data: {id : product_id, product_name:product_name},
  dataType: "json"
});

$post.done(function(msg) {
  $("#log").html( msg );
});

$post.fail(function() {
  alert( "Request failed: Request Has been failed" );
});

 

Spread the love

Drupal Interview Questions and Answers

Drupal is a Powerful CMS. Flexibility of Drupal makes it popular and Lovable Framework.  Since Drupal is a Popular CMS and Website Development tool based on PHP there is huge demand of Drupal Professionals. If you are also a Drupal Developer or want to Find a Job in Drupal Development Profile then You should prepare these Drupal Interview Questions. These are the important Drupal Interview Questions and specially designed for both freshers and as well as intermediate level of experience professionals.

We have listed here top Drupal Interview Questions and Answers:

What is Drupal?
Drupal is an open source Content Management System and used for Complex websites. It has great flexibility of functionality and modularity. We can design our website using the core of Drupal and we can manage content on pages easily. Nowadays Drupal is used for e-commerce stores, blogging, business sites, college and universities websites.

What are the main features of Drupal?
Main features of Drupal are listed as:
-Open Source
-Flexible and Robust CMS in comparison to Others.
-Provide Security layer.
-Easy to manage Content.
-Fields and Blocks that are the most flexible assets of Drupal.

How Drupal is different from other CMSs available as opensource?
Drupal has a complex structure, and a heavy core so it is not suitable for small websites. It is secure than any other CMS.It has a great functionality to manage content and visibility. It provides a robust user management module in core.

What is the .info file in a Drupal theme?
This is the configuration setting of the Drupal theme. A .info file is a static content and settings are written here as key=value format. Each line has a different key and value for that. Metadata, style sheets, JavaScripts, block regions and more can be defined here. It is used for theme and not for the module.

What is a theme?
The theme is a collection of files to construct the layout. A Drupal theme contains following important elements:
– Configuration file (.info)
– Templates file (.tpl.php)
– Stylesheets
– sub-themes

What is Module in Drupal?
A module in Drupal is a collection of PHP files to provide some additional functionality to Drupal site. A module can access all the core functions and variables of the Drupal.

What is Block?
Blocks are the layout elements. A block defines that what particular content should be displayed at what place in the layout. It is a box in the content area.

How can we add modules to the core?
We can upload compressed files of the module or we can directly import from the remote URL.

What are the regions?
Regions are the layers defined by theme to represent the content area. For example footer, sidebar, navigation etc.

What is a node?
All the contents are treated as a node in Drupal. A node is a chunk of content. We create content, custom content using node module.

What is taxonomy?
Taxonomy is used to organize Metadata, tags, categories in Drupal. It a feature of Drupal core. It is used to categorize the content of the website. We can use tags to connect the content.

What is sub-theme?
A sub-theme is child theme. It inherits the resources of the Parent theme. It can be chained. A sub-theme can be a child of another sub-theme. All the styles sheets and javascript inherited by sub-theme.

What is service.yml?
service.yml placed in the root directory in and all the services are defined here.

What are properties of services?
Services may have following properties:
-abstract
-alias
-tag
-arguments
-calls
-class
-factory
-file
-public
-scope

What is settings.php?
This is the global settings of the site.Tthe database, URL structure, salt, encryption etc all the variables are defined here.

What is clean URL?
SEO friendly URLs in Drupal is clean URL.We can enable or disable it.

How can we manage clean URL in Drupal?
We can enable or disable clean URLs by following steps:
-navigate to Administer > Configuration > Search and metadata > Clean URLs
-Wait for the automated Clean URLs test to run.
-Check or uncheck the Enable clean URLs checkbox
-Click “Save configuration”

What is URL alias?
We can add our custom URL in place of “node”. It makes URL clean and SEO friendly.

What does cron do in Drupal?
Cron deletes temporary files and trigger the search module to index the content on the site.It pings modules to get updates.

What is Report in Drupal?
Reports modules collect the site health report and logs.It does the following task:
-Recent log entries
-Top ‘access denied’ errors
-Top ‘page not found’ error
-Available updates
-Status Report
-Site statistics

What is the status report?
Here you can find a short overview of your site’s parameters as well as any problems detected with your installation.

What is Recent Log entries?
The Database Logging module logs system events in the Drupal database. Monitor your site or debug site problems on this page.

What are the content types in Drupal?
Contents are categorized into 2 basic categories:
1- Basic pages
2- Articles

What is Basic page content?
Basic Page is the landing pages for a site, that rarely change. If we are creating About us, Contact us, Services, Team pages then we have to choose Basic Page type content.

What is Article type content?
Article type is a regular blog post on the site. We can select Article if we are writing an article or blog posts related to latest updates, hobbies etc.

Spread the love

20 Android Interview Questions and Answers : Basic Level

Android is a proven technology and generating ample of job opportunities as an Android developer.

Collection of Android developer interview questions and Android coding test questions help you cracking an interview in with any company.

Along with skill set you must have proper answers techniques for interview question.

Find best answers for your questions and  best techniques for answering coding test questions. These section also contain Android interview questions for freshers.

What are the components of Android application?What is Android?

Android is an operating system based on a modified version of Linux kernel and other open source software which was developed by Google and later the Open Handset Alliance (OHA).

Contrary to what most of the people think, Android is not a programming language.

In other words, Android is an open source operating system used for devices like smartphones and tablet computers.

  • Activities:
  • Intent
  • Services
  • Broadcast receiver
  • Content providers

What languages do android support?

Android system most commonly uses JAVA language, though the native C/C++ can also be used to write a program in android.

How Androidpes of Android applications are there?

There are two types of Android applications, namely:
a) Hybrid Applications
b) Native Applications

Who is the founder of android?

Android was invented by Andy Rubin, Rich Miner, Nick Sears and Chris White in the year 2003 in Paolo Alto, California.

What do you understand by the term APK?

APK stands for Android Package, an APK file can be installed on an android device just like installing software on windows.

APK files are kind of archive files, to make an APK file an android program is compiled and then all its contents like assets, resources, and certificates are packaged into one file.

What is AAPT?

AAPT stands for Android Asset Packaging Tool, it is a tool that provides developers the ability to deal with zip-compatible archives including creating, extracting and viewing the contents.

Give some disadvantages of Android OS?

Android is categorized a heavy operating system and most apps tend to run in the background even when not in use.
High power consumption rate is inherent to Android-powered devices.
Android is not considered among the safest types of OS and is prone to malware.
High data consumption due to background running of applications.

What are the essential items in an Android application?

Following are the essential items for an android application:

  • AndroidManifest.xml
  • build.xml
  • bin/
  • src/
  • res/
  • assets/

What is Android Studio?

Android Studio is the primary IDE for native Android application management. It is the official Integrated Development Environment for Google’s Android operating system.

What is the earliest version of Android?

The earliest version of Android was, “Android 1.0” and it was released on September 23, 2008.

What is ANR?

ANR is the short form for Application Not Responding; it is a dialogue that appears when an application has been unresponsive for a long period of time.

If we run a big application on an OS in main thread we won’t be able to get responses back, so at this point, ANR is displayed.

Which database is used in Android?

Android system uses SQLite database; it is an open source, a lightweight relational database for mobile devices.

It is inbuilt in the Android system by default, so one doesn’t need to perform any database setup or administration task.

Give some advantages of Android?

Listed below are the advantages of the Android operating system:
Ease of notification.
Ease of access to several applications
Modified ROMs can be flashed to android devices.
Multitasking is an added benefit.
Multiple language support.

What is activity?

The building block of the user interface is defined as an activity. Activity is a predefined class in Android all the applications which have the user interface (UI0 must inherit it. In other words, we can also define it as a Java code that supports a screen or UI.

Activities are central to how a user navigates within an application while serving as an entry point for user’s interaction with an Android application.

What is Android Architecture?

The key components that constitute android architecture are given below:
Linux kernel
Libraries
Android framework
Android Applications

Define Intents.

The intent in an android system can be defined as a notification to the user or developer from within the Android-powered device that is used to alert him/her of a particular state that occurred so that the user can respond to it in a required manner.

What do you mean by AIDL?

AIDL: Android Interface Definition Language is used to handle interface requirements between a client and service so as to accommodate the same level of communication through IPC ( Inter Process Communication).The objects are broken down into primitives that android can understand.

What is Content Provider used for?

A content provider is part of an android system application which is used to provide a way to share data with other applications.

In other words, it can be said that content provider manages the access to a repository of data.

What is the use of Android SDK?

Android SDK or Android Software development Kit is used for writing programs.

SDK offers comprehensive tools for development of Android applications, some of which are; debugger, libraries, sample code, tutorials, etc. SDK also supports older android versions.

Spread the love

TOP 10 : MySQL Database Interview Questions For Experienced

What are the storage engines used by MySQL?
Storage Engines supported by MySQL are as follows:
  1. InnoDB
  2. MyISAM
  3. Memory
  4. CSV
  5. Merge
  6. Archive
  7. Federated
  8. Blackhole

Which one is the default storage Engine in MySQL?
The default engine is InnoDB.

What is a database engine?
Database Engine is the basic building blocks of storage systems , used by Database Management Systems to run CRUD (INSERT,SELECT,UPDATE,DELETE)instructions.

What is difference between InnoDB and MyISAM?
InnoDB is featured with ACID propety of transactions, but MyISAM does not support transaction. MyISAM supports FULLTEXT search index where as InnoDB does not.

What are HEAP tables in MySQL?
HEAP tables are the existing tables in memory.They also known as memory tables and use Indexes instead of BLOB and TEXt.

What are Stored Procedures in MySQL?
Stored Procedure is Batch of SQL statements and saved in database. It also accepts parameters and can be triggered explicitly. It improves the traffic control and gives a modular structure to implement maintainability.

CREATE PROCEDURE show_employee

AS

    SELECT FirstName, LastName

    FROM employee;

EXEC show_employee;

What is Trigger?
Auto executable sets of SQL statements stored in database are known as Triggers. They are fired when some event CRUD event occurs.When we do some CRUD operations on table the trigger linked with that table fires. Trigger is behaves like a stored procedure but it invoked automatically. It adds a layer of security in database.

What are differences between Trigger and Stored Procedure?

We can execute procedure explicitly whenever we would like , but trigger can only be invoked on an event fire.We can call a Procedure inside another Procedure but we can not invoke a trigger directly inside another trigger. We can use trigger for transaction purpose but we can not use procedure for transactions.

What are the CONSTRAINTs in MySQL?
MySQL CONSTRAINTs used to define the rules for data restrictions. MySQL provides various types of constraints as:
NOT NULL– does not allow NULL value
UNIQUE – does not allow duplicate entry in column
PRIMARY KEY – uniquely identify a rows in a table
FOREIGN KEY – Primary Key of another table is being as a reference in another table
CHECK – Check for the valid data to be saved in the database
DEFAULT – set the default value for the column, in case of no value passed to SQL statement.
We can declare MySQL CONSTRAINT at the time of table creation or we can alter table to apply CONSTRAINT.

What do you mean by index in a table?
MySQL Indexing is the indexing of data as keys to make the accessibility fast and easy. Rather than searching all over the data indexing allows to get directly to the indexed values. It Eliminates the unnecessary iteration because the indexes are stored in the form of B.Tree.

Spread the love

Basic MySQL Interview Questions and Answers

What is MySQL?
MySQL is a Relational Database Management System marketed and distributed by Oracle as an open source software. However, enterprise edition is also available with support systems.

What is Relational Database?
Yes, we can say a database as a Relational database, because tables in the database are related to each other.

What is the use of the DISTINCT phrase in MySQL?
DISTINCT eliminates the duplicate records in the selection and return unique values. We can use it also with aggregate functions like AVG, SUM, MAX, MIN etc.

What is SELF JOIN?
Join a table to itself is called SELF JOIN. We must use an alias of the table to join itself. There is no any phrase like SELF JOIN.

What is LEFT JOIN?
LEFT JOIN gets the column of the LEFT table if the relation exists with the next table.

What is CROSS JOIN?
CROSS JOIN is a cartesian product of two tables and does not require any join condition. CROSS JOIN used to JOIN two table having no relations.If table A has 100 rows and Table B has 200 rows then we will get 100×200 = 20000 rows in CROSS JOIN.

What is INNER JOIN?
INNER JOIN gets all the records that are matched or common between the tables followed by the condition.

What is FULL JOIN?
FULL JOINS returns the records from both the tables. It is the result of LEFT JOIN and RIGHT JOIN at the same time.

What is RIGHT JOIN?
RIGHT JOIN results in the column of the RIGHT table if the relation exists with the next table.


What is OUTER JOIN?
LEFT JOIN, RIGHT JOIN and FULL JOIN are OUTER joins.

What are aggregate functions in MySQL?
The function that performs a calculation on records and returns a resulting single value is known n as an aggregate function. We have many aggregate functions in MySQL. As : AVG,SUM,MIN,MAX,COUNT.

What is the difference between DISTINCT and GROUP BY?
DISTINCT can return NULL values because it considers NULL as a value and selects one NULL from many, however, GROUP BY does not consider NULL values as a record. GROUP BY sorts the records where DISTINCT does not.

What is VIEW MySQL?
VIEW is an imaginary table holding the real records, based on query statements. It fetches data from real tables and displays always updated values. We can do all the MySQL operations on it.  It helps to achieve security and reusability while implementing database operations. We can hide sensitive data from end users while limiting the access of original tables.
For example, we can have a VIEW for all the employee who is older than 40 years.

CREATE VIEW older_than_fourty AS SELECT * FROM employee WHERE age > 40 ;
Spread the love

JSON Interview Questions and Answers

What is JSON?
JSON: JavaScript Object Notation is a tool to exchange data. It is defined as a javascript object. Using JSON we can store javascript Objects as text. When it will be required we can convert text into objects.

Is it possible to have an array of JSON or JSON having the array as values?
Yes, it is possible to do so. We can define a key in JSON having an array as value and we also can define an array having a JSON as value.

What is the use of JSON?
JSON is used to exchange data from the server. Since it is a text string, it is faster than any other format like XML.

What is JSON.parse() ?
JSON.parse() , parse the JSON string and return an full fetured object.

What is JSON.stringify()?
JSON.stringify(), convert the JSON Objects into string.

How can we handle the JSON in PHP?
PHP provides functions to handle the JSON. We can parse JSON using PHP and can convert it into an array. Function we use to convert a JSON to Object is json_decode(); json_decode() convert Javascript Object into PHP object. If we pass second argument in it as “true” it will return an associative array.


What is JSONP?
JSONP is called JSON with Padding. This is used to exchange data on cross sites protocols.

Spread the love

Basic Java Script Interview Questions and Answers

JavaScript is common and most powerful programming and scripting language being used today. JavaScript is a lightweight and client-side scripting language.
Although after may server-side supporting frameworks have been developed and JavaScript is used today as a powerful server-side tool. Most of the framework based on Javascript provides smooth user experience and seamless content rendering.
Due to huge populariy of JavaScript and frameworks there are huge oppourtunnities in JavAScript and Great potential of Hihgly paid Job. Google, Microsoft, Facebook, Amazon and almost all the big player in IT and software Industry are using JavaScript.
That why We need to focus on JavaScript Interview Questions to get a right job. We have designed the collection of Questions asked in JavaScript Inteview and are having Most Frequent Questions along with Answers.
Here you will find JavaScript Interview Questions and Answers usefull for any level of Expertise . Lets go for it:

What is Javascript?

Javascript is a client-side scripting language, used to enhance webpage functionality and User Experience.
JavaScript is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods.
Its syntax is based on the Java and C languages — many structures from those languages apply to JavaScript as well.
What is the importance of Javascript in Web Development and Web design?
Javascript provide additional functionality to HTML elements. It handles the DOM and content dynamically. Javascript is used by all the giant players in software industries like Microsoft, Google, Facebook, Amazon, etc.
How can we define a variable in javascript?
We can define a variable in javascript using ‘var’ keyword. for example :
var userName = 'Vishal Agrawaal';

When JavaScript was created?
JavaScript was created in 1995 by Brendan Eich while he was an engineer at Netscape. JavaScript was first released with Netscape 2 early in 1996.

What was the earliest name of JavaScript?
It was originally going to be called LiveScript.

Is JavaScript Object-Oriented?
JavaScript supports object-oriented programming with object prototypes, instead of classes.

What are the methods to return output in javascript?
We use alert(),console.log() and document.write() to display output in javascript.

What are the main types of JavaScript?
JavaScript’s types are:

  • Number
  • String
  • Boolean
  • Function
  • Object
  • Symbol (new in ES2015)

What is an alert?
Alert is a dialog box to display some warning or error. It displays a message on dialogue and a close button or OK button by default.

How to get a value by the ID of the element?
We can find the value by using Javascript function
var employee_name = documenst.getElementById(‘element_id’).value;

What is DOM?
The HTML DOM model is a tree of Objects and Objects are created by HTML the elements when the page loaded. It allows us to access the content and allow us to manipulate the HTML elements’ properties and attributes dynamically using Javascript or other scripts.

What are the functions of JavaScript?
Functions are just Objects and can be used to do some particular task.

What is the event?
An event is an action that takes place followed by any DOM activity or manipulation. Javascript provides a vast range of events that helps to create interactive interfaces in HTML. For example : onchange, onclick, onblur, onfocus, onmouseover, onkeypress, onkeyup, onmouseout, onload, etc.

How to create a function in Javascript?
Syntax to create a function in javascript:

function myFunction(){
//function logic goes here
}

Can JavaScript replace PHP or JSP or ASP?
Never, Not comparable. Javascript is a client-side scripting language whereas PHP and others are the server-side scripting language. So there is no reason for replacement.

What are the standard Arithmetic Operations that are supported in JavaScript?
Arithmetic Operations Supported by JavaScrip:

    • Addition operator.
    • Subtraction operator.
    • Division operator.
    • Multiplication operator.
    • Remainder operator.
    • Exponentiation operator.

What are the equality operators in JavaScript?
The result of an equality operator is always of type Boolean :

  • (==) Equality operator.
  • (!=)Inequality operator.
  • (===)Identity operator.
  • (!==)Nonidentity operator.

Does JavaScript support shift operators?
Yes, Here are some operators to shift all bits of the operand.

  • << : Bitwise left shift operator.
  • >>: Bitwise right shift operator.
  • >>> : Bitwise unsigned right shift operator.

How can we create an array in JavaScript?
Here is the way to create array in JavaScript:

  • var my_array = [ ]
  • Var my_array = new Array()

Write a function using JavScript.

function printMyName(){

console.log(‘ My Name is Lakhan’);

}

How to define an array in Javascript?
Defining an array in javascript is similar to any other language:

var students=['Ram','Vishal','Rahul','Kallu','Ballu','Lallu'];

How to handle date in javascript?
Javascript provides a constructor Date(). We can use Objects created by Date() and can Handle dates. For example:

var date = new Date();
var today = date.getDay();
var hour = date.getHours();
var minute = date.getMinutes();
var second = date.getSeconds();

How to convert an array into a string in Javascript?
We have an array :

var cars = ["BMW", "Benz", "Toyota", "Ford"];
var carString= car.toString();

and the result will be BMW, Benz, Toyota, Ford.

What is the functionality of pop() in js?
pop() is a standard method in javascript and it removes the last element of an array when we apply.
for example, we can apply it to cars :

cars.pop();

Now cars array will be : [“BMW”, “Benz”, “Toyota”];

What is the functionality of push() in js?
pop() is a standard method in javascript and it adds an element at the end of an array when we apply.
for example, we can apply it to cars :

cars.push("FORD");

Now cars array will be : [“BMW”, “Benz”, “Toyota”, “Ford”];

What is the functionality of splice() in js?
splice() added element/s at the particular index of an array and can remove some elements from the index. It can be used to replace some elements in the array.

var cars = ["BMW", "Benz", "Toyota", "Ford"];
fruits.splice(1, 0, "Ferari");

Resulting array : [“BMW”, “Ferrari”,”Benz”, “Toyota”, “Ford”];
The first parameter is the index of the element where the new elements will be added and second is the number of elements will be removed from that index.

How to apply a for loop in an array in Javascript?
Example of for loop in javascript:

var text='';
for (var i = 0; i < cars.length; i++) { 
text += cars[i] + "
";
}
alert(text);

Spread the love

WordPress Advance Interview Questions and Answers

How can we create a CTP in wordpress?
CTP means Custom Post Type. We can create our own custom post types in wordpress besides the default post. We have to use wordpress core to implement this feature. We can add Product type, property type using CTP .
Example is given as follows:

<?php
function create_post_type() {
      register_post_type( 'Custom CPT',
        array(
          'labels' => array(
            'name' => __( 'Name of your CPT' ),
            'singular_name' => __( 'Name of your CPT' )
          ),
          'public' => true,
          'has_archive' => true,
        )
      );
    }
?>
add_action( 'init', 'create_post_type' );

Write custom query to list recent five posts?
Using WP_Query() method we can create custom wordpress queries. An example is given below:

<?php
$args = Array('post_type' => 'post', 'posts_per_page' => '5' );
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) : 
   while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php endwhile; ?>
<?php else : ?>
    <p> no posts found</p>
<?php endif; ?>

How can we create a widget area?
We can create a widget using the code given in example:

<?php
function create_widget() {

    register_sidebar( array(
        'name'          => 'My Widget Area',
        'id'            => 'my_widget',
        'before_widget' => '<div>',
        'after_widget'  => '</div>',
        'before_title'  => '<h2 class="title-widget">',
        'after_title'   => '</h2>',
    ) );

}
add_action( 'widgets_init', 'create_widget' );
?>

How we will add new navigation menu in footer?
Register a new menu and after calling this menu at proper place in footer template we can add a Footer menu.

How to display menus with container and additional css class?
We can add classes and ids ate the time of dislaying menu. We have to pass the values of parameters in function in wp_nav_menu();


What is the default directory to store images and other files in wordpress uploaded by user?
The default directory to stote files in wordpress is uploads folder. Using wp_upload_dir() we can get the path of current uploading directory.

What is excerpt?
An excerpt is a post summary .Placing a tag
we can create an excert for a post automatically.

How we can get page id or post id in wordpress?
We can use “get_the_ID()” function to get page or post id.
For Example:

    <?php
      while ( have_posts() ) : the_post();
            echo get_the_ID(); ?>
      endwhile; 
    ?>

How we will add a post meta post?
Wordpress has a function add_post_meta(). We can use an unique key to identify this meta for a particular post.



How we will check a logged in user in wordpress?
Wordpress function is_user_logged_in() is used to check logged in user.

What are sort code?
ShortCode is a specific code that allow you to do things with less effort. Shortcode is allow to execute code in post, page, and widget without writing any code. Shortcode can be used directly in post’s/page’s editor and in widget also.
In php file, shortcode should be called as suggested:

<?php do_shortcode('Here paste your plugin shortcode'); ?> 



Which Text Editor does wordpress use?
WordPress uses the TinyMCE Editor.

Spread the love

DBMS Interview Questions and Answers

What is DBMS?
A database management system (DBMS) is system software. The DBMS is used for creating databases and manipulating data and records in an organized way.

What is RDBMS?
RDBMS stands for Relational Database Management System. it is based on relational blocks. RDBMS replaces the traditional file system to store the data. All modern systems follow the concept of RDBMS. for example MS SQL Server, Oracle, MySQL etc.

What is Relational Database?
A relational database is a collection of tables and the tables are related to each other. Data is organized in the form of a matrix of rows and columns. The columns are Fields and Rows are the records.

What do you mean by Schema?

The Schema is the structure of Database System.

What is Database Model?
The database model is a conceptual model to represent the flow of data processing and manipulation techniques.It displays the Blueprint of a database.

What is ER-Model?
The entity-relationship model (or ER model) is a graphical representation of Database Model.  ER model uses different types of graphical shapes to represent the different types of the element of database systems.

What is Metadata?
Metadata is the information about other data stored.

What is data dictionary?
The data dictionary is the collection of Metadata. All the metadata are stored in data dictionary.

What is tuple?
A tuple is a row or a record in a table.

What is the unique key?
The unique key is a column of a table that is used to identify a column. It defines a column uniquely.No two rows can have the same unique key. It is used as a constraint to make records unique.

What is a foreign key?
A foreign key is a unique key of a table can is used as a reference in another table. A column in a table can be used to identify records in another table, then It will be a foreign key.

What is a composite key?
A composite key is a combination of keys that functions like a unique key. When two or more columns are required to Identify a record uniquely, then It will be called as a Composite key.

What is Index?
The index is a key that is used to search records in the database. An index makes searching and parsing of data easy. It can be used for sorting or grouping purpose in queries. It improves the runtime of queries.

What is the procedure?
We can say a procedure is a function defined in PL/SQL. It is the collection of multiple Structured Query Language. We cam implement modules in SQL using procedures.

What is a transaction?
A transaction is an independent thread in execution. It can be described on the basis of ACID properties.

Explain ACID properties?

ACID properties are associated with a database transaction. ACID stands for Atomicity, Consistency, Isolation, and Durability. A transaction must maintain these states during its execution.

What is aggregation?
Aggregating the values of many rows to produce an efficient result is known as aggregation in Database System. There are many functions to complete these tasks as SUM, COUNT, AVG etc.

What is normalization?
Normalization is a technique to process over a grouped records organized in tuples.

What are the database languages?
Database systems provide some standard communication that can be used to operate the systems. We can read, update, alter and store data in tables using these languages. For example, SQL is a database Language.

What is DDL – the Data Definition Language?
The database language for creating the structure is known as DDL or Data Definition Language. CREATE, ALTER, and DROP is the DDL parts.

What is DML – the data Manipulation Language?
DML is a tool to read and amend the data stored in the database. SELECT, INSERT, UPDATE are the part of DML.

Spread the love

SEO Interview Questions

What is SEO?
SEO or Search Engine Optimization is processing to rank your website or blog well.

A good rank means your website is indexed by search engines and will be found first if somebody searches the related keyword. The goal of SEO is to make your site reachable on www easily.

What are the techniques used for SEO?

There are two broad categories of SEO techniques:

  1. In page
  2. Off-Page

In-page SEO means content and page elements to be optimized for good rank and reachability.

Off-page SEO is to promote your sites on different platforms and submit artificially in directories.

What is In-Page SEO?

On-page, SEO is the Optimization of content in page and HTML elements that are scanned by crawlers of search engines.

Content should be unique, repetitive, error-free and without grammatical mistakes. The page must have a good title that can reflect your keyword and your goal to publish this page.

A good meta content and meta description help page in indexing.

What is Off-Page SEO?

Off-page, SEO is marketing and promoting your site. We have to promote our age for targeted audiences and demography.

What is Crawler?

The crawler is Web boat that scans the site content and structure and found the niche of writing.

Different search engines have different crawling algorithms but their goals are the same and that is to index the site as per the quality of contents and links.

What is PR or PageRank?

PageRank is an Analytical Method of Google to calculate the quality of content on the page. it shows How appropriate a page content is.

What is Indexing?

Indexing of a page or a website refers that the site is recognized by search engines. Now they will be reflected in search results.

What is a keyword?

A keyword is a single word or a phrase that highlights the center point of your content.

The whole content is all about this keyword.

We can say The keyword is a term and the content is the description of that word or explanation of those key phrases.

What is robots.txt?

Robots.txt is a text file used to give directives to the search engine crawlers.

These concerns the indexing and coaching of a webpage, directory, file or domain of a website.

What is meta-content and meta description?

The meta tag is placed inside the head tag in an HTML page.

A meta-content is an explanation of meta description and meta description is a keyword.

What do you mean by backlinks?

Backlinks as the name are the incoming links to your site or page.

They are submitted as an SEO process using off-page technique and when they are clicked, redirect to your website or blog.

Backlinks are the backbone of SEO. Google bot searches for links and this is a parameter to rank your page better.

What is the difference between do-follow and no-follow links?

Do-Follow means linking a website but allow the crawler to recognize that link. Do follow allow the link juice to gets passed. It helps to achieve a higher page rank. Do follow does not allow the link juice to gets passed. It does not affect the Page rank.

What is the purpose of robot.txt to be put in the root directory?

It is exclusion protocol.robot.txt communicates with the crawler and escapes the links that not follow.

What is organic traffic?

Organic traffic is a result of natural search results on search engine consoles. This is a better interpretation of good content and popularity over www.

Traffic coming from search results are organic because they are suggested by the crawler to visit this page for their search solution.

What is SEO friendly URL?

SEO friendly URLs are the URL without unnecessary characters that has a bad effect on Page Rank. Phrases should be separated by the dash and not by underscores. avoid using numbers, special characters, etc.

How does a good title help in SEO?

A good title means a title that is related to whole content and it allows the crawler to find the keyword. A search result listed the page title in its list.

What is the Google Search Console?

The Google Search Console is a free platform offered by Google to monitor a website. You will get free:

  • Crawl errors
  • Indexing data
  • Search queries
  • Backlinks information

You can also submit the XML sitemap

What is the main purpose of Search Engine Spiders and Boats?

Spiders index the contents of index sites. However, spiders do not examine sites for unethical activities.

I hope these collections of Search Engine Optimization will help in your interview. Please let us know your queries and feedback in the comment or through the contact page.

Thanks.

Spread the love

15 Advance Code Igniter Interview Questions and Answer


How routing is beneficial in Code Igniter?
Routing provides a way to alter your URL and redefine it according to you. It helps in security and SEO. We can create URL having keywords and phrases influential for SEO ranking.What is a helper?
Helpers are the file having functions for specific purposes. We can directly call them in our script.There is numerous type of helper:
  • Array Helper: It has functions that we use to manipulate arrays.
  • File Helper: Use of this helper is to play with files as upload an image.
  • HTML Helper : Html helper is used to compose HTML dom using php code.
  • URL Helper: We use it to create and construct or redirect URLs.
What does autoload.php do?

It loads when the application start loading contains and default parts of application call. It has information to load the segments that we need to load automatically. For example, we may need to load some models automatically.

How can we connect code igniter to our database?
There is a database.php file in the config directory. We can put here our database information like database name, hostname, username and password and It will be connected.

Can we call multiple model function in a single controller function?
Yes, of course. We can call any number of model and their functions in a single controller class?

Can we write database queries in a controller?
Yes, we can write database queries directly in controllers but this is not a good practice. We should write database queries always in the model.

How can we pass data to view?
We create an array having a particular key and pass this array to load view call. We will have this data on the view page as having the name of the key given to data array.

<?php
$data['employee']=array("name"=>"Dhananjay");
$this->load->view("employee_info",$data);
?>

Now on the employee_info.php page, we will have a $employee variable and that will store the data passed in the array $data in the controller.

How can we pass a parameter to controller function?
A parameter can be passed to URL segment after backslash next to function route. Suppose “admin” is a controller , “all_user” is a function and “active” is a parameter. Now we have to pass this to function that it can list the active user so we can call as given below:

<?php echo site_url("admin/all_user/active")?>

What is a library in Code Igniter?
Code Igniter library is a utility to extend the functionality and to use some predefined functions and classes. We have different libraries for different purposes as upload, database etc.

How can we execute a raw query in Code Igniter?
Using query builder library of code igniter we can execute raw query. For example,

db->query($sql);
$result=$query->result_array();
?>

What is URL helper?
We use URL helper to do manipulation with URL. We can easily create custom URL, we can extract parameters from URL, we can easily create custom anchors, form action, and page redirection.

How the database library provide strength to Code Igniter framework?
Database library has query builder functions. It works with single data and also in batch data. It accepts the array and single values as parameters. Functions are very similar to MySQL query phrases and keywords. We can use almost the query using query builder. It fetches the data in all possible formats. We can select, update, join, delete the records in very simple and robust way.

How we will submit data using a form on code igniter view?
We can give the controller function route as the form action. When we will submit this for, the controller function will be called and data will be collected using $_GET or $_POST arrays, as the method defined in the form.

How we create a session variable and how will we get that value stored in a session variable?
Code igniter has session library.It uses four types of the driver to store session data:
1-files
2-database
3-redis
4-Memcached
The file is the default storage.
After loading session library we can use session class and its method to set or get the session value.

<?php 
$this->load->library('session');
//set session data
$this->session->set_userdata('user_session_name', 'session_value');

//check session
$this->session->has_userdata('user_session_name', 'session_value');

//get session data
$this->session->get_userdata('user_session_name', 'session_value');

//destroy session data
$this->session->unset_userdata('user_session_name');
?>

How can we upload any file in Code Igniter application?
Code igniter has upload library. We will use this library and set preferences in $config variable.
After initializing library we use call do_upload() function and it will complete the task.

Spread the love

HTML Interview Questions and Answers for Freshers

HTML stands for Hyper Text Markup Language. We can not say that HTML is a programming language but a markup language. HTML uses markup tags and they are designed to perform some particular task. For Example, Paragraph tag p is used to include any paragraph in a web page, Anchor tag a is used to add a hyperlink in a page.
HTML is not only limited to design but also it has advanced and can be used to develop device compatible applications fro smart Television, Digital Advertisement Display etc.Whatever can be the server side language say JSP, ASP or PHP, Python or Ruby HTML will be the display part. When we are talking about a web page we are talking about an HTML page. Basically, it is part of Web Design and case insensitive. We can have following questions that can be asked in interviews:

What is HTML?
HTML is a markup language and used to design a web page using marking tags.

How can we create an HTML page?
We can create a plain text file and .htm or .html as an extension, it will be converted to the HTML page.

What is the basic structure of HTML page?
HTML page is devided in to three segments
(1) Document Type markup  that is  html
(2) Head and Title portion that is head and title
(3) Main Content or body portion

 <html>  

      <head>
           <title></title>
      </head>
      <body>
      </body>
 </html> 

What types of input tag are used nowadays?
There are many input tags introduced since HTML5. Some of the most used and popular input types are as below:

(1)text: this is used for alphabetical characters to input in the form.
(2)tel: this is used to input the telephone numbers
(3)date: date is used to input date.
(4)email: email is used to input date
(5)number: a number is used to input a number, negative, positive or zero
(6)textarea: Long text can be input using text area. For example, we can use to input the message in a contact form.
(7)Select type(combo): when we have to select from some options it may be multiple type selection.



How many methods are there for a form?

There are two methods for a form: get and post.

What is  br tag? 
It is called Break Line tag. When we have to break line in the paragraph we use Break Line tag.

What is meta tag?
Meta tag is a part of head section of a HTML page. It includes page information, content type information and device compatibility information. Meta tag helps page to be indexed in search engine directories.

How we can include a style sheet in an HTML page?
We can include a seperate style sheet using link tag inside head section.

 <link rel="stylesheet" type="text/css" href="style.css" />

What is arrtibutes of Tag?
Every tag has some advanced and customize features that developer can enhace. These features are known as arrtibutes. For example “bgcolor” is backgroud color , “font-style”,”width”,”height”,”align” etc. How the content will display it depends on the value given to different properties of tags.

What is table tag?
table tag is used to create a tabular structure to represent some statistical data in a web page. Table has number of rows and number of columns in each rows.

What are the arrtibutes of table tag?
Arrtibutes of table tag are as below:
1- Border
2- Width
3- Height
4- Align
5- Bgcolor etc.

What is the use of anchor tag?
Anchoe tag is used to create a hyperlink is a webpage. We can connect to pages on the site or any third pary link to our website. For exampe:

 <a href="www.facebook.com">Facebook</a>

List some attributes of anchor tag?
Attributes of anchor tag are as below:
(1)Href : What will be hyper link?
(2)target : where to open the link?
(3)title : what will be the title of tag, it will apear when mouse goes over link.

What is a div tag?
Div tag create a rectangular area in a web page. Further we can manipulate it using attributes and style. div tag is used to create layout of webpage.

What is form?
FORM tag is used to create a user form in web page to store user inputs. Input tags are used to collect the input values from user and form action hadle the request.

How to write a form tag in a web page?
We can include a form tag as given below:

 <form method="post" action="form-action.php">  
 <!---input elements--->
 </form>

What is marquee tag?
marquee tag is used to insert a moving element in the HTML page. For example, Notices are moving from left to right or top -bottom direction in an informational website.

Create a table having table head and foot?
We can create a table as given below:

 <table>  

      <thead>
           <tr>
                <th></th>
                <th></th>
           </tr>
      </thead>
      <tbody>
           <tr>
                <td></td>
                <td></td>
           </tr>
      </tbody>
      <tfoot>
           <tr>
                <td></td>
                <td></td>
           </tr>
      </tfoot>
 </table>


How Many types are lists?
There are three types of lists in HTML basically, as given below:
1- Unordered List  implemet by ul tag
2- Ordered list implement by ol tag
3- Data list implement by dl tag

What are the headings tag? What is the usage of Headings in HTML page?
HTML provides heading tags to implement document heading in the page. There are 6 headings H1, H2……H6.H1 has the biggest font size by default so we can use it as the main heading and other can be used as subheadings.

How can we include Javascript in HTML page?
We can include javascript code inside html page using  script tag. We can directly write code of javascript in pgae or we can use a seperate javascript page.

What is a responsive web page?
A responsive webpage is dynamic view page that is compatible to different types of display and orientation. To make a page responsive we use media query and view port acces to control orientaion and layout.

Spread the love

Most Common PHP-MySQL Interview Questions and Answers

There are some basic PHP Interview questions, asked in every interview often. They must be known to every interview aspirants.

Chances of asking these questions by Interviewer is very high because they just test your basic concepts of PHP. They highlight your understanding and command of the language. They are helpful to nail the first impression on the interviewer when you are in the interview.

An Interviewer expects that you should know the answers to these questions. After these questions, you will be asked to answer some hard-core questions and concepts.

What we have given here is experienced. these questions give you the pattern of often asked questions on Interviews along with their answers.

We try to give genuine answers, by verifying them from www.php.net, www.w3schools.com, and other popular tutorials site. After knowing the pattern It will be easy for you to explore more questions from various sources.

What is PHP?
PHP is a server-side scripting language. It is lightweight as well as enriched with OOPs features. PHP is freely available and has lots of frameworks, CMS to built robust and secure applications.

Explain these functions :
echo( ),print( ),print_r( ),die( ),exit( ),var_dump( )
var_dump($var):- Displays information about a variable.
echo() or echo: This is not actually a function.This doesn’t return a value after it takes parameter.
print() pritn : This is also not a function ,accepts always single parameter and returns 1.
print_r():-This prints the content and indexes of arrays and objects.
exit:-It terminates the current script with a message.
die(): This is identical to exit;

What are the differences amongst include(), require(),require_once(), require(),include()?
include(): Includes an external script into current script. On failure it emits Warning and allows script to continue, it does not terminate the execution of the script.
include_once(): On failure emits an compile E_COMPILE_ERROR  error. It terminates the script execution.

What is the difference between in_array() and is_array()?
Both of these function returns a boolean type.
in_array() :
If a value finds within an array it returns TRUE otherwise returns false.
is_array() :
It checks whether the type of variable is an array or not. It returns true if an array is passed into it. It can be applied to any type of array.

What is the difference between count() and sizeof()?
Literally we can say there is no difference between these two terms. Both of these have Identical behaviors.
count():- It counts all elements of an array or object.
sizeof():-Identical to count(), can say Alias.

What is the difference between json_encode() and json_decode()?
json_encode() converts a PHP array or an object into json string, and json_decode() convers an JSON string into PHP array or into PHP object.

Where do we store Session and Cookie?
The session is stored on the server whereas cookies are stored on the client machine in browsers.

How we use foreach loop in PHP?
Foreach loop is used to iterate an array or an object in PHP. For example

<?php 
foreach ($array as $key =>; $value){
echo "$value is at $key place";
}
?>

What are the differences amongst trim(),ltrim(),rtrim()?

  • trim():-It removes white spaces from both the sides of a string.
  • ltrim():-It removes white space from the left side of a string.
  • rtrim():-It removes white space from the right side of a string.

What are the constants , how we define them in PHP?
A constant is a name assigned to a value. It is like Identifiers but cannot change during script execution. We can define them usually in UPPER_CASE underscored string without $. For example: define(“CURRENT_YEAR”, “2017”);


What is $_GLOBAL?
$_GLOBAL Is a superglobal array and holds all the variables that are global and can be accessed from anywhere in the script. $_POST,$_GET,$_REQUEST,$_FILE,$_SESSION,$_COOKIE all are superglobal arrays available in PHP. We can call them anywhere in the script.


What is the difference between MySQL and mysqli?
MySQLi is the extension of MySQL and It is an improved version of MySQL. MySQLi supports OOPS features and compatible with PDO.


What unlink() function do in PHP?
It is used to delete a file or directory from its location.

What are the basic differences amongst Warning, Fatal Error, and Notice?
Fatal error results in the termination of the script, no further execution of the script is possible when it happens. Whereas Notice does not terminate the script, rather it notifies about some tolerable mistake and script after that line is able to execute. Warnings are the deprecated and bearable things in scripts. This doesn’t affect the result usually.

Which function is used to send email in PHP?
The mail() function is used to send emails in PHP. Learn more about The PHP mail() Function.

What is the difference between array_diff() and array_filter()?
array_diff() returns the array of values of difference of two arrays and array_filter() returns the arrays of values and filter null values or specific values. The function array_filter() also used a callback function but it is optional.


What is the difference between array_serach() and in_array()?
The method array_search() returns the key if the value is found in the array and the function in_array() return TRUE if it will find the values in the array. In case of a failure, both functions return FALSE.


What strlen() do?
strlen() is a PHP library function and it returns the length of string passed to it.


How substr() works?
substr() is a PHP library function and it returns the part of string passed with parameters to it. It accepts starting point, length of returning string and input string as parameters.


How str_replace() works?
It is used to replace a sub-string with another substring in an input string.

 

Spread the love

Top Interview Questions and Answers

Exit mobile version