1. What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run? A. 10 B. 9 C. 0 D. 1 Note: This quiz question probably generates more email to the webmaster than any other single item on the site. Yes, the answer really is 10. If you don't understand why, think about it this way: what condition has to be true for the loop to stop running? 2. When does the code block following while(x<100) execute? A. When x is less than one hundred B. When x is greater than one hundred C. When x is equal to one hundred D. While it wishes 3. Which is not a loop structure? A. For B. Do while C. While D. Repeat Until 4. How many times is a do while loop guaranteed to loop? A. 0 B. Infinitely C. 1 D. Variable |
Thursday, August 4, 2011
Quiz Answer: Loops
Subscribe to:
Post Comments (Atom)
RELATED KEYWORDS:
- Intro to C The basics of C
- If statements If statements, and how to use boolean operators
- Loops in C All you want to know about loops
- Functions Make your programs more modular and easier to understand with functions
- Switch case About the switch case structure
- Pointers Using pointers to access memory locations
- Structures Learn about grouping multiple variables together under a single name
- Arrays Learn about arrays--one variable with many values
- C-style Strings About character arrays (strings)
- C File I/O About file I/O in C
- Typecasting Typecasting: making variables look like another data-type
- Command line arguments How to accept command line arguments
- Linked Lists The basics of singly linked lists
- Recursion Recursion--a function calling itself
- Variable argument lists Learn to write flexible functions accepting a variable number of arguments
- Binary Trees Learn about binary trees, a fundamentally important data structure!
No comments:
Post a Comment