Starting Out with Visual C#, 4th Edition Chapter 5 Loops, Files, and Random Numbers

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

37. You can specify the directory to be initially displayed by the Open dialog box by storing its path in the ____________. a. InitialDirectory property b. Source property c. Filename property d. Path property

a. InitialDirectory property

1. ListBox controls have an ____________ property that reports the number of items stored in the ListBox. a. Items.Count b. Items.Size c. Items.List d. Items.Contains

a. Items.Count

43. Once you have created a Random object, you can call its ____________ method to get a random integer number. a. Next b. GetInteger c. GenerateNumber d. NextInteger

a. Next

32. The ____________ displays a standard Windows Open dialog box. a. Open method b. OpenFileDialog control c. FindFileDialog control d. SelectFile control

a. OpenFileDialog control

27. You can use the StreamReader class's ____________ method to read a line of text from a file. a. ReadLine b. ReadText c. GetNext d. Read

a. ReadLine

22. When you want to read data from a text file, you create a file object using the ____________. a. StreamReader class b. TextReader class c. BufferedReader class d. InputReader class

a. StreamReader class

31. A(n) ____________ accumulates a total by adding each number in a series to a variable that holds the sum. a. running total b. numeric tally c. active summary d. dynamic collection

a. running total

19. When you work with a ____________, you process data from the beginning of the file to the end of the file. a. sequential access file b. direct access file c. text file d. input file

a. sequential access file

13. The second expression appearing in the header of a for loop is the _____________, which is a Boolean expression that determines whether the loop will repeat. a. test expression b. update expression c. initialization expression d. control expression

a. test expression

6. If a loop does not have a way of stopping, it is called a(n) ____________. a. runaway loop b. game loop c. infinite loop d. expressionless loop

c. infinite loop

9. The increment operator is ____________. a. -- b. ++ c. -= d. +=

b. ++

10. The decrement operator is ____________. a. += b. -- c. -= d. ++

b. --

41. If the user clicks the Cancel button, the SaveFileDialog control's ShowDialog method returns the value ____________. a. Result.False b. DialogResult.Cancel c. DialogResult.Abort d. Result.NULL

b. DialogResult.Cancel

35. If the user clicks the Open button, the OpenFileDialog control's ShowDialog method returns the value ____________. a. Result.True b. DialogResult.OK c. DialogResult.Open d. Result.OpenFile

b. DialogResult.OK

2. ListBox controls have an ____________ method that erases all the items in the Items property. a. Items.Erase b. Items.Remove c. Items.Clear d. Items.Reset

b. Items.Clear

33. The ____________ is useful in applications that must open an existing file because it allows the user to browse the system and select the file. a. File.OpenText method b. OpenFileDialog control c. Open dialog box d. Windows Explorer

b. OpenFileDialog control

39. The ____________ displays a standard Windows Save As dialog box. a. SaveAs method b. SaveFileDialog control c. Save_File event d. OpenFileDialog control

b. SaveFileDialog control

4. The statement or block of statements following the while clause is known as the ____________ of the loop. a. assembly b. body c. definition d. sequence structure

b. body

24. A ____________ character is an invisible character that marks the end of a line of text. a. line feed b. newline c. line marker d. startline

b. newline

5. The while loop is known as a ____________, which means it tests its condition before performing each iteration. a. posttest loop b. pretest loop c. proactive loop d. preemptive loop

b. pretest loop

14. The third expression appearing in the header of a for loop is the ____________, which executes at the end of each iteration. It usually increments the loop's counter variable. a. test expression b. update expression c. initialization expression d. increment expression

b. update expression

42. The expression ____________ causes an object of the Random class to be created in memory. a. GetRandom(int) b. GenerateRandom(number) c. new Random() d. random new()

c. new Randowm()

29. You can use the StreamReader class's ____________ to determine if the file's read position is at the end of the file. a. EndOfFile property b. StreamEnd method c. EndOfStream property d. EOF method

c. EndOfStream property

26. To append data to an existing file, you open it with the ____________ method. a. File.Append b. File.AppendAll c. File.AppendText d. File.OpenExistingText

c. File.AppendText

36. When the user selects a file with the Open dialog box, the file's path and filename are stored in the control's ____________. a. FilePath property b. Source property c. Location property d. Filename property

c. Location Property

44. You can call a Random object's ____________ method to get a random floating-point number between 0.0 and 1.0. a. GetDouble b. NextFloat c. NextDouble d. DoubleRand

c. NextDouble

40. In code, you can display a Save As dialog box by calling the SaveFileDialog control's ____________ method. a. SaveAs b. Show c. ShowDialog d. Display

c. ShowDialog

38. You can change the default text displayed in the Open dialog box's title bar by changing the control's ____________. a. Caption property b. Text property c. Title property d. Heading property

c. Title property

3. The ____________ begins with the word while, followed by a Boolean expression that is enclosed in parentheses. a. conditional statement b. logic mark c. while clause d. loop parameter

c. While clause

23. You can use the StreamWriter class's ____________ method to write a line of text to a file. a. PrintLine b. WriteText c. WriteLine d. PrintText

c. WriteLine

34. When controls such as the OpenFileDialog and SaveFileDialog are created, they do not appear on the form, but in an area at the bottom of the Designer known as the ____________. a. control overflow b. design space c. component tray d. virtual form

c. component tray

8. To ____________ a variable means to decrease its value by 1. a. subtract b. increment c. decrement d. supplement

c. decrement

20. When you work with a ____________, you can jump directly to any piece of data in the file without reading the data that comes before it. a. file object b. binary file c. direct access file d. sequential access file

c. direct access file

11. The ____________ is specifically designed for situations requiring a counter variable to control the number of times a loop iterates. a. while loop b. if-else statement c. for loop d. switch statement

c. foor loop

15. Be careful not to place a statement that modifies the counter variable inside the body of a ____________. a. while loop b. if statement c. for loop d. switch statement

c. for loop

28. A file's ____________ marks the location of the next item that will be read from the file. a. line marker b. index value c. read position d. newline character

c. read position

16. In the header of a for loop, which expression should not end with a semicolon? a. initialization expression b. test expression c. update expression d. none of these

c. update expression

21. In order to write data to a text file, you must create a file object using the ____________. a. TextReader class b. TextWriter class c. StreamReader class d. StreamWriter class

d. Stream Writer

25. The ____________ is a method in by the StreamWriter class that writes an string to a text file without writing a newline character. a. Print method b. Text method c. WriteLine method d. Write method

d. Write method

30. The variable that accumulates a total of the numbers in a running total is called a(n) ____________. a. counter b. sentinel c. entity d. accumulator

d. accumulator

17. The ____________ is a posttest loop, which means it performs an iteration before testing its Boolean expression. a. for loop b. while loop c. do-while loop d. do-before loop

d. do-while loop

7. To ____________ a variable means to increase its value by 1. a. append b. decrement c. add d. increment

d. increment

12. The first expression appearing in the header of a for loop is the ____________, which usually assigns a starting value to a counter variable. a. update expression b. test expression c. Boolean expression d. initialization expression

d. initializaion expression

18. A ____________ contains data that has been encoded as text using a scheme such as ASCII. a. document (as on MS-Word or Open-Document Format) b. spreadsheet (as in Excel) c. binary file d. text file

d. text file


संबंधित स्टडी सेट्स

BC: GOOD GOVERNANCE AND SOCIAL RESPONSIBILITY

View Set