Developer interview preparation – Commonly asked basic Unix commands – Part 2

(11) free

Provides free used and swapped memory in the system. Usually output is listed in bytes.

Example :

$ free

$ free -g

-g can be used to see how many GB of RAM system has. You can use -m for megabytes and -k for kilobytes.

unix interview questions(12) cp

copies one file into another file.

Example :

$ cp -i file1 file2

the command above will copy file1 to file2. It will show you a prompt if file2 already exists, before overwriting.

 

Unix interview questions and answers : 20 Commonly asked basic unix commands with example

unix interview questionsUnix is widely used Operating System and many companies use as their development platform. I have provided a list of basic Unix Commands that would be a great refresher before you go for an interview. These commands are one of the most asked questions during interview. I’ve provided one of the most used unix commands, their description and code example.

Hope this helps you in getting successful interview.

(1) chmod

It can be used to change permission of a file

Example :
(1) $ chmod 644 *.txt
Which changes permission to
read only

(2) chmod 755 filename.exe
which changes permissions to executable

(2) passwd

It can be used to change current password

Example : $ passwd

(3) kill

It can be used to kill a process

Example : $ kill -9 5555
Kills a process with ID number 5555

(4) gcc <source>
g++ <source>

this can be used to compile a C or C++ programs

Example :
$ gcc file.c -o file
$ g++ fil2.cpp -o fil2

(5) who

this lists who is logged currently on the machine

(6) pwd

pwd prints the current directory name.

(7) ls

this is one of the most used unix commands on a daily basis by unix users.

Example :

$ ls -ltr
which prints files in order by last modified time

$ ls -lh
Displays file size and file names in MB / KB

(8) gzip 

This command creates .gz compressed files for provided file name in the input

Example :

$ gzip file.txt

which creates compressed file with extension which would be :
file.txt.gz

To uncompress the file, following command can be used :
$ gzip -d file.txt.gz

(9) ps 

ps commands are used to display information about processes that are currently running within the system.

Example :

$ ps -ef | more

is can be used to see currently running processes

$ ps -efH | more

in above example H stands for hierarchy. this can be used to see a tree structure of current running process in the system.

(10) grep

grep can be used to search for a string within the file.

$ grep “work” test.txt
which will find line that has “work” within that and prints on console.

$ grep “work” *.txt
can be used to find all files with lines that has word “work”. It will print each file name with the word specified

 

PHP interview questions and answers : Commonly asked PHP Questions – Part 2

PHP interview questions answer11.  What are the different types of errors in PHP? Provide details around each of them. 

There are three types of errors in PHP : Notices, Warnings and Fatal Errors.

Notices : Notices represent non-critical errors, which means accessing a variable that has not yet been defined. This type of errors are not displayed to users by default. However, you can change the default and have it displayed whenever needed.

Warnings : Warnings are a bit serious errors but they do not result in script termination. which means calling include() a file that does not exist. By default, these type of errors are displayed to the user while executing them at run time.

Fatal Errors : Fatal errors are most critical errors. which means calling a non-existent function or a class. These errors cause the immediate termination of the script and prevent applications from rendering for users.

 

 

Basic Introduction to Object Oriented Programming Concept (OOP) – Part 2

Object Oriented Programming Concept(3) Code Reusability

Up until now we have discussed features that let’s you build intelligence within your application without writing same code again. Why OOP is powerful? Because it allows building artificial intelligence within objects and reuse the same code over and over again. It let’s you use same method or function for performing two totally different tasks if you call based upon different number of arguments (e.g. Polymorphism). You can inherit properties for sub-classes and their objects without writing additional code and then can extend class with further features.

(4) Abstraction and Data Encapsulation

Abstraction and Data Encapsulation both are related with each other. Again they make Object-oriented programming powerful. You can learn syntax and coding paradigm as you learn a particular language, Java or .Net or PHP. I will provide you basic concept using very simple real life examples.

Encapsulation

Encapsulation is data hiding; as the name suggest. Encapsulation allows wrapping properties, methods around a wrapper in order to protect them from outside world where they are not supposed be accessed. Encapsulation is used for hide the code and data in a single unit to protect the data from the outside the world. Class is the best example of encapsulation.

Abstraction

Abstraction allows to display only related and necessary details to the intended user. As the name suggests, abstraction is the “abstract form of something – some object”. We use abstraction in programming languages to make abstract class. Abstract class represents abstract view of methods and properties of a class. Abstract class is more of a Java term; however the basic concept remains the same. You can extend an abstract class that is already defined and then define properties that are aligned with the objects belong to that class.

How would you differentiate both with an example?

Just to add more clarity while we’re talking about Java : Abstraction can be implemented using interface and abstract class whereas Encapsulation is implemented using public, private and protected access modifier.

