12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications மின்னணு தரவு பரிமாற்றம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிக பாதுகாப்பு அமைப்புகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின்னணு செலுத்தல் முறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications திறந்த மூல கருத்துருக்கள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு வடமிடல் Sample Question Papers Study Material - QB365 Set A

Published on: 05/09/2022
QB365 provides a detailed and simple solution for every Possible Book Back Questions in Class 12 Computer Applications Subject -PHP Conditional Statements, English Medium. It will help Students to get more practice questions, Students can Practice these question papers in addition to score best marks.
Download Tamil Nadu 12th Standard Computer Applications question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Applications Test

1.
Explain if else statement in PHP. With an example.
2.
Explain the if elseif else statement. With suitable example.
3.
Explain the working of Conditional Statements in PHP?
4.
Discuss in detail about Switch statement with an example.
5.
Explain the Function of Conditional Statements in PHP.
1.
If else statement in PHP:
If statement executes a statement or a group of statements if a specific condition is satisfied by the user expectation. When the condition gets false (fail) the else block is executed.
Syntax:
if (condition)
{
Execute statement(s) if condition is true;
}
else
{
Execute statement(s) if condition is false;
}
Example
$Pass_Mark=35;
$Student_Mark= 70;
if ($Student_Mark>= $Pass_Mark){
echo "The Student is eligible for the promotion";
}
else {
echo "The Student is not eligible for the promotion";
} ?>
2.
If elseif else statement in PHP:
If-elseif-else statement is a combination of if-else statement. More than one statement can execute the condition based on user needs.
Syntax:
if (1st condition)
{
Execute statement(s) if condition is true;
}
elseif(2nd condition)
{
Execute statement(s) if 2nd condition is true;
}
else
{
Execute statement(s) if both conditions are false;
}
Example Program:
$Pass_Mark=35;
$first_class=60;
$Student_Mark= 70;
if ($Student_Mark > = $first_ class){
echo "The Student is eligible for the promotion with First Class";
}
elseif ($Student_Mark >= $Pass_Mark){
echo "The Student is eligible for the promotion";
}
else {
echo "The Student is not eligible for the promotion";
} ?>
3.
Conditional statements in PHP are implemented by the following types:
(i) if Statement
(ii) if... else Statement
(iii) if... elseif... else Statement
(iv) switch Statement
(i) If statement in PHP:
If statement executes a statement or a group of statements if a specific condition is satisfied as per the
user expectation.
Syntax:
if (condition)
{
Execute statement(s) if condition is true;
}
(ii) If else statement in PHP:
If statement executes a statement or a group of statements, if a specific condition is satisfied by the user
expectation. When the condition gets false (fail) the else block is executed.
Syntax:
if (condition)
{
Execute statement(s) if condition is true;
}
else
{
Execute statement(s) if condition is false;
(iii) If elseif else statement
It is a combination of if-else statement. More than one statement can execute the condition based on user needs.
Syntax:
if (1st condition)
{
Execute statement(s) if condition is true;
}
elseif (2nd condition)
{
Execute statement(s) if 2nd condition is true;
}
else
{
Execute statement(s) if both conditions are false;
}
(iv) Switch Statement
It is used to perform different actions based on different conditions.
Syntax:
switch (n) {
case label 1:
code to be executed if n-label1;
break;
case label2:
code to be executed if n=label2;
break;
***
default:
code to be executed if n is different from all labels;
}
4.
Switch Statement:
(i) This is a multiple branching statement where, based on a condition, the control is transferred to one of the many possible points.
(ii) The switch statement is used to specify multiple conditions. It runs a different code block for different conditions.
Syntax
switch (expression)
{
case value1:
//code to be executed if expression = value1; break;
case value2:
//code to be executed if expression = value2; break;
...
default:
//code to be executed if expression is not equal to any of the values;
}
Example:
$x = 10;
switch ($x)
{
case 5:
echo "x is equal to 5";
break;
case 10:
echo "x is equal to 10";
break;
case 15:
echo "x is equal to 15";
break;
default:
echo "x is not equal to 5, 10, or 15";
}
?>
Output:
x is equal to 10
5.
(i) If statement in PHP: If statement executes a statement or a group of statements if a specific condition is satisfied as per the users expectation. This is the simplest PHP's conditional statement and can be written in the following form.
Syntax:
if (condition)
{
// code to be executed if condition is true;
}
(ii) If else statement in PHP: The if statement evaluates a condition and executes a set of code if the condition is true and another set of code if the condition is false.
Syntax:
if(condition)
{
//True-block;
}
else
{
//False-block;
}
(iii) If-elseif-else statement in PHP: If-elseif-else statement is a combination of if-else statement. Here multiple conditions can be checked and action is based on the result of the condition.
Syntax:
if (Condition 1)
{
//code to be executed if condition 1 is true;
}
elseif (condition2)
{
//code to be executed if condition1 is false and condition2 is true;
}
elseif (condition3)
{
// code to be executed if condition1 and condition2 are false and condition3 is true;
}
else
{
//code to be executed if all conditions are false;
}
Switch case: The switch case is an alternative to the if.. elseif.. else statement which executes a block of code corresponding to the match.
Syntax:
switch (expression)
case value1:
//code to be executed if expression= value1; break;
case value2;
//code to beexecuted if expression = value2; break;
...
default:
//code to be executed if cexpression is not equal to any of the values;
}
12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications களப்பெயர் முறைமை (DNS) Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு எடுத்துக்காட்டுகள் மற்றும் நெறிமுறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications கணினி வலையமைப்பு ஓர் அறிமுகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications PHP-உடன் MySQL-ஐ இணைத்தல் Sample Question Papers Study Material - QB365 Set A
Tamilnadu Stateboard 12th Standard Subjects

Maths

Chemistry

Physics

Biology

Computer Science

Business Maths and Statistics

Economics

Commerce

Accountancy

History

Computer Applications

Biology

Computer Technology

Computer Applications

Computer Science

Business Maths and Statistics

Commerce

Economics

Maths

Chemistry

Physics

Computer Technology

History

Accountancy

Tamil

English

French
Tamilnadu Stateboard Standards