Trending ▼   ResFinder  

ICSE Notes 2018 : Computer Applications (Lawrence High School, HSR Layout, Bangalore)

93 pages, 0 questions, 0 questions with responses, 0 total responses,    0    0
Sudhir
Lawrence High School, HSR Layout, Bangalore
+Fave Message
 Home > salva >   F Also featured on: School Page

Formatting page ...

Chapter 7: Repetitive Structures Practice Questions187 A. Answer the following questions: 1. Explain the term loop with an example. [ICSE 2005] Ans. Loop is a repetitive structure that allows a group of statements to be executed repeatedly. The loop structure executes as long as the given test-expression is executed. For example, the following for loop will execute 10 times displaying the first 10 natural numbers. int i; for( i =1 ; i<=10 ; i++) { System.out.print(i+" "); } The loop starts with the initial value of 1 for i' and iterates every time increasing the value of i' by 1 as long as the value of i is less than or equal to 10. The loop body in the mean while displays each value of i , thus giving the output as: 1 2 3 4 5 6 7 8 9 10 2. Discuss "Elements That Control a Loop". Ans. Elements that control the loop are: 1. Initialization Expression(s): Before entering a loop, the variable that controls the execution of it is called initialization. The initialization of a variable may be inside a loop or outside it. Whatever it may be it is executed only once before the iteration starts. 2. Test Expression. The test-expression is a condition, which decides whether the loop body will be executed or not. Till the test-expression evaluates to true, the loop body gets executed otherwise the loop is terminated. 3. Update Expression(s). The update expression(s) change the value(s) of the control variable(s). The update expression(s) is usually made to be executed; before the next iteration. 4. The Body of the Loop. The statements that are executed repeatedly (as long as the, test-expression is true) form the body of the loop. 3. What are the three types of looping statements available in Java? Ans. The three types of looping statements in Java are: a) for

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 

© 2010 - 2024 ResPaper. Terms of ServiceContact Us Advertise with us

 

salva chat