Hope this clarifies basic concept of Object Oriented Programming; and why it’s very well recommended and powerful programming technology.

 

PHP interview questions and answers : 20 commonly asked PHP Questions

PHP interview questions answerI have listed 20 commonly asked PHP questions and answers during interview as a PHP developer. This will be useful if you are attending in person interview or a technical phone screening. Let us know your feedback by posting comments below.

1. What is “echo” in PHP?

The “echo” is used to write or print text string. You can print any text you like using echo.
Sample Code : <?php echo ‘PHP interview Questions and Answers’;

2. How can you declare a simple static array in PHP?

Sample Code : var $samplearr = array(‘one’, ‘two’, ‘three’);

Continue reading

Video : Commonly asked HTML5 interview Questions and Answers

I have created a video of Commonly asked HTML5 interview questions and answers. This video contains questions and content mentioned in this article. We hope you would like this video. Don’t forget to like this video if you think it’s helpful.

JavaScript interview questions and answers : Javascript interview coding samples

JavaScript interview questions and answersFront-end developers are normally asked to write a small snippet of code during the interview process. I have listed one of the most common Javascript coding question and sample code that is asked during well developed technology companies.

Remember, interviewers are looking for your ability to understand concept, turn that into logical expressions and write most efficient, non-complex code that executes well at the run time. One of the most common coding question is :

Step by Step coding example: How to find row with maximum number of 1s in given array.

We will use Binary Search to find row with maximum no of 1s in given array. First we have to find the index of first instance of 1 in each row. The count of 1s is equal to total number of columns minus the index of first 1. Time complexity is O(RLogC).

JavaScript Source Code 

/**Here is the code how to find maximum no of 1s in sorted array*/

var a = new Array();

a = [[0,0,0,1],[0,1,1,1],[0,0,1,1],[0,0,0,0]];

function findfist1(arr,low,high) {

    var myarray = new Array();

    myarray = arr;

    var myhigh = high;

    var mylow = low;

    var mid;

    //alert(myarray);

    //alert(myhigh);

    //alert(mylow);

    if(myhigh >= mylow) {

        mid = mylow + (myhigh - mylow)/2;

        var mymid = parseInt(mid); 

        if ( ( mymid == 0 || myarray[mymid-1] == 0) && myarray[mymid] == 1) {

            return mymid;

        }

        else if(myarray[mymid] == 0) {

            return findfist1(myarray, (mymid + 1), myhigh);

        }

        else {

            return findfist1(myarray, mylow, (mymid -1));

        }

  }

    return -1;

}   

function maxone(arr) {

    //alert(arr);

    var max_row_index = 0;

    var max = -1; 

    var i, index;

    var R = arr.length;

    var C = arr.length;

    //alert(R);

    //alert(C);

    for (i = 0; i < R; i++) {

        index = findfist1(arr[i], 0, C-1);

        //alert(index);

        if (index != -1 && C-index > max) {

           max = C - index;

           max_row_index = i;

           //alert(max_row_index);

       }

    }

    return max_row_index;

}

alert(maxone(a));

Below is working code sample in Javascript.

Interview Preparation : Basic Introduction to Object Oriented Programming Concept (OOP)

OOPObject Oriented Programming is a widely used buzz word if you are going for a tech job interview or in an engineering school. You wonder why OOP is so important. I will explain most important basic aspects for Object Oriented Technology in this article. I promise this concept will be very useful if you have an upcoming interview.

What is Object Oriented Programming?

Object Oriented Programming is a concept based upon Class and Objects. In this concept each class represents basic attributes of it’s family and contains a set of Objects. Every Object belongs to that class inherits attributes, state and / or properties defined by the Class. Objects can have their own properties in addition as well.

Most widely used advanced programming languages such as Java, .Net, C++ and PHP use Object Oriented Programming. On front-end JavaScript – JSON or JQuery also use OOP. There are key characteristics why it’s widely used programming paradigm.

While OOP is a broad subject, we’ll discuss benefits of using Object Oriented Programming technology. One of the biggest advantage is code re-usability.

What are major advantages of using Object Oriented Programming?

There are four major benefits why we used OOP methodology.

(1) Polymorphism

(2) Inheritance

(3) Code Reusability

(4) Abstraction and Data Encapsulation

Let’s review each of the four major Object Oriented Programming benefits in details. Remember, concept is more important than anything else especially if you have upcoming interviews.

(1)  Polymorphism

In terms of object-oriented programming, Polymorphism refers to a programming language’s ability to allow object processing differently each time depending on their data type or class. It allows to redefine methods for derived classes.

