PTA CH 4&5 MC Questions

Ace your homework & exams now with Quizwiz!

35. The ____________ method can determine whether a string contains a value that can be converted to a specific data type before it is converted to that data type. a. Parse b. TryParse c. Peek d. String.Compare

ANS: B

36. 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

ANS: B

37. To convert a string to a double, use the ____________ method. a. String.ToDouble b. double.TryParse c. Try.ParseDouble d. ToString

ANS: B

39. If you specify a path in a string literal, be sure to prefix the string with the ____________ symbol, also known as the literal text character. a. # b. @ c. $ d. *

ANS: B

40. The ____________ keyword is required when specifying a variable as an output argument. a. in b. out c. extern d. static

ANS: B

41. The process of checking input for errors before it is processed is called ____________. a. parsing b. input validation c. pre-rendering d. data authentication

ANS: B

45. RadioButton controls have a ____________ property that determines whether the control is selected or deselected. a. Selected b. Checked c. Pushed d. Active

ANS: B

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

ANS: B

46. 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

ANS: B

48. 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

ANS: B

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

ANS: B

55. 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

ANS: B

56. The .NET Framework provides a class named ____________ that you can use in C# to generate random numbers. a. Rand b. Random c. GenNum d. RandomGenerator

ANS: B

6. 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

ANS: B

7. 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

ANS: B

9. When the user selects an item in a ListBox, the item's index is stored in the Listbox's ____________ property. a. DataValue b. SelectedIndex c. Index d. ValueIndex

ANS: B

1. A ____________ appears as a small box with some accompanying text. a. list box b. link c. check box d. radio button

ANS: C

11. A(n) ____________ is a logical design that controls the order in which a set of statements execute. a. elementary structure b. logic structure c. control structure d. sequence structure

ANS: C

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

ANS: C

15. The ++ and -- operators can be written before their operands, which is called ____________. a. preface mode b. postfix mode c. prefix mode d. superscript mode

ANS: C

16. A ____________ is an expression that can be evaluated as either true or false. a. binary expression b. double expression c. Boolean expression d. classical expression

ANS: C

16. 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

ANS: C

21. 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

ANS: C

22. 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

ANS: C

29. 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

ANS: C

3. 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

ANS: C

3. When a RadioButton or a CheckBox control's Checked property changes, a ____________ happens for that control. a. SelectionChanged event b. Checked event c. CheckChanged event d. Click event

ANS: C

35. 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

ANS: C

36. The ____________ method can be used to convert a string to an integer. a. Try.Parse.int b. int.Parse c. int.TryParse d. TryParse.int

ANS: C

38. 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

ANS: C

41. 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

ANS: C

42. 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

ANS: C

43. ____________ works by automatically deselecting any other items in the same group when a single item is selected. a. multiple selection b. mutually inclusive selection c. mutually exclusive selection d. monographic selection

ANS: C

47. 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

ANS: C

5. 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

ANS: C

51. 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

ANS: C

54. 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

ANS: C

57. 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()

ANS: C

59. 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

ANS: C

6. Once you create a ListBox control, you add items you wish to display to its ____________. a. Display property b. Text property c. Items property d. Values property

ANS: C

61. A ____________ is used in the calculation to generate random numbers. a. sentinel b. logarithmic value c. seed value d. Random object

ANS: C

8. ____________ are commonly used to control the number of times a loop iterates. a. Boolean variables b. Sentinel variables c. Counter variables d. Named constants

ANS: C

9. 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

ANS: C

10. If no item is selected in a ListBox, what value is in the SelectedIndex property? a. false b. true c. 0 d. −1

ANS: D

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

ANS: D

12. A(n) ____________ is a set of statements that execute in the order that they appear. a. control structure b. ordered structure c. command structure d. sequence structure

ANS: D

14. When the ++ and -- operators are written after their operands it is called ____________. a. prefix mode b. suffix mode c. appendix mode d. postfix mode

ANS: D

17. 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

