Samacheer Kalvi 12th Computer Applications Solutions Chapter 4 Introduction to Hypertext Pre-Processor
Students can Download Computer Applications Chapter 4 Introduction to Hypertext Pre-Processor Questions and Answers, Notes Pdf, Samacheer Kalvi 12th Computer Applications Book Solutions Guide Pdf helps you to revise the complete Tamilnadu State Board New Syllabus and score more marks in your examinations.
Tamilnadu Samacheer Kalvi 12th Computer Applications Solutions Chapter 4 Introduction to Hypertext Pre-Processor
Samacheer Kalvi 12th Computer Applications Introduction to Hypertext Pre-Processor Text Book Back Questions and Answers
PART – I
I. Choose The Correct Answer
Question 1.
What does PHP stand for?
(a) Personal Home Page
(b) Hypertext Preprocessor
(c) Pretext Hypertext Processor
(d) Pre-processor Home Page
Answer:
(b) Hypertext Preprocessor
Question 2.
What does PHP files have a default file extension?
(a) html
(b) xml
(c) .php
(d) ph
Answer:
(c) .php
Question 3.
A PHP script should start with ……………………. and end with …………………….
(a) <php>
(b) < ? php ?>
(c) < ? ? >
(d) < ?php ? >
Answer:
(d) < ?php ? >
Question 4.
Which of the following must be installed on your computer so as to mn PHP script?
(a) Adobe
(b) windows
(c) Apache
(d) IIS
Answer:
(c) Apache
Question 5.
We can use ………………….. to comment a single line?
(i) /?
(ii) 11
(iii) #
(iv) /* */
(a) Only (ii)
(b) (i), (iii) and (iv)
(c) (ii), (iii) and (iv)
(d) Both (ii) and (iv)
Answer:
(c) (ii), (iii) and (iv)
Question 6.
What will be the output of the following PHP code?
Answer:
< ?php
$num =1;
$num1 =2;
print $num . $num1 ;
?>
(a) 3
(b) 1+2
(c) 1.+.2
(d) Error
Answer:
(a) 3
Question 7.
Which of the following PHP statements Will output Hello World on the screen?
(a) echo (“Hello World”)
(b) print (“Hello World”)
(c) printf (“Hello World”)
(d) sprintf (“Hello World”)
Answer:
(a) echo (“Hello World”)
Question 8.
Which statement will output $x on the screen?
(a) echo “\$x”
(b) echo “$$x”
(c) echo “/$x”
(d) echo “$x
Answer:
(a) echo “\$x”
Question 9.
Which of the below symbols is a newline character?
(a) \r
(b) \n
(c) /n
(d) /r
Answer:
(b) \n
PART – II
II. Short Answers
Question 1.
What are the common usages of PHP?
Answer:
- PHP can be used on all major operating systems.
- PHP has also support for most of the web servers today. This includes Apache, IIS, and many others.
- The main advantage of creating your own PHP GUI(Graphical User Interface)
- PHP can interact with MySQL databases
- PHP can perform all types of calculations and It can collect user information.
Question 2.
What is Webserver?
Answer:
Web server software is available as the open-source or licensed version in the market. A Web server is a Software that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users.
Question 3.
What are the types of a scripting language?
Answer:
Web scripting languages are classified into two types,
- Client-side scripting language
- Server-side scripting language
Question 4.
Difference between Client and Server?
Answer:
The server is a high-performance hardware machine it could run more than one application concurrently. The client is a separate hardware machine which is connected with the server in the network (Internet/intranet). It could send the request and receive the response from the server hardware. The Server and client are also called a service provider and service requester respectively.
Question 5.
Give few examples of Web Browser?
Answer:
- Google Chrome v Mozilla Firefox
- Opera
- Safari
- Internet Explorer
- UC Browser
- Netscape Navigator etc.
Question 6.
What is a URL?
Answer:
URL: Uniform Resource Locator, the address of a specific Web page or file on the Internet. Eg. http://example.com
Question 7.
Is PHP a case sensitive language?
Answer:
Yes, PHP is case sensitive in regards to function only but it should not include the function(s) which is defined by the user.
Question 8.
How to declare variables in PHP?
Answer:
The variable in PHP begins with a dollar ($) symbol and the assignment activity implemented using “=” operator, finally the statement ends with a semicolon The semicolon indicates the end of the statement.
$a=5; $b=T0;
Question 9.
Define Client-Server Architecture?
Answer:
- Client-server architecture is a network architecture in which each computer or process on the network is either a client or a server.
- Servers are powerful computers or processes dedicated to managing disk drives printers, or network traffic
- Clients are PCs or workstations on which users run applications.
Question 10.
Define Webserver?
Answer:
Web server software is available as the open-source or licensed version in the market.
A Web server is a Software that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users.
PART – III
III. Explain in Brief Answer
Question 1.
Write the features of a server-side scripting language?
Answer:
- The server is a high-performance hardware machine it could run more than one application concurrently.
- Most of the server side scripting languages are working on anyone the client-server architecture model.
- The webserver is software which is running in server hardware.
- It takes the responsibilities for the compilation and execution of server-side scripting languages.
Question 2.
Write is the purpose of Web servers?
Answer:
- A web server (or Web server) is server software or hardware dedicated to running said software, that can satisfy World Wide Web client requests.
- A web server can, in general, contain one or more websites.
- A web server processes incoming network requests over HTTP and several other related protocols.
Question 3.
Differentiate Server-side and Client-Side Scripting language?
Answer:
Server Side Scripting Language:
- The server is a high-performance hardware machine. It could run more than one application concurrently.
- The server is the service provider.
- Ex. Php. Asp.net, Python, Cold Fusion
- It is relatively secure
Client-Side Scripting Language:
- The client is a separate hardware machine which is connected with a server in the network.
- The client is the service requester
- html, css, Javascript
- Insecure
Question 4.
In how many ways you can embed PHP code in an HTML page?
Answer:
- There are two ways to use HTML on your PHP page.
- The first way is to put the HTML outside of your PHP tags. You can even put it in the middle if you close arid reopen the tags.
- The second way to use HTML with PHP is by using PRINT or ECHO. By using this method you can include the HTML inside of the PHP tags.
Question 5.
Write short notes on PHP operator?
Answer:
Operator is a symbol which is used to perform mathematical and logical operations in the programming languages. Different types of operator in PHP are:
- Arithmetic operators
- Assignment operators
- Comparison operators
- Increment/Decrement operators,
- Logical operators, and
- String operators.
PART – IV
IV. Explain in detail
Question 1.
Explain client-side and server-side scripting language?
Answer:
- PHP (Hypertext Pre-processor) is a one of the important server-side Web and general-purpose scripting language invented by Rasmus Lerdorf in 1994.
- It is very simple and lightweight open-source server-side scripting language.
- It can easily embed with HTML and other client-side scripting languages like CSS (Cascading Style Sheets) and Javascript.
- It also creates dynamic and interactive Webpages in the real-time Web development projects
- Web scripting languages are classified into two types, client-side and server-side scripting language.
- PHP is completely different from Client-side scripting language like Javascript.
- The PHP code entirely executes on Webserver which is installed in the remote machine and it is generating HTML code that is sent to the user.
- The user receives the HTML code and sees the Website contents via an Internet browser in their computer or laptop.
- PHP also supports OOPs (Object Oriented Programming) concepts. It is applicable to implement all OOPs features such as class, object and inheritance etc. The action is shown in Figure.
Question 2.
Discuss in detail Website development activities?
Answer:
Web development concept describes in detail Website development and hosting through the network (Internet/Intranet).
The process of development also includes
- Web content generation
- Web page designing
- Website security and so on.
Website Development Life Cycle
1. Information Gathering
- Set goals for the website
- Define website’s target audience
2. Planning
- Create a sitemap sketch
- Create a wireframe/mockup
- Select technology stack
3. Design
- Create colorful page layouts
- Review the layouts
- Get client’s feedback on the layouts
- Change the layout when required
4. Content writing and assembly
- Create new content
- Get content ready for migration
5. Coding
- Build and deploy a website
- Add special features and website
- Testing, Review and Launch
6. Test the create website
- Upload the website to server
- Final test and launch
7. Maintenance and Regular updating
- Add report system
- Fix bugs
- Keep website up-to-day
Question 3.
Explain the process of Webserver installation?
Answer:
Web server software that runs on server hardware, governs the server-side scripting compilation into an intermediate bytecode that is then interpreted by the runtime engine.
Web server software is available as the open-source or licensed version in the market. Recent statistics of Web server usage depict that more than 130% of Websites are running under open-source Web servers such as Tomcat Apache, Nginx etc. The following are the steps to install and configure Apache Httpd Webserver and PHP module in windows server machine.
Step 1:
Go to the Apache foundation Website and download the Httpd Webserver Software.
https://httpd.apache.org/download.cgi
Step 2:
After downloading .MSI file from Apache foundation Website, user launches the. MSI file and clicks next and next button to finish the installation on server machine. The software takes default port number 130 or 130130. Once the user finished, the Web server software is installed and configured on server hardware machine as a service.
Step 3:
To test the installation of Apache Httpd Webserver, enter the following URL from your Web browser which is installed in your client machine.
https://localhost:130/ or https://localhost: 130130 The output page that says “Its works”
Step 4:
Administrator user can start, stop and restart the Web server service at any time via the Windows Control panel. Once the services stops, the client machine will not receive the response message from the server machine.
Step 5:
Webserver’s configuration setting “httpd.conf” file is located in the conf directory under the apache installation directory. Edit this file and enable the PHP module to run PHP scripting language.
Question 4.
Discuss in detail PHP data types?
Answer:
PHP Data type:
PHP scripting language supports 13 primitive data types. Data Types plays important role in all programming languages to classify the data according to the logic. PHP supports the following data types.
- String
- Integer
- Float
- Boolean
- Array
- Object
- NULL
- Resource
1. String:
String is a collection of characters within the double or single quotes like
“Computer Application” or ‘Computer Application’. Space is also considered as a character.
Example:
$x = “Computer Application!”;
2. Integer:
Integer is a data type which contains non-decimal numbers.
Example:
$x = 59135;
*
The var_dump( ) system define function, returns structured information (type and value) about variables in PHP.
3. Float:
Float is a data type which contains decimal numbers.
Example:
$x = 19.15;
4. Boolean:
Boolean is a data type which denotes the possible two states, TRUE or FALSE
Example:
$x = true;
$y = false;
5. Array:
The array is a data type which has multiple values in a single variable.
Example:
Scars = array(“Computer”,“Laptop”,“Mobile”);
OUTPUT:
array(3) {[0]=> string(5) “Computer” [1]=>
string(3) “Laptop “ [2]=> string(6)” Mobile”}
Var_dump:
The var_dump( ) function is used to dump information about a variable. This function displays structured information such as type and value of the given variable. Arrays and objects are explored recursively with values indented to show structure.
6. Object:
PHP object is a data type which contains information about data and function inside-the class.
<?php
class School {
function marks( ) {
$this->sec = “A”;
}
}
// create an object
$schoolobj = new School ( );
?>
OUTPUT
NULL
7. NULL:
Null is a special data type which contains a single,value: NULL
<?php $x = null;
?>
OUTPUT:
NULL
8. Resources:
Resource is a specific variable, it has a reference to an external resource. These variables hold specific handlers to handle files and database connections in respective PHP program.
<?php
// Open a file for reading
Shandle = fopen(“note.txt”, “r”);
var_dump($handle);
echo “<br>”;
// Connect to MySQL database server with
default setting
Slink = mysql_connect(“localhost”, “root”, “”);
var_dump($link);
?>
Question 5.
Explain operators in PHP with examples?
Answer:
Operators in PHP:
The operator is a symbol which is used to perform mathematical and logical operations in programming languages. Different types of the operator in PHP are:
- Arithmetic operators
- Assignment operators
- Comparison operators
- Increment/Decrement operators
- Logical operators, and
- String operators.
1. Arithmetic operators:
The arithmetic operators in PHP perform general arithmetical operations, such as addition, subtraction, multiplication and division etc.
2. Assignment Operators:
Assignment operators are performed with numeric values to store a value to a variable. The default assignment operator is “=”. This operator sets the left side operant value of the expression to the right side variable.
3. Comparison Operators:
Comparison operators perform an action to compare two values. These values may contain integer or string data types (Numbers or Strings).
4. Increment and Decrement Operators:
Increment and decrement operators are used to perform the task of increasing or decreasing the variable’s value. This operator is mostly used during iterations in the program logics.
5. Logical Operators:
Logical Operators are used to combining conditional statements.
6. String Operators:
Two operators are used to perform string related operations such as Concatenation and Concatenation assignment (Appends).