Monday, 31 July 2017

Server Architecture Interview Questions and Answer

Server Architecture Interview Questions and Answer

Question: What is VPC?
Full form of VPC is Virtual Private Cloud.
It is virtual network dedicated to AWS account.It is logically isolated to the other virtual network in the AWS cloud.


Question: Can a VPC of any size be created?
Yes, After selecting an option, you can modify the size and IP address range of the VPC and its subnets.
You can modify the VPC to add more subnets or add/remove gateways at any time after the VPC has been created.
Question: How do AWS VPC work?
It is logically isolated from other virtual networks. You can launch your AWS resources, such as Amazon EC2 instances, into your VPC.
You can configure your VPC and select its IP address range, create subnets, and configure route tables, network gateways, and security settings.

Question: What is route table in AWS?
A route table contains a set of rules, that are used to determine where network traffic is directed.
Each subnet in your VPC must be associated with a route table, the route table controls the routing for the subnet.


Question: What is an Internet gateway AWS?
An Internet gateway is a horizontally scaled, redundant, and highly available VPC component that allows communication between instances in your VPC and the Internet.


Question: What is an Amazon VPC?
Amazon VPC lets you provision a logically isolated section of the Amazon Web Services (AWS) cloud where you can launch AWS resources in a virtual network that you define.

Following are components of VPC
  1. A Virtual Private Cloud
  2. Subnet
  3. Internet Gateway
  4. NAT Gateway
  5. Hardware VPN Connection
  6. Virtual Private Gateway
  7. Customer Gateway
  8. Router



Question: What is an Elastic IP address?
An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. With an Elastic IP address, you can mask the failure of an instance or software by rapidly remapping the address to another instance in your account.
Question: What is AWS VPN?
You can connect your VPC to remote networks by using a VPN connection.


Question: What is Route 53?
Amazon Route 53 (Route 53) is a scalable and highly available Domain Name System (DNS).


Question: What is a static route?
Static routing is a form of routing that occurs when a router uses a manually-configured routing entry, rather than information from a dynamic routing traffic.


Question: What do you mean by dynamic routing?
Dynamic routing is a networking technique that provides optimal data routing. dynamic routing enables routers to select paths according to real-time logical network layout changes.


Question: What is meant by API gateway?
The API Gateway will often handle a request by invoking multiple microservices and aggregating the results.
It can translate between web HTTP and WebSocket and web?unfriendly protocols that are used internally.


Question: What is an API management?
It is process of publishing, documenting and overseeing application programming interfaces (APIs) in a secure, scalable environment.


Question: What is Amazon MWS?
Full form of MWS is Amazon Marketplace Web Service. It is an integrated web service API that helps Amazon sellers to programmatically exchange data on listings, orders, payments, reports, and more. Data integration with Amazon enables high levels of selling automation, which can help sellers grow their business.


Question: What is cloud computing?
cloud computing is the delivery of computing services—servers, storage, databases, networking, software, analytics and more—over the Internet.


Question: what is load balancer?
A load balancer is a device that acts as a reverse proxy and distributes network or application traffic across a number of. servers.
Load balancers are used to increase capacity (concurrent users) and reliability of applications.


Question: What is load balancing on a router?
Network load balancing is the ability to balance traffic across two WAN links without using complex routing protocols like BGP.


Question: How do load balancing servers work?
A load balancer acts as the "traffic cop" sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked.


Question: What is Lambda?
AWS Lambda lets you run code without managing servers, AWS states on the Lambda product page.
You can think of Lambda as an event-driven computing platform;
Lambda runs when triggered by an event and executes code that's been loaded into the system.


Wednesday, 26 July 2017

PHP interview questions and answers for 4 year experience

PHP interview questions and answers for 4 year experience

Question: Difference between include and require?
include: It include a file, It does not find through an warning.
require: It include a file, It does not find through an fatal error, process exit.


Question: How to get IP Address of client?
$_SERVER['REMOTE_ADDR'];



Question: How to get IP Address of Server?
$_SERVER['SERVER_ADDR'];



Question: What is output of following?
$a = '10';
$b = &$a;

$b = "2$b";

echo $a;
echo $b;

Output
210
210



Question: What are the main error types?
  1. Notices: Simple, non-critical errors that are occurred during the script execution.Ideally we should fix all notices.
    echo $undefinedVar;
    
  2. Warning: more important than Notice but it is also non-critical errors that are occurred during the script execution. It should be fixed.
    include "non-ExistFile.php";
    
  3. Error: critical errors due to which script execution stopped. It must be fixed.
    require "non-ExistFile.php";
    