ANS: D

18. Which one of the following expressions determines whether the value of the length variable is greater than or equal to the value of the width variable? a. length < width b. width <= length c. length > width d. length >= width

ANS: D

22. ____________ are decision structures that appear inside other decision structures. a. paired decision structures b. hidden decision structures c. dual decision structures d. nested decision structures

ANS: D

26. 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

ANS: D

26. The ____________ operator is the logical OR operator, which takes two Boolean expressions as operands and creates a compound Boolean expression that is true when either of the subexpressions is true. a. ! b. && c. <> d. ||

ANS: D

33. 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

ANS: D

37. 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

ANS: D

49. 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

ANS: D

7. When the user selects an item in a ListBox, the item is stored in the ListBox's ____________ property. a. Checked b. SelectedValue c. DataSelection d. SelectedItem

ANS: D

20. The ____________ has two possible paths of execution - one path is taken if the Boolean expression is true, and the other path is taken if the Boolean expression is false. a. dual-alternative decision structure b. comparative structure c. multi-decision structure d. branching structure

ANS: A

30. The expression (A >= 1) XX (A <= 10) will determine if the value in A is inside a range, if "XX" is replaced by which logical operator? a. && b. ! c. || d. >=

ANS: A

42. ____________ are useful when you want the user to select one choice from several possible choices. a. Radio buttons b. Check boxes c. Buttons d. Text boxes

ANS: A

23. 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

ANS: C

24. The C# language provides a set of operators known as ____________, which you can use to create complex Boolean expressions. a. Boolean operators b. relational operators c. logical operators d. expressional operators

ANS: C

25. The ____________ operator is the logical AND operator, which takes two Boolean expressions as operands and creates a compound Boolean expression that is true only when both subexpressions are true. a. ! b. <> c. && d. ||

ANS: C

29. The expression (A < 1) XX (A > 10) will determine if the value in A is outside a range, if "XX" is replaced by which logical operator? a. && b. ! c. || d. >=

ANS: C

33. You can use the ____________ operator to compare two strings. a. || b. && c. == d. !

ANS: C

38. A string can be converted to a decimal with the ____________ method. a. decimal.ParseString b. decimal.ToString c. Try.Parse(decimal) d. decimal.TryParse

ANS: D

4. Each time a loop executes its statement or statements, we say the loop is performing a(n) ____________. a. cycle b. pass c. execution d. iteration

ANS: D

43. 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

ANS: D

5. In Visual C#, you use the ____________ to create a list box on an application's form. a. ListView control b. MaskedTextBox control c. CheckedListBox control d. ListBox control

ANS: D

27. Both the && and || operators perform ____________, in which CPU time is saved by not checking the expression on the right side of the operator depending on the value of the expression on the left side of the operator. a. logical optimization b. short-circuit evaluation c. cycle-branching d. single-stage execution

ANS: B

14. An action that is ____________ occurs only when a certain condition is true. a. conditionally executed b. logically executed c. interactively driven d. truth bound

ANS: A

17. A(n) ____________ compares the values of two expressions. a. relational operator b. bitwise assessment c. associative operator d. comparative structure

ANS: A

18. 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

ANS: A

2. 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

ANS: A

2. When you want to create a check box on a form, you use the ____________, which is found in the Common Controls section of the Toolbox. a. CheckBox control b. RadioButton control c. ListBox control d. LinkLabel control

ANS: A

20. Because the for loop tests its Boolean expression before it performs an iteration, it is a ____________. a. pretest loop b. pseudo loop c. posttest loop d. infinite loop

ANS: A

23. C# provides a special version of the decision structure known as the ____________, which simplifies the logic for testing a series of conditions. a. if-else-if statement b. else-try statement c. series statement d. multi-condition logic structure

ANS: A

25. The term ____________ is used to describe a file from which data is read. a. input file b. output file c. record file d. recordset

ANS: A

28. 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

ANS: A

