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: 12/08/2019
Looping Structure
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.
________ loops execute a block of code a specified number of times.
foreach
for
while
do..while
2.
Which of the following is an entry check loop?
foreach
for
while
do..while
3.
Which of the following is an exit check loop?
foreach
for
while
do..while
4.
PHP supports which types of looping techniques;
for loop
while loop
foreach loop
all the above
5.
Most complicated looping structure in PHP is ________
While
Do While
for
None of them
6.
How "while loop" will execute?
7.
What is will provide "foreach" loop in PHP?
8.
How "for loop" will execute?
9.
Write Syntax of Do while loop in PHP.
10.
List out Looping Structure in PHP.
11.
Define Looping Structure in PHP
12.
Write short note on all the loops
13.
Write a PHP program to display color names "using foreach" loop
14.
Write a php program to display the string "Hello World" 5 times using "for loop".
15.
Write a php program to display 1 to 10 numbers using while loop
16.
Differentiate While and Do while loops.
17.
Write short notes on Do while Loop.
18.
Explain working of loops in array
19.
Explain the process Do while loop.
20.
Explain Looping Structure in PHP.
1.
(b)
for
2.
(d)
do..while
3.
(d)
do..while
4.
(d)
all the above
5.
(c)
for
6.
PHP while loops execute a block of code while the specified condition is true.
7.
The foreach construct provides an easy way to iterate over arrays
8.
For loops execute a block of code a specified number of times.
9.
Syntax of Do while loop
do
{
code to be executed;
} while (condition is true);
10.
(i) for loop
(ii) for each loop
(iii) while loop
(iv) Do while loop
11.
Loop structures in PHP is an iterative control structures that involves executive the same block of code a specified number of times. Loops that iterate for fixed no of times is also called as Bounded loops.
12.
1. PHP while loops execute a block of code while the specified condition is true.
2. The for loop is used when you knew in advance how many times the script should run.
3. The foreach loop works only en arrays, and is used to loop through each key/value pair in an array.
4. do ... while - loops through a block of code once, and then repeats the loop as long as the specified condition is true.
13.
< ?php
scolors = array("red", "qreen", "blue'; "yellew'');
fereach (sectors as $value)
{
echo "svalue < br >";
}
? >
14.
< ?php
for ($x = 0; $x < = 5; $x++)
{
echo "Hello World < br >";
}
? >
15.
< ?php
$x = 1;
while($x < = 10)
{
echo sx:
$x++;
}
? >
16.
| While loop | Do while loop |
| (i) It is important feature which is used for simple iteration logics. | (i) It always run the statement inside of the loop block at the first time execution. |
| (ii) It is Entry controlled loop | (ii) It is exit controlled loop |
| (iii) It checks the condition, and executes the loop if specified condition is true. | (iii) It checks the condition, and then repeats the loop as long as the specified condition is true. |
| Syntax : While(condition) { code to be executed; } |
Syntax : do { code to be executed; } while (condition is true); |
17.
1. Do whileloop always run the statement inside of the loop block at the first time execution.
2. Then it is checking the condition whether true or false.
3. It executes the loop, if the specified condition is true.
Syntax:
do
{code to executed;
}while (condition is true);
18.
1. The array concepts in looping structure is used in for each loop.
2. For each loop is exclusively available in PHP. It works only with arrays.
3. The loop iteration depends on each KEY value pair in the array. In for each, loop iteration the value of the current array element is assigned to $value variable and the array pointer is shifted by one until it reaches the end of the array element.
4. For each works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable.
Syntax:
for each ($ array as $ value)
{
code to be executed;
}
1. The for each statement is used to loop through arrays.
2. 'For each' pass the value of the current array element is assigned to $value and the array pointer is moved by one and in the next pass next element will be processed.
Example:
$array = array (1, 2, 3);
{
echo "Value is $value
";
}
?>
Output:
Value is 1
Value is 2
Value is 3
19.
Do while loop always run the statement inside of the loop block at the first time of execution. Then it checks the condition whether true or false. It executes the loop, if the specified condition is true.
Syntax:
do
{
code to be executed;
} while (condition is true);
Example
\(\$\)Student_count = 10;
\(\$\)student_number= 1;
do
{
echo "The student number is: \(\$\)student_number
";
\(\$\)student_number++ ;
}
while(\(\$\)student_number< = \(\$\)Student_count);
?>

20.
Looping structure are useful for writing iteration logics. It is the most important feature of many programming languages including PHP.
Looping categories are
(i) for loop
(ii) for each loop
(iii) while loop
(iv) Do while loop
(i) for loop:
It is used for iteration logics when the programmer know in advance how many times the loop should run.
Syntax:
for (init counter; test counter; increment counter)
{
code to be executed;
}
Parameters:
init counter: To initialize the loop initial counter value
test counter : Evaluated for every iteration, of the loop.
If it evaluates to TRUE, the loop continues.
If it evaluates to FALSE, the loops ends.
Increment counter:Increases the loop counter value.
(ii) for each loop:
It works only with arrays.
Loop iteration depends on each KEY value pair in the Array.
In loop iteration, value of the current array element is assigned to $value variable and the array
pointer is shifted by one until it reaches the end of the array element.
Syntax:
for each ($array as $value)
{
code to be executed;
}
(iii) While loop:
It is used for simple iteration logics.
It checks the condition, if the condition is true, and it executes the loop.
Syntax:
while (condition is true)
code to be executed;
}
(iv) Do while loop:
Do while loop always run the statement inside the loop block at the first time of execution. It then checks the condition. If the specified condition is true, it executes the loop.
Syntax:
do
{
code to be executed;
}while (condition is true);
}
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