+ All Categories

Http

Date post: 28-Oct-2014
Category:
Upload: fathia-helail
View: 330 times
Download: 3 times
Share this document with a friend
Popular Tags:
31
http://web.cocc.edu/pcasey/cis133vb/testquestionsnet/ chapter_3.htm Chapter 3 Fundamentals of Programming in VB.NET Section 3.1 VB.NET Controls 1. Press F4 to (A) run a program. (B) display the Properties window. (C) display the Solution Explorer window. (D) terminate a program. 2. Which of the properties in a control's list of properties is used to give the control a meaningful name? (A) Text (B) ContextMenu (C) ControlName (D) Name 3. VB.NET access keys are created by using which symbol in a button's Text property? (A) @ (B) & (C) % (D) # 4. B Which of the following steps specifies P as the access key for a button? (A) Set the Text property to Com_pute. (B) Set the Text property to Com&pute. (C) Set the Text property to &Com_pute. (D) Set the Text property to comPute.
Transcript
Page 1: Http

http://web.cocc.edu/pcasey/cis133vb/testquestionsnet/chapter_3.htm

Chapter 3 Fundamentals of Programming in VB.NET

Section 3.1 VB.NET Controls

1. Press F4 to

(A) run a program.(B) display the Properties window.(C) display the Solution Explorer window.(D) terminate a program.

 

2. Which of the properties in a control's list of properties is used to give the control a meaningful name?

(A) Text(B) ContextMenu(C) ControlName(D) Name

 

3. VB.NET access keys are created by using which symbol in a button's Text property?

(A) @(B) &(C) %(D) #

 

4. B Which of the following steps specifies P as the access key for a button?

(A) Set the Text property to Com_pute.(B) Set the Text property to Com&pute.(C) Set the Text property to &Com_pute.(D) Set the Text property to comPute.

 

5. When a VB.NET program is running, the user can move from one control to another using the keyboard by pressing the

(A) Tab key.(B) Space bar.(C) Enter key.(D) Backspace key.

 

Page 2: Http

6. Which of the following properties determines the words appearing in a form's title bar?

(A) Text(B) Caption(C) Name(D) Title

 

7. What effect will the following statement have?

lblOne.Visible = False

(A) Enable lblOne(B) Delete lblOne(C) Make lblOne invisible(D) It is not a valid VB.NET statement.

 

8. When creating a new application in VB.NET, you are asked to supply a name for the program and the location to store it. If you do not specify a name, a default name is used. What is this default name?

(A) Wapplication followed by a number.(B) Application followed by a number.(C) WindowsApplication.(D) WindowsApplication followed by a number.

 

9. In VB.NET, tooltips assist by showing a small caption about the purpose of each button on the toolbar. How do you make a tooltip visible?

(A) Right click the toolbar icon, select purpose from the available options.(B) Position the mouse pointer over the icon for a few seconds, the tooltip will

appear.(C) Hold your shift key, then click the appropriate toolbar icon to display its

purpose.(D) Hold your Alt key, then click the appropriate toolbar icon to display its purpose.

 

10. The Properties window plays an important role in the development of VB.NET applications. It is mainly used

(A) to change how objects look and feel.(B) when opening programs stored on a hard drive.(C) to allow the developer to graphically design program components.(D) to set program related options like Program Name, Program Location, etc.

 

Page 3: Http

11. Sizing Handles make it very easy to resize virtually any control when developing applications with VB.NET. When working in form design view, how are these sizing handles displayed?

(A) A rectangle with 4 arrows, one in each corner, around your control.(B) A 3-D outline around your control.(C) A rectangle with eight small squares around your control.(D) None of the above.

 

12. The Font dialog box allows you to select different Fonts, their style, their size, and some other special effects. How do you bring up this Font dialog box?

(A) In the Properties window, click the ellipsis (…) on the right side of the settings box for the Font property.

(B) Double-click the textbox, and select Font Property.(C) Right-click the textbox, and select Font Property.(D) None of the above.

 

13. What keyboard shortcut allows you to run the current program?