31. Many systems, including MS-Windows, support the use of ____________, which are short sequences of characters that appear at the end of filenames and are preceded by a period. a. filename extensions b. pragmatic identifiers c. binary indices d. run time signatures

ANS: A

31. The C# language provides the ____________ data type that you can use to create variables that hold true or false values. a. bool b. int c. Boolean d. double

ANS: A

34. 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

ANS: A

39. A(n) ____________ is a variable that is passed as an argument to a method, and when the method is finished, a value is stored in the variable. a. output variable b. result variable c. parameter variable d. method variable

ANS: A

4. The ____________ is a multiple-alternative decision structure, which allows you to test the value of a variable or an expression and then use that value to determine which statement or set of statements to execute. a. switch statement b. if statement c. try-catch statement d. else statement

ANS: A

40. 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

ANS: A

44. 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

ANS: A

44. When you want to create a group of radio buttons on a form, you use the ____________, which is found in the Common Controls section of the Toolbox. a. RadioButton control b. ListBox control c. ListView control d. ComboBox control

ANS: A

50. 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

ANS: A

53. The ____________ allows the user to browse the system and select a location and name for a file that is about to be saved. a. Save As dialog box b. Save File dialog box c. Select Source dialog box d. Open dialog box

ANS: A

58. 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

ANS: A

60. The numbers generated by the Random class are ____________calculated by a formula. a. pseudorandom numbers b. binary encoded numbers c. algebraic derivatives d. complex variables

ANS: A

62. When you run an application, the application's form is loaded into memory and an event known as the ____________ takes place. a. Load event b. Launch event c. Boot event d. Initialization event

ANS: A

8. Each item in a ListBox has a(n) ____________, which is an integer that identifies the item's position in the ListBox. a. index b. list number c. unique identifier d. table key

ANS: A

1. To add an item to a ListBox control with code, you call the control's ____________method. a. Add.Items b. Items.Add c. Items.Append d. Items.Insert

ANS: B

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

ANS: B

13. A(n) ____________ can execute a set of statements only under certain circumstances. a. sequence structure b. decision structure c. circumstantial structure d. event structure

ANS: B

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

ANS: B

15. A(n) ____________ decision structure provides only one alternative path of execution. a. alternate path b. single-alternative c. single path d. ordered path

ANS: B

19. 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

ANS: B

19. Which one of the following expressions determines if the value of the balance variable is equal to zero? a. 0 = balance b. balance == 0 c. balance = 0 d. balance <= 0

ANS: B

21. A(n) ____________ statement has two parts: an if clause and an else clause. a. logic b. if-else c. Boolean d. else-if

ANS: B

24. The term ____________ is used to describe a file to which data is written. a. input file b. output file c. record file d. recordset

ANS: B

27. A ____________ contains data that cannot be viewed by a text editor (such as NotePad). a. source file b. binary file c. data file d. save file

ANS: B

28. The ____________ operator is the logical NOT operator, which is a unary operator that takes a Boolean expression as its operand and reverses its logical value. a. <> b. ! c. && d. ||

ANS: B

30. Files on disk are identified by a(n) ____________. a. index b. filename c. access number d. binary signature

ANS: B

32. A ____________, is an object associated with a specific file and provides a way for the program to work with that file. a. data object b. file object c. Filename class d. referential extension

ANS: B

32. A(n) ____________ is a variable that often signals the value of a Boolean condition. a. sentinel b. flag c. event d. marker

ANS: B

34. The ____________ method can be used to determine whether one string is greater than or less than another string. a. String.Equals b. String.Compare c. String.IsGreater d. String.String

ANS: B


Related study sets

Structure : il faut + INF, il faut + NOM, pour + INF

View Set

Chapter 19 PrepU: Postoperative Nursing Management

View Set

Graphing Two-Variable Linear Inequalities: Assignment

View Set

RN Maternal Newborn Online Practice 2023 A

View Set

CSCS Exam - Organization and Administration

View Set

Chapter 18/1: Life Policies Review

View Set