Saturday, July 30, 2016

Project Documentation - Reason Behind Choosing C++

Back

The traditional methodology(Function-Oriented Programming), object-oriented programming emphasises on the data rather than the algorithm.In OOP, data is compartment or capsule is called an object.
In the OOP approach, the problem is divided into objects, whereas in function-oriented programming the problem is divided into functions. Although, both approaches adopt the same philosophy divide and conquer, OOP conquers a bigger region, while function-oriented programming is content with conquering a smaller region. Object-Oriented Programming contains function-oriented programming and so OOP can be referred to as the super set of function-oriented programming and hence, it can be concluded that OOP has an edge over function-oriented programming.
Some of the most prominent features of C++ are classes, operator and function overloading, free store management, constant types, references, inline and friend function, inheritance, virtual functions, streams for console and file manipulations, templates and exception handling.

Advantages:

Information hiding and data abstraction increase reliability and help decouple the procedural and representational specification from its implementation.
Dynamic binding increase flexibility.
Inheritance coupled with dynamic binding enhances the re-usability of code, thus increasing the productivity of a programmer. Code reuse is possible in conventional language as well, but object-oriented language greatly enhances the possibility of reuse.
Object-Orientation provides many other advanges in the production and maintenance of software; Shorter development time, high degree of code sharing and malleability.  

Saturday, July 23, 2016

Interview Questions for PHP - 4 - Answers

Back - Interview Questions for PHP - 4

Q1. Ans - The output is displayed directly to the browser.

Q2. Ans - If you want to create a table, you can run the CREATE TABLE statement as shown in the following sample script:

<?php
include "mysql_connection.php";

$sql = "CREATE TABLE astore ("
. " id INTEGER NOT NULL"
. ", url VARCHAR(80) NOT NULL"
. ", notes VARCHAR(1024)"
. ", counts INTEGER"
. ", time TIMESTAMP DEFAULT sysdate()"
. ")";
if (mysql_query($sql, $con)) {
print("Table Astore created.\n");
} else {
print("Table creation failed.\n");
}

mysql_close($con);
?>

Remember that mysql_query() returns TRUE/FALSE on CREATE statements. If you run this script, you will get something like this:
Table Astore created.

Q3. Ans - The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. The major difference between include() and require() is that in failure include() produces a warning message whereas require() produces a fatal errors.

Q4. Ans - string urlencode(str) - Returns the URL encoded version of the input string. String values to be used in URL query string need to be URL encoded. In the URL encoded version:

Alphanumeric characters are maintained as is.
Space characters are converted to "+" characters.
Other non-alphanumeric characters are converted "%" followed by two hex digits representing the converted character.

string urldecode(str) - Returns the original string of the input URL encoded string.

For example:

$discount ="10.00%";
$url = "http://domain.com/submit.php?disc=".urlencode($discount);
echo $url;

You will get "http://domain.com/submit.php?disc=10%2E00%25".

Q5. Ans - Once the Web server received the uploaded file, it will call the PHP script specified in the form action attribute to process them. This receiving PHP script can get the uploaded file information through the predefined array called $_FILES. Uploaded file information is organized in $_FILES as a two-dimensional array as:
$_FILES[$fieldName]['name'] - The Original file name on the browser system.
$_FILES[$fieldName]['type'] - The file type determined by the browser.
$_FILES[$fieldName]['size'] - The Number of bytes of the file content.
$_FILES[$fieldName]['tmp_name'] - The temporary filename of the file in which the uploaded file was stored on the server.
$_FILES[$fieldName]['error'] - The error code associated with this file upload.

The $fieldName is the name used in the <INPUT TYPE=FILE, NAME=fieldName>.

Q6. Ans - MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array.

Q7. Ans - Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program.
Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

Q8. Ans - PHP Interpreter treats numbers beginning with 0 as octal.

Q9. Ans - Total 5 types of tables we can create
1. MyISAM
2. Heap
3. Merge
4. INNO DB
5. ISAM
MyISAM is the default storage engine as of MySQL 3.23. When you fire the above create query MySQL will create a MyISAM table.

Q10. Ans - define() directive, like define ("MYCONSTANT", 100).



Tuesday, July 19, 2016

Interview Questions for PHP - 4

Q1. What does a special set of tags do in PHP?

Q2. How to create table in mysql?

Q3.What are the differences between require and include, include_once?

Q4. what is meant by urlencode and urldecode?

Q5. How to get the uploaded file information  in the receiving script?

Q6. What is the difference between mysql fetch object and mysql fetch array?

Q7. How can I execute script using command line?

Q8. I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what's the problem?

Q9. What are the different tables present in mysql? which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2), ename varchar(10))?

Q10. How do you define a Constant?

Wait for Answers .......Till Next Post.....Interview questions' answers. 

Interview Questions for PHP - 4 - Answers

Free Download PHP Interview Questions and Answers