(A) F4(B) F5(C) F6(D) F7

 

14. What would be a good name for a text box to hold a persons first name?

(A) txtFirstName(B) FirstName(C) txt First Name(D) First Name

 

15. What feature in VB.NET allows you to make more room on your desktop by temporarily minimizing tool windows?

(A) Help(B) Auto Hide(C) Auto Minimize(D) Expert-View

 

Page 4: Http

16. Which property is available for most controls that allows you to hide/unhide them ether manually by setting the property or by setting it during runtime via code?

(A) Clear(B) Refresh(C) Visible(D) View-Control

 

17. Changing a control's Text property also changes how you refer to the control in code. (T/F)

 

18. You can display the Properties window by pressing F4. (T/F) 

19. The Properties window is used to change how objects look and react. (T/F) 

20. When working with text boxes, the sizing handles allow you to resize the object by dragging to make it wider or narrower. (T/F)

 

21. Once a text box control is placed on a form, it can not be resized or moved. (T/F) 

22. F5 is the keyboard shortcut used to activate the Properties window. (T/F) 

23. Once a control is placed on your form, you can rename it by editing the Name property in the Properties window. (T/F)

 

24. The Description pane, located below the Properties windows, shows a brief explanation of the highlighted property. (T/F)

 

25. The ForeColor property of a text box changes the color of the form containing the text box. (T/F)

 

26. Shortcut keys like F5 (Run), allow you to perform certain tasks without the use of the mouse. (T/F)

 

27. The recommended prefix for the name of a button control is btn. (T/F) 

Page 5: Http

Section 3.2 VB.NET Events

1. When the user clicks a button, _________ is triggered.

(A) an event(B) a method(C) a setting(D) a property

 

2. Which of the following is not one of the three steps used to create a VB.NET program?

(A) create the interface(B) set the properties of the object(C) specify the methods(D) write the code

 

3. Reserved words in VB.NET are words that

(A) should be used when naming variables.(B) are used to name controls, such as TextBox1, Command2, etc.(C) have special meaning and should not be used when naming variables.(D) are used as prefixes for control names (such as txt, btn, lbl, and lst).

 

4. IntelliSense is a technology built into VB.NET that assists the programmer by

(A) automatically inserting text and words that have similar meaning to those currently being entered by the programmer.

(B) allowing the programmer to edit object properties from inside the code window.(C) replacing misspelled words with the correct spelling as soon as the programmer

presses the Enter key.(D) automatically displaying the methods and properties available to a control.

 

5. What of the following is a correct statement for specifying the words to appear in the title bar of Form1?

(A) Form1.Text = "My Text"

(B) Form1.TitleBar = "My Text"

(C) Me.Text = "My Text"

(D) Me.Caption = "My Text"

 

Page 6: Http

6. Select the code statement that will set the current text color to Red.

(A) txtBox.ForeColor = "Red"

(B) txtBox.ForeColor = Red

(C) txtBox.ForeColor = Color.Red

(D) txtBox.ForeColor = "Color.Red"

 

7. When will the following event procedure be executed?

Private Sub txtBox_TextChanged(…) Handles txtBox.TextChanged

(A) when text is added to the text box(B) when text is deleted from the text box(C) when text is modified inside the text box(D) all of the above

 

8. What is the function of the rectangle in the Code window containing the words “Windows Form Designer generated code”?

(A) You click on it to invoke the Form Designer.(B) It is code that is replaced once the developer starts entering new code.(C) It hides a block of code containing information about the form and the controls

placed on it.(D) It identifies the current window as the Code window.

 

9. Which of the following statements specifies that the color of the text in txtBox be red?

(A) txtBox.Text = Color.Red

(B) txtBox.ForeColor = Color.Red

(C) txtBox.ForeColor = Red

(D) txtBox = Color.Red

 

10. The statement

btnButton.Focus()

(A) has no effect.(B) moves the focus to the button btnButton.(C) has the same effect as clicking on the button btnButton.(D) is invalid in VB.NET.

 

