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/08/2019
PHP Conditional Statements
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.
What will be the output of the following PHP code ?
< ?php
if (-100)
print “hi” ;
else
print “how are u”;
? >
how are u
hi
error
no output
2.
What will be the output of the following PHP code ?
< ?php
\($\)x = 10;
\($\)y = 20;
if (\($\)x > \($\)y + \($\)y != 3)
print “hi” ;
else
print “how are u”;
? >
how are u
hi
error
no output
3.
What will be the output of the following PHP code ?
< ?php
\($\)a = “”;
if (\($\)a)
print “all”;
else
print “some”;
? >
all
some
error
no output
4.
Statement which is used to make choice between two options and only option is to be performed is written as
if statement
if else statement
then else statement
else one statement
5.
What will be the output of the following PHP code ?
< ?php
\($\)x;
if (\($\)x == 0)
print “hi” ;
else
print “how are u”;
print “hello”
? >
how are uhello
hihello
hi
no output
6.
What will be the output of the following PHP code?
< ? php
\($\) x;
if (\($\)x)
print “hi” ;
else
print “how are u”;
? >
how are u
hi
error
no output
7.
How Switch statement and if statement differs?
8.
What IS"if statement" in PHP?
9.
How conditional statements perform?
10.
What is the purpose of the if ... else statement?
11.
Write the syntax for an if statement in PHP.
12.
What are the different types of conditional statements in PHP?
13.
Write, a PHP program to display independenc day and republic day the greetings using If elseif else statement.
14.
Write a php program to birthday greetings using if statement.
15.
Write a PHP code to display "Have a nice weekend!" if the current day is Friday, otherwise it will output "Have a nice day!" using if-else statement.
16.
Differentiate if statement and if elseif else statement.
17.
Write Short notes on Switch statement
18.
Differentiate Switch and if else statement.
19.
Switch case statement
20.
If elseif else statement
21.
If-else statement
22.
Simple if statements
23.
Write a PHP code to display the days of weak using switch statement
1.
(b)
hi
2.
(b)
hi
3.
(b)
some
4.
(b)
if else statement
5.
(b)
hihello
6.
(a)
how are u
7.
Switch statements work the same as if statements but they can check for multiple values at a time
8.
The If Statement is a way to make decisions based upon the result of a condition.
9.
It performs different actions for different decisions in programing language
10.
The if ... else statement is a conditional statement in PHP. It executes one block of code if a condition is true and another block of code if the condition is false.
11.
Syntax:
if (condition)
{
//code to be executed if condition is true;
}
12.
There are several types of conditional statements in PHP. They are
1. 'if' statement
2. 'if...else' statement
3. 'if...elseif...else' statement
4. 'switch' statement
13.
< ?php
$x = "August";
if ($x == "January'') {
echo "Happy Republic Day";
}
elseif ($x == "August'') {
echo "Happy Independence Day!!!";
}
else{
echo "Nothing to show";
}
? >
14.
< ?php
$date=date("m-d'');
if ($date== > >01-10 > >)
{
echo "Wishing you a very Happy Birthday";
}
? >
15.
< ?php·
$d=date("D'');
if($d=="Fri'')
{
echo"Have a nice weekend!";
}
Else
{
echo"Have a nice day!";
}
? >
16.
| No. | if elseif else statement | if statement |
| 1 | If-elseif-else statement is a combination of if-else statement. | If statement executes a single statement |
| 2 | More than one statement can execute the condition based on user needs | Only one statement can execute |
| 3 | If the condition if false more alternatives are there. | If the condition is false, there is no alternative. |
17.
(i) The switch-case statement is an alternative to if... elseif... else statement which does almost the same thing.
(ii) The switch-case statement tests a variable against a series of values until it finds a match, and then executes the block of code corresponding to that match.
(iii) The switch statement executes line by line, unlike if... elseif...else.
(iv) It also executes all the subsequent case statement till the end of the switch block automatically.
(v) To prevent this add a break statement to the end of each case block.
18.
| Switch Statement | If else statement |
|---|---|
| Switch statement uses single expression for multiple choices. | if-else statement uses multiple statement for multiple choices. |
| It test only for equality. | It test for equality as well as for logical expression. |
| Statement will be executed is decided by user. | Evaluates any type |
| If switch statements does not match any cases, the default statements is executed. | If the condition fails, then by default the else statement is executed. |
19.
Alternative statement
20.
Only one option
21.
Combination of if-else statement
22.
Multiple branching
23.
< ?php
$today=date("D'') ;
switch($today)
{
case"Mon":
echo"Today is Monday. ";
break;
case''Tue'':
echo''Today is Tuesday.";
break;
case''Wed'':
echo''Today is Wednesday.";
break;
case''Thu'':echo''Today is Thursday.";
break;
case"Fri":
echo''Today is Friday. Party tonight.";
break;
case"Sat":echo''Today is Saturday.";
break;
case"Sun":
echo''Today is Sunday.";
break;
default:
echo"No information available for that day.";
break;
}
? >
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