I can give you a quick simple example to better understand this concept. Let’s say you have defined a method to find out area of a shape.  If you have a base class Shape, polymorphism enables you to define different area methods for any number of derived classes, such as circles, rectangles and triangles. In each of this cases you will be passing arguments accordingly and area will be computed upon that. If you’re computing area of circles; argument will be considered as a radius. Whereas arguments passed for rectangles will be their sides to find area.

(2) Inheritance

While using Object-oriented programming, inheritance enables new objects to take on the properties of existing objects. Various different objects often have a certain attributes in common with each other and that’s how they belong to the same class. As an example Car is a generic class and then there are different types of cars, such as economy sedan, SUV and van. The basic attributes are same for cars e.g. they all have wheels, seating capacity, speed, gears, head lights, mirrors etc. However, all of the car class (sedan, SUV, van) have their own features that are more specialized for them.

Object-oriented programming allows classes to inherit commonly used attributes, behaviors and states from other classes. That way they are not need to be defined, declare again. The derived classes are called sub-classes and parents are called super classes. You can extend them and reuse code that is written already. Inheritance is one of the most powerful feature of OOP and that’s why programming languages that support OOP is very popular such as Java, .Net, PHP etc.

 Read More…(on OOP)

Front-end Developer Software Engineer Interview Questions and answers : 10 Commonly asked questions Continue

Front-end interview questions

Book recommendationHTML5 and CSS3 All-in-One For Dummies by Andy Harris. 

This book is far better than any other learning material. It has very basic information that includes both HTML5 and CSS3 with sample code and comprehensive examples. If you’re looking for reading material; this is a great resource.

Q. 6. What can I do to improve my website page rendering time?

Less resource:

Less http requests

Prioritize above the fold code

Load the static content

Q. 7. What tools can I use to troubleshoot any issue on front end that I encounter?

Firebug – which is an add-on used widely in Firefox

Charles proxy – which is a third party tool that can be used on any browser e.g. Chrome, Firefox etc.

Chrome Developer tool – which can be used in it’s own browser such as Chrome or Firefox

Fiddler – Can be used for browser of your choice including Internet Explorer

Q. 8. Can you give examples of HTTP Status code and what do they mean?

When a request is made to your server for a page on your site (for instance, when a user accesses your page in a browser, your server returns an HTTP status code in response to the request.

This status code provides information about the status of the request. This status code gives information about your site and the requested page.

Some common status codes are:

  • 200 - the server successfully returned the page OK
  • 404 - the requested page doesn’t exist
  • 503 - the server is temporarily unavailable
  • 500 – Internal server error
  • 403 – Resource forbidden

Q. 9. What are major browsers and mobile devices environments users use?

Chrome 39

Firefox 34

Internet Explorer 11

Safari 8

Chrome 36

Safari 7

Internet Explorer 8

Firefox 33      2.89%

Internet Explorer 9

Android OS, Apple OS, Blackberry, Windows phone

Q. 10. Why CMS environments such as WordPress, Drupal or Joomla are very popular recently?

CMS provides front-end user interface that allows a user, even with limited expertise, to add, modify and remove content from a Web site without the intervention of a Webmaster.

Below are the points why we should use CMS instead stand-alone websites:

Increase efficiency – Content can be publishing easily and efficiently as editing and revisions do not require visual design or coding knowledge. This allows for fast and efficient updates, saving cost and time.

Extensibility – Most CMSs can extend functionality beyond its default capabilities, typically by purchasing additional plug-ins or modules.

Easy customization: CMS contains built-in plugins, modules CSS and script that allows easy customization through UI.

Quick dynamic page management – CMS allows easy to create, edit, remove and update the dynamic page management.

Search Engine Friendly – CMS provides functionality to built seo friendly URLs.

Cost-effective – Most of the CMS provides open source platform.

Powerful search within site – With powerful CMS search engines new content is indexed automatically so it can be instantly found. Visitors can also use taxonomy applications, sorting lists, saved searches and more to personalize the search experience.

Support community – Most of the CMS has great community, which provides support and quick response for any type of questions.

Standard security – CMS comes with built in standard security, which prevents site from any hacking attack.

Multi-User env: It has the capability to support Multi-user work env. Many users can work at the same time and easy remote website management

 

If you love Questions and Answers on this page; and if you are preparing for an interview, I’d strongly recommend reading HTML5 and CSS3 All-in-one For Dummies book by Andy Harris. I really liked this book and found very helpful preparing for interviews.

Amazon instant Discount LinkHTML5 and CSS3 All-in-One For Dummies by Andy Harris. 
 

Thanks for reading and hope you like the post. If you have any comments, feedback or like compiled information, please encourage us by posting comments below.

tickMotorola Moto G – Global GSM – Unlocked – 8GB (Black) Discount link on Amazon

tickMotorola Moto X – 2nd Generation discount link on Amazon