Page 7: Http

11. Which of the following statements sets the words on a button to "Push Me"?

(A) btnButton.Name = "Push Me"

(B) btnButton.Text = Push Me

(C) btnButton.Text = "Push Me"

(D) btnButton = "Push Me"

 

12. Which of the following is a valid statement in VB.NET?

(A) Form1.Text = "Revenue"

(B) Form1.Caption = "Revenue"

(C) btnButton.Text = Push Me

(D) Me.Text = "Revenue"

 

13. A user action such as clicking a button is called:

(A) an accident(B) an event(C) a procedure (D) a property

 

14. VB.NET responds to events using which of the following?

(A) a code procedure (B) an event procedure (C) a form procedure(D) a property

 

15. Which of the following statements will place "Greetings" in the title bar of a form?

(A) Me.Title = "Greetings"

(B) Me.Text = "Greetings"

(C) Me.Name = "Greetings"

(D) Me.Heading = "Greetings"

 

16. The following lines of code are valid. (T/F)

Private Sub Click(...) Handles Click txtBox.Text = ""End Sub

 

17. Keywords are also referred to as reserved words. (T/F) 

Page 8: Http

18. Member Listing is a helpful feature produced by the Microsoft Technology called IntelliSense. (T/F)

 

19. The smart editor built into VB.NET will automatically detect certain types of errors as you are entering code. (T/F)

 

20. The statement

txtBox.Font.Bold = True

will produce an error message when VB.NET tries to execute it. (T/F) 

21. After the statement txtBox.Text = "" is executed, the text box will be clear and the cursor will appear inside the text box. (T/F)

 

22. In the Code window, the Class Name box lists all controls defined for the form (T/F) 

23. The VB.NET editor automatically capitalizes the first letters of reserved words. (T/F) 

24. The first line of an event procedure must contain both the keyword Sub and Handles. (T/F)

 

25. The statement btnButton = "Press" produces an error message. (T/F) 

26. Write a statement that gives the focus to btnCompute. 

27. Write a statement that disables btnCompute. 

Section 3.3 Numbers

1. Which one of the statements below is equivalent to the following code?

With lstBox.Items .Add (5)End With

(A) lstBox.Items.Add(5)

(B) lstBox.Items Add(5)

(C) Add.lstBox.Items(5)

(D) Add lstBox.Items(5)

 

Page 9: Http

2. What is the correct statement when declaring and assigning the value of 100 to an Integer variable called commission?

(A) Dim commission = 100

(B) Dim commission = Int(100)

(C) commission = 100

(D) Dim commission As Integer = 100

 

3. What is the value of Int(8.9)?

(A) 8(B) 8.9(C) 9(D) 1

 

4. The type of error that is normally spotted by the editor is:

(A) runtime(B) logical(C) syntax(D) user

 

5. Which of the following arithmetic operations has the highest level of precedence?

(A) +-(B) */(C) ^(D) ( )

 

6. Which of the following statements removes all text from lstBox?

(A) lstBox.Clear()

(B) lstBox.Items.Clear()

(C) lstBox.Text.Clear()

(D) lstBox.Items.Add("")

 

7. What will be the contents of the variable x after the following statement is executed?

x = Math.Sqrt(((9 + 7) / (4 * 2)) + 2)

(A) 1(B) 2(C) 3(D) 4(E) None of the above

 

Page 10: Http

8. Suppose the Double variable num has the value 123.4567. What value will the following statement assign to num?

num = Math.Round(num, 2)

(A) 123.4567(B) 123.457(C) 123.45(D) 123.46

 

9. What value will be assigned to the numeric variable x when the following statement is executed?

x = 2 + 3 * 4

(A) 20(B) 14(C) 92(D) 234

 

10. Which of the following statements declare the variables a and b as type Integer?

(A) a = 0: b = 0

(B) Dim a, b

(C) Dim a & b As Integer

(D) Dim a, b As Integer

 

11. Assume that x, y, and temp are Integer variables. Which of the following lines of code swaps the values of x and y?

