Upload
meljun-cortes-mbampa
View
223
Download
0
Embed Size (px)
Citation preview
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
1/30
ExamName
MULTIPLECHOICE. Choose the one alternative that best completes the statement or answers the question.1) Which of the following is NOT an example of an event in VB?
A) Change focus of a control B) Click a controlC) Drag a control onto a form from the tool box D) Change contents of a textbox
Answer: C2) The process of debugging is to .
A) ensure that all of the documentation is completeB) ensure that the outputs are correctC) remove any syntax or run time errorsD) both Band C
Answer: D3) What is the code to close a form?
A) Form.Exit() B) Form.Close()Answer: CC) Me.Close() D) Me.Clear( )
4) GUI (Graphical User Interface) applications .A) requires users to follow a predefined orderB) requires users to know commands before using themC) are more complex for programmers to writeD) more difficult to use
Answer: C5) Which of the following is NOT a feature of the use of Graphical User Interfaces?
A) Programs that use a GUI are normally easier for the user to useB) GUIs are made of objects such as buttons, dialog boxes, and menusC) The use of a GUI makes programming much easierD) GUIs have helped influence the shift to object-oriented programming
Answer: C6) One feature of Even- Driven Programming is _
A) an action takes place when a control such as button is pushedB) that each procedure is called in orderC) that it is used by the earliest programming languagesD) most even-driven programs are text based
Answer: A7) In Visual Basicwe work with objects, which have .
A) projects, solutions, and proceduresC) programmer preference
Answer: B
B) properties, methods, and eventsD) classes, actions, and disciplines
1
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
2/30
8) What is the purpose of the Toolbox?A) To select controls with associated event proceduresB)To select controls and place on an application formC) To select methods to be placed on the formD) To design user defined methods
Answer: B
9) How would you get the Design window to display if it is not visible in your project?A) Double clickthe icon in the tool bar for the designer window.B) Click View on the menu bar, and then on the View menu click Designer.C) Press Shift+F9 on the keyboard.D) Select view designer in the edit menu.
Answer: B10) A VBkeyword .
A) should be used instead of the default names supplied by VBB)has a special purpose and cannot be used as a variable or other identifierC) can only be used to name VBcontrolsD) is used to name the forms for VBprojects
Answer: B11)Which is considered a valid step for developing a Visual Basic application?
A) Create a flowchart or pseudocode version of each methodB)Make a list of the controls neededC) Make a list of methods needed for each controlD) all of the above
Answer: D12) Finding and fixing programming errors is called .
A) debugging B) recoding C) fix-itsAnswer: A
D) tuning
13) If you want to display text which cannot be modified by the user, use the 'A) Label control B) TextBox control C) Name control
Answer: AD) Caption control
14) Application software are programs thatA) perform general user needsC) manage the computer's hardware devices
Answer: A
B) performs diagnostic tests on secondary storageD) controls the computers input/output
15) Which of the following is NOT a Visual Basic Control?A) TextBox B)Label
Answer: DC) Form D) Algorithm
16) A TextBox control .A) is used to describe other controls on the formC) can be used to display graphical images
Answer: D
B) has the same function as a label controlD) is typically used to input data
2
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
3/30
---
'\(17);A ToolBar .\
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
4/30
25) What is the purpose of testing a program with sample data?A) To be sure that the user has input a valid numberB)To check to see if the program will runC) To insure that the program handles the calculations correctlyD) To be sure that there are no syntax errors in the program
Answer: C
26) The CPU only processes instructions written in this language.A) machine language B) Visual Basic C) JavaAnswer: A
D) Pseudo code
27) All of the following are major hardware components of a typical computer system except .A) CPU B)Main Memory C) secondary storage D) Operating System
Answer: D28) Programs should use comments (remarks) to _
A) make a program run more efficientlyB)make the code more understandable to human readers of the programC) make the code run fasterD) make the program smaller in size
Answer: B; : : - - . . "g9) }The purpose of an algorithm is to '\j A) define user interface
C) specify problem requirementsAnswer: D
B)analyze a problemD) describe problem solution
30) The auto hide feature .A) will hide the controls on a form, until the programmer changes the statusB)permanently remove the toolbox from the VBenvironmentC) will cause the window to stay minimized as a tab along one of the edges of the screen until the mouse
cursor is over the tabD) enables the programmer to hide a control on a form automaticallyAnswer: C
/~/31) When your program is in run time mode, you _\,,) A) can create the user interface
C) can save your programAnswer: B
B) can interact with the program as it executesD) can always edit your program
32) Which is true of an Identifier?A) It is a programmer defined name.B) It is not part of the Visual Basicprogramming language.C) It has special meaning in VB.D) Both A and Bare correct.
Answer: D
4
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
5/30
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
6/30
33) Which of the following FormBorderStyle values will create a Border that can be resized, closed, minimized, ormaximized?A) Sizable
Answer: AB) Fixed3D C) None D) FixedDialog
34) What will the following section of code do?
Pr i vat e Sub bt nExi t~Cl i ck(ByValByVal e as System EventArgs)Me. Cl ose( )End Subsender As System Obj ect ,Handl es btnExi t . Cl i ck
A) Log off the current userC) Close the current form
Answer: C
B)NothingD) Shut down the computer
35) Event procedures are also known asA) properties B) controls
Answer: DC) keywords D) event handlers
36) The property of a label determines if the label can be seen by the user.A) Visible B) Font C) Selected
Answer: AD) Size
37) If you accidentally delete a control you can restore it with the .A) Redo button on the standard toolbar B) Find button on the standard toolbarC) Restore property D) Undo button on the standard toolbar
Answer: D38) Assume you have a Button control named btnDisplayList. Which is the correct name for an event procedure
that will be executed when the user clicks on the control?A) _Click btnDisplayListC) btnDisplay List_ClickEvent B)btnDisplayList_ ClickButtonD) btnDisplayList_Click
Answer: D39) You can display the Code window in all of the following ways except '
A) click View on the menu bar, and then click the Code commandB) click view code button on the Solution Explorer windowC) click Project on the menu bar, and then click show all filesD) press the F7 key
Answer: C40) You can end an application that is running in Visual Basic .NET in all of the following ways except _
A) click the close button on the applications windowB) click the down arrow on the Debug list box, and then click on releaseC) click Debug on the menu bar, and then click Stop Debugging on the Debug menuD) double click the Stop Debugging Icon on the extended Tool Bar while the program is running
Answer: B
5
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
7/30
41) In the properties window, a few of the properties, including the Name property are enclosed in tomake them appear at the top of the alphabetical list.A) quotes B) parenthesis C) asterisks D) brackets
Answer: B42) This property is used to automatically adjust an image to fit the size of the PictureBox control it is displayed in.
A) SizeAdjust B) AutoAdjust C) AutoSize D) SizeModeAnswer: D
43) [ntellisense .'~. A) allows the user to easily modify properties for a control at design time
B) provides some automatic code completion while developing a programC) is a feature that will help the programmer use proper naming conventionsD) provides hints about the input data requested from the user
Answer: Bi44}Which of the following is not a valid value for the FormBorderStyle property?\.,./ A) FixedSingle B) Fixed3D C) Sizable
Answer: DD) FixedDouble
/:"'.
~; You can ~iew the properties window when the project is available by doing any of the following actions exceptA) go to the view menu and the clicking properties.B)pressing the Ctrl/Alt/P keysC) by clicking on the properties icon above the Solutions explorer windowD) pressing the F4 key
Answer: B46) During design time a control will when the Visible property is set to false.
A) be active B) be inactive C) be displayedAnswer: C
D) not be visible
47) When you have an item selected and then you press the F1 key, the is displayed.A) tool-tip for the item B) context-sensitive helpC) the solution explorer window D) properties window
Answer: B48) Choose the correct assignment statement for a Label control named IblTitle that would align the control's text
with the middle and center of the control's bounding box?A) l bl Ti t l e. Text Al i gn = Cont ent Al i gnment . M ddl eCent er~ bl Ti t l e. Text Al i gn =M ddl eCent erC) I bl Ti t l e. Text Al i gn = Cont entAl i gnment . Cent erD) l bl Ti t l e. Text Al i gn =M ddl e
Answer: A49) The properties of the controls are listed '
A) solution explorer windowC) in the properties window
Answer: C
B) in the options windowD) in the project window
6
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
8/30
50) You save a Visual Basic .NET project in all of the following ways except _A) click the Save Project button on the standard toolbarB) click the Save All button on the standard toolbarC) click File on the menu bar, and then click Save All on the File menuD) press Ctrl+Shift+S on the keyboard
Answer: A
51) You can run an application in all of the following ways except .A) click the start button on the toolbarB) press the F5 keyC) click Debug on the menu bar, and then click Start on the Debug menuD) press the Ctrl F4 keys
Answer: D52) When you select an existing control on a form during design time .
A) the project will automatically be saved B) the tool box will be visibleC) the sizing handles appear D) its color changes to dark blue
Answer: C
53) Programs should use comments (remarks) to .A) make a program run more efficientlyC) make the code more understandable
Answer: C
B) help with program designD) assist with debugging a program
rr>.- '\t54) A is a section of code that may be hidden from view, or collapsed.\..f A) code segment B) code window C) a sub procedure
Answer: DD) code region
55) You lock all of the controls on a form during design time by _A) clicking Window on the Menu Bar, then clicking Lock ControlsB) left-clicking the form, then clicking Locked on the properties windowC) right-clicking the form, then clicking the lock controls icon on the toolbarD) right-clicking on an empty spot on the form, and selecting the Lock Controls option from the pop up
menuAnswer: D
,(56)lf you want to prevent the user from resizing, minimizing, or maximizing a window, you would change the
form's property.A) W ndowSt at eC) M nMaxSi ze
Answer: B
B) For mBor der St yl eD) Show nTaskBar
57);All of the following steps allow you to delete a control from a form except _< A) select the control, then hit the delete key
B) select the control, and then click on the delete icon in the menu barC) select the control, then select delete from the edit menuD) select the control, and then use the cut option on the menu bar
Answer: B
7
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
9/30
---.-- -------------
58) A Label control's property allows a label to change size to fit the amount of text in its text propertyA) Vi si bl e B) Si ze C) Aut asi ze D) TextAl i gn
Answer: C59) What is the resulting value after the following function call is executed: FormatNurnber(73.394, I)?
A) 73.4 B) 73.3 C) 73 D) 73.39Answer: A
60) Each of the Visual Basic data types has a method, which returns a string representation of thevariable calling the method.A) Convert B) String
Answer: DC) ToText D) ToString
61) When you assign a value of one data type to a variable of another data type, Visual Basic .NET attemptsA) Implicit conversionC) String conversion
Answer: A
B) Explicit conversionD) Boolean conversion
. 62) The statement to declare a local variable named Index (note: the prefix has intentionally been left out) that will\ !' / store whole numbers is:A) Dim index As Integer B) Dim Integer As IndexC) Dim index As Whole D) Dim index As String
Answer: A63) What will be the value of intAnswer after execution of these statements?
Canst i nt NumA As I nt eger = 6Canst i nt NumB As I nt eger = 4Canst i nt NumC As I nt eger = 2i nt Answer = i nt NumA + i nt NumB * i nt NumCA) 20
Answer: CB) 48 C) 14 D)6
64) Variables declared within a button's click-event are variables.A) local B) private C) global
Answer: AD) module-level
65) The order in which controls receive the focus is called the _A) tab order B) control order C) sequence order
Answer: AD) focus order
8
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
10/30
66) What is the value of intE after the following section of code is executed?Dim intC As IntegerDim intO As IntegerDim intE As IntegerintC = 20intO = 3intE = intC \ indO
A) 6.66667 B) 0 C)6 D)7Answer: C
67) Which of the following is not a valid data type?A) Real B) Integer
Answer: AC) String D) Decimal
68) What is the result after evaluating the following expression: 24Mod 9?A)5 B) -6 C)6
Answer: CD)2
69) The is used to perform string concatenation.A) percent symbol (%)C) pound symbol (#)
Answer: D
B) dollar sign ($)D) ampersand symbol (&)
(; ; '0 ) The lets you view the TabIndex of each of the controls on the form.""..) A) TabIndex viewer B) TaxIndex order mode
C) tab order selection mode D) sequence selection modeAnswer: D
71) Which of the following is the correct way to declare a variable that will be used to store the first name ofstudent?A) Dim first.name as CharC) Dim strFirstName as String
Answer: C
B) Dim firstname as Char[]D) Dim str.FirstName as String
72) What is the default value of the Date Data type?A) 12:00:00PM January I, of the year 1C) 12:00:00 PMJanuary 1,2000
Answer: D
B) 12:00:00AM January I, 2000D) 00:00:00, Date unspecified
73) What is the default value of the Boolean data type?A) 0 B) 1
Answer: CC) False D) True
74) Which of the following is not a valid rule for naming variables?A) Names may contain digits. B) Names may contain underscores.C) Names may contain letters. D) Names may contain spaces.
Answer: D
9
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
11/30
--------- ----
75) If you want to execute code automatically when a form is displayed, you can place the code in the form's____ event procedure.A) GotFocus B)Load C) Focus D) KeyPress
Answer: B76) The statement to declare strName as a variable that can hold text is .
A) Dim strName As Word B)Dim strName As TextC) Dim strName As String D) Dim strName As Single
Answer: C77) What is the error in the following code?
Pr i vate Sub bt nCal cul at e_Cl i ck( ByVal sender As Syst em Obj ect ,ByVal e As Syst em Event Ar gs) Handl es bt nCal cul at e. Cl i ck, Decl ar e some var i abl esDi m sngNumber l As Si ngl eDi m sngNumber 2 As Si ngl eDi m sngSum As Si ngl e, Get t he 2 number ssngNumber l = ( t xt Number l . Text )sngNumber 2 = ( t xt Number 2. Text )Cal cul at e t hei r sngSum. . . i s t he next l i ne wor ki ng?sngSum = sngNumber l + sngNumber 2, Di spl ay t he r esul tl bl Sum Text = sngSumToSt r i ng
End SubA) The sngSum variable was declared as the wrong data type.B)The variable name sngNumberI was misspelled.C) A local variable is misplaced.D) A conversion function such as CSng was not used.
Answer: D78) What isthe value of dblOutcome after the following section of code is executed?
Di m dbl A as Doubl eDi m dbl B as Doubl eDi m dbl C as Doubl eDi m dbl Out come as Doubl edbl A = 45dbl B = 30dbl C = 3 * dbl A/ dbl Bdbl Out come = 2 * dbl C + 15A)24
Answer: AB) 80 C)o D) 39
10
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
12/30
79) In a program, you clear a text box with code .A) by clicking the clear buttonB) by setting the focus on the control and using the delete keyC) by setting the focus on the control and using the back space keyD) by assigning a blank to the text property
Answer: D
80) The following code will copy the text from a TextBox named txtInput into a Label called IblDisplay.A) IblDisplay.Text =txtInput.Text B) txtInput =IblDisplayC) IblDisplay = txtInput D) txtInput.Text =IblDispl.ay.Text
Answer: A
81) Which of the following would be the correct command to remove all the leading and trailing spaces in a textboxnamed txtStudentID?A) Di m strSt udent I D as St r i ng
strSt udent I D = t xt St udent I DB) Di m st r St udent I D as St r i ngst r St udent I D = t xt St udent I D. TextC) Di m st r St udent I D as St r i ngstrStudent I D = t xt St udent I D. Text . Tr i m )D) Di m st r St udent I D as St r i ngst r St udent I D = RemoveSpaces( t xt St udent I D. Text )
Answer: C82) What is the value of sngTaxes when the following program segment runs, assuming the user enters 60000 into
the txtSalary textbox?Di m sngSal ar y As Si ngl e = 0Di m sngTaxes As Si ngl e = 0sngSal ar y = CSng( t xt Sal ar y. Text )I f ( sngSal ar y > 50000) ThensngTaxes = . 40 * sngSal ar yEnd I fI f ( sngSal ar y > 40000) ThensngTaxes = . 30 * sngSal aryEnd I fI f ( sngSal ar y > 30000) ThensngTaxes = . 20 * sngSal ar yEl se
sngTaxesEnd I f . 10 * sngSal ar yA) 24000
Answer: DB) 6000 C) 18000 D) 12000
11
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
13/30
~~-~.---. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83) Choose the correct Select Case statement which will check the value of a variable intMyNum and process asfollowing:value 1or 7 or 15value 2 or 9 or 21value 3 or 6 or 13none of the above
add 100to the variableadd 150 to the variableadd 200 to the variableprint "Cannot find it"
A) Sel ect Case i nt MyNur nCase val ue = 1 Or val uei nt MyNur n += 100Case val ue = 2 Or val uei nt MyNurn += 150Case val ue = 3 or val uei nt MyNur n += 200Case el set xt Out put . Text = "Cannot f i nd i t "
7 or val ue = 159 or val ue = 21
6 Or val ue = 13
End CaseB) Sel ect Case i nt MyNur n
Case val ue = 1, 7, 15i nt MyNur n += 100Case val ue = 2, 9, 21i nt MyNur n += 150Case val ue = 3, 6, 13i nt MyNur n += 200Case el set xt Out put . Text = "Cannot f i nd i t "End Case
C) Sel ect Case i nt MyNur nCase 1, 7, 15i nt MyNur n += 100Case 2, 9, 21i nt MyNur n += 150Case 3, 6, 13i nt MyNur n += 200Case el set xt Out put . Text = "Cannot f i nd i t "End Case
D) Sel ect Case Val ueCase i nt MyNur n = 1 Or 7 or 15i nt MyNur n += 100Case i nt MyNur n = 2 Or 9 or 21i nt MyNurn += 150Case i nt MyNur n= 3 Or 6 or 13i nt MyNur n += 200Case el set xt Out put . Text = "Cannot f i nd i t "
End CaseAnswer: C
12
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
14/30
- - - - - - . - - - - - - - - - - - - - - - - - ----- .._ . ---------
84) You want to check the variable sngSales, and change a labellblMessage to say "Great Year" if the value is atleast 50,000.Which ofthe following code segments does this?
A) I f sngSal es < 50000 ThenI bl Message. Text = "Gr eat Year "End I fB) I f sngSal es < =50000 ThenI bl Message. Text = "Gr eat Year "End I fC) I f sngSal es > 50000 ThenI bl Mess age. Text = "Gr eat Year "End I fD) I f sngSal es >= 50000 ThenI bl Message. Text = "Gr eat Year "End I f
Answer: D
85) What is the value of the String variable strSecond after the following code is executed?Di m st r Fi r st , st r Second As St r i ngst r Fi r st ="1 2 3 But t on My Shoe"st r Second = st r Fi r st Name. ToUpperA) "123BUTTONMYSHOE"C) "1 2 3 BUTTON MY SHOE"
Answer: C
B) "D) "1
BUTTON MY SHOE"2 3 bUTTON mY sHOE"
86) What would the following code return - with proper understanding of the If ...Then ...ElseIf statement whenthe score of 85is entered?
I f i nt Scor e > 60 ThenGr ade = "Passed"El seI f i nt Scor e > 70 ThenGr ade = "Your mot her st i l l l oves you"El seI f i nt Scor e >80 ThenGr ade = "Your par ent s woul d be Pr oud"El seI f i nt Scor e > 90 ThenGr ade = " Your f am l y i s pr oud of you"End I fA) PassedC) Your mother still loves you
Answer: A
B) Your parents would beProudD) Your family is proud of you
87) The Dim statement for a class-level variable must be outside any procedure, and between the _statement and the statement.A) Publ i c Cl ass, End Cl assC) Pr i vat e Sub, End Sub
Answer: A
B) Pr i vat e Sub, End Cl assD) Publ i c Cl ass, End Sub
13
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
15/30
--------- --------_
88) The first character in a string has an index of .A) 1C) the length of the string - 1
Answer: D
B) -1D) O
89) Visual Basic .NETuses to store characters, such as A, B, and C in memory.A) BCD code B)ASCII codeC) Extended ASCII code D) Unicode
Answer: D90) You want to check that the user has entered a value into a text box named txtBox, and respond with the
appropriate message if no value has been entered. Which of the following code segments does this?A) I f t xt Box. Text "bl ank" ThenMessageBox. Show( " dat a has been ent er ed")End I fB) I f t xt Box. t ext =" "ThenMessageBox. Show( "No dat a has been ent er ed" )End I fC) I f t xt Box " " ThenMessageBox. Show( "dat a has been ent er ed")End I fD) I f t xt Box. Text = " " ThenMessageBox. Show( "No dat a has been ent er ed" )End I f
Answer: C
14
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
16/30
91) What line of code would produce the following MessageBox (assume the value of intAnswer is 39)?
I"'- R .. I c-. I ,es:ult ! ._ " : 0 :~ " _ ~ )!
,_ -1& '. 39
GR:Gaddis:A20881116
A) MessageBox( i nt Answer . ToSt r i ng, "Resul t " , MessageBoxBut t ons. OK,MessageBoxI con. Quest i on)B) MessageBox( i nt Answer , "Resul t " , MessageBoxBut t ons. YesNo)
C) MessageBox( i nt Answer . ToSt r i ng, "Resul t " , MessageBoxBut t ons. OK,MessageBoxI con. I nf or mat i on)D) MessageBox( i nt Answer . ToSt r i ng, "Resul t " , MessageBoxBut t ons. OK,MessageBoxI con. Quest i on)
Answer: C92) To remove the spaces at the end of a string called strAddress and display the result in labellblAddress, you
would use which of the following statements?A) l bI Addr ess. Text = st r Addr ess. Tr i mEndB)st r Addr ess. Tr i mEnd = I bl Addr ess. TextC) l bI Addr ess. Text = st r Address . Tr i mD) l bl Address. Text = Tr i mSt ar t
Answer: A93) What is displayed in IblMessage.Text after the following code segment is executed?
Di m st r Namel As St r i ng = " J i m"Di m st r Name2 As St r i ng = " J ohn"I f st r Namel > st r Name2 Thenl bl Message. Text = " J i m i s gr eat er "El se l bl Message. Text = " J ohn i s gr eat er "End I fA) Jim is greater
Answer: DB)True C) False D) John is greater
15
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
17/30
-------------------- -------- -- ---- -- -- -----------------
94) Considering the logic of the 1... Then... Else statement, what will be the result of the following code if a score of88 is entered?I f i nt Scor e < 80 Then
gr ade = "C"El se i nt Scor e > 80 Then
gr ade = "A"
~\ ~
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
18/30
I.99)/Which of the following methods can you use to convert a string to an Integer? A) CNumber B)CInt C) IntC
Answer: BD)CInteger
100) A control's event is triggered just before the focus shifts to another control whose CausesValidationproperty is set to true.A) Verifying B) Validating C) Verified D) Validated
Answer: 0101) A counter is a that can be incremented or decremented each time a loop runs.
A) method B) integer C) statement D) variableAnswer: 0
102)What's wrong with the following code?For intIndex = 5 To 1
ListBox.Items.Add (intIndex )Next
A) In VB.Net, you must specify Next intIndex.B)Youneed to specify a negative step size in order to execute the loop.C) You cannot add a number to a list box.D) intIndex is not a proper Loop control variable.
Answer: B103) This method will erase all the items in the list box.
A) Items.Remove B) Items.DeleteAnswer: C
C) Items. Clear D) Items.Erase
104)What is the difference in execution between the two following sections of code?'Example 1Dim intCounter as IntegerintCounter = 0Do While intCounter < 10
lstOutput.Items.Add(intCounter * intCounter )Loop'Example 2Dim intCounterFor intCounter = 0 to 9
lstOutput.Items.Add(intCounter * intCounter )Next intCounter
A) The first example will execute one more time than the 2nd example.B)They will both do the same thing.C) The 1st example will not do anything.D) The 2nd example will execute one more time than the 1st example.
Answer: B
17
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
19/30
105) How would you get scroll bars on your list box?A) Set the scrollFlag of the listbox to TrueB)Visual Basic .NETwili automatically add a scroll bar to the list box when it contains more items than canbe displayed.
C) If you set the CheckedListBox flag at design time, then you will get scroll bars at run time.D) You cannot get scroll bars for a list box, only for a ComboBox.
Answer: B106) Which of the following code fragments finds the average of 5 numbers input via an input box and displays the
result in lblResult using a Do While statement?A) i nt Count = 0i nt Sum = 0Do Whi l e i nt Count < 5Val ue = CI nt ( I nput Box( "ent er a number " ) )i nt Sum = i nt Sum + val uei nt Count += 1LoopAvg = i nt Sum 5l bl Resul t . Text sngAvg. ToSt r i ngB)intCount = 0i nt Sum = 0Do Whi l e i nt Count
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
20/30
108)All of the following are styles of Combo Boxes, except 'A) Simple Combo Box B)Drop-Down Combo BoxC) Drop-Down List Combo Box D) List Combo Box
Answer: D109) The ToolTip is a that allows the user to creates a small box that displays when the user places the
mouse over the control.A) method
Answer: BB) control C) property D) function
110)What is wrong with the following code?intCount = 0Do While intCount < 10
lstOutput.Items.Add ("Good Job")LoopA) The count should start at -1B)This should be a For ... Next Loop.C) The text string Good Job should not have the " marks around it.D) The loop will never stop.
Answer: 0111)Which loop is a pretest that first initializes a counter variable and then increments the counter variable at the
end of each iteration?A) The Do While LoopC) The Count ... Until Loop
Answer: B
B)The For ... Next LoopD) The Do Until Loop
112) If a procedure is called more than once in a program, the values stored in the procedure's local variables willpersist only if declared with the keyword.A) Public B) Static C) Dim D) Const
Answer: B113)What is wrong with the following function?
Public Function sum( ByVal intA As Integer, ByVal intY As Integer) As IntegerDim intAns As IntegerintAns = intX + inty
End FunctionA) intAns should not be declared in the FunctionB)parameters a and b should be ByReparametersC) the Function does not return a valueD) the Function heading should be replaced with:
sum(ByVal intA As Integer, ByVal intY As Integer,ByRef intAns As Integer )
Answer: C
19
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
21/30
------------- ---- --------------. -
114)What is the problem with the following Sub procedure?Sub DisplayValue(Dim intNumber As Integer)
This displays a value.MessageBox.Show(intNumber.ToString)
End SubA) intNumber doesn't need to be converted to a stringB)Dim should not be used in the parameter variable declarationC) scope of procedure must be declaredD) all are problems
Answer: B115)Which is the correct general format to declare a variable that remains the samebetween procedure calls?
A) Static variableName As DataType B)VariableName As static = xC) Sub Static variableName ( ) D) Dim variableName As Static
Answer: A116)What is the correctway to declare the variable in tNumCall s at the top of a Function that would keep track of
the number of times that function has been called?A) Dim intNumCalls as Static IntegerB)Dim intNumCalls as IntegerC) Static intNumCalls as IntegerD) You can't do this with VB.NET- declare intCalls as a Class-Level Variable
Answer: C117)Which of the following calls does not pass in valid arguments to the following GetANumber subprocedure?
Sub GetANumber(ByVal intNumber as Integer), does some code
End SubA) GetANumber(intX)C) GetANumber(intX + 3, intY)
Answer: C
B)GetANumber(Cint(txtNumber.Text))D) GetANumber(3 + 5 * 8 + intX)
20
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
22/30
---------------------------- - ---
118) Which of the following is a correctly written Sub procedure that uses an input box to get an integer, which isreturned to the calling program?A) Publ i c Sub Get I nput ( )Di m i nt Number As I nt egeri nt Number = CI nt ( I nput Box( "Ent er an I nt eger ") )End SubB) Publ i c Sub Get I nput( ByRef i nt Number As I nt eger )i nt Number = CI nt ( I nput Box(" Ent er an I nt eger " ) )End SubC) Publ i c Sub Get I nput ( ByRef i nt Number As I nt eger )i nt Number = CI nt ( I nput Box( "Ent er an I nteger ") )Ret ur n i nt NumberEnd SubD) Publ i c Sub Get I nput ( ByVal i nt Number As I nt eger)i nt Number = CI nt ( I nput Box( nEnt er an I nt eger") )End Sub
Answer: B119) Which of the following can be returned by a function?
A) String valuesC) nonnumeric values
Answer: D
B)Boolean valuesD) All of the above
120) If you want to prevent statements from outside a form from accessing a procedure, you set the access specifierto in the procedure's declaration.A) Scope B) Publ i c C) St at i c D) Pr i vat eAnswer: D
121) A is a special variable in a Sub or Function heading that receives an argument's value/address from acalling procedure.A) original argumentC) temporary variable
Answer: B
B) parameterD) constant
21
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
23/30
----------- ----- ---. ---.-.- - --- ---. ---------
122) Which is the correct way to write the Function Square that receives a input parameter that is an integer andreturns the square of that parameter as an integer?
A) Funct i on Squar e( ByRef i nt Num As I nt egerDi m dbl Ans as Doubl edbl Ans = i nt Num * i nt NumRet ur n dbl AnsEnd Funct i onB) Funct i on Squar e( ByRef i nt Num As Doubl eRet ur n i nt Num * i nt NumEnd Funct i onC) Funct i on Squar e ( ByRef i nt Num as I nt eger ) As I nt egerRet ur n i nt Num * i nt NumEnd Functi onD) Funct i on Square ( ByRef i nt NumRet ur n i nt Num * i nt NumEnd Funct i on
Answer: C123) Which of the following does not apply to using Sub procedures and functions?
A) It will make it easier to maintain and modify code.B) The execution time is significantly reduced.C) You can modularize an application's code.D) You can write code once, and have it performed in many places.
Answer: B
124) The purpose of a compiler is to .A) aid the programmer in developing GUlsB) aid the programmer in commenting he/her codeC) convert a program from one programming language such as basic to C++D) convert a program from a programming language to machine code
Answer: D
125) Which of the following is NOT an acceptable name for a label?A) l bl Last Name B) l bl St at e C) l bl Fi r st Name
Answer: DD) l bl Addr ess
~. . . ..h26) T~s is a transparent rectangular area that defines the control's size.\.. // A) Bounding region B) Limiting region C) Bounding box. . . . . . -
Answer: CD) Size mode region
127) Event procedures are a type of procedure.A) module B) sub
Answer: BC) method D) function
22
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
24/30
128)What property would you change if you want to place the name on the top of a form named MyFirstForm?A) Forml.Tag B)Forml.text C) Form1.name D) Forml.caption
Answer: B129) Which statement is correct with respect to a project?
A) A project is a container that holds a solution.B) Visual studio creates a folder to hold the solution and project.C) A project is created and must belong to a solution.D) Both B and C are correct.
Answer: D'"\
1{30)Fompile time errors ',-,' A) are not syntax errors
B) cause the program to halt because an attempt was made to perform an invalid input operationC) are errors such as misspelled key words or incorrect use of operatorsD) are run-time errors found while the program is running
Answer: C
131) What is the purpose of using the following type of structure?Tr y Some st at ement sCat ch Ot her St at ementsEnd Tr yA) This is not a valid structure for VB.NET.B) to try different types of commands to see which one will give you the correct answerC) in order to catch any run-time errors such as divide-by-zero and not have the program shut downD) to use for debugging your program, you'll remove this structure when you are sure your program works
correctlyAnswer: C
132) Which of the following has the highest order of precedence in arithmetic expressions?A) Operators are not significant; all calculations are evaluated from left to rightB)ExponentiationC) Addition and subtractionD)Multiplication and division
Answer: B)133) Which is true of the CInt function?i."._./ A) It converts letters to numbers.
B) Floating-point numbers that are passed to Clnt are rounded to the nearest whole number.C) It cannot convert a string such as "247"to an integer.D) Floating-point numbers that are passed to CInt completely lose their fractional part.
Answer: D134) The control(s) can have the focus.
A) ButtonC) TextBox
Answer: B
B)TextBox and ButtonD) Label
23
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
25/30
135)'Declaration statementsA) are only used for variables and are not needed for constantsB)give variables and constants names, and specify the type of data they will holdC) are only allowed in the Declarations section of a formD) both answers Band C are correct
Answer: B
I136JiAll of the following are advantages of using named constants except .\.J A) they can be used instead of keywordsB) the value of the constant cannot be changed within the programC) they help make the program more self documenting, since they can describe the meaning of the constant
value.D) it is easier to make widespread changes to a named constant throughout a program
Answer: A;-_. r/ 1 3 7 , ) You can break up long lines of code, so they can it in the code window by _\ ! A) typing a space, followed by an underscore and then hitting the enter key\j B)hitting the ctrl/enter keys
C) hitting the enter key where you want to end the lineD) typing a hyphen where you want to break the line and then hitting enter keyAnswer: A
138) The value returned by passing "#45.25"to the CSng function is 'A) OB)45.25C) 45.3D) No value is returned. The program stops with a runtime error.
Answer: D/~\\13t) You can perform all of the following actions with variables except _.~.../ A) copy and store values entered by the user, so they may be manipulated
B) convert a variable to a constantC) remember information for later use in the programD) perform arithmetic on values
Answer: Bf"",.\, 140);Which is NOT true of a class-level variable?"'~:' A) declared outside a procedure
B)not local to any procedureC) can be used outside the formD) can be declared anywhere between Public Class and End Class
Answer: C(... ~~(::~VBecause only one radio button in a group can be sele
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
26/30
142) What is the resulting string that is stored in the String variable strSnip at the end of the code segment?Dim strSnip, strfullString as String = "Washington"strSnip = strfullString.Substring( 7, 3)A) "Washing" B) "Was" C) "gto" D) "ton"
Answer: D143) You display a message box with the method.
A) MessageBox.DisplayC) DisplayMessageBoxAnswer: D
B)MessageBox.OutputD)MessageBox.Show
/'-~I(144 Which of the following is true regarding the use of Class -Level Variables?\.-J A) Class-level variables can be accessed by any procedure in the same form.B) Class-Ievel variables must be declared inside the first procedure called on the form.C) You must declare the use of Class- Level Variable in EVERYprocedure that uses the variable.D) You should use Class- Level variables as much as possible in order to reduce the amount of memory used
by your program.Answer: A
145) Which is the correct general format for the method call that displays a message box?A)Messagebox.show (MessageBox, CaptionBox, ButtonsBox, IconBox,DefaultButton)B)Messagebox.message (Caption, Buttons, Icon, DefaultButton)C)Messagebox.show (Message, Caption, Buttons, Icon, DefaultButton)D) A and B are both correct.
Answer: C~4 - - ' , ,-\ 146)What value is returned by the IndexOf method if the search string is not found?\ / A) the length ofthe string - 1 B)1
""~ C) 0 D) -1
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
27/30
150) What is the difference in the execution of the Do Until Loop (first example) and the Do Loop Until(second example)., First ExamplesngPayAmount = 400Do Until sngPayAmount > 150
, Processing StepssngPayAmount = sngPayAmount - 50
Loop'Second ExamplesngPayAmount = 400Do
, Processing StepssngPayAmount = sngPayAmount - 50
Loop Until sngPayAmount > 150A) The first loop will not be executed.B) There is no difference between the 2 loops.C) The test statements should be sngPayAmount >=150 in the second example so that the loop will be
executed.D) The first loop will execute 1more time than the second loop.
r" Answer: Ar,(151) Which property of the list box 1s t s t uden t s indicates the number of items in the list?\~j A)lstStudents.Count B) lstStudents. Items. Count
C) lstStudents.Names.Count D)lstStudents.Names.NumberAnswer: B
152) The first item in a list box has an index of _A) -1 B)1
Answer: CC) O D) 2
153) The data in a list box is stored in the property.A) Items.Count B) Items
Answer: BC) Insert D) Add
154) When calling a Sub Procedure, the arguments and the corresponding parameters must agree in all of thefollowing ways except one of the following.A) The number of the arguments and the parameters must be the same.B)The type of the arguments and parameters must correspond.C) The names of the arguments and parameters must correspond.D) The order of arguments and parameters must correspond.
Answer: C155) In break mode, pressing will activate the Step Into command.
A) F5 B)Ctrl F5 C) Shift F8Answer: D
D) F8
26
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
28/30
156)Which VBdebugging command will allow the programmer to execute all of the procedures/functions in theprogram?A) Step Into B) Step Out C) Step Over D) Step All
Answer: A157) When a Sub procedure has finished executing .
A) the application enters break mode.B)the application terminates.C) the application branches back to the procedure call, and resumes executing at the next line.D) the application waits for the user to trigger the next event.
Answer: C158) Order the following arithmetic operators from highest precedence to lowest precedence.
A) Exponentiation (the 1\ operator), Multiplication and division, Modulus (the Mod operator), Integerdivision (the \ operator), Addition and subtraction
B)Exponentiation (the 1\ operator), Multiplication and division, Integer division (the \ operator), Modulus(the Mod operator), Addition and subtraction
C) Exponentiation (the 1\ operator), Multiplication and division, Integer division (the \ operator), Additionand subtraction, Modulus (the Mod operator)
D) Exponentiation (the 1\ operator), Modulus (the Mod operator), Multiplication and division, Integerdivision (the \ operator), Addition and subtractionAnswer: B
159) The control is used to gather input the user has typed on the keyboard.A) Text Box B) Li st Box C) But t on
Answer: AD) Label
160)Which would be the expected output shown in a label named lblkesult from the following line of code?Di m dbl Gr ossPay as Doubl edbl Gr ossPay = 3500I bl Resul t . Text = dbl Gr ossPay( "c")
A) 3500.00Answer: B
B) $3500.00 C) ($3500.00) D) 3500.00000
161) The declaration of an integer variable named intLength with an initial value of 12 is .A) Dim intLength As Integer = 12 B)Dim intLength As Integer initialize to 12C) Dim intLength =12As Integer D) Dim intLength As Integer 12
Answer: A
27
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
29/30
162) What would be the value ofthe variable dblCommission at the end running the following section of code?Dim dblMonthlySales, dblCommRate, dblCommission as DoubledblMonthlySales = 6500. 00Select Case dblMonthlySales
Case Is < 1000dblCommRate = 0. 0
Case 1000 to 4999.99dblCommRate = 0. 05Case 5000 to 9999.99dblCommRate = 0. 10
Case Is >= 10000dblCommRate = 0. 15
End SelectdblCommission = dblCommRate * dblMonthlySales
A) 325.00Answer: B
B) 650.00 C) 0.00 D) 925.00
163) To get a copy of a string in all uppercase letters, use the method of the Stringobject.A)ConvertToUpper B)ToUpperCaseC) ToString D) ToUpper
Answer: D1r64)This function accepts a string as its argument and returns true ifthe string contains only numeric digits.\',,--,jA) CInt B)Val C) IsNumber D) IsNumeric
Answer: D165) How many times will the message be displayed?
Dim intCount As Integer 0Do
lstOutPut.Items.Add ("I love Visual Basic 2005")intCount += 1
Loop While intCount > 10A) 1 timeC) 10times
Answer: A
B)2 timesD) It will not display the message.
166) These two properties can beused in code to automatically selectthe text in a text box.A) Start, Length B)SelectionStart, SelectionLengthC) Select, Section D) Select, Length
Answer: B
28
7/27/2019 MELJUN CORTES UMAK First Grading Exam - VB.Net 2010
30/30
170) What i s t he va l u e o f i nt T ot a la f t e rt h e f ol l o wi ng c ode i s ex ec ut e d?Di m i nt Number l As I nt e ger = 2Di m i nt Number 2 As I nt eger = 3~~~ ~~~m~~~ n~ T~~~~~~
167) Whi c h of t h e f ol l owi ng c al l sdoes not pas s i n v al i d ar g ument s t o t h e f o l l owi ng Get A Number Sub P r oc edur e ?Sub Get ANumbe r ( ByVal i nt Number As I nt ege r )
I does s ome codeEnd Sub
A) Get ANumber ( Ci n t ( t x t Number . Te x t ) )C) Get ANumber ( i nt x +3, i nt y)Ans wer : C
B) Get ANumber ( 3 + 5 * 8 + i nt X)D) Get ANumb e r ( i nt X)
168) Whi c h of t h e f o l l owi ng c ode i s a c o r r e c t l ywr i t t en f u nc t i on named Av er a ge t h at wi l l ac cept t h r ee i nt e ge r s a spar amet er s , c al c ul at e he i r av er a ge and r e t ur n t h e r es ul t .A) P r i vat e Func t i on Aver age ( By Re f
i nt Y As I nt eger , ByRef i nt Z AsAs Dou bl e)
Av e r age = ( i nt X + i nt Y + i nt Z) / 3End Func t i on
i nt X As I nt e ger , ByRe fI nt eger , By Ref Aver age _
B) Pr i v a t e Func t i on Av e r age ( ByVal i nt X As I nt ege r , ByVa li nt Y As I nt eger , ByVal i nt Z As I n t e ger ) As Si ngl e
Ret ur n ( i nt X + i nt Y + i nt Z) / 3End Func t i on
C) Pr i vat e Func t i on Av er age ( i nt X As I nt eger , i nt Y As I nt ege r ,I nt eger ) As S i n gl e
Av er age = ( i nt X + i nt Y + i nt Z) / 3End Fun c t i on
i nt Z As
D) Pr i vat e Func t i on Aver ag e( ByVal i nt X As I n t ege r , By Val i nt YAs I nt eger , ByVal i nt Z As I nt ege r ) As Si ngl eAver age = i nt X + i nt Y + i nt Z / 3Re t u r n Aver ag e
En d Func t i onAnswer : B
169):What i s t he pur pos e of t h e L i s t BOK. Add met hod?' - - - '. : A) The met hod wi l l a l ways put t he i t emat t he end of t he l i s t .
B) The met hod c an be us ed t o put an i t em anywher e i n t h e l i s t .C) The met hod wi l l a l ways put t he i t em at t he b egi nn i n g of t he l i s t .D) The met hod wi l l f i nd t he s um of a l l of t he i t ems i n t he l i s t .
Ans wer : A