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: 16/10/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.
Which of the following is an entry check loop?
foreach
for
while
do..while
2.
The ________ construct provides an easy way to iterate over arrays
foreach
for
while
do..while
3.
What will be the output of the following PHP code ?
< ?php
for (\($\)x = 1; \($\)x < 10;++\($\)x)
{
print “*\t”;
}
? >
**********
*********
***********
Infinite loop
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.
Draw the For loop Structure and Flow chart
7.
Explain the use of for each loop in PHP.
8.
Compare For loop and for each loop.
9.
Write Syntax of For each loop in PHP.
10.
List out Looping Structure in PHP.
11.
What is For each loop in PHP?
12.
Define Looping Structure in PHP
13.
Write a php program to display the string "Hello World" 5 times using "for loop".
14.
Differentiate While and Do while loops.
15.
Differentiate For each and While loop.
16.
Write the features Looping Structure.
17.
Explain ‘for’ loop with example.
18.
Explain Looping Structure in PHP.
19.
_________ loop always run the statement inside of the loop block at the first time execution and then it is checking the condition whether true or false.
20.
_______ loop works only with arrays.
21.
________ Structures are useful for writing iteration logics.
22.
There are __________ types of loops in PHP
23.
do while loop
24.
For Each loop
25.
While loop
26.
For loop
1.
(d)
do..while
2.
(a)
foreach
3.
(b)
*********
4.
(d)
all the above
5.
(c)
for
6.
7.
(i) It is used to loop through each KEY value pair in an array.
(ii) It will issue an error when you try to use it on a variable with a different data type or an initialized variable.
8.
| For loop | For each loop |
|---|---|
| For loops execute a block of code a specified number of times. | The foreach construct provides an easy way to iterate over arrays. |
9.
Syntax of for each loop
for each ($array as $value)
{
code to be executed;
}
10.
(i) for loop
(ii) for each loop
(iii) while loop
(iv) Do while loop
11.
For each loop is exclusively available in PHP and is mainly used for looping through the values of an array. The loop iteration deepens on each KEY Value pair in the Array. For each, loop iteration the value of the current array element is assigned to $value variable and the array pointer is advanced by one, until it reaches the end of the array element.
12.
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.
13.
< ?php
for ($x = 0; $x < = 5; $x++)
{
echo "Hello World < br >";
}
? >
14.
| 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); |
15.
| For each loop | While loop |
| (i) It provides an easy way to iterate over arrays. | (i) It is used for simple iteration logics. |
| (ii) Loop iteration depends on each KEY value pair in the Array | (ii) It executes block of code while the specified condition is true. |
| (iii) Syntax: for each (Sarray as $value) { code to be executed; } |
(iii) Syntax: while (condition is true) { code to be executed; } |
16.
(i) PHP Loop Often when you write code, you want the same block of code to run over and over again in a row.
(ii) Instead of adding several almost equal code-lines in a script, we can use loops to perform a task.
(iii) Looping structures are useful for writing iteration logics.
(iv) It is the most important feature of many programming languages, including PHP.
17.
'for loop' is called as the entry-check loop.
The for loop is used to execute a block of code a specific number of times.
Syntax:
for (initialization; condition; increment / decrement)
{
//code to be executed;
}
The initialization part is executed only once at the beginning of the loop. It is used to initialize variables. The condition is evaluated before each iteration of the loop. If it is true, the code block is executed. If it is false, the loop is terminated. The increment/ decrement part is executed after each iteration of the loop. It is used to update variables.
Example 1
To print the numbers from 1 to 5 in ascending order
for (i = 1;
i<=5;
i++)
{
echo i. "<br>";
}
Output:
1
2
3
4
5
Example 2
To print the numbers from 5 to 1 in descending order
for (i = 5;
i<=1;
i--)
{
echo i. "<br>";
}
Output:
5
4
3
2
1
18.
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);
}
19.
( )
Do while
20.
( )
For each
21.
( )
Looping
22.
( )
4
23.
Exit check loop
24.
Works only with array
25.
Simple iteration logics
26.
Complicated looping structure
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