(A) x = yy = x

(B) x = tempx = yy = temp

(C) temp = xx = yy = temp

(D) x = ytemp = xy = temp

 

Page 11: Http

12. Which of the following is a valid name for a variable?

(A) Two_One(B) 2One(C) Two One(D) Two.One

 

13. Given x = 3 and y = 1, what value will be assigned to the Double variable w when the following statement is executed?

w = (x + y) / (x – y)

(A) 1(B) 2(C) 3(D) None of the above

 

14. What will be displayed when the following lines are executed?

Dim x As Double = 3, y As Double = 1Dim z As Doublez = x + (y * x)x = yz = x + zlstBox.Items.Add(x + y + z)

(A) 4

(B) 9

(C) 10

(D) None of the above 

15. Which of the following is the same as 2 ^ 3?

(A) 2 * 2 * 2(B) 2 * 3 (C) 2 + 2 + 2 (D) 3 * 3

 

16. Which of the numbers below is equivalent to 0.000017489?

(A) 1.7489E+05(B) 17489E+06(C) 1.7489E-06(D) 1.7489E-05

 

Page 12: Http

17. When declaring a variable that will refer to a submarine, a good name for the variable is sub. (T/F)

 

18. The function Math.Int will always round mixed numbers down to the next lowest integer. (T/F)

 

19. When using the equal sign to assign values, the variable on the left hand side of the equal sign will always receive the value. (T/F)

 

20. The variables firstName and firstNAME are identical. (T/F) 

21. The following statement assigns 6 times the value of y to x. (T/F)

x = 6y

 

22. The following statement is valid. (T/F)y = y + 72

 

23. A numeric variable that has not been assigned a value has the value zero. (T/F) 

24. The following statement is valid. (T/F)

Dim x As Double = 3,542.36

 

25. The statement a + b = c assigns to c the sum of the values of a and b. (T/F) 

26. The exponential notation used in VB.NET is exactly the same as standard mathematical notation. (T/F)

 

27. The lstBox.Items.Clear() statement is used to clear the contents of a list box. (T/F) 

28. VB.NET always displays numbers in decimal format. (T/F) 

29. Each word inside a With block that is preceded by a period is evaluated as if it had the phrase following the With statement as a prefix. (T/F)

 

Page 13: Http

30. You are required to declare every variable before its use.(T/F) 

31. An assignment statement is used to assign a value to a variable or property. (T/F) 

32. You can use a variable name in almost any place you could use a literal value. (T/F) 

33. Numeric variables can be initialized to zero or any other number, but once they are initialized, they cannot be changed. (T/F)

 

34. The following two statements are equivalent. (T/F)

var1 = var2var2 = var1

 

35. The following two statements are equivalent, where numVar is a numeric variable. (T/F).

numVar = numVar + 1numVar += 1

 

36. What is the value of numVar after the following three statements are executed?

Dim numVar As Integer = 5numVar = numVar + 2numVar += 3

 

Section 3.4 Strings

1. Which of the following statements is a valid assignment statement?

(A) txtBox = "Hello World"

(B) "Hello World" = txtBox.Text

(C) txtBox.Text = "Hello World"

(D) Text.txtBox = "Hello World"

 

Page 14: Http

2. What is the correct syntax for displaying the value of the String variable myString in a text box?

(A) txtBox.Text = "myString"

(B) txtBox.Text = myString

(C) txtBox.Text.myString

(D) txtBox.Text = Str(myString)

 

3. Which of the following code statements generates an error?

(A) txtFirst.Text = "Hello"

(B) txtFirst.Text = Hello

(C) txtFirst.Text = "My Text"

(D) txtFirst.Text = Me.Text

 

4. Which of the following statements will NOT display the number 5 in the text box?

(A) txtBox.Text = 5

(B) txtBox.Text = "5"

(C) txtBox.Text = CStr("5")

(D) txtBox.Text = CStr(5)

 

5. Which statement will assign the words “Hello World” to a text box?

(A) txtBox.Text = Hello & World

