Computer Programming Final
Select Case intNum Case Is > 10 Me.lblMessage.Text = "Num is more than 10." Case Is < 10 Me.lblMessage.Text = "Num is less than 10" Case Is > 20 Me.lblMessage.Text = "Num is greater than 20." End Select What message would be displayed if intNum is 16?
"Num is more than 10."
If intNum1 = intNum2 Then lblMessage.Text = "The numbers are the same." Else lblMessage.Text = "The numbers are the different." End If What is displayed when intNum1 is 5 and intNum2 is 5?
"The numbers are the same."
Which of the following is the proper way to write a single line comment in Visual Basic?
'Visual Basic
11. What is the output of the following code? Dim strA As String = "Programming rocks!" Dim intIndex As Integer intIndex = strA.IndexOf(" ") lblAnswer.Text = intIndex
(11)
Boolean
(bln) true or false
Char
(chr) single character
Double
(dbl) large decimal numbers
Decimal
(dec) currency, including decimals
Float
(flt) small decimal numbers
Integer
(int) positive or negative whole numbers
String
(str) multiple words or characters
Netiquette
- Do not attempt to access the account of another user without authorization - Do not share your password - change it periodically - Use appropriate subject matter and language, and be considerate of other people's beliefs and opinions.
32(Base 10) to Base 16
20
1A(Base 16) to Base 10
26
How many arguments are passed in the statement calculate (intNumerator, intDenominator, dblAnswer)?
3
1101(Base 2) to Base 10
30
Binary or Base 2
32 16 8 4 2 1 "Calculated Values of Places" 25 24 23 22 21 20 Base 2 Example 1 1 1 = (1 * 4) + (1 * 2) + (1 * 1) = 7 So 111 Base 2 = 7 Base 10. This can also be written 1112 = 710 or 1112 = 710
Converting Binary/Base 2 to Decimal/Base 10
32 16 8 4 2 1 "Calculated Values of Places" 25 24 23 22 21 20 Base 2 Example1 1 1 1 = (1 * 4) + (1 * 2) + (1 * 1) = 7 Example2 1 1 0 = (1 * 4) + (1 * 2) + (0 * 1) = 6 Example3 1 0 1 = (1 * 4) + (0 * 2) + (1 * 1) =? Example4 1 1 0 0 = (? * 8)+(? * 4) + (? * 2) + (? * 1) =? Example4 1 1 1 0 1 = (? * 16) + (? * 8) + (? * 4) + (? * 2) + (? * 1) =?
Reference Parameter
A parameter that passes a reference to the variable to the sub procedure.
Value Parameter
A parameter that passes the value to the sub procedure.
Postcondition
A statement of what must be true at the end of the execution of a procedure if the procedure has worked properly
Postcondition
A statement of what must be true at the end of the execution of a procedure if the procedure has worked properly.
Modularization can allow you to use one block of code multiple times by calling it from another sub. This makes coding more efficient because it allows you to avoid repeating the same code
Advantages of Modularization
7. The Do... Loop While structure evaluates a condition _____ executing a loop once.
After
Assignment
After we declare a variable we must give it a value.(=)
Came up with the idea of a "universal machine" that would perform many different tasks by changing a program (list of instructions)
Alan Turing
A list of steps to solve a problem
Algorithm
Click the button Add the numbers Show the answer
Algorithm
a set of steps that create an ordered approach to a problem solution
Algorithm
Public
Allows access from any module within the project
Private
Allows access only from within the same module
Intellisense
Allows you to see the properties of your variables, checks for errors more completely, and leads to faster code execution. ENABLED WHEN YOU USE STRONG TYPING
one of first PCs 1975
Altair
Consumer Credit Reporting Reform Act of 1996
Amended the Fair Credit Reporting Act (FCRA) of 1970 Addresses data collection by credit, insurance and employment agencies Gives individuals the right to see information maintained about them Restricts who may access credit files to only those with a court order or the written permission of the individual whose credit is being checked.
Wash hair. Rinse. Repeat.
An Iterative Infinite Loop
Which of the following statements about an accumulator is false?
An accumulator is a value that is incremented by the same value.
Which of the following statements about arrays is false?
An array can hold values of more than one datatype.
What is the result of the following code? Dim x As Integer = 100 Do While (x <= 100) x -= 1 Loop
An infinite loop
A machine that was to perform variety of calculations by following a set of instructions (or program) on punched cards. It was never built but was used as a model for modern computer
Analytical Machine
17. What is the output of the following code? Dim strA As String = " Apex " Dim strB As String = "High" strA= strA.Trim lblAnswer.Text = strA & strB
ApexHigh
12. What is the output of the following code? Dim strA As String = "Apex" Dim strNew As String strNew = strA.Insert(3, "s") lblAnswer.Text = strNew
Apexs
Code to close your application
Application.Exit()
Performs logic and arithmetic operations
Arithmetic Logic Unit (ALU)
Which of the following statements would result in the following output from the ZooArr? Zebra Monkey Chimp
Array.Reverse(ZooArr)
How to Sort an Array in Descending Order
Array.Reverse(nameofarray)
Which of the following statements will sort the array intNumArr in ascending order?
Array.Sort(intNumArr)
How to Sort an Array in Ascending Order
Array.Sort(nameofarray)
Strong Typing
Assigning a data type to ALL variables including those in procedure calls
Precondition
Assumptions or initial requirements of a procedure
Event Procedure
Button actions are sub procedures too - this one is called when the button is clicked- and ByVal is used.
All of the following were developed in the 1990's except
C
What is the most closely related language to the CLI (Common Language Infrastructure) the backbone of the .Net Framework, and the first one developed specifically for it?
C#
All of the following are second generation programming languages except:
C++
The 1st computer language
C-10
Audio, Video, Data are examples of what
CD/DVD
Which processes data and controls the flow of data between the computer's other units?
CPU
High speed memory that stores frequently accessed instructions
Cache
SRAM (Static RAM) is also referred to as
Cache
The _______________is high speed memory that stores frequently accessed instructions.
Cache
Which statement can be used to execute a sub procedure?
Call
Control Bus
Carries control signals
19. How would you write the Case statements for the following: a. Between 1 and 10
Case 1 to 10 Strstring= "True" Case Else StrString = "False End Select
19. How would you write the Case statements for the following: b. 6, 7, or 8
Case 6 to 8 Strstring= "True" Case Else StrString = "False" End Select
Which Case statement is written correctly?
Case 93 To 100
Which of the following Case statements is written incorrectly?
Case = 10
Processes data and controls the flow of data between the computer's other units
Central Processing Unit (CPU)
allows users to provide multiple inputs to answer a question
Checkbox
Button Events
Click Event
Checkbox Events
Click Event, Check Changed Event, Checked Property
Radio Button Events
Click Event, Check Changed Event, Checked Property
Testing for all syntax errors
Debugging
Rhombus
Decision
Remove() Function
Deletes all the characters from this string beginning at a specified position and continuing through the last position.
All of the following are part of testing except
Deployment
The window that displays the application interface and allows objects to be added, deleted, and sized
Design Window
Four Visible Tools
Designer Window, Solution Explorer Window, Properties Window, Toolbox
when you create a table of possible inputs and determine what the outputs should be
Desk Checking
_______________ is when you create a table of possible inputs and determine what the output should be.
Desk checking
Single-user systems designed with microprocessor technology where an entire CPU is contained on a single chip
Desktop Computers
Equals() Function
Determines whether this instance ans another specified String object have the same values
4. The ______ _______ ______ executes a set of statements as long as a condition is true.
Do... Loop While
5. The looping structure that evaluates a condition after executing a loop once is the:
Do... Loop While
Which loop is a posttest loop?
Do...Loop While
CPU
Does the "computing" of the computer, Central Processing Unit. Measures in Hertz. Stores memory using "cache", which speeds the processing. 1)L1 cache, 2)L2 cache, 3)Processing unit, 4) Memory controller
Meaning of DDR
Double Data Rate
Two Ways to Code a Button Click
Double click the button, open the code editor window
Syntax for using a TryParse for a double Integer?
Double.TryParse
Information Age
Due to the computer's ability to store and manipulate large amounts of information
Special type of memory used by flash drives
EEPROM
What type of memory does a flash drive use?
EEPROM
Was a secret military project during WWII to calculate trajectory of artillery shells
ENIAC
Which of the first generation computers was a secret military project during WWII used to calculate trajectory of artillery shells?
ENIAC
End Sub
Ending of a sub
How to Pass an Array to a Sub Procedure
Ensure that one of the procedure parameters specifies an array with the same rank and Element data type. Then supply the array variable at the corresponding place in the argument list. Do not follow the array name in the parentheses.
Identity Theft penalty Enhancement Act of 2004
Establishes penalties for aggravated identity theft Prohibits a court from giving parole, reducing any sentence or for providing for concurrent terms of imprisonment.
executes itself using the name corresponding to the event
Event Procedure
19. What is the output of the following code? Dim strA As String = " Apple " Dim strEx As String = "Example: " Dim strNew As String strNew = strA.TrimStart lblAnswer.Text = strEx & strNew
Example: Apple
Step Out
Exit the current programming block
Circuit boards that connect to the motherboard to add functionality
Expansion Slots/Boards
9. True/False: If, in a pretest, the condition is false the loop will terminate
False
A flowchart should be created after the program is written
False
A logic error will cause the program to stop running
False
A logic error will cause the program to stop running.
False
A variable or value passed to a sub is called a formal parameter.
False
Arguments passed by value MUST be constants.
False
Given the following function, what is returned if intNum is 12? Function IsValid(ByVal intNum As Integer) As Boolean If intNum > 0 And intNum < 11 Then Return True Else Return False End If End Function
False
Pseudocode details all of the programs within a system and how they interrelate
False
The event procedure's name affects the procedure execution.
False
True Or False: A pretest loop only executes if the condition is false for at least one time.
False
Three Ways to Create a New Project
File > New > Project; Click new project button; In Recent Projects, Create: Project, Click Project
SRAM
Flash drives
What provides a visual representation of how the data should flow?
Flowchart
Which of the following code segments would add all values to a ListBox?
For Each Animal in strZooArr lstZoo.Items.Add(Animal) Next Animal
8. What are the relational operators in VB?
Greater than, less than, greater than or equal to, less than or equal to, equal, and do not equal
Object is used to group related radio buttons
GroupBox
Works like a record player
Hard drive
The Physical Components
Hardware
What are the five steps of the programming process?
Identify the Problem Design the Solution Write the Program Test the Program Document and Maintain the Program
Which code block correctly uses the IsNumeric function?
If IsNumeric(txtnum.Text) Then intNum = Convert.ToInt32(txtNum.Text) Else MessageBox.Show("Enter Numbers!") End If
Write the if statement that will check to see if the item "Chocolate" in the ListBox is selected.
If Me.lstEvent.SelectedItem = "Chocolate" Then Statement goes here.... End If
Write the If statement that will check to see if the first item in a ListBox is selected.
If Me.lstEvent.SelectedItem = True Then Firstevent.checked = True End If
Write the if statement that checks to see if a user selected the no button from the MessageBox with the prompt of "Would you like to continue?", the title "Continue?" and the button YesNo
If MessageBox.ItemSelcted = "Yes" Then Statements ElseIf MessageBox.ItemSelcted = "No" Statements End If
11. Write the decision structure that will execute a set of statements when a condition is true or another set of statements if that condition is false.
If Then... (True) Else (False) End If
What happens if TryParse returns true? False?
If TryParse returns true, the conversion that the program was attempting succeeded.
Which of the following statements will short circuit correctly?
If dblGPA >= 4.00 OrElse intSAT >=1500
22. Write a compound Boolean expression for intNum between 0 and 10.
If intNum >=0 And intNum <=10 Then Messagebox.show ("True") End If
23. Write a compound Boolean expression for intX is greater than 0 or intY is greater than 0.
If intX >0 And intY >0 Then Messagebox.Show= ("True") End If
26. Re-write 22 and 23 using short circuiting.
If intX >0 AndALso iintY>0 Then Messagebox.show("True") End If If IntNum >=0 AndAlso intNum <=10 Then Messagebox.show("True") End If
What happens if TryParse returns false?
If it returns false, the conversion failed.
Write an If statement to see if an item was selected from the list or typed.
If lstName.SelectedIndex = 0 Then End If
10. Write the decision structure that will execute a set of statements when a condition is true?
If...(condition) Then End...(statement)..If
statement should be used to decide among three or more actions
If...Then...ElseIf statement
Created by IBM & Harvard Mechanical telephone replay switches to store information and accepted data on punch cards.
Mark 1
Mechanical telephone replay switches to store information and accepted data on punch cards
Mark I
Online Profiling
Marketing technique where data is collected about customers visiting a website
Alan Turing
Mathematician, developed idea of "universal machine" to perform many different tasks by changing the program.
John von Neumann
Mathematician, worked on idea of stored program concept with Turing.
Which statement correctly uses the format function?
Me.lblAnswer.Text = Format(intNum, "Standard")
Which statement will access the first element in the array strNameArr?
Me.lblDisplay.Text = strNameArr(0)
Statement that will show a MessageBox with message hello
MessageBox.Show("Hello")
Display a MessageBox with the message "Programming is awesome!"
MessageBox.Show("Programming is awesome!")
Which statement displays the following message box?
MessageBox.Show("Try Again")
Replaced the Integrated Circuit
Microprocessor
What made it possible to build the microcomputer (PC)?
Microprocessor
Difference Machine
Invented by Charles Babbage in 1822, this device could produce a table of numbers. It could be used by ship's navigators. Never manufactured.
Analytical Machine
Invented by Charles Babbage in 1833, this device can perform a variety of calculations by following a set of instructions on punched cards, used as a model for the modern computer. Never manufactured.
Stepped Reckoner
Invented by Gottfried Leibnez, this device included a cylindrical wheel with a movable carriage. It could add, subtract, multiply, divide, and perform square roots. It often jammed or malfunctioned. Second device in the evolution of computers.
ENIAC
Invented in 1943, Electronic Numerical Integration and Calculator. Weighed 30 tons and was 1500 square feet in size. Secret military project in WW2 used to calculate trajectory of missiles. Took 20 minutes to solve a problem that took mathematicians three days to solve.
Charles Babbage
Invented the Difference and Analytical Machines
9. What is a Boolean expression?
It evaluates to True or False
What is the purpose of the ALU?
It performs logic and arithmetic operations and makes comparisons.
How does an object access a member of its class?
It uses a dot (.) between object and member name
What happens if you use ReDim without preserve?
It will not save the original value
10. Each time the loop runs is called a/an:
Iteration
Input Device
Keyboard
working independently developed the IC
Kilby and Noyce
Byte Size (Hahaha it's a pun :)
Kilo- Thousand (1000 bytes) *actual 1024 Mega- Million (1000 KB, 1,000,000 bytes) Giga- Billion (1000 MB, 1,000,000 KB) Tera- Trillion (1000 GB, 1,000,000 MB) Peta- Quadrillion Exa- Quintillion *One byte: 8 bits
The cache that is within the CPU itself
L1 Cache
The CPU is made up of these four things
L1 cache, L2 cache, Processing Unit, Memory Controller
used to display information to the user either to identify another object, provide instructions, or display output
Label
Prompt
Label placed near the text box to describe its contents or purpose is called
Mainframes
Large computer
Privacy Policy
Legally binding document that explains how any personal information will be used.
Used to display a list of items for a user to select. Multiple items can be selected
ListBox
The variable is declared in a sub like an event and and can only be used there
Local
A button is clicked to show the sum of three numbers, but the three number are shown instead. This is an example of what type of error?
Logic Error
When running a program to average a list of numbers, the programmer notices that the average is not correct. This is an example of what type of error?
Logic Error
20. What are logical operators?
Logical Operators are used to create compound Boolean expressions. Use logical operators And or Or to form a Boolean expression. Logical operators join two expressions to create an expression that evaluates to either True or False. Third operator is Not.
Mobile Computing Devices
Long-lasting batteries
Programming Languages
Low level - very little abstraction from the computer, code is specific to the computer, Machine language (1 GL), Assembly Language (2GL) High level Very high level
How speeds are measured
MHz or throughput
The following is an example of what? 8B542408 83FA0077 06B80000
Machine Code
What type of code is directly understood by the CPU?
Machine Code
How data was stored in the second generation
Magnetic tape and high speed reel-to-reel tape machines
MegaHertz
Millions of cycles per second
What is the error? If intNum1 > 100 Then If intNum1 < 500 Then lblResult.Text = "Between 100 and 500" End If
Missing End If statement
Notebook Computers, Tablets, Smartphones
Mobile Computing Devices
The first medium-sized computer introduced by IBM
Model 650
The breaking up of a program into simpler pieces, such as using sub procedures
Modularization
breaking down a problem into smaller sub-problems
Modularization
18. What can be in the Case statement?
Multiple case clauses, and the Case Else is optional
17. What can be in the Select Case statement?
Multiple else statements
Button Control Properties
Name: btn, Text
CheckBox Control Properties
Name: chk, text, checked
GroupBox Properties
Name: grp, text
Radio Button Control Properties
Name: rad, text, checked
statement generates random numbers in the range from 5 to 10
Next(5,11)
12. Is the Else required?
No, the Else is optional- if omitted and the statement is false no action is taken.
order of evaluation with logical operators
Not, And, Or
21. What is the order of precedence for the logical operators?
Not, then AND, then Or.
where the variable is available to use
Scope
16. What is the basic format for the Select Case?
Select Case expression (such as Select Case intScore) Case value (such as Case 0,10) Statements ... Case Else Statements End Select
What is a condition used to signify that a loop should stop executing?
Sentinel
Bus
Set of circuits that connect CPU & other components
Pascaline
Set of gears similar to a clock that can only perform addition, invented in 1642, first device in the evolution of computers.
Reads using a laser
Optical Drives
The control that allows you to turn on or turn off strong typing by default. Turning on option strict requires all conversions between data types to be stated instead of inferred.
Option Strict
A set of gears similar to a clock that only performed addition
Pascaline
Set of gears, similar to clock, Only performed addition
Pascaline
14. What is the output of the following code? Dim strA As String = "Apex" Dim strB As String = "Programming" Dim strNew, strNew2 As String strNew = strA.Replace("a", " ") strNew2 = strB.Replace("m", "") lblAnswer.Text = strNew & " " & strNew2
Pex Prograing
Hardware
Physical components of the computer
used to display a picture or image to the user
Picturebox
13. What is the output of the following code? Dim strA As String = "Apex" Dim strB As String = "Programming" Dim strNew, strNew2 As String strNew = strA.Remove(0) strNew2 = strB.Remove(6, 1) lblAnswer.Text = strNew2 & " " & strNew
Pograming Pex
A statement of what must be true at the end of the execution of a procedure if the procedure has worked properly
Postcondition
assumptions or initial requirements of a procedure
Precondition
Not an input device
Printer
Output Device
Printer, monitor (screen), scanner, speaker
Which sub is written correctly and can only be accessed from within the same module?
Private Sub getName (ByVal strFName As String, ByVal strLName As String)
only the class that the private method was declared in can see it
Private sub
How to pass an array to a sub
Private sub addNums (ByVal intNum as Integer)
The variable is declared in a block of code and only be used there
Procedural
Rectangle
Process
Handling your code for incorrect input is an example of what type of debugging?
Program Debugging
The proper use of syntax in a programming language is called
Programming style
defines the appearance, behavior, position and more of a control
Properties
The area of the IDE is used to change the text displayed in an object
Properties Window
A mix of English language and code that represents what you want your program to do
Pseudocode
English-language statements that describe the processing steps of a program in paragraph form
Pseudocode
If button is clicked then calculate the answer else show a message
Pseudocode
another class can use and see the method
Public Sub
Which sub header is written correctly and can be accessed from within several different modules?
Public Sub getNums (By Val intFirstNum As Integer, By Val intSecNum As Integer)
__________ holds data for all applications that are currently running on your computer, but only while the power is on.
RAM
allows user to make only one choice from the options in the group
RadioBox
RAM
Random Access Memory
Which of the following code segments would re-declare an array, keeping its existing values?
ReDim Preserve strZooArr(9) As String
Contains most basic operating instructions for computer, Cannot be changed - permanent
Read Only Memory
ROM
Read Only Memory
Errors that occur while your program runs
Runtime
What is the error called when your programming is running?
Runtime
The following code would cause what type of error? Dim intNumerAs Integer = 9 Dim intDenom As Integer = 0 Dim dblAverage As Double = 0.0 dblAverage = intNumer/intDenom lblAnswer.Text = dblAverage.ToString()
Runtime Error
process when the computer looks at the first Boolean expression in a compound Boolean expression to determine if it needs to look at the remainder of the statement
Short Circuit
What a silicon chip is made of
Silicon wafer
Desktop Computers
Single-user systems designed with microprocessor technology where an entire CPU is contained on a single chip, designed to fit on/under a desk.
The area of the IDE that contains controls that are used to create objects on the interface
Toolbox
What is the most frequently used design in the programming process?
Top-Down Design
Data/Address Bus
Transfers data between CPU, memory, & other hardware that show where data is located/where it should go
Sparked the second generation of computers
Transistor
What sparked the second generation computers?
Transistor
What the Integrated Circuit replaced
Transistor
TetraHertz
Trillions of cycles per second
3. True/False: The step integer can be a negative number to tell the compiler to decrement the counter.
True
6. True/False: A loop is endless when it is always true.
True
A tool used to lay out the logic to solve a program is a flowchart
True
An event procedure is a Sub procedure written for a specific object event.
True
If you need to alter the value of the actual variable used in the sub call, you should use a reference variable.
True
Postconditions should be included with every sub.
True
The location in memory where its value is stored is its address.
True
True Or False: A posttest loop will ALWAYS execute at least one time
True
What shows the possible outcomes of a compound Boolean expressions?
Truth Table
Which of the following code blocks correctly uses a Try/Catch?
Try intEntered = Convert.ToInteger(txtNumEnt.Text) MessageBox.Show("The number is " & intEntered ) Catch ex as exception MessageBox.Show("Enter numeric values") End Try
Dim intGrade As Integer = 80 If intGrade > 85 Then Me.lblMessage.Text = "Great Job" Else Me.lblMessage.Text = "Try Again" End If What is displayed when the statements execute?
Try Again
How many states do the electrical circuits on an integrated circuit have?
Two: on, off
First computer sold to US Census Bureau in 1951.
UNIVAC
What computer was sold to US Census Bureau in 1951?
UNIVAC
Byte
Unit used to measure memory & storage on a computer, single 0 or 1 in binary.
Amount of time memory is stored in RAM
Until Computer Shuts Down
The items do not match. The boolean expression is false and the following code will not execute
What happens given the following items in the ListBox and the following if statement?
A scrollbar is automatically added
What happens to a listbox if the list entered is longer than the ListBox?
String
What is the data type of the value returned from an InputBox?
Preserve
statement used to declare the array AND hold the values
ReDim
statement used to redeclare the array
When you want a variable, like a counter, to hold its value, it should be declared as
static
Pause
stop here
Blue Square
stop the program and return to the IDE
String abbreviation
str
Which statement will correctly get input from a user using an InputBox?
strInput = InputBox("Enter something", "Input Example")
Which statement correctly assigns the value Smith to the variable strName?
strName= "Smith"
9. What is the output of the following code? Dim strA As String = "Programming" Dim strB As String = " Rocks" Dim strNew As String strNew = String.Concat(strA, strB) lblAnswer.Text = strNew
strNew = "ProgrammingRocks"
Which of the following statements would correctly add a value to the array given the strZooArr has 5 elements?
strZooArr(1) = "Monkey"
str
string
Concatenation
strings combined from several different sources
Select the MenuStrip control from the ToolBox and click the form to add it
What is the procedure to add a menu to a form?
14. What is an Else If ladder?
When a IF Statement has multiple else statements and each one has a new question or condition to check
Object
When a class is used to create a variable
13. What is a nested If statement?
When an if..then..statement is within another If..then..statement
Which would be classified as a mobile computing device?
tablet PC
Data Type
tells the computer what type of value to expect in a variable
txt
textbox
Literal
the actual value that will "reside" in the memory place
Lifetime
the time that the variable is available for use
Formal Parameter
the two arguments that are passed by value
Speeds are measured in MHz or _________ rate.
throughput
Breakpoint
tool used by a programmer to isolate a section of code and watch how the compiler steps through it
What contains the controls that are used to create objects on the interface?
toolbox
How to Pass 1 Element of an array to a sub
use ByVal to pass a single data value and a call statement
designed and build first Apple Computer
Wozniak and Jobs
Can a sub procedure have an array parameter?
Yes
Can you declare a variable in a For Loop Condition?
Yes
How to add items to a ComboBox
You add items by clicking on the collection property, which will open a dialog box called String Collection Editor. Type in your items and press enter when you are done.
All of the following are reasons for commenting in your code except
You are creating user documentation
What is the result of adding the GroupBox control to the form after placing RadioButtons on the form?
You can select more than one RadioButton
1. The For... Next loop is used when:
You know how many times the loop will run
18. What is the output of the following code? Dim strA As String = " Apex " Dim strB As String = "High " strA = strA.TrimEnd lblAnswer.Text = strA & strB
_________ApexHigh
Sub Procedure
a block of code that will execute in response to a call from inside another block of code
ComboBox
a combination of a textbox and a listbox that displays a list in a drop down box.
ComboBox
a drop down menu that allows a user to type in an entry or select an option
Combobox
a drop down menu that also allows a user to type in an entry or select an option
Convert Method
a function that changes the data type of a variable from one type of another
A bit is
a single 0 or 1 in the binary code
Given a string called strWord, complete the code to find each of the following. a. The first letter chrLetter = b. The last letter chrLastLetter = c. The middle letter chrMidLetter =
a. The first letter chrLetter = strWord.Chars(0) b. The last letter chrLastLetter = strWord.Chars(strWord.Length - 1) c. The middle letter chrMidLetter = strWord.Chars(strWord.Length / 2)
Hungarian Notation
abbreviations for the common data types
Arguments
actual parameters, when you do not pass
Program Debugging
allowing for unexpected input from a user
Watch Window
allows the coder to track the value of variables as the program is being executed
Radiobutton
allows user to make only one choice from the options in the group
TextBox
allows users to enter values at run time
Checkbox
allows users to provide multiple inputs to answer a question
Given the following statements, what is displayed in the label? Dim gen As New Random() Dim intNum As Integer intNum = gen.Next(10, 20) lblAnswer.Text = intNum.ToString
an integer greater than or equal to 10 and less than 20
15. What is the output of the following code? Dim strA As String = "Apex" lblAnswer.Text = strA.ToLower
apex
Function
are a special type of procedure that return only one value to the main program using a return statement
Actual Parameter
argument
Local Watch Window
automatic watch window
This property sizes the label to fit the text
autosize
00000000 00100001 represents the letter A in
binary
Boolean abbreviation
bln
bln
boolean
Groupbox
box that ties the checkboxes together
Button Abbreviation
btn
How an optical drive stores data
burns "pits" into the disk
btn
button
Computer memory capacity and file size are measured in
bytes
Global scope
can be called anywhere in the program
Local scope
can be only called in the sub/function it is declared in
Procedural scope
can be only used in the block of code it is declared in
ComboBox Prefix
cbo
chr
character
chk
checkbox
CheckBox Abbreviation
chk
Char abbreviation
chr
Button
clicked by the user to perform an action or group of actions
Button
clicked by the user to perform an action or group or actions
cbo
combobox
Array
container that holds more than one value
Designer Window
contains a form
Toolbox
contains the controls for designing a form
Editor Window
contains your program code
Toolbox tab
control you use to add a menu for your form
ToString
converts any value given to it to a string and formats it with the format given
The arguments in call statement must
correspond in order to the parameters in the procedure being called
Double abbreviation
dbl
Decimal abbreviation
dec
dec
decimal
Properties
define a form's appearance, behavior, position, and other attributes
Properties
defines the appearance, behavior, position and more of a control
Listbox
displays a list from which the user can select one or more items
Selected Object
displays handles that appear as squares
MessageBox
displays output or alerts users to fatal errors
dbl
double
Green Arrow
execute the rest of the program without stopping
Step Out
exit the current programming block
Header
first line that declares the sub any values. These are the values or variables inside the () of the call
Float abbreviation
flt
frm
form
Code to close dialog box
formname.Close()
Code to hide dialog box
formname.Hide()
Code to show dialog box
formname.Show()
Try Catch
function to check for incorrect user input
Given the following sub header, which call would correctly access the sub? Private Sub getPerimeter (ByVal dblSide1 As Double, ByVal dblSide2 As Integer)
getPerimeter (dblNum, intNum)
How to add menu to your form
go to toolbox tab, click menustrip control and drag to form
Form
graphical object that contains a title bar, a system menu and minimize, maximize, and close buttons
Component Tray
gray area at the bottom
GroupBox Abbreviation
grp
Which is the physical aspect of the computer?
hardware
Static Variable
holds its value between runs of the program, used commonly with loops
img
image
Given the following statements, how many times will the body of the Do...Loop execute? Dim intNum As Integer = 0 Do While intNum < 20 intNum = intNum - 2 Loop
infinite
Integer abbreviation
int
Which of the following code segments will correctly call the function getArea if it has two parameters?
intAnswer = getArea (intNum1, intNum2)
Complete the code to find the length of the string strAnimal. intLength =
intLength = strAnimal.Length
Which statement correctly gets input from the TextBox txtNumEntered?
intNum = txtNumEntered.Text
Which statement correctly assigns the value 5 to the variable intNum?
intNum=5
6. Give an example of modulus division.
intNumber= 5 mod 2
4. Give an example of integer division
intNumber= 51 \ num2
Which statement correctly updates the accumulator intSum (syntax)?
intSum = intSum + intNum
int
integer
What is it is called each time a loop runs?
iteration
lbl
label
Label Abbreviation
lbl
8. What is the output of the following code? Dim strA As String = "Peanut" Dim strB As String = "Butter" If String.Compare(strA, strB) = 0 Then lblAnswer.Text = strA & " is equal to " & strB ElseIf String.Compare(strA, strB) < 0 Then lblAnswer.Text = strA & " comes before " & strB ElseIf String.Compare(strA, strB) > 0 Then lblAnswer.Text = strA & " comes after " & strB End If
lblAnswer.Text = "Peanut comes after Butter"
Which statement correct concatenates to display the text in the label?
lblInfo.Text = "My name is " & strName
Which segment of code correctly puts the message "Take More Programming!" on three lines?
lblMessage.Text = "Take" & vbCrlf & "More" & vbCrlf & "Programming!"
Label Control Syntax
lblName.Text
Which statement correctly uses the ToString method?
lblTotal.Text = decTotal.ToString("$###.##")
lst
listbox
Index
location of a value in an array
Listbox Prefix
lst
code to enable listbox
lstBox.Enabled = True
code to hide listbox
lstBox.Show = False
code to sort listbox
lstBox.Sorted = True
Write the code to add "Cookie" to the ListBox called lstIceCream.
lstBox1.Items.Add("Cookie")
Write the code to remove "Cookie" to the ListBox called lstIceCream.
lstBox1.Items.Remove("Cookie")
Write the code to remove all items from the ListBox called lstIceCream.
lstIceCream.Items.Clear()
mnu
menu
Linear Search
method for finding a particular value in a list that checks each element in sequence until the right element is found or the entire list has been searched through
Menu Prefix
mnu
The breaking up of a program is called
modularization
All of the following are advantages of dividing a program into parts except
more code redundancy
Step Into
move to the next line of code in the programming block
Parallel Array
multiple arrays were their elements are related by their positions in the array
Constant Variable
must be given a value when it is declared or the program will produce an error
TextBox Properties
name, text, alignment, passwordchar
Variable
named place in computer memory that holds a value
All of the following are reasons for logic errors except:
not following the rules of the programming language.
Logic Errors
occur when the program compiles and executes, but the output is not what you want
Runtime Errors
occur while your program runs
Syntax Errors
occurs when the programmer does not follow the rules of the programming language
Difference between a radio button and a check box
only one radio button can be selected while multiple can be selected for a checkbox
Possible cause of a runtime error
operation violates the rules of the computer
Class Name List
part of application where you select a menu object
Method name list
part of application where you select appropriate method
Value Parameter
pass the value to the sub procedure
Function procedures
perform a specific task and then return a value
pic
picturebox
How to place a control object on your form
place object on your form by double clicking or the click and drag method
What must be true when a sub completes execution?
postcondition
Members
properties and methods in a class
SelectedIndex Property
property allows the programmer to compare what the user has selected in the list box with a value
RadioBox Abbreviation
rad
Given the code, which radio button has been selected? radDarkChocolate.Checked = true radMilkChocolate.Checked = false radWhiteChocolate.Checked = false
radDarkChocolate.Checked=true
Which property will evaluate to whether or not a radio button has been selected?
radProgram.Checked
rad
radiobutton
Reference Parameter
represents the same storage location as the variable given in the argument call
Dynamic Array
resizable array list that is a random access, variable size list that allows elements to be added or removed
To size an object
select it and then drag a handle
How to add items to a lisbox
select the property Collection which will open a dialog box called the String Collection Editor. Type in your items and then press enter.
Char
used for a single character
Boolean
used for true and false
ListBox
used to display a list of items for a user to select
Label Control
used to display a message, information, or a prompt
PictureBox
used to display a picture or image to the user
Picturebox
used to display a picture or image to the user
Label
used to display information to the user either to identify another object, provide instructions, or display output
TextBox
used to gather input from a user or to display text back to the user
Textbox
used to gather input from a user or to display text back to the user
Length Property Purpose
used to resize the array
IsNumeric
used with an IF statement
Decimal
used with decimal numbers: currency
Radio Button
used with group boxes, allows user to make only one choice from the options in the group
Double
used with larger decimal numbers
Float
used with small decimal numbers
String
used with strings of characters/words
Integer
used with whole numbers
CheckBox
usually found in a group box, allows users to provide multiple inputs to answer a question
Properties Window
utilized to change the characteristics of your form during design time
Element
values inside the array with the SAME data type
Output
values or strings the program displays for the user based on the execution of the program
Break Mode
when the user is at a breakpoint
Desk Checking
when you create a table of possible inputs and determine what the output should be
Step Over
skip the current programming block
Privacy
- Ethical issue - Computers record transactions, calls, etc. - These records can be used to learn a lot about you. - Because of privacy issues, many laws have been passed.
Index of First Item
0
Possible Values of a bit
0 or 1
Components of a Computer
1. CPU 2. RAM 3. Storage 4. Input Devices 5. Output Devices
16(Base 10) to Base 16(Hex)
10
Given the following statements, how many message boxes will be displayed? Dim intNum As Integer For intNum = 1 To 10 MessageBox.Show(intNum.ToString()) Next intNum
10
Decimal or Base 10
100,000 10,000 1000 100 10 1 "Calculated Values of Places" 105 104 103 102 101 100 Base 10 Example 1 1 1 = (1 * 100) + (1 * 10) + (1 * 1) = 111
11(Base 10) to Base 2
1011
Number of actual bytes in a KB
1024
How many KB in 1 MB?
1024 KB
13(Base 10) to Base 2
1101
20(Base 10) to Base 16
14
A1(Base 16) to Base 10
161
When IBM introduced the IBM-PC
1981
Converting Hexadecimal/Base16 to Decimal/Base10
4096 256 16 1 "Calculated Values of Places" 103 162 161 160 Base 10 Example 1 1 1 = (1 * 256) + (1 * 16) + (1 * 1) = 273 Example1 1 0 = (1 * 16) + (0 * 1) = 16 Example2 2 1 = (2 * 16) + (1 * 1) = 33 If you can have 1 - 15 in one Place - how do you represent 10, 11, 12, 13, 14, and 15? Answer: 10 = A, 11=B, 12=C, 13=D, 14=E, 15=F Example1 A B = (10 * 16) + (11 * 1) = 171 Example2 1 E = (1 * 16) + (14 * 1) = 30 Example3 1 F = (1 * 16) + (15 * 1) = ? Example4 B 1 = (? * 16) + (? * 1) =? Example1 C A = (? * 16) + (? * 1) = ?
101(Base 2) to Base 10
5
Given the following statements, how many times will the body of the Do...Loop execute? Dim intNum As Integer = 0Do intNum = intNum + 1Loop While intNum < 5
5
In the statement Dim strName(4), how many elements are automatically initialized?
5 elements
Given the following statements, what is the value of intNum after the last loop iteration? Dim intNum As Integer For intNum = 1 To 5 MessageBox.Show(intNum.ToString()) Next intNum
6
Number of bits in a byte
8
Which is not a logical operator?
>
The following image is an example of what? (Line of code highlighted in red)
A BreakPoint has been added to the code.
What is a FLAG?
A Sentinel, A condition used to signify that a loop should stop executing.
Sub Procedure
A block of code that will execute in response to a "call" from inside another block of code.
2. A flag is:
A condition used to show that a loop should stop executing
What is something programmers can code to repeat actions into their programs
A loop
GigaHertz
Billions of cycles per second
24. What is a truth table?
A truth table shows the possible outcomes of the Boolean Expressions.
Counter
A variable storing a number that is incremented by constant value
16. What is the output of the following code? Dim strA As String = "Apex" lblAnswer.Text = strA.ToUpper
APEX
Often called the first programmer
Ada Byron
Sponsor of Analytical Machine
Ada Byron
Who is called the first programmer due to writing a program based on the design of the Analytical Machine?
Ada Byron
Who wrote the first computer program?
Ada Byron
What does the "step 1" do in a for loop?
Adds 1 to the variable
Given the following code, what does strName(3)= "Joe" do? Dim strName(2) As String StrName(3) = "Joe"
Adds an extra variable to the array
The number system used in computers is called
Binary
Which of the following should be reviewed when checking your code?
I, II, III &IV
All of the following are high-level programming languages except:
Basic
27. How do you use an If in assignment statements?
Be used in assignment statements to set the value of a variable
Who invented the transistor
Bell Lap
Who developed the first keyboard and numeric keypad
Betty Holberton
What bytes are broken down into
Bits
8. In the syntax code, the condition must always be a __________ ___________.
Boolean expression
What is a tool used by a programmer to isolate a section of code and watch how the compiler steps through it?
BreakPoint
Atanasoff-Berry Computer
Built around 1939 - 1942, used binary system, vacuum tubes, and stored information by electronically burning holes in sheets of paper.
Transfers data between the CPU, memory and other hardware addresses that indicate where the data is located and where it should go
Bus
clicked by the user to perform an action or group or actions
Button
Determines the speed at which a CPU can execute instructions
Clockrate
a drop down menu that also allows a user to type in an entry or select an option
ComboBox
CD's vs DVDs
Compact Disk vs Digital Versatile Disk (holds more data, images)
Compare() Function
Compares 2 spring objects and returns an integer to indicate their relative position in the order.
The following represents what type of error? num as integer
Compilation Error
What is another name of a syntax error?
Compilation Error
One of first computers to use Integrated Circuits
IBM System 360
An electronic machine that accepts data, processes it according to instructions, and provides the results as new data
Computer
What happens if there is no RAM
Computer beeps
Mark I
Computer invented in 1944 by IBM & Harvard, mechanical telephone replay switches to store information & accepted punch card data. Unreliable calculator.
Proceed down Main Street for two miles 2.Turn left on Ocean Drive, 3.Proceed on Ocean Drive for three blocks, to the fork. 4.IF left turn at fork is blocked THEN Take a right turn at the fork onto Eagle Street? ELSE At the fork, take Swan Street to the left. Proceed two blocks. House is second on the left. (246 Swan Street.) ENDIF
Conditional Control Structure
Which type of variable that once declared cannot be changed by the program?
Constant
Which function is used to convert an entry from an input box to an Integer?
Convert.ToInt32()
Which statements are properly written to increment a counter variable by 1?
Counter +=1 Counter = counter + 1
IBM System 360
Created in 1964, one of the first computers to use IC.
Concat() Function
Creates the string representation of a specified object, usually two or more strings.
3. What is integer division?
Cuts off the decimal portion and returns the integer (symbol: \)
Types of Ram
DDR2 and DDR3
A machine that was never built that was to produce table of numbers used by ships' navigators
Difference Machine
Created by Charles Babbage to produce table of numbers to be used by ships' navigators. (Never built)
Difference Machine
30. Set dblRndNum to a number between 0 and 1
Dim dblRndNum Select Case dblRndNum Case 0 to 1 strString="True" End Select dblRndNum=gen.nextDouble
What are the steps to create a programmer defined dialog box?
Dim dlg1 as new Form() dlg1.ShowDialog()
29. Write the statement to declare a random number generator.
Dim genName As New Random genName=gen.nextDouble OR Dim genName As New Random genName=gen.next
Which statement declares a variable correctly?
Dim intAge As Integer
Input box that will get the user's age and set it to the variable IntAge
Dim intAge as integer = InputBox("Enter your age.", "How old are you?")
Declare intAges as an array that stores 14, 15, 16, 17, and 18.
Dim intAges As Integer = {14, 15, 16, 17, 18}
28. Declare the variable intGrade and assign the value 100 if strComplete is equal to "yes" and the value 0 if strComplete is equal to "no".
Dim intGrade as Integer= IF(strComplete=yes, "yes", "no")
Which statements correctly declare a variable and initialize it (give it a starting variable)?
Dim intNum As Integer intNum = 0 Dim intNum As Integer = 0
Which of the following statements correctly declares an array?
Dim intNumArr(3) As Integer
Write a Dim statement declaring an array called strNames that has 4 string elements.
Dim strName(4) As String
Which of the following statements correctly declares an array?
Dim strNameArr() As String = {"Jon", "Joe", "Anne"}
Write a Dim statement declaring an array called strNames that has 4 string elements
Dim strNames(4) As String
What indicates the flow of logic in a flowchart?
Direction of the arrow
Which code segment would correctly check that input was entered between 1 and 10, inclusive?
Do strNumInput = InputBox("Enter a number between 1 and 10 inclusive") intEntered = Convert.ToInt16(strNumInput ) Loop While (intEntered < 1 Or intEntered > 10)
what is the syntax of a Do... Loop While?
Do Statements Loop While condition
What are the four types of Loops in VB?
Do While Do...Loop While For...Next For Each...Next
Which code segment correctly checks to see if input was entered before looping?
Do While (strEntered <> Nothing) Loop
What is the syntax of a Do While Loop?
Do While condition Statements Loop
7. What are relational operators?
They are used to create a Boolean expression
What is the syntax of a For... Next Loop?
For counter = start To end Statements Next counter
Which loop will count all even numbers between 1 and 10?
For i As Integer = 0 To 10 Step 2 sum = sum + 1 Next i
Which of the following loops will traverse the strNameArr array?
For i As Integer = 0 To strNameArr.Length - 1
Which of the following code segments would NOT count backwards from 5 to 1?
For intNum As Integer = 0 To 5 Step 1 Next intNum
A graphical object that contains a title bar, a system menu and minimize, maximize and close buttons
Form
Function
Function addNums (ByVal intNum As Integer, ByVal intNum2 As Integer) As Integer
Which of the following headers is written correctly?
Function isInteger (ByVal intNum As Integer) As Integer
What does the Chars property do?
Gets any character part of a string
What does the Length property do?
Gets the length of any string
Type of memory used by iDevice
Gigabytes
0
Given the following code, what is the value of intNum?
555
Given the following code, what is the value of intNum?
True
Given the following code, what is the value of result?
false
Given the following code, what is the value of result?
5
Given the following picture, how many message boxes will be displayed?
The variable is declared in the class and can be used anywhere
Global
Hollberith's Tabulating Machine
Herman Hollerith used electricity to create this machine for the US census, holes punched in cards represented information to be tabulated. Successfully manufactured.
How speed is measured
Hertz
Which category of programming languages has the most abstraction from the hardware?
High Level
Cache
High speed memory. Pathway that the computer takes in order to transfer data.
Who invented microprocessor
Hoff at Intel Corp
Machine create for US Census that had holes representing information to be tabulated were punched in cards
Hollerith's Tabulating Machine
This device used electricity and was built for US Census Holes representing information to be tabulated were punched in cards
Hollerith's Tabulating Machine
specifies that an argument is passed in a way that the procedure can change depending on the value of a variable
How ByRef works
specifies that an argument is passed in a way that the procedure cannot be changed by the value of the variable
How ByVal works
All of the following are considerations when choosing an algorithm EXCEPT
How many lines of code you must write
You put the name of the sub; whatever you put after "Private Sub"
How to call a sub
Private sub
How to declare a sub
What are 3 ways you can create a project in visible basic?
I, II, III
Which of the following should be reviewed when checking your code? I. Check expected input II. Check unexpected input III. Check boundaries IV. Check null input
I, II, III & IV
Parallelogram
Input/Output
Insert() Function
Inserts a specified instance of String at a specified index position in this instance.
Syntax for using TryParse for an integer
Int.TryParse
Silicon wafers with intricate circuits etched in their surfaces and then coated with a metallic oxide that fills in the etched circuit patterns
Integrated Circuit
IC
Integrated Circuits, replaced transistors. Silicone wafers with intricate circuits etched on their surfaces.
OOP
Object Oriented Programming - a programming model using "objects" (data structures consisting of data fields and methods together with their interactions) to design computer programs
represents the same storage location as the variables given in the argument call
Reference Parameter
2. What are the division operators?
Regular division, integer division and modulus division
Trim() Function
Removes all leading and trailing white - space characters specified in an array from the current string object
TrimStart() Function
Removes all leading occurrences of a set of characters specified in an array from the current String object
TrimEnd() Function
Removes all trailing occurrences of a set of characters specified in an array from the current string object
IndexOf() Function
Reports Index of the first occurance of the specified Unicode character(or string) in this string
Parts of identifying the problem?
Requirements and Specifications
Federal Information Security management Act of 2002
Requires federal agencies to develop, document and implement an agency-wide program to provide information security.
ToLower() Function
Returns a copy of this string converted to lowercase
ToUpper() Function
Returns a copy of this string converted to uppercase
Replace() Function
Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string
5. What is modulus division?
Returns the remainder resulting from the division (symbol: mod)
What are the steps to add a variable to a Watch Window?
Right Click on the variables you want to "watch". Select Add Watch. The variable is added to the Watch Window.
The area of the IDE that is used to switch between the Design and Code windows
Solutions Explorer Window
Ada Byron {Lovelace}
Sponsor of Analytical Machine, "First programmer", used punch cards based on Analytical Machine's design
High speed memory referred to as cache
Static Random Access Memory
How do you declare a static variable?
Static intCounter As Integer = 0
Which of the debugging tools will move compilation to the next line of code in the programming block?
Step Into
Cylindrical wheel with movable carriage Add, subtract, multiply, divide, square roots
Stepped Reckoner
Cylindrical wheel with movable carriage that can add, subtract, multiply, divide, square roots
Stepped Reckoner
Pause
Stop Here
Class
String Data Type
This is assigning a data type to ALL variables including those in procedure calls
Strong Typing
Which is not a property of the Label control?
Style
executes itself when a certain event occurs
Sub Procedure
The type of error that occurs when the programmer does not follow the rules of the programming language.
Syntax
Modularization
The breaking up of a program into modules
What is an iteration?
The execution of the loop one time.
1. What are the operators you can use in VB?
They are symbols used to perform math. 1. + (add), 2. - (subtract) 3. / (divide) 4. * (multiply) 5. ^ (Exponents)
Trillion bytes is known as
TeraByte
Used to communicate with mainframe
Terminals
Oval
Terminator (start/stop)
Cookie
Text file created by the server computer when a user enters information into a website.
What type of event you would use to clear an answer if the user selected another item from the ComboBox?
TextChanged
used to gather input from a user or to display text back to the user
Textbox
Computer that used binary number system and vacuum tubes Stored info by electronically burning holes in sheets of paper.
The Atanasoff Berry Computer
Properties Window
The area of the IDE is used to change the text displayed in an object
Toolbox
The area of the IDE that contains controls that are used to create objects on the interface
Solutions Explorer Window
The area of the IDE that is used to switch between the Design and Code windows
Which of the following statements is false given the image?
The auto size property is set to false
What the CPU is known as
The brain of the computer
Modularization
The breaking up of a program
What sparked the beginning of third generation computers?
The invention of the Integrated Circuit
How do you know which line is to be executed when looking at the code editor window in Break mode?
The line of code is highlighted in yellow.
What is a possible cause of a runtime error?
The operation violates the rules of the computer.
Hertz
The speed at which a computer can process.
10. What is the output of the following code? Dim strA As String = "Apple" Dim strB As String = "apple" If strA.Equals(strB) Then lblAnswer.Text = "The strings are the same." Else lblAnswer.Text = "The strings are the different." End If
The strings are different
Design Window
The window that displays the application interface and allows objects to be added, deleted, and sized
Strong Typing
This is assigning a data type to ALL variables including those in procedure calls
Describe the SelectedItem property.
This property allows the programmer to compare what the user has selected in the list box with the item itself as a string value
Web beacons
Tiny, transparent graphics located on web pages or in e-mail message that are used in combination with cookies to collect data about web page users or email senders
Listbox
Used to display a list of items for a user to select. Multiple items can be selected
25. What is short circuiting?
VB provides a way to "short circuit" long compound IF statements. The computer looks at the first statement and uses that information to decide if it needs to look at the rest of the statement.
What the transistor replaced
Vacuum Tubes
the default
Value Parameter
Scope
Variables only exist within their defined
15. When should you use an Else If ladder?
When there is a condition within a condition or decision to be made and is Used to decide among three or more actions Ex: If condition Then Statements ElseIf condition Then Statements ElseIf condition Then Statements ... Else Statements End If Last Else clause is optional
When should you use an accumulator?
When you want to add a changing amount to the variable.
dblNum = Convert.ToDouble(InputBox ("Enter a number between 1 & 10", "Numbers"))
Which code segment will correctly display an InputBox and get the value for a double variable?
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Application.Exit() End Sub
Which code segment would close an application using a menu?
If lstAnimals.SelectedItem = "Bird" Then
Which code segment would return true if the user selected "Bird"?
Listbox
Which control displays a list from which the user can select one or more items?
ComboBox
Which control would allow a user to select from a list as well as enter input?
If (MessageBox.Show("Would you like to continue?", "Continue?", MessageBoxButtons.YesNoCancel) = DialogResult.Yes Then
Which of the following code segments to see if the user selected the Yes button on the MessageBox?
lstChoices.SelectedIndexChanged
Which of the following event procedures should you use to clear an answer if the user selects another choice in a ListBox?
TryParse (String, Int32) converts the string into the destination argument and returns true/false indicating success/failure.
Which of the following statements is true regarding TryParse?
if lstColors.SelectedIndex = 2 Then
Which of the following statements will check to see if "Blue" has been selected from the ListBox?
If cboColors.SelectedIndex>=0 Then
Which of the following statements will check to see if an item was selected in the ComboBox cboColors?
frmAbout.Show()
Which statement correctly displays a user defined DialogBox?
If cboColor.SelectedIndex >= 0 Then Color = cboColor.SelectedItem Else Color = cboColor.Text End If
Which statement will check to see if the user entered a value into the ComboBox?
lstColors.Items.Clear()
Which statement will clear all items from the ListBox?
Messagebox.Show("Try Again")
Which statement will display this?
cboColors.Visible = False
Which statement would hide the ComboBox?
lstColors.Sorted = True
Which statement would sort the ListBox?