loops, arraYS, AND FUNCTIONS

loops, arraYS, AND FUNCTIONS - TestProblems...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Test Problems Loops, Arrays, and Functions  (Basic Programming Structures)    Final Exam: Thursday, December 10, 12:30 - 2:30 PM: 5 Lockett    Answers to all the Problems   1.    Which of the following loops will never execute, which one will execute and run indefinitely, and which loop will  execute and finish.  Help Information  
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
a.          a = 1         Do While a > 10                  a = a - 1         Loop  b.         a = 20        Do While a > 10                  a = a - 1        Loop  c.        a = 20       Do While a > 10             a = a + 1       Loop  2.  What will be the value of the variable x after the following program segments are executed? Help Information  
Background image of page 2
a.          x = 10         If  x > 0  Then                        x = x - 1        End If  .       x = 10         Do While x > 0               x = x - 1          Loop  See also  Visual Basic for Applications (VBA)  Tutorial Part 2   3.    (a) Compute the following expression:   1 + 1/3 + 1/5 + 1/7 + . . + 1/21 using a Do While loop. ( Help Information) (b) Rewrite the Do While loop from the previous problem using a For. .Next loop. (  Help Information  )  4.  Create a 'Do While Loop' which will continue adding the whole numbers 1 + 2 + 3 + . .. until the total is greater  than 50. ( Help Information 5.   Compute the following expression:   1 2  + 3 2  + 5 2 + . . + 11 2   using a Do While loop. ( Help Information  6. 
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The following segment is an example how to use a Do While loop to validate data. It prompts for the radius of  outer circle, the radius of inner circle, and the length of a metal cylinder. Before the volume of metal is 
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2010 for the course CHE 2160 taught by Professor Cygan during the Fall '09 term at LSU.

Page1 / 14

loops, arraYS, AND FUNCTIONS - TestProblems...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online