(B) txtBox.Text = "Hello " & World

(C) txtBox.Text = Hello & " World"

(D) txtBox.Text = "Hello" & " World"

 

6. Which of the following expressions has as its value the value of strVar with its leading and trailing spaces removed?

(A) strVar.Length

(B) strVar.ToUpper

(C) strVar.Ctrim

(D) strVar.Trim

 

7. Which of the following expressions has as its value the words "Hello World” surrounded by quotation marks?

(A) "Hello World"

(B) Chr(34) & "Hello World"

(C) Chr(34) & Hello World & Chr(34)

(D) Chr(34) & "Hello World" & Chr(34)

 

Page 15: Http

8. Which statement can be used to clear the contents of a text box?

(A) txtBox.Empty = True

(B) txtBox = ""

(C) txtBox.Text = ""

(D) txtBox.Wipe()

 

9. What character is used to signify the beginning of a comment statement?

(A) asterisk(B) exclamation mark(C) apostrophe(D) backslash

 

10. The joining of two strings together to form a new string is called

(A) concatenation.(B) addition.(C) compaction.(D) substrings.

 

11. Asc("A") is 65. What is Asc("C")?

(A) 66(B) 67(C) 68(D) "C"

 

12. Asc("A") is 65. What is displayed by txtBox.Text = Chr(65) & "BC"?

(A) ABC

(B) A BC

(C) 656667

(D) Not enough information is available. 

13. Given the data assigned to the string variable y shown below, which of the following statements will assign the value ALL to the string variable x?

y = "WHEN ALL ELSE FAILS, READ THE DIRECTIONS"

(A) x = y.Substring(5)

(B) x = y.IndexOfStr("ALL")

(C) x = y.Substring(6, 3)

(D) x = y.Substring(5, 3)

 

Page 16: Http

14. What will be the output of the following statement?

txtBox.Text = CStr(Math.Round(17 / 2))

(A) 8

(B) 9

(C) 8.5

(D) 17.00

 

15. What will be the output of the following lines?

Dim alphabet, soup As Stringalphabet = "abcdefghijklmnopqrstuvwxyz"soup = alphabet.ToUppertxtBox.Text = alphabet.Substring(0, 5) & soup.Substring(0, 5)

(A) abcdeABCDE

(B) ABCDEABCDE

(C) eE

(D) EE

 

16. What is the value of ("12/15/02").Substring(3,2)?

(A) /15

(B) 15.

(C) /15/

(D) 12/15/97

 

17. What will be the value of numVar when the following code is executed?

Dim strVar As String, numVar As IntegerstrVar = "Now is the time for all good men"numVar = strVar.IndexOf("the time for")

(A) "Now is all good men"

(B) "12"

(C) 7

(D) 8

 

Page 17: Http

18. What will be displayed when the following lines are executed?

Dim a, b, c As Stringa = "THE WHOLE"b = "PART"c = a.Substring(CInt(Math.Sqrt(4)), b.Length)txtBox.Text = CStr(c)

(A) THE WHOLE PART

(B) 6

(C) E WH

(D) HE W

 

19. What will be displayed when the following lines are executed?

Dim x As Double = 2'x = 3txtBox.Text = CStr(x)

(A) 3

(B) 0

(C) 2

(D) None of the above 

20. The symbol for the string concatenation operator is

(A) @(B) &(C) %(D) #

 

21. What will be the output of the following line?

txtBox.Text = "2" & 3

(A) 23

(B) 2 3

(C) 5

(D) Syntax error 

22. The following statement contains what type of error?

txtAverage.Txt = CStr(CDbl(txtNum1.Text) + CDbl(txtNum2.Text) / 2)

(A) a syntax error only(B) a logic error only(C) both a syntax error and a logic error(D) no errors

 

Page 18: Http

23. To continue a long statement on another line, use

(A) an underscore character.(B) an ampersand character.(C) Ctrl + Enter.(D) a space followed by an underscore character.

 

24. If strVar.Length is 5, then the value of

strVar.Substring(4, 1)

