ITEC81 Flashcards
What do control statements in VB.NET primarily manage?
A) Memory allocation
C) User interface design
B) Code execution based on conditions
D) Database connections
B
Which of the following is NOT a type of control statement in VB.NET?
A) If-Then Statement
C) For Each Statement
B) Select Case Statement
D) While-For Statement
D
In an If-Then statement, what happens if the condition evaluates to false?
A) The code inside the If block is executed.
C) An error occurs.
B) The code after the End If is executed.
D) The program terminates.
B
What does the Select Case statement allow you to do?
A) Iterate through a loop
C) Declare variables
B) Test a variable against multiple values
D) Handle exceptions
B
Which statement is used to ensure a code block executes at least once?
A) Do Until B) While
C) Do While D) For Next
C
What is the purpose of Integer.TryParse in VB.NET?
A) Convert strings to dates
C) Convert integers to strings
B) Convert strings to integers safely
D) Check if a string is empty
B
What type of loop is executed a specific number of times?
A) While loop
B) For…Next loop
C) Do…Loop
D) Nested loop
B
In the For Each…Next loop, what does the “item” variable represent?
A) The index of the collection
C) The current element being processed
B) The collection itself
D) The number of items in the collection
C
Which of the following loops continues until a specified condition is true?
A) Do While loop
B) Do Until loop
C) For…Next loop
D) While loop
B
What does the End With statement do?
A) Ends a loop
C) Terminates the program
B) Closes a block of code associated with a With statement
D) Executes the previous block
B
What is the key benefit of using With…End With?
A) Increases execution speed
C) Reduces redundancy in code
B) Reduces code readability
D) Prevents logical errors
C
Nested loops are primarily used for:
A) Error handling
C) Complex iterations over data sets
B) Iterating over collections
D) Database transactions
C
What does the Step keyword do in a For…Next loop?
A) Determines the starting point of the loop
C) Specifies the increment or decrement value
B) Sets the data type of the counter D) Marks the end of the loop
C
In a While…End While loop, what happens if the condition is false?
A) The loop continues
C) An error occurs
B) The loop terminates
D) The code inside the loop executes
B
The Do Until loop:
A) Runs at least once before checking the condition
C) Runs infinitely
B) Stops when the condition is true D) Is not a valid loop type in VB.NET
B
The expression in a Select Case statement must evaluate to which data type?
A) Only Integer
B) Any elementary data type
C) String only
D) Boolean only
B
What does the Application.DoEvents() method do?
A) Pauses the application
C) Terminates the application
B) Keeps the UI responsive
D) Starts a new event
B
If a condition in an If-Then-ElseIf statement is met, what happens?
A) All conditions are checked
C) The program terminates
B) Only the block for that condition executes
D) The Else block executes
B
What type of loop is best for processing items in a collection?
A) For…Next loop
B) Do While loop
C) For Each…Next loop
D) While loop
C
The Exit Do statement is used in which type of loop?
A) For…Next
B) Do…Loop
C) While…End While
D) For Each…Next
B
Which statement allows execution based on multiple conditions?
A) If-Then B) Select Case
C) For…Next D) While…End While
B
A For…Next loop is ideal for:
A) Uncertain iteration counts
C) Infinite loops
B) Known iteration counts
D) Exception handling
B
In the For…Next loop, which of these is optional?
A) Start
B) End
C) Step
D) Next
C
The Do While loop ensures that:
A) The code runs at least once
C) The loop cannot exit
B) The condition is always checked
D) No code runs if false
B
If an Else block exists, it executes when:
A) All conditions are true
C) The program terminates
B) The initial condition is false
D) None of the statements run
B
The For Each…Next loop simplifies:
A) Index management
C) Error handling
B) Memory allocation
D) File operations
A
The Do While loop guarantees:
A) At least one iteration
C) Execution only if true
B) Infinite execution
D) No execution if false
C
The If-Then-Else statement can execute two blocks of code based on a condition.
T
Control statements in VB.NET can only handle Boolean conditions.
F
The Select Case statement can only evaluate strings.
F
A While loop guarantees that the code inside will run at least once.
F
The For Each…Next loop requires manual index management.
F
Nested loops can be used to process multi-dimensional arrays.
T
The Do While loop executes as long as the condition is true.
T
You can only use integer types as counters in loops.
F
The With statement allows repeated reference to the same object.
T