Official Kerala Board Solutions for Class 12 Computer Science: Chapter 10 Server Side Scripting Using PHP
Access comprehensive textbook solutions for Chapter 10 Server Side Scripting Using PHP using the official curriculum guides for Class 12 Computer Science. Designed to align with the 2026-27 Kerala Board standards, these detailed answers help students reinforce core academic concepts.
Chapter-wise Solutions for Computer Science: Chapter 10 Server Side Scripting Using PHP
View or download the dedicated Chapter 10 Server Side Scripting Using PHP solution resource below. Engaging with these textbook answers under focused study conditions ensures continuous academic progress and mastery of the 2026-27 curriculum for Computer Science.
One Mark Questions and Answers
Question 1: PHP files have a default file extension of ______.
(a) .html
(b) .xml
(c) .php
(d) .ph
Answer:
(c) .php
Exam Tips:
a) A PHP file must be saved with the .php extension in the web server's root folder (for example, htdocs) so that the server runs it through the PHP interpreter.
Question 2: A PHP script should start with ______.
(a) <php>
(b) <?php?>
(c) <?php
(d) <php?>
Answer:
(c) <?php
Exam Tips:
a) A PHP block opens with <?php and closes with ?>; write both tags whenever you write PHP code in the exam.
Question 3: We can use ______ to write multi-line comments.
(a) /?
(b) //
(c) #
(d) /* */
Answer:
(d) /* */
Exam Tips:
a) // and # are used for single-line comments, while /* ... */ can span many lines.
Question 4: Which of the following PHP statements will store 111 in the variable num?
i) int$num = 111;
ii) intnum = 111;
iii) $num = 111;
iv) 111 = $num;
(a) Both i) and ii)
(b) All of the mentioned
(c) Only iii)
(d) Only i)
Answer:
(c) Only iii)
Exam Tips:
a) PHP variables start with a $ sign and are not declared with a data type; the type is decided by the value assigned.
b) The variable must be on the left side of the assignment operator.
Question 5: What will be the output of the following PHP code?
<?php
$num = 1;
$num1 = 2;
print $num . "+" . $num1;
?>
(a) 3
(b) 1+2
(c) 1.+.2
(d) Error
Answer:
(b) 1+2
Exam Tips:
a) The dot (.) is the string concatenation operator in PHP, so the values are joined as text and not added.
Question 6: Which of the following PHP statements will output Hello World on the screen?
i) echo ("Hello World");
ii) print ("Hello World");
iii) cout("Hello World");
iv) sprintf ("Hello World");
(a) i) and ii)
(b) i), ii) and iii)
(c) All of the mentioned
(d) i), ii) and iv)
Answer:
(a) i) and ii)
Exam Tips:
a) cout belongs to C++, and sprintf() only returns a formatted string without printing it; echo and print are the PHP output statements.
Question 7: What will be the output of the following PHP code?
<?php
$total = 25;
$more = 10;
$total = $total + $more;
echo "$total";
?>
(a) Error
(b) 35 students
(c) 35
(d) 25 students
Answer:
(c) 35
Exam Tips:
a) Inside double quotes, a variable is replaced by its value, so "$total" prints 35.
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";
Exam Tips:
a) The backslash is an escape character; \$ prints a literal dollar sign instead of the value of the variable.
Question 9: What will be the output of the following PHP code?
<?php
$a = "clue";
$a .= "get";
echo "$a";
?>
(a) get
(b) true
(c) false
(d) clueget
Answer:
(d) clueget
Exam Tips:
a) The .= operator appends the right-hand string to the existing value; a plain = would replace it and print only "get".
Question 10: PHP's numerically indexed arrays begin with position ______.
(a) 1
(b) 2
(c) 0
(d) -1
Answer:
(c) 0
Exam Tips:
a) As in C++, the first element of an indexed array is at index 0.
Question 11: What will be the output of the following PHP code?
<?php
echo $x-- != ++$x;
?>
(a) 1
(b) 0
(c) error
(d) no output
Answer:
(a) 1
$x is not defined, so it is NULL. The post-decrement $x-- gives NULL (decrementing NULL has no effect). Then ++$x changes NULL to 1. Since NULL != 1 is true, echo prints 1.
Exam Tips:
a) Remember that a post-decrement uses the old value first, and that incrementing NULL gives 1 while decrementing NULL leaves it NULL.
b) echo prints true as 1 and false as an empty string.
Question 12: List the superglobals used in PHP.
Answer:
The superglobals used in PHP include $_REQUEST, $_POST, $_GET and $_COOKIE.
Exam Tips:
a) Superglobals are built-in arrays that are available everywhere in a script; write them with the $_ prefix and in capital letters.
Two Mark Questions and Answers
Question 13: Name the PHP functions used
1. to find the length of a string
2. to compare two strings
Answer:
1. strlen()
2. strcmp()
Exam Tips:
a) strcmp() returns 0 when the two strings are equal; mentioning this adds value to the answer.
Question 14: What is the main difference between JavaScript and PHP?
Answer:
JavaScript is a client-side scripting language, which runs in the browser, whereas PHP is a server-side scripting language, which runs on the web server.
Exam Tips:
a) State where each one runs (browser versus server); that is the key point of the difference.
Question 15: What will be the output of the following PHP code?
<?php
$a = 10;
echo ++$a;
echo $a++;
echo $a;
echo ++$a;
?>
(a) 11111213
(b) 11121213
(c) 11111212
(d) 11111112
Answer:
(a) 11111213
It works as follows:
$a = 10;
echo ++$a; → pre-increment first adds 1 to 10 and then prints 11.
echo $a++; → post-increment first prints 11 and then adds 1, so $a = 12.
echo $a; → prints 12.
echo ++$a; → pre-increment first adds 1 to 12 and then prints 13.
Since echo prints without spaces, the output is 11111213.
Exam Tips:
a) Pre-increment (++$a) changes the value before use; post-increment ($a++) uses the value first and changes it afterwards.
b) Trace the value of $a line by line, as shown, to avoid mistakes.
Question 16: What will be the output of the following PHP code?
<?php
$x = "test";
$y = "this";
$z = "also";
$x .= $y .= $z;
echo $x;
echo $y;
?>
(a) testthisthisalso
(b) testthis
(c) testthisalsothisalso
(d) error at line 4
Answer:
(c) testthisalsothisalso
The assignment works from right to left. First $y .= $z makes $y = "thisalso". Then $x .= $y makes $x = "testthisalso". Printing $x and then $y gives testthisalsothisalso.
Exam Tips:
a) Assignment operators are evaluated from right to left, so work out the rightmost .= first.
Question 17: What will be the output of the following PHP code?
<?php
$y = 2;
if ($y-- == ++$y)
{
echo $y;
}
?>
(a) 2
(b) 1
(c) 3
(d) no output
Answer:
(a) 2
It works as follows. Initially $y = 2.
On the left side of the condition, $y-- first uses the value of $y, so the left side becomes 2; then $y is decremented to 1.
On the right side, ++$y first increments $y, so $y = 2 and the right side becomes 2.
Since both sides are equal, the condition $y-- == ++$y is true, so the value of $y, that is 2, is printed.
Exam Tips:
a) Evaluate the left operand completely (including the decrement) before moving to the right operand.
b) Write the value of $y after each step to justify the answer.
Three Mark Questions and Answers
Question 18: A special type of array which is not supported by C++ is used in PHP. Describe the features of that array with an example.
Answer:
Associative arrays
Arrays that use named keys (string indices) instead of numeric positions are called associative arrays.
Syntax: $variable_name = array(key1 => value1, key2 => value2, ...);
Example:
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>We are learning PHP</title>
</head>
<body bgcolor="cyan">
<?php
$course = array("Computer Science" => "05", "Commerce" => "39", "Science" => "01");
echo "The code of Computer Science is " . $course["Computer Science"];
?>
</body>
</html>
Output: The code of Computer Science is 05
Exam Tips:
a) Use the => operator to pair each key with its value; this is the main feature examiners look for.
b) Show how an element is accessed using its key, such as $course["Computer Science"].
Question 19: Compare the echo and print statements used in PHP.
Answer:
Both echo and print are output statements used to display all types of data. The differences are:
1. echo can display multiple outputs separated by commas, while print can display only one output.
2. Parentheses are optional for both. With echo, parentheses can be used only when there is a single argument.
3. print returns a value (always 1), so it can be used in an expression, whereas echo does not return any value.
Examples:
echo "first output", "second output";
echo ("only one output");
print "only one output";
print ("only one output");
Example program:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>This is a php page</title>
</head>
<body>
<?php
echo "This is first output", " This is second output<br>";
print "Only support single output";
?>
</body>
</html>
Exam Tips:
a) Present the comparison point by point: number of outputs, return value, and use of parentheses.
b) Give one short code example for each statement.
Question 20: List the main differences between the GET and POST methods of form submission.
Answer:
| GET method | POST method |
|---|---|
| 1. Faster | 1. Slower |
| 2. Used to send a small volume of data | 2. Used to send a large volume of data |
| 3. Up to about 2000 characters | 3. No limit |
| 4. Less secure | 4. More secure |
| 5. Data is visible (in the URL) during submission | 5. Data is not visible during submission |
| 6. The page link can be bookmarked | 6. The page link can never be bookmarked |
Exam Tips:
a) Write the differences as a two-column table with matching points in each row.
b) Security and visibility of data are the most important points; mention that GET data appears in the URL.
Five Mark Questions and Answers
Question 21: What are the additional steps involved in running PHP on your computer?
Answer:
A. Setting up the development environment
Step 1: Install a PHP-compatible web server (for example, Abyss Web Server for Windows).
Step 2: Install the PHP interpreter.
After installing the web server, type http://localhost in the address bar of the browser. The web server's default welcome page will appear, showing that the server is working.
B. Writing and running the script
Open a text editor such as Notepad and type the code. PHP code should begin with <?php and end with ?>. Save the file in the root directory of the web server with the extension .php.
Step 1: Open Notepad, type the following code and save it as first.php in C:\Abyss Web Server\htdocs.
<?php
echo "My first PHP web page";
?>
Step 2: Start the web server if it is off.
Step 3: Type http://localhost/first.php in the address bar of the browser. The output "My first PHP web page" will be displayed.
Exam Tips:
a) Divide the answer into two parts: setting up the environment and writing/running the script.
b) Mention that the file must be saved in the server's root folder (htdocs) with the .php extension.
c) Show the URL http://localhost/first.php, since the file must be opened through the server and not directly from the disk.
Free study material for Computer Science
Computer Science Class 12 Curriculum Solutions: Chapter 10 Server Side Scripting Using PHP
Textbook Solutions for Class 12 Computer Science Chapter 10 Server Side Scripting Using PHP
Review comprehensive exercise answers for Class 12 Computer Science Chapter 10 Server Side Scripting Using PHP. Fully updated to match current Kerala Board syllabus guidelines, these textbook solutions help students verify their work and maintain accurate study notes.
Mastering Theoretical and Practical Questions
Clear, methodical explanations accompany every challenging problem within the Class 12 Computer Science text. Engaging with these detailed answers lays a solid foundation for advanced learning and improves foundational clarity for upcoming assessments.
Effective Self-Study and Homework Assistance
Frequent review of these structured answers builds strong analytical capabilities and response efficiency. Maximize your academic readiness by combining these textbook solutions with our curated study materials and mock evaluations for Class 12 Computer Science.
FAQs
The complete and updated Kerala Plus Two Computer Science Chapter 10 Server Side Scripting Using PHP Questions and Answers is available for free on StudiesToday.com. These solutions for Class 12 Computer Science are as per latest Kerala Board curriculum.
Yes, our experts have revised the Kerala Plus Two Computer Science Chapter 10 Server Side Scripting Using PHP Questions and Answers as per 2026 exam pattern. All textbook exercises have been solved and have added explanation about how the Computer Science concepts are applied in case-study and assertion-reasoning questions.
Toppers recommend using Kerala Board language because Kerala Board marking schemes are strictly based on textbook definitions. Our Kerala Plus Two Computer Science Chapter 10 Server Side Scripting Using PHP Questions and Answers will help students to get full marks in the theory paper.
Yes, we provide bilingual support for Class 12 Computer Science. You can access Kerala Plus Two Computer Science Chapter 10 Server Side Scripting Using PHP Questions and Answers in both English and Hindi medium.
Yes, you can download the entire Kerala Plus Two Computer Science Chapter 10 Server Side Scripting Using PHP Questions and Answers in printable PDF format for offline study on any device.