is the last character of the value of strVar. (T/F) 

25. The value of strVar.Length is the number of characters in the value of strVar. (T/F)

 

26. The following lines are valid. (T/F)

Dim h As String = "Hello"txtBox.Text = CStr(h.IndexOf("h"))

 

27. All comment statements must be placed at the beginning of a program. (T/F) 

28. The statement txtBox.Text = Chr(162) causes VB.NET to display the cents symbol (ANSI 162) in the text box, regardless of the font in use. (T/F)

 

29. The statement lstBox.Items.Add("") clears all the text from the list box. (T/F) 

30. The statement txtBox = "Hello" is an example of a syntax error. (T/F) 

31. A string variable that has not been assigned a value has the empty string as its value. (T/F)

 

32. The following statements assign the lowercase letters to the string variable alphabet. (T/F)

Dim alphabet As Stringalphabet = abcdefghijklmnopqrstuvwxyz

 

Page 19: Http

33. The following statement is valid where dog and cat are variables of the same type. (T/F)

dog = cat

 

34. A string literal is a sequence of characters that is treated as a single entity. (T/F) 

35. When declaring a variable of type String, you must specify a length for the string.(T/F)

 

36. Type casting is used to convert a value to a different data type. (T/F) 

37. The Trim method is used to remove all blank space before and after a string. (T/F) 

38. The Substring method is used to extract a portion of a string. (T/F) 

39. The empty string is the same as a string that contains one space. (T/F) 

40. The empty string is the default value for String variables. (T/F) 

Section 3.5 Input and Output

1. Which format statement should be used when you want to output your results in tabular format with the first column 10 characters wide, the second 5, and the third 10?

(A) Dim fmtStr as String = "{10}{5}{10}"

(B) Dim fmtStr as String = "{0}{1}{2}"

(C) Dim fmtStr as String = "{0, 10}{1, 5}{2, 10}"

(D) Dim fmtStr as String = "{0, 10; 1, 5; 2, 10}"

 

2. What is the proper syntax when using a message dialog box?

(A) MsgBox("Hi there", , "Hi")

(B) MsgBox(Hi there, , Hi)

(C) MsgBox "Hi There", , "Hi"

(D) MsgBox Hi There, , Hi

 

Page 20: Http

3. Which declaration statement is used when you want to read data from the file DATA.TXT?

(A) Dim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT")

(B) Dim sr As IO.StreamReader = IO.File.OpenText(DATA.TXT)

(C) Dim DATA.TXT As IO.File.OpenText

(D) Dim IO.File.OpenText("DATA.TXT")

 

4. Which of the following is not used to assign a value to a variable?

(A) InputBox(B) ReadLine(C) an assignment statement(D) MsgBox

 

5. After the statement

Dim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT")

has been executed, which of the following statements will close the file?

(A) "DATA.TXT".Close()

(B) Close "DATA.TXT"

(C) sr.Close()

(D) Close sr

 

6. Suppose the first two lines of the file DATA.TXT contain the strings Clint and 1930. What is displayed by the following lines of code?

Dim name As String, birthYear As IntegerDim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT")name = sr.ReadLinebirthYear = CInt(sr.ReadLine)txtBox.Text = "In 2005, " & name & " will be " & (2005 – birthYear)sr.Close()

(A) Clint, 1930

(B) In 2005, Clint will be 2005 – 1930

(C) In 2005, "Clint" will be 75

(D) In 2005, Clint will be 75

 

Page 21: Http

7. The statement

Dim sr As IO.StreamReader = IO.File.OpenText("DATA.TXT")

will try to open the file from which folder?

(A) “My Documents”(B) The Windows default temporary folder (usually “C:\Windows\Temp”)(C) The folder in which VB.NET was installed.(D) A folder named bin.

 

8. Which statement prompts the user for a name and then assigns the name to the string variable strName?

(A) strName = InputBox("What is your first name?", "First Name")

(B) strName = Msgbox("What is your first name?", "First Name")

(C) InputBox("What is your first name?", "First Name") = strName

