ICS Computer Science part-2 Chapter-12 Loop Constructs

Important Question for ICS Computer Science Part-2, Important notes for ICS computer Science for all Intermediate Boards.




Chapter-12(Loop Constructs)


1
What is the final value of x after executing the following code:
for (int x=0; x <10; x++)

10
9
0
1
2
What is the value of a after execution of the following code?
Int a = 25;
for (int c =0; c<4; c++)
a = a -1;
a = a +3;

23
24
25
20
3
The body of while loop with multiple statements ends with:

Right bracket]
Right braces}
Comma,
Semi colon;
4
Which is a loop statement?

 if
if-else
switch
None
5
Semicolon is placed at the end of condition in:

While loop
Do-while loop
For loop
All
6
While loop is also called:

Conditional loop
Wend loop
Counter loop
None
7
This means to increase a value by one:

Modulus
Increment
Decrement
None
8
This statement may be used to stop a loop’s current iteration and begin next one;

Continue
Break
Terminate
None
9
A for statement contains three expressions: initialization , test, __________ .

Null
Validation
Increment/decrement
None
10
A special value that marks the end of a list of input data is called:

Terminal value
Sentinel value
Loop control value
Input value
11
One execution of a loop is known as a (n).

Cycle
Duration
Iteration
Test
12
How many types of loop are available in c language?

2
3
4
5
13
While loop structure always executes at least once?

Do-while
For
While
None
14
Which of the following loop is called counter control loop?

For
While
Do while
None
 

Q-2: Write short answers
i.    Define loop.
ii.    Write two advantages of loop.
iii.    Define “while” loop.
iv.    Define do-while loop.
v.    Describe the syntax of do-while loop with example.
vi.    Describe the syntax of “for” loop.
vii.    What is “for” loop.
viii.    What is counter controlled loop?
ix.    What is sentinel controlled loop.
x.    Define sentinel value.
 
xi.    Describe nested loop.
xii.    Define infinite loop.
xiii.    How many times will the following loop display “ORIAL ACADEMY”.
for (int i =20; i > 0; i++)
{
    printf(“Akram Bhatti”);
}
 

Q-3: Write detail answers
•    Write a program that uses a while loop to enter a number from the user and then display it. The loop is terminated when the user enters -1.
•    Explain “for” loop? Explain its working.