Tamilnadu State Board New Syllabus Samacheer Kalvi 12th Computer Applications Guide Pdf Chapter 4 Introduction to Hypertext Pre-Processor Text Book Back Questions and Answers, Notes.

## Tamilnadu Samacheer Kalvi 12th Computer Applications Solutions Chapter 4 Introduction to Hypertext Pre-Processor

### 12th Computer Applications Guide Introduction to Hypertext Pre-Processor Text Book Questions and Answers

Part I

Question 1.
What does PHP stand for?
b) Hypertext Preprocessor
c) Pretext Hypertext Processor
b) Hypertext Preprocessor

Question 2.
What does PHP files have a default file extension?
a) .html
b) .xml
c) .php
d) .ph
c) .php

Question 3.
a) <php>
b) < ? php ?>
c) < ? ? >
d) < ?php ? >
b) < ? php ?>

Question 4.
Which of the following must be installed on your computer so as to run PHP script?
b) windows
c) Apache
d) IIS
c) Apache

Question 5.
We can use to ………… comment a single line?
i) /?
ii) //
iii) #
iv) /* */
a) Only (ii)
b) (i), (iii) and (iv)
c) (ii), (iii) and (iv)
d) Both (ii) and (iv)
e) Both (ii) and (iii)
e) Both (ii) and (iii)

Question 6.
Which of the following PHP statement/statements will store 41 in variable num?
(i) $x = 41; (ii)$x = ’41’;
(iii) (i) $x = “41”; a) Both (i) and (ii) b) All of the mentioned, c) Only (iii) d) Only (i) Answer: d) Only (i) Question 7. What will be the output of the following PHP code? <?php$num = 1;
$num1 = 2; print$num . “+‘ $numl ; a) 3 b) 1+2 c) 1.+.2 d) Error Answer: c) 1.+.2 Question 8. 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 9. Which statement will output$x on the screen?
a) echo “\$x”; b) echo “$$x”; c) echo “/x”; d) echo “x; Answer: b) echo “$$x”; Question 10. Which of the below symbols is a newline character? a) \r b) \n c) /n d) /r Answer: a) \r Part II Short Answers Question 1. What are the common usages of PHP? Answer: • It is a 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 red time Web development projects. Question 2. What is a Web server? Answer: • A Web sewer is Software that uses HTTP (Hypertext Transfer Protocol) to serve the files that form Web pages to users • 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, Question 3. What are the types of a scripting language? Answer: 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. Question 4. Differentiate between Client and Server? Answer:  Client Server The client-side environment used to run scripts is usually a browser. The server-side environment that runs a scripting language Is a web server. Does not need server Interaction Requires server interaction. Example: HTML, CSS, JavaScript etc. Example PHP, ASP.net, Ruby on Rails, Python, etc. Question 5. Give few examples of Web Browser? Answer: • Internet Explorer • UC Browser • Opera • Google Chrome and • Mozilla Firefox. Question 6. What is a URL? Answer: • URL is the abbreviation of Uniform Resource Locator • It is the address of a specific Web page or fiie on the Internet, • URL is made up four parts-protocols, hostname, folder name and fiie name, • Example: http://www.googie.com/ Question 7. Is PHP a case sensitive language? Answer: Yes, smaller case & uppercase letters are different in PHP. Examples If you defined a variable in lowercase, then you need to use it in lowercase everywhere In the program. Question 8. How to declare variables in PHP? Answer: • Variable name must always begin with a$ symbol.
• Variable names are case-sensitive.

Question 9.
Define Client-Server Architecture.
The client-server architecture introduces an application sharing mechanism between two different hardware systems over the network (Internet/intranet).

Question 10.
Define Web server.
A Web server is Software that uses HTTP (Hyper-text Transfer Protocol) to serve the files that form
Web pages to users.

Part III

Question 1.
Write the features of server side scripting language.

• Server-side scripting offers greater protection for user privacy
• Some browsers don’t fully support JavaScript, so server-side scripting is essential to run dynamic pages on these browsers.

Question 2.
Write is the purpose of Web servers?

1. Webserver is software which is running in server hardware.
2. It takes the responsibilities for the compilation and execution of server-side scripting languages.
3. After receiving the request from the client machine the Web server tries to compile and interpret the PHP code which is available in remote machine.
4. Next a response will be generated and sent back to the client machine over the network from Webserver.