(D) Msgbox "What is your first name?", "First Name" = strName

 

9. Suppose you are 20 years old, num is an integer variable, and the statement

num = 1 + CInt(InputBox("How old are you?"))

is executed and responded to? What will be the output of

txtBox.Text = num & " years old"

(A) 1 + "How old are you?"

(B) Syntax error(C) 20 years old

(D) 21 years old

 

10. What will be displayed when the following lines are executed?

Dim x As Double = 2Dim y As Double = 3Dim fmtStr As String = "{0,-5}{1, -5}"lstOutput.Items.Add("1234567890")lstOutput.Items.Add(String.Format(fmtStr, x, y))

(A) 1234567890 (B) 1234567890 (C) 1234567890 (D) 1234567890 23 2 3 2 3 2 3

 

Page 22: Http

11. What will be displayed when the following lines are executed?

Dim fmtStr As String = "{0,-4:C0}{1, 6:P1}"lstBox.Items.Add("123456789012")lstBox.Items.Add(String.Format(fmtStr, 2.25, 0.375))

(A) 123456789012 (B) 123456789012 (C) 123456789012 (D) 123456789012 $2.00 37.5% $2 0.375 % $2.00 37 % $2 37.5 %

 

12. Give a declaration statement for the format string fmtStr that will produce the output

1234567890a bc

when the following lines of code are executed.

lstOutput.Items.Add("1234567890")lstOutput.Items.Add(String.Format(fmtStr, "a", "bc"))

(A) Dim fmtStr As String = "{0,4}{1,4}"

(B) Dim fmtStr As String = "{0,-4}{1,-4}"

(C) Dim fmtStr As String = "{0,-4}{1,4}"

(D) Dim fmtStr As String = "{0,4}{1,-4}"

 

13. What message will be displayed by the following statement:

MsgBox("This is a test.", , "Test")

(A) This is a test.(B) Nothing.(C) Test(D) This is a test. Test

 

14. What is the displayed in the title bar of the message dialog box by the following statement?

MsgBox("This is a test.", , "Test")

(A) This is a test.(B) Nothing.(C) Test(D) The same as the name of the program.

 

Page 23: Http

15. What will be the output of the following statement?

txtBox.Text = FormatCurrency(1234.567)

(A) $1234.567

(B) 1,234.57

(C) $1234.57

(D) $1,234.57

 

16. What will be the output of the following statement?

txtBox.Text = FormatNumber(1234.56789, 3)

(A) 1234.568

(B) 1230

(C) 1,234.568

(D) 1,230

 

17. What will be the output of the following statement?

txtBox.Text = FormatPercent(2/3, 4)

(A) 0.6666

(B) 0.6667

(C) 66.66%

(D) 66.6667%

 

18. Which of the following expressions will yield the string "John Doe", where name1 = "John Blake" and name2 = "Janet Doe"?

(A) name1.Substring(0, 4) & name2.Substring(6, 8)

(B) name1.Substring(0, 4) & name2.Substring(0, 3)

(C) name1.Substring(0, 5) & name2.Substring(6, 3)

(D) None of the above. 

19. The value of FormatCurrency(12345) is $12,345.00. (T/F) 

20. When using zones to display output in a table, you should use a fixed width font like Courier New? (T/F)

 

21. When reading from a file in the bin subfolder of the program's folder, there is no need to specify the path. (T/F)

 

Page 24: Http

22. If sr is a StreamReader, then a statement of the form var = sr.ReadLine reads an item of data from a file and assigns it to the string variable var. (T/F)

 

23. The value returned by InputBox is a string. (T/F) 

24. Write a statement that assigns the first character of the value of strVar1 to strVar2. 

25. Write a statement that assigns the last character of the value of strVar1 to strVar2. 

26. Write a statement that produces a message dialog box with the words "US Motto" in its title bar and the message "E PLURIBUS UNUM".

 

27. Write a statement that produces an input dialog box with the words "US Motto" in its title bar and the message "E PLURIBUS UNUM".

 


Recommended