Wednesday, 26 August 2020

PHP Program Reverse the String without Function

PHP Program Reverse the String without Function

 Write a PHP  function FirstReverse(str) take the str parameter being passed and return the string in reversed order. 

    For example: if the input string is "Hello World and Coders" then your program should return the string sredoC dna dlroW olleH.


function FirstReverse($str) {
    for($i=strlen($str)-1; $i>=0; $i--){
      $result = $result.$str[$i];
      return $result;


PHP Program Find Intersection between Two array

PHP Program Find Intersection between Two array

Create PHP  function FindIntersection(strArr) read the array of strings stored in strArr which will contain 2 element

 the first element will represent a list of comma-separated numbers sorted in ascending order.
 the second element will represent a second list of comma-separated numbers. 

Your function should return a comma-separated string containing the numbers that occur in elements of strArr in sorted order.
  If there is no intersection, return the string false.


  function FindIntersection($strArr) {
    $return ='false';  
    $array1 = explode(',',$strArr[0]);
    $array1= array_map('trim',$array1);

    $array2 = explode(',',$strArr[1]);
    $array2= array_map('trim',$array2);

    $result= array_intersect($array1,$array2);

  return $return;


PHP Program Longest Word from the string

PHP Program Longest Word from the string

 Create PHP function LongestWord(sen) take the sen parameter being passed and return the largest word in the string.

If there are two or more words that are the same length, return the first word from the string with that length. 

Ignore punctuation and assume sen will not be empty.


function LongestWord($sen) {
    $return = '';

    //Convert string into Array
    $strArrayList = explode(' ', $sen);
    $finalArray = array();

    ///////Filter the words///////////
    foreach($strArrayList as $str){
        $str = preg_replace("#[[:punct:]]#", "", $str);
        $finalArray[] = $str;
    ///////Filter the words///////////
    /////////// Get the First word  from the string with that length////////
    foreach($finalArray as $word){
        if(strlen($word)> strlen($return)){
        $return = $word;
    /////////// Get the First word  from the string with that length////////
    return $return;


Tuesday, 25 August 2020

PHP Username Validation program


PHP Username Validation program

Creat function usernameValidation(str) take the str parameter being passed and determine if the string is a valid username according to the following rules:
  1. The username is between 4 and 25 characters.
  2. It must start with a letter.
  3. It can only contain letters, numbers, and the underscore character.
  4. It cannot end with an underscore character.
If the username is valid then your program should return the string true, otherwise return the string false

function usernameValidation($str) {
    $return = true;
    ////////////////// 4 to 25 character////////////
    if ($return) {
        if (!(strlen($str) >= 4 && strlen($str) <= 25)) {
            $return = false;
    ////////////////// 4 to 25 character////////////
    ////////////////// Must start with Number ////////////
    if ($return) {
        $asciiCode = ord($str[0]);
        if (!(($asciiCode >= 97 && $asciiCode <= 122) || ($asciiCode >= 65 && $asciiCode <= 90))) {
            $return = false;
    ////////////////// Must start with Number ////////////
    ///////////// It can only contain letters, numbers, and the underscore character.///////////
    if ($return) {
        for ($i = 0; $i < strlen($str); $i++) {
            $asciiCode = ord($str[$i]);
            if (!( ($asciiCode >= 97 && $asciiCode <= 122) || ($asciiCode >= 65 && $asciiCode <= 90) || ($asciiCode >= 48 && $asciiCode <= 57) || ($asciiCode == 95))) {
                $return = false;
    ///////////// It can only contain letters, numbers, and the underscore character.///////////
    ///////////It cannot end with an underscore character.///////////
    if ($return) {
        $asciiCode = ord($str[$i - 1]);
        if ($asciiCode == 95) {
            $return = false;
    ///////////It cannot end with an underscore character.///////////
    return $return ? 'true' : 'false';

Docker tutorial for beginners

Docker tutorial for beginners

Question: What is docker?
Docker is a container management service.
It is for mainly for developers to easily develop applications, push them into containers which then be deployed anywhere to physical server/virtual server/cloud server.

Question: Features of Docker?
  1. Docker containers are lightweight so they can be easily scalable.
  2. Deploy docker containers on any physical and virtual machines and even on the cloud.
  3. Docker has the ability to reduce the size of development by providing a smaller part of the operating system via containers

Question: What is container in docker?
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.
Applications are better shape in containers and Docker provides the isolation capabilities.

Question: What is docker image?
A Docker image is a file, comprised of multiple layers, that is used to execute code in a Docker container.
Images can exist without containers, whereas a container needs to run an image to exist.

Question: What is a docker hub repository?
Docker Hub is a hosted repository service provided by Docker for searching and sharing container images.
hosted repository can be public or private.

Question: How to install docker in windows 10 Pro?
  1. Open the link : Download docker for windows
  2. Click on "Get Stable" Link
  3. Download the file
  4. Once downloaded, then simply install

Question: How to check the version of docker?
docker --version

Question: How to list the running docker containers ?
docker container ls

Question: How to list the all docker containers ?
docker container ls -a

Question: How to list the all docker images?
docker images

Question: How to pull the docker container from docker hub?
docker run --name my-mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql

Wednesday, 12 August 2020

npm firebase

npm firebase

Question: What is firebase?
Firebase provides the tools and infrastructure you need to develop, grow, and earn money from your app.

Question: What is firebase used for?
Firebase is mobile application development platform that helps you build, improve, and grow your app.

Question: Is firebase a backend?
Firebase is a fully managed platform for building Android, iOS, and web apps that provides automatic data synchronization services, authentication services, messaging services, file storage services and analytics etc.

Question: Is firebase free to use?
Both (free and Paid)

Question: What companies use firebase?
  1. Client Platform
  2. Accenture
  3. LaunchDarkly
  4. Bepro Company
  5. ViaVarejo
  6. Stack
  7. Twitch
  8. Instacart

Question: Does firebase provide Crash Reporting?
Yes, Its provide crash reports for both App (android and IOS)

Question: Which language is used in firebase?
The Firebase SDK supports programming in C++, Java, JavaScript, JavaScript/Node. js, Objective-C, and Swift.

Question: Which language is used in firebase?
The Firebase SDK supports programming in C++, Java, JavaScript, JavaScript/Node. js, Objective-C, and Swift.

Question: What does provide the firebase?
Firebase Realtime Database - The Firebase Realtime Database lets you store and query user data, and makes it available between users in realtime.
Cloud Firestore - Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud Platform.
Firebase Storage - Firebase Storage lets you upload and store user generated content, such as files, and images.
Firebase Cloud Messaging - Firebase Cloud Messaging is a cross-platform messaging solution that lets you reliably deliver messages at no cost.
Firebase Authentication - Firebase helps you authenticate and manage users who access your application.
Create and setup your account - Get started using Firebase for free.

Question: How to use firebase in browser?
//Include the below JS in HTML${JSCORE_VERSION}/firebase.js

//Create the Firebase Object
  var app = firebase.initializeApp({
    apiKey: '',
    authDomain: '',
    databaseURL: '',
    projectId: '',
    storageBucket: '',
    messagingSenderId: ''

Question: How to use firebase with node?
//Install the firebase in node
npm install --save firebase

//Create the Firebase object
var firebase = require('firebase');
var app = firebase.initializeApp({ ... });

Monday, 3 August 2020

log analyzer tool for linux - GoAccess

log analyzer tool for linux - GoAccess

Question: What is GoAccess in linux?
GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal.

Question: How GoAccess works?
It analyse the Log file (access.log) which is cotinue in writes by application.

Question: What are the benefits of GoAccess?
  1. Completely Real Time
  2. Nearly All Web Log Formats
  3. Track Application Response Time
  4. Incremental Log Processing
  5. Minimal configuration needed
  6. Visitors
  7. Color Scheme Customizable

Question: Does GoAccess is available for GUI?
Yes, You can watch in Terminal and GUI.

How to install GoAccess in Server?
git clone
cd goaccess
autoreconf -fi
./configure --enable-geoip --enable-utf8

How to run GoAccess to check the analytics?
goaccess access.log -c

How to check the analytics in HTML page?
goaccess access.log -o report.html --log-format=COMBINED

Now run,

How to check the analytics in HTML page dynamically?
goaccess access.log -o /var/www/html/dynamic.html --log-format=COMBINED --real-time-html

Now run,

Question: Share the Offical website link?

Wednesday, 29 July 2020

How do I manage MongoDB connections in a Node.js web application?

How do I manage MongoDB connections in a Node.js web application?

Question: How do I manage MongoDB connections in a Node.js web application?
You need to install mongoose and bluebird module.
Also you must have mongodb install in server, As you need mongodb URL and port on which mongodb running.

var mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
//mongodb connection with error handing
mongoose.connect(config.MONGO_DB_URL + config.MONGO_DB);
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
    console.log("MongoDB connected Successfully.!");

Question: mongoose - find all documents with IDs listed in array?
var AjaxChatUser = mongoose.model('AjaxChatUser');
    '_id': { $in: [
}, function(err, docs){

Question: How to npm install to a specified directory?
Use --prefix option, to installed in specific directory.
npm install --prefix  -g

Question: How to declare multiple module.exports in Node.js?
You can put multiple function inside module.exports.

module.exports = {
    method: function() {},
    otherMethod: function() {},

Question: Can we write a JS code that work for both (node and the browser)?
Yes, We can write.
Suppose we have mymodule.js which have following code.
Example of Code
   exports.test1 = function(){
        return 'this is test1 function.'
   exports.test2 = function(){
        return 'this is test2 function.'

})(typeof exports === 'undefined'? this['mymodule']={}: exports);

In Node (Server side()
var share = require('./mymodule.js');

In Browser (Client side()
//Include the js with script tag

Question: How we can use global variable in Node?
We can use with global.varname

Question: How we can access static files with express.js in Node?
Use following to set the folder as static so that we can put public files here.
app.use(express.static('public')); //public folder

Friday, 24 July 2020

Scrum Tutorial - part 2

Scrum Tutorial - part 2

Question: What is Scrum Events?
There are prescribed events that are used in Scrum to create regularity  and these are time-boxed events.
Following are 4 Events.
  1. Sprint planning
  2. Daily scrum
  3. Sprint review
  4. Sprint retrospective

Question: What is Product Backlog?
The Product Backlog is an ordered list of application/software/etc that is known to be needed in the product.
It is the single source of requirements for any changes to be made to the product.
The Product Owner is responsible for the Product Backlog, including its content, availability, and ordering.

Question: What is Sprint Backlog?
The Sprint Backlog is the set of Product Backlog items selected for the Sprint, plus a plan for delivering the product Increment and realizing the Sprint Goal.
The Sprint Backlog is a forecast by the Development Team about what functionality will be in the next Increment

Question: What is Increment?
The Increment is the sum of all the Product Backlog items completed during a Sprint and the value of the increments of all previous Sprints.

Question: What is Definition of DONE?
When a Product Backlog item or an Increment is described as “Done”, everyone must understand what "Done" means.
Before a Product Backlog Item is considered "done" or "complete", it must respect the following criteria (Defination may be similar to below):
--Unit Tests are written and passing
--Acceptance Tests are written and passing
--Accessibility testing using
--Continuous Integration (CI) pipeline passing

Question: What is Burn-down Chart?
A chart which shows the amount of work which is thought to remain in a backlog. .

Question: What is Burn-up Chart?
A chart which shows the amount of work which has been completed..

Question: What is Coherent/Coherence?
The quality of the relationship between certain Product Backlog items which may make them worthy of consideration as a whole.

Question: What is Emergence?
The process of the coming into existence or prominence of new facts or new knowledge of a fact, or knowledge of a fact becoming visible unexpectedly.

Question: What is Empiricism?
It has three pillars: transparency, inspection and adaptation.

Question: What is Sprint Retrospective?
Scrum Event that is set to a time-box of 3 hours, or less, to end a Sprint.

Question: What is Technical Debt?
The typically unpredictable overhead of maintaining the product.

Question: What is Artifacts?
An object made by a human being, typically one of cultural or historical interest.

Question: What is Cancelling a Sprint?
A Sprint can be cancelled before the Sprint time-box is over. Only the Product Owner has the authority to cancel the Sprint, although he or she may do so under influence from the stakeholders, the Development Team, or the Scrum Master. 

Question: Describe the Scrum Events in Details?
  1. Sprint planning: A time-boxed event occurs at the beginning of a sprint where the team determines the product backlog items they will work.
  2. Daily scrum: A is a 15-minute time-boxed event for the Development Team to synchronize activities and create a plan for the next 24 hours.
  3. Sprint review: A time-boxed event holds at the end of the Sprint to inspect the Increment and adapt the Product Backlog if needed. In this the Scrum Team and stakeholders collaborate about what was done in the Sprint.
  4. Sprint retrospective: Event for providing an opportunity for the Scrum Team to inspect itself and create a plan for improvements to be enacted during the next Sprint.

Thursday, 23 July 2020

Scrum Tutorial - part 1

Scrum Tutorial - part 1

Question: What is Scrum?
Scrum is an agile framework which is used for developing, delivering the software products.
Now its also used in other fields like research, sales and marketing.

Question: Who is Scrum team?
  1. Product owner:
    The Product Owner is responsible for maximising the value of the product resulting from work of the Development Team.
  2. Developers:
    The Development Team consists of professionals who do the work.
  3. Scrum Master:
    The Scrum Master is responsible for promoting and supporting Scrum as defined in the Scrum Guide.

Question: What are uses of Scrum?
  1. Research and identify viable markets, technologies, and product capabilities
  2. Develop products and enhancements
  3. Develop and sustain Cloud (online, secure, on-demand) and other operational environments for product
  4. Maintain products

Question: What are 3 pillars of Scrum?
  1. Transparency
    What task have done and what are pending and what team are doing will be visible to the Scrum team members and stockholder of product.
  2. Inspection
    Scrum users must frequently inspect Scrum artifacts and progress.
  3. Adaptation
    If an inspector determines that one or more aspects, then that can be taken.

Question: What are events of scrum?
  1. Sprint Planning
  2. Daily Scrum
  3. Sprint Review
  4. Sprint Retrospective

Question: What are Scrum Master Service to the Product Owner?
  1. Finding techniques for effective Product Backlog management
  2. Helping the Scrum Team understand the need for clear and concise items
  3. Ensuring the Product Owner knows how to arrange the Product Item to maximize value
  4. Facilitating Scrum events as requested or needed.
  5. Ensuring that goals, scope, and product domain are understood by everyone on the Scrum Team

Question: What are Scrum Master Service to the Product Owner?
  1. Removing impediments to the Development Team’s progress
  2. Coaching the Development Team in self-organization and cross-functionality
  3. Facilitating Scrum events as requested or needed
  4. Coaching the Development Team
  5. Helping the Development Team to create high-value products

Question: What are Scrum Master Service to the Organisation?
  1. Causing change that increases the productivity of the Scrum Team
  2. Leading and coaching the organisation in its Scrum adoption
  3. Planning Scrum implementations within the organisation
  4. Helping employees and stakeholders

Wednesday, 22 July 2020

How to determine a user's IP address in node

How to determine a user's IP address in node
Question: How to determine a user's IP address in node?
We can use request.connection.remoteAddress to detect the IP Address in node but sometimes server is running behind the load balancer, In this case we need to check for x-forwarded-for

exports.check_node = function(req, res) {
    var ip = req.headers['x-forwarded-for'] || 
     req.connection.remoteAddress || 
     req.socket.remoteAddress ||
     (req.connection.socket ? req.connection.socket.remoteAddress : null);

Question: How can I use wait In Node.js?
You can use setTimeout function similar to javascript

function function1() {    
    console.log('Welcome to My Console,');

function function2() {    

setTimeout(function2, 3000); //call second
function1(); //Call first

Question: Command to remove all npm modules in windows?
  1. Remove module local
    Go to directory with name of node_modules under current project. DELETE all the folder.
  2. C:\Users\DELL\AppData\Roaming\npm\node_modules
    Delete all the files

Question: Node.js check if path is file or directory?
For this, you need to install the fs module.
var fs = require('fs');
stat = await fs.lstat(PATH_HERE)

Question: What is use of app.use in express?
app.use is a method to configure the middleware used by Express.

Question: Difference between process.stdout.write and console.log?
console.log() calls process.stdout.write with formatted output.
console.log() explains in library
console.log = function (d) {
  process.stdout.write(d + '\n');

Question: How to Detect if file called through require or directly by command line?
if (require.main === module) {
    console.log('called directly');
} else {
    console.log('required as a module');

Question: What is the use of next() in express?
It passes control to the next matching route.
For Example:
app.get('/user/:id?', function(req, res, next){
    var id =;
    if (id) {
        // do something
    } else {

How to Call async/await functions in parallel

How to Call async/await functions in parallel

Question: How to Call async/await functions in parallel?
We can use await on Promise.all()

let [someResult, anotherResult, anotherResult3] = await Promise.all([someCall(), anotherCall(), another3Call()]);

const promise1 = Promise.resolve(3);
const promise2 = 42;
const promise3 = new Promise((resolve, reject) => {
  setTimeout(resolve, 100, 'foo');
Promise.all([promise1, promise2, promise3]).then((values) => {

Question: How to read data from Image url and write in file synchronous?
First, We must need to install https and fs module in node.
https - Its for execute the https request.
fs - for save the file in local.

const https = require('https');
const fs = require('fs');

const file = fs.createWriteStream("file.jpg");//Create  a file
const request = https.get("", function(response) {
  response.pipe(file);//Add the image-content in file

Question: What is difference between app.listen and server.listen?
Both are used to start the server, for listening the request.

We need server.listen for create the request on https server.
var https = require('https');
var server = https.createServer(app).listen(config.port, function() {
    console.log('Https App started');

app.listen will create http server.
var express = require('express');
var app = express();

Question: How to return the json response?
You can use res.json() to return the response in APIs
exports.get_data = function(req, res) {  
    res.json({name: "web technology experts",description:"this is description"});

Question: How to auto-reload files in Node.js in Local server?
While doing the development, you do not want to re-start the node server each time, when you made changes.
For this you can use nodemon module.
Install the nodemon module
npm install nodemon -g 

start the node with nodemon instead of node
nodemon app.js

Question: How to create https request?
To Create the https server,
---first you need to install the modules like https, express and etc
---You need private/public keys for ssl

var https = require('https');
var privateKey  = fs.readFileSync('public/server.key', 'utf8');
var certificate = fs.readFileSync('public/file.crt', 'utf8');
var caCertificate = fs.readFileSync('public/chain.crt', 'utf8');
var credentials = {key: privateKey, cert: certificate, ca: caCertificate};
var httpsServer = https.createServer(credentials, app);  
var io = require('')(httpsServer);  
httpsServer.listen(443,function() {
    console.log('https listening on 443');

Monday, 20 July 2020

Call socket event from router page in Node

Call socket event from router page in Node

Question: How to send socket notification from Node API/Router?
  1. In App file (like index.js OR app.js)
    //Express setup
    var express = require('express');
    var app = express();
    //socketsetup setup
    var io = require('')(https);    
    app.set('io', io); //IMP this will let available io in router file
  2. In Router or Controller file
    exports.sendnotify = function(req, res) {
        var io ='io');
        io.sockets["in"]('room_446').emit('session_end_notify', {vid:100,event_type:'live'});   //Send the Notification
        res.send('node is working fine');

Question: How decrypt a text which is encoded with base64?
let buff = Buffer.from('ENCRYPTED_TXT', 'base64');
print buff.toString('ascii');        

Thursday, 2 July 2020

Node JS Interview Questions and Answers

Node JS Interview Questions and Answers

Question: How to write in files synchronous in Node.js?
const fs = require('fs');
fs.writeFileSync('/fold/test.txt', 'Write in file');

Question: What is the difference between --save and --save-dev?
--save-dev is used to save the package for development purpose. Example: unit tests, minification
--save is used to save the package required for the application to run.

Question: is node single threaded or multithreaded?
It is a single threaded language which in background uses multiple threads to execute asynchronous code. Also its is non-blocking which means that all functions ( callbacks ) are delegated to the event loop and they are ( or can be ) executed by different threads.

Question: How to print console without a trailing newline?
    process.stdout.write("hello: ");

Question: How to create a directory if it doesn't exist using Node.js?
var fs = require('fs');
var dir = './tmp';
if (!fs.existsSync(dir)){

Question: How can we execute binary/exe files in Node ?
const { exec } = require('child_process');
exec('wc -l', (err, stdout, stderr) => {
  if (err) {
    // node couldn't execute the command

Question: Is there a way to get version from package.json?
var pjson = require('./package.json');

Question: How can I update npm on Windows?
Simple way
Download and run the latest MSI from The MSI will update your installed node and npm.

Question: How can node in background?
nohup node server.js &

Question: What is the difference between __dirname and ./ in node.js?
__dirname is always the directory in which the currently executing script exist.
. gives you the directory from which you ran the node command in your terminal window

Question: How to get the full url in Express?
var url = require('url');
function fullUrl(req) {
  return url.format({
    protocol: req.protocol,
    host: req.get('host'),
    pathname: req.originalUrl

Wednesday, 1 July 2020

Node JS Interview Questions and Answers for 3 Years experience

Question: What is the difference between tilde(~) and caret(^) in package.json?
~ update you to all future patch versions, without incrementing the minor version. ~2.2.3 will use releases from 2.2.3 to 2.3.0.
^ update you to all future minor/patch versions, without incrementing the major version. ^2.3.3 will use releases from 2.3.3 to 3.0.0.

Question: How do I pass command line arguments to a Node.js program?
In Node - How to pass arguent
node process-2.js one two=three four
In Node - How to get argument value

Question: How do I update each dependency in package.json to the latest version?
npm i -g npm-check-updates
ncu -u
npm install

Question: How can I update NodeJS and NPM to the next versions?
npm install -g npm

Question: How to write in files synchronous in Node.js?
const fs = require('fs');
fs.writeFileSync('/fold/test.txt', 'Write in file');

Question: How to read environment variables?
var mode   = process.env.NODE_ENV;
var apiKey = process.env.apiKey; 

Question: How to parse JSON using Node.js?
//Parse JSON Data
var bodyParser = require('body-parser')
app.use(bodyParser.json());       // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({// to support URL-encoded bodies
    extended: true

Question: How  an HTTP POST request made?
var request = require('request');
    { json: { key: 'value' } },
    function (error, response, body) {
        if (!error && response.statusCode == 200) {

Question: How can I get the full object in Node.js's console.log(), rather than Object?
const util = require('util');
console.log(util.inspect(myObject, {showHidden: false, depth: null}));

console.log(JSON.stringify(myObject, null, 4));

Question: How to encode a text using base64?
Buffer.from("Hello World").toString('base64'); //SGVsbG8gV29ybGQ=

Question: How to decoded a text which is encoded with base64?
Buffer.from("SGVsbG8gV29ybGQ=", 'base64').toString('ascii'); //Hello World

Thursday, 18 June 2020

Get Mysql Row size too large error when change engine from MyISAM to Innodb

Get Mysql Row size too large error when change engine from MyISAM to Innodb

When i try to change the engine From MyISAM to InnoDB, getting following error.

row size too large (> 8126). changing some columns to text or blob or using row_format=dynamic or row_format=compressed may help.

  1. Add the following to the my.cnf file under [mysqld] section.
            innodb_file_format = Barracuda;
            innodb_log_file_size = 256M    

Sunday, 7 June 2020

MySQL database Administrator interview question and Answer for 6 year experienced

MySQL database Administrator interview question and Answer for 6 year experienced

Question: How to reset AUTO_INCREMENT in MySQL?>

Question: How to concatenate multiple rows into one field?>
SELECT GROUP_CONCAT(id SEPARATOR ', ')   FROM users   WHERE city = 'india'  GROUP BY city;

(It will concatinate all the users)

Question: Which MySQL data type to use for storing boolean values?>

Question: What are best character-set for multi-language data?>

Question: What is the difference between utf8mb4_unicode_ci and utf8mb4_general_ci?
utf8mb4_unicode_ci is based on the official Unicode rules for universal sorting and comparison, which sorts accurately in a wide range of languages.

utf8mb4_general_ciis a simplified set of sorting rules which aims to do as well as it can while taking many short-cuts designed to improve speed. It does not follow the Unicode rules and will result in undesirable sorting or comparison in some situations

Question: How do you set a default value for a MySQL Datetime column?>
For example:

Question: What is the difference between physical and logical backup?>
physical backup is to copy for backing up all the physical files that belongs to database.(like data files,control files,log files, executables etc), we need to stop the mysql service temporary.>
In logical backup, you don't take the copies of any physical things,you only extract the data from the data files into dump files.(ex : using export )

Question: What are World's most popular Databases?>
  1. Oracle
  2. MySQL
  3. Microsoft SQL Server
  4. PostgreSQL
  5. MongoDB

Question: Explain ACID?
Atomicity. All completed OR Nothing.
Consistency. Database protected from actions that may corrupt data.
Isolation. multiple actions occuring in parallel will not impact each other.
Durability. All commited statements data are safe.

Question: What does FLUSH TABLES WITH READ LOCK do?
1 set the global read lock - after this step, insert/update/delete/replace/alter statements cannot run.
2 close open tables - this step will block until all statements started previously have stopped.
3 set a flag to block commits.

Thursday, 4 June 2020

MySQL database Administrator interview question and Answer

MySQL database Administrator interview questions and Answer

Question: How to start MySQL Service?
Start MySQL Server using service
sudo service mysql start

Start MySQL Server using using init.d
sudo /etc/init.d/mysql start

Start MySQL Server using systemd
Start MySQL Server using systemd

Question: List the MySQL Users
select user from mysql.user;

Question: List all databases
show databases

Question: Grant insert,UPDATE,delete privileges on the mydb (DB) to dbuser (User)
GRANT INSERT, UPDATE, DELETE ON mydb.* TO bob@localhost;

Question: Grant all privileges on the mydb (DB) to dbuser(User)
grant all privileges on mydb.* to dbuser@localhost;

Question: Show all the privileges to dbuser(User)

Question: Revoke insert,UPDATE,delete privileges on the mydb (DB) from dbuser (User)
REVOKE INSERT, UPDATE ON mydb.* FROM dbuser@localhost;

Question: List all the Proesslist in MySQL

Question: What are different MySQL storage engines
  1. MyISAM: Before MySQL version 5.5, MyISAM is the default storage engine. MyISAM extends the former ISAM storage engine. MyISAM tables are optimized for compression and speed. MyISAM tables can be compressed into read-only tables to save spaces. The MyISAM tables are not transaction-safe. MySQL also checks and repairs InnoDB tables.
  2. InnoDB: InnoDB tables fully support ACID-compliant and transactions. InnoDB table supports foreign keys, commit, rollback, roll-forward operations. MySQL also checks and repairs InnoDB tables.
  3. MERGE: A MERGE table is a virtual table that combines multiple MyISAM tables that have a similar structure to one table. MERGE table does not have its own indexes;
  4. MEMORY: The memory tables are stored in memory and use hash indexes so that they are faster than MyISAM tables The lifetime of the data of the memory tables depends on the uptime of the database server.

Monday, 1 June 2020

MySQL Stored procedure interview Questions and Answer

MySQL Stored procedure interview Questions and Answer

Question: What is stored procedure?
A stored procedure is Structured Query Language (SQL) statements which has a name, a parameter list, and SQL statement(s) stored in MySQL Server.

Question: Give example of stored procedure?
CREATE PROCEDURE getUsersAscending()
	ORDER BY first_name;    

Question: Give example of stored procedure with parameter details?
CREATE   PROCEDURE `getUsersDetails`(IdSearch INT)    
	WHERE id=IdSearch;      


Question: To show all stored procedures:

Question: How to show stored procedures in a specific database

Question: MySQL stored procedures advantages?
  1. Reduce network traffic
  2. Make database more secure

Question: MySQL stored procedures dis-advantages?
  1. Resource usages: If you use many stored procedures, the memory usage of every connection will increase substantially.
  2. Troubleshooting:MySQL does not provide any facilities to debug stored procedures like other enterprise database products such as Oracle and SQL Server
  3. Maintenances Developing and maintaining stored procedures often requires a specialized skill set that not all application developers possess.

Question: How to call stored procedure with OR without arguments?
Call without argument
call getUsersAscending();
Call With argument
call getUsersDetails(10);

Question: How to delete the procedure?

Question: What if i am trying to delete the stored procedure for non-exist.?
It will give warning only, if you have used "IF EXISTS"
It will give Error, if you have used not used "IF EXISTS"

Question: How to Alter a stored procedure in mysql?
1: Delete the Stored procedure. 
2: Re-Create the Stored procedure.

Sunday, 31 May 2020

AWS Elastic Beanstalk Interview Questions and Answers

AWS Elastic Beanstalk Interview Questions and Answers

Question: What is Elastic Beanstalk in AWS?
AWS Elastic Beanstalk is End-to-end web application management.

Question: Can we use Elastic beanstalk to deploy the web application which is made in Node OR PHP?
Yes, AWS Elastic Beanstalk is service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.

Question: How does works Elastic Beanstalk?
You simply upload your code and Elastic Beanstalk automatically handles the deployment, from capacity provisioning, load balancing, and automatic scaling to web application health monitoring, with ongoing fully managed patch and security updates.

What are Benefits and features of Elastic Beanstalk?
  1. Easy to get started
    Elastic Beanstalk is the simplest way to deploy and run your web application on AWS.
  2. Complete resource control
    You have the freedom to select the AWS resources, such as Amazon EC2 instance types, that are optimal for your web application.
  3. Fully managed: update your web application with the latest platform security and patch updates.
  4. Automatic application health monitoring
    Elastic Beanstalk automatically collects more than 40 key metrics and attributes to determine the health of your web application

Question: What Language Supported by Elastic Beanstalk
  1. Go
  2. Java SE
  3. Java with Tomcat
  4. NET on Windows Server with IIS
  5. Node.js
  6. PHP
  7. Python
  8. Ruby
  9. Packer Builder

Question: How is AWS CloudFormation different from AWS Elastic Beanstalk?
AWS CloudFormation helps you provision and describe all of the infrastructure resources that are present in your cloud environment. On the other hand, AWS Elastic Beanstalk provides an environment that makes it easy to deploy and run applications in the cloud.
AWS CloudFormation supports the infrastructure needs of various types of applications, like legacy applications and existing enterprise applications. On the other hand, AWS Elastic Beanstalk is combined with the developer tools to help you manage the lifecycle of your applications.

Question: Who should use AWS Elastic Beanstalk?
Those who want to deploy and manage their applications within minutes in the AWS Cloud. You don’t need experience with cloud computing to get started. AWS Elastic Beanstalk supports Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker web applications.