Question: How to enable/disable error reporting?
Enable error
error_reporting(E_ALL);

Disable error
error_reporting(0);



Question: What are Traits?
Traits are a mechanism that allows you to create reusable code in PHP where multiple inheritance is not supported. To create a Traits we use keyword trait.
Example of Traits
trait users {
    function getUserType() { }
    function getUserDescription() {  }
    function getUserDelete() {  }
}

class ezcReflectionMethod extends ReflectionMethod {
    use users;    
}

class ezcReflectionFunction extends ReflectionFunction {
    use users;
}



Question: How to extend a class defined with Final?
No, You can't extend. A class declare with final keyword can't be extend.


Question: What is full form of PSRs?
PHP Standards Recommendations


Question: What is the difference between $message and $$message?
$message is a simple variable whereas $$message is variable whose name is stored in another variable ($message).


Question: How to destroy the session?
session_destroy



Question: How do you execute a PHP script from the command line?
  1. Get the php.exe path from server (My PHP path is : D:\wamp\bin\php\php5.5.12)
  2. In environment variable, Add this path path under PATH variable.
  3. Re-start the computer.
  4. Now, you can execute php files from command file.
    php hello.php



Question: How to repair the session?
REPAIR TABLE tablename 
REPAIR TABLE tablename QUICK 
REPAIR TABLE tablename EXTENDED 



Question: Are Parent constructors called implicitly inside a class constructor?
No, You need to call explicitly.
parent::constructor($value);



Question: What does $_GLOBALS means?
It is associate variable which have all the global data of GET/POST/SESSION/_FILES/ENV/SERVER/GLOBALS etc.
Array
(
    [_GET] => Array
        (
        )

    [_POST] => Array
        (
        )

    [_COOKIE] => Array
        (    
            [_gu] => 1cf7097e-eaf0-486d-aa34-449cf1164ba8
            [_gw] => 2.127103(sc~1,s~oru42c,a~1)127418(sc~1,s~oru42c)u[~0,~0,~0,~0,~0]v[~ev3o1,~4,~0]a()
            [PHPSESSID] => ki18pnad1knttqv5i6233sjem7
        )

    [_FILES] => Array
        (
        )

    [_ENV] => Array
        (
        )

    [_REQUEST] => Array
        (
        )

    [_SERVER] => Array
        (            
            [REQUEST_TIME_FLOAT] => 1501064295.228
            [REQUEST_TIME] => 1501064295
        )

    [GLOBALS] => Array
 *RECURSION*
    [_SESSION] => Array
        (
        )

)



Question: How is it possible to parse a configuration file?
parse_ini_file('config.ini');


Question: What is the difference between characters \034 and \x34? \034 is octal 34 and \x34 is hex 34.


Question: Explain soundex() and metaphone().?
soundex() function calculates the soundex key of a string. A soundex key is a four character long alphanumeric strings that represents English pronunciation of a word.
$str= "hello";
Echo soundex($str);

metaphone() the metaphone() function calculates the metaphone key of a string. A metaphone key represents how a string sounds if pronounced by an English person.

Question: How to start displaying errors in PHP application ? Add following code in PHP.
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

OR
Add following code in .htacess
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag  log_errors on




Question: What is stdClass?
It is PHP generic empty class.
stdClass is used to create the new Object. For Example
$newObj = new stdClass();
$newObj->name='What is your name?';
$newObj->description='Tell me about yourself?';
$newObj->areYouInIndia=1;
print_r($newObj);

Output
stdClass Object
(
    [name] => What is your name?
    [description] => Tell me about yourself?
    [areYouInIndia] => 1
)



Question: What is output of below?
$a = '1';
$b = &$a;
$b = "2$b";
echo $a.", ".$b;

output
21, 21


Question:What is the difference between GET and POST?
  1. GET displays the submitted data as part of the URL whereas post does not show.
  2. GET can handle a maximum of 2048 characters, POST has no such restrictions
  3. GET allows only ASCII data, POST has no restrictions, binary data are also allowed.
  4. Normally GET is used to retrieve data while POST to insert and update.



Question:What is traits and give example?
Traits are a mechanism for code reuse in single inheritance languages such as PHP.
class Base {
    public function sayHello() {
        echo 'Hello ';
    }
}

trait SayWorld {
    public function sayHello() {
        parent::sayHello();
        echo 'World!';
    }
}

class MyHelloWorld extends Base {
    use SayWorld;
}

$o = new MyHelloWorld();
$o->sayHello();


output
Hello World