Question 3.
Differentiate Server side and Client Side Scripting language.

 Basis for comparison Server-side scripting Ciient-side scripting Basic Works in the back end which could not be visible at the client end. Works at the front end and script are visible among the users. Processing Requires server interaction. Does not need interaction with the server. Languages involved PHP, ASP.net, Ruby on Rails, ColdFusion, Python, et­cetera. HTML, CSS, JavaScript, etc. Affect Could effectively customize the web pages and provide dynamic websites. Can reduce the load to the server. Security Relatively secure. Insecure

Question 4.
In how many ways you can embed PHP code in an HTML page?

1. PHP script can be written inside of HTML code and save the file with an extension of .php. The embedded PHP file gets executed in the Webserver, the browser receives only the HTML and other client-side files.
2. Php files can also be embedded with css and js files.
3. Using template engines like Smarty, DWOO, Mustache, Blade we can embed PHP files.

Question 5.
Write short notes on PHP operator.
An operator is a symbol which is used to perform mathematical and logical operations in programming languages.
Different types of the operator in PHP are:

1. Arithmetic operators
2. Assignment operators
3. Comparison operators
4. Increment/Decrement operators
5. Logical operators and
6. String operators

Part IV

Explain In Detail

Question 1.
Explain client-side and server-side scripting language.
Web scripting languages are classified into two types, client-side and server-side scripting language.
Client-side Environment

• The client-side environment used to run scripts is usually a browser.
• The processing takes place on the end-users computer.
• The source code is transferred from the webserver to the user’s computer over the internet and run directly in the browser,
• The scripting language needs to be enabled on the client computer. Sometimes if a user is conscious of security risks they may switch the scripting facility off. .
• When this is the case a message usually pops up to alert the user when the script Is attempting to run.

Server-side Environment

• A server is a computer system that serves as a central repository of data and programs and is shared by clients
• The server-side environment that runs a scripting language is a web server.
• A user’s request is fulfilled by running a script directly on the webserver to generate dynamic HTML pages.
• This HTML is then sent to the client browser.
• It is usually used to provide interactive websites that interface to databases or other data stores on the server.
• This is different from client-side scripting where scripts are run by the viewing web browser, usually in JavaScript.
• The primary advantage to server-side scripting is the ability to highly customize the response based on the user’s requirements, access rights, or queries into data stores.

Question 2.
Discuss in detail Website develop¬ment activities.
The process of development also includes Web content generation, Web page designing, Website security, and so on.
PHP Script:

1. Website or Web page is developed by the programmer using PHP script. Finally, the entire Website codes are moved to the Web server path in a remote server machine.
2. From the client-side, the end-user opens a browser, types the URL of the Website or Webpage, and initiates the request to the remote server machine over the network.
3. After receiving the request from the client machine the Web server tries to compile and interpret the PHP code which is available in a remote machine.
4. Next, a response will be generated and sent back to the client machine over the network from Webserver.
5. Finally, the browser which is installed in the client machine receives the response and displays the output to the user.

Question 3.
Explain the process of Webserver installation.
The following are the steps to install and config¬ure Apache Httpd Web server and PHP module in windows server machine.
Step 1:
Go to the Apache foundation Website and download the Httpd Web server Software.

Step 2:

• After downloading. MSI file from Apache foundation Website, the user launches the. MSI file and clicks next and next button to finish the installation on the server machine.
• The software takes default port number 130 or 130130.
• Once the user finished, the Web server software is installed and configured on the server hardware machine as a service.

Step 3:

https://iocalhost: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 server machine.

Step 5:

• Webserver’s configuration setting file “httpd. conf ” 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.
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.

1. String
2. Integer
3. Float
4. Boolean
5. Array
6. Object
7. NULL
8. Resource
 Data type Explanation Example String The string is a collection of characters within the double or single quotes $x = “Computer Application!”; Integer An integer is a data type which contains non-decimal numbers.$x = 59135; Float Float is a data type which contains decimal numbers, $x = 19.15; Boolean Boolean is a data type which denotes the possible two states, TRUE or FALSE$x = true; $y = false; Array The array is a data type which has multiple values in a single variable.$cars = arrayC’Computer”,”Laptop”, Mobile”); Object It is a data type which contains information about data and function inside the class. $school_obj = new School (); NULL Null Is a special data type which contains s single value; NULL$x = null; Resources The resource is a specific variable, it has a reference to an external resource. Shandle = fopen(“note.txt” “r”); var_dump($handle); Question 5. Explain operators in PHP with examples. Answer: The operator is a symbol that is used to perform mathematical and logical operations in programming languages, Different types of the operator in PHP are: 1. Arithmetic operators, 2. Assignment operators, 3. Comparison operators, 4. Increment/Decrement operators, 5. Logical operators, and 6. String operators, 7. Arithmetic operators The Arithmetic operators in PHP perform genera! arithmetical operations, such as addition, subtraction, multiplication and division etc  Symbol Operator Name Purpose + Addition This operator performs the process of adding numbers – Subtraction This operator performs the process of subtracting numbers * Multiplication This operator performs the process of multiplying numbers / Division This operator performs the process of dividing numbers % Modulus This operator performs the process of finding remainder in division operation of two numbers 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 expression to right side variable.  Assignment Similar to Description x = y x = y This operator sets the left side operant value of expression to right side variable x += y x = x+ y Addition x- = y x = x – y Subtraction x* = y x = x*y Multiplication x/ = y x = x/y Division x % = y x = x % y Modulus Comparison Operators: • Comparison operators perform an action to compare two values. • These values may contain integer or string data types (Numbers or Strings).  Symbol Operator Name Symbol Operator Name == Equal > Greater than === Identical < less than ! = Not equal >= Greater than or equal to <> Not equal <= Less than or equal to !== Not identical 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.  Operator Name Description ++$x Pre-increment Increment $x value by one, then returns$x $x++ Post-increment Returns$x, then increments $x by one —$x Pre-decrement Decrements $x by one, then returns$x $x~ Post-decrement Returns$x, then decrements $x by one Logical Operators: Logical Operators are used to combine conditional statements.  Symbol Operator Name Example Result && And$x && $y True if both$x and $y are true || Or$x || $y True if either$x or $y is true ! Not !$x True if $x is not true xor Xor$x xor $y True if either$x or $y is true, but not both String Operators: Two operators are used to perform string related operations such as Concatenation and Concatenation assignment (Appends).  Operator Name Example Result Concatenation$textl . $text2 Concatenation of$txtl and $txt2 .= Concatenation$textl .= $text2 Appends$txt2 to $txtl ### 12th Computer Applications Guide Introduction to Hypertext Pre-Processor Additional Important Questions and Answers Part A Choose The Correct Answers: Question 1. The variable in PHP begins with a dollar ………… symbol. a) @ b) # c)$
d) %
c) $Question 2. ……………………… Scripting languages was introduced to support Internet online business. (a) Server (b) Client (c) Web (d) Online Answer: (c) Web Question 3. In PHP, a Variable name can never start with a …………. a) alphabet b) number c) both a and b d) either a or b Answer: b) number Question 4. PHP scripting language supports …………. primitive data types. a) 10 b) 11 c) 12 d) 13 Answer: d) 13 Question 5. CSS means (a) combined script style (b) cascading style sheets (c) calculated spreadsheet (d) consecutive script sheets Answer: (b) cascading style sheets Question 6. PHP was invented in …………. a) 1992 b) 1993 c) 1994 d) 1995 Answer: c) 1994 Question 7. PHP can embed with …………. a) HTML b) CSS c) Javascript d) All of the above Answer: d) All of the above Question 8. JSP means (a) Joint Server photographs (b) Java Server pages (c) Java Script program (d) Active script pages Answer: (b) Java Server pages Question 9. PHP also creates ………… Webpages in thereat time Web development projects, a) Dynamic b) interactive c) both a and b d) None of these Answer: c) both a and b Question 10. 78.9 % of Website are developed by ………… scripting language. a) ASP b) JSP c) VbScript d) PHP Answer: d) PHP Question 11. Which of the following is an assignment operator? a) = b) = = c) = = = d) ! = = Answer: a) = Question 12. CGI stands for (a) Common Gateway Interface (b) Call Gateway Interrupt (c) Cold Gateway Interface (d) Client Gateway Interface Answer: (a) Common Gateway Interface Question 13. Which of the following is a non-identical operator? a) = b) = = c) = = = d) ! = = Answer: d) ! = = Question 14. Which of the following is an equal operator? a) = b) = = c) = = = d) ! = = Answer: b) = = Question 15. Find the Correct one (i) PHP is an open source (ii) Apache tom cat supports PHP (iii) MS-ITS Supports PHP (a) Only (i) is true (b) (ii), (iii) – True (c) (i), (ii) – True (d) (i), (ii), (iii) – True Answer: (d) (i), (ii), (iii) – True Question 16. ………….is a collection of characters within the double or single quotes a) String b) Boolean c) Integer d) Float Answer: a) String Question 17. Boolean is a data type which denotes ………… a) Integer numbers b) Decimal point numbers c) True or False state d) Array Answer: c) True or False state Question 18. …………is a data type which has multiple values in a single variable. a) Integer numbers b) Decimal point numbers c) True or False state d) Array Answer: d) Array Question 19. How many client-server architecture models there? (a) 2 (b) 3 (c) 4 (d) 5 Answer: (b) 3 Question 20. ………… is a data type which contains information about data and function inside the class. a) Integer numbers b) Array c) True or False state d) Array Answer: d) Array Abbreviations: • ASP – Active Server Page • JSP – Java Server page • CSS – CascadingStyle Sheets • PHP – Hypertext Pre-processor • WWW – World Wide Web • CGI – Common Gatewaylnterface • OOPs – Object-Oriented Programming Choose the incorrect sentences: 1. a) 25% of Websites are developed by PHP scripting language. b) PHP is a Case Sensitive c) PHP is a Simplicity Program language d) PHP is an Open Source Answer: b) PHP is a Case Sensitive 2. a) PHP is an Efficiency Program language b) PHP is a Platform dependent Program language c) PHP is a Security Program language d) PHP is a Flexibility Program language Answer: b) PHP ¡s a Platform dependent Program language 3. a) PHP is a Real-Time Access Monitoring Program language b) PHP Script should with “<Tag name>” and closes with “</Tagname>’ c) PHP files have a default file extension is .php. d) PHP stands for Personal Home Page Answer: b) PHP Script should with “<Tag name>” and closes with “</Tagname>’ 4. a) PHP can be executed via an interpreter which is installed in the Web servers or CGI. b) PHP is an open-source community development initiation. c) Website or Web page is developed by the programmer using PHP script only. d) Three types of PHP Syntax are available. Answer: c) Website or Web page is developed by the programmer using PHP script only. 5. a) PHP script can be written inside of HTML code and save the file with an extension of .php. b) The embedded PHP file gets executed in the Web server. c) The browser receives only the HTML and other client-side files. d) The raw PHP code ¡s visible ¡n browser which means that Compiler Answer: d) The raw PHP code ¡s visible ¡n browser which means that Compiler Find the odd one on the following 1. a) Python b) C++ c) PHP d) C Answer: a) Python 2. a) Microsoft SQL Server b) Apache c) Tomcat d) Microsoft IIS Answer: a) Microsoft SQL Server 3. a) Default Syntax b) Short open Tags c) HTML Script embed Tags d) Open Source Answer: d) Open Source 4. a) Array b) Object c) Structure d) NULL Answer: d) NULL 5. a) Integer b) Octal c) Boolean d) Float Answer: b) Octal 6. a) String b) Binary c) Resource d) Boolean Answer: b) Binary 7. a) Arithmetic operators b) Assignment operators c) Comparison operators d) Conditional Operator Answer: d) Conditional Operator 8. a) Increment operators b) Decrement operators c) Bitwise operator d) Logical operators Answer: c) Bitwise operator 9. a) Ternary Operator b) String operators. c) Arithmetic Operator d) Decrement Operator Answer: a) Ternary Operator 10. a) Average b) Multiplication c) Addition d) Modulus Answer: a) Average 11. a) XOR b) XNOR c) AND d) OR Answer: b) XNOR 12. a) = b) = = c) = = = d) != Answer: a) = 13. a) ! = b) != – c) < > d)() Answer: d)() 14. a) && b) || c) !! d) ! Answer: c) !! 15. a) + b) – c) x d) / Answer: c) x Match the following: 1. String – Structured Information 2. Integer – Data and Function 3. Float – Database Connection 4. Boolean – Single value 5. Array – True/False 6. Object – Multiple values 7. NULL – Decimal numbers 8. Resource – Non- Decimal numbers 9. Var_dump() – Remainder 10. Modulus – Collection of characters Answer: 1. Collection of characters 2. Decimal numbers 3. No-Decimal number 4. True/False 5. Multiple values 6. Data and functions 7. Single value 8. Database Connection 9. Structured information 10. Remainder Assertion and Reason Question 1. Assertion (A): The Web-based Internet application ensures the success of critical business in real-world competitions. Reason (R): The legacy programming languages meet the expectations of the latest Internet concepts and executions. a) Both (A) and (R) are correct and (R) is the correct explanation of (A) b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A) c) (A) is true and (R) is false d) (A) is false and (R) is true Answer: b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A) Question 2. Assertion (A): The Web-based Internet application ensures the success of critical business in real-world competitions. Reason (R): The legacy programming languages meet the expectations of the latest Internet concepts and executions. a) Both (A) and (R) are correct and (R) is the correct explanation of (A) b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A) c) (A) is true and (R) is false d) (A) is false and (R) is true Answer: c) (A) is true and (R) is false Question 3. Assertion (A): PHP is a competitor and alternative for other server-side scripting languages like HTML and CSS. Reason (R): Recent statistics of server-side scripting language usage depict that 78.9 % of Websites are developed by PHP scripting language. a) Both (A) and (R) are correct and (R) is the correct explanation of (A) b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A) c) (A) is true and (R) is false d) (A) is false and (R) is true Answer: d) (A) is false and (R) is true Question 4. Assertion (A): in the evolution of network architecture, various critical networks related problems are getting resolved by the client-server architecture model. Reason (R): The client-server architecture introduces an application sharing mechanism between two different hardware systems over the network (Internet/intranet). a) Both (A) and (R) are correct and (R) is the correct explanation of (A) b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A) c) (A) is true and (R) is false d) (A) is false and (R) is true Answer: b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A) Question 5. Assertion (A): HTTP means HyperText Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web Reason (R); This protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands a) Both (A) and (R) are correct and (R) is the correct explanation of (A) b) Both (A) and (R) are correct, but (R) is not the correct explanation of (A) c) (A) is true and (R) is false d) (A) is false and (R) is true Answer: a) Both (A) and (R) are correct and (R) is the correct explanation of (A) Part B Short Answers Question 1. Define Web browser? Answer: • Web Browser: A Web browser (commonly referred to as a browser) is a software application for accessing information on the World Wide Web. • Each individual Web page, image, and video is identified by a distinct URL, enabling browsers to retrieve and display them on the user’s device. Question 2. Classification of Client-Server Architecture Model. Answer: Client-server architecture is classified into three types, as follows • Single Tier Architecture • Two-Tier Architecture • N/Multi/Three tire architecture. Question 3. Write a note on HTTP? Answer: HTTP: 1. HTTP HyperText Transfer Protocol. 2. HTTP is the underlying protocol used by the World Wide Web. 3. This protocol defines how messages are formatted and transmitted. 4. The actions were taken by web servers and browsers in response to various commands. Question 4. Write a note on the var-dump function? Answer: Var_dump: 1. The var_dump( ) function is used to dump information about a variable. 2. This function displays structured information such as the type and value of the given variable. 3. Arrays and objects are explored recursively with values intended to show structure. Part C Explain in brief answer Question 1. Explain important features of PHP? Answer: 1. PHP is an Open Source 2. PHP is a Case Sensitive 3. PHP is a Simplicity Program language 4. PHP is an Efficiency Program language 5. PHP is a Platform Independent Program language 6. PHP is a Security Program language 7. PHP is a Flexibility Program language 8. PHP is a Real-Time Access Monitoring Program language Question 2. Write a short note on Var_dump() function with Example. Answer: • The var_dump() function is used to dump information about a variable. • This function displays structured information such as the type and value of the given variable. • Arrays and objects are explored recursively with values intended to show structure. Example; <?php$x = “COMPUTER APPLICATION!”;
$x = null; var_dump($x);
?>
OUTPUT; NULL

Question 3.
What do you mean by Resources?

• The resource is a specific variable.
• It has a reference to an external resource.
• These variables hold specific handlers to handle files and database connections irrespective PHP program.

Part D

Explain in Detail

Question 1.
What are the three types of syntax in PHP? Explain them in detail.