


Preparing for a Visual Basic .NET developer interview? Knowing VB .NET syntax is only the beginning. Employers also expect you to reason through application behavior, select reliable solutions, and recognize common bugs in real development scenarios.
VB .NET Interview Questions and Answers: 6 Practice Tests is a focused technical interview preparation course containing 573 multiple-choice questions across six progressively challenging practice tests. Every question presents four answer options and an explanation so you can review the logic behind the correct response, recognize common traps, and identify topics that need more attention.
Start with Visual Basic .NET fundamentals: the CLR, .NET environment, variables, data types, operators, type conversion, conditions, and loops. Build confidence with procedures, functions, arrays, strings, collections, classes, constructors, properties, and access modifiers. Then move into inheritance, polymorphism, interfaces, SOLID principles, dependency injection, exceptions, and resource management.
The next stage covers delegates, events, generics, lambda expressions, LINQ, file handling, serialization, XML, and configuration. Work through ADO .NET interview questions on connections, commands, DataReaders, DataSets, transactions, SQL parameters, and concurrency. Practice Windows Forms interview questions about controls, data binding, input validation, UI-thread access, and responsive interfaces.
Finally, challenge your decision-making with advanced .NET topics, including multithreading, async/await, deadlocks, reflection, garbage collection, memory diagnostics, security, deployment, architecture, resilience, and production troubleshooting. Many questions describe realistic technical problems and ask you to select the most appropriate response.
This is a practice-test-only course, not a video tutorial or a promise of employment. It is designed for students, junior and experienced VB .NET developers, and professionals preparing for .NET programming interviews or evaluating their existing knowledge.
Use the tests to establish a baseline, review the explanations after each attempt, revisit weaker subjects, and practice selecting solutions with sound technical reasoning. Whether you are refreshing Visual Basic .NET fundamentals or preparing for challenging Windows Forms and enterprise application discussions, this structured question bank gives you a practical way to prepare more deliberately and communicate your technical choices with greater confidence.
Purpose
Designed to strengthen both theoretical knowledge and practical interview readiness through a balanced combination of conceptual, definition-based, application-oriented, and real-world interview questions.
Question 1 — Short-Circuit Operators
Source: Test 1
A conditional expression checks customer IsNot Nothing before reading customer.IsActive. Which operator ensures the second condition is skipped when the customer reference is Nothing?
Options:
A. AndAlso B. And C. Xor D. Mod
ANS: A. AndAlso
Explanation:
AndAlso performs short-circuit logical AND evaluation. If its left operand is False, the right operand is not evaluated. This prevents access to customer.IsActive when customer is Nothing. And normally evaluates both operands, which can cause a null-reference failure in this scenario. Xor and Mod do not provide the required short-circuit condition. Short-circuiting is a fundamental technique for safe conditional member access.
Question 2 — Array Copying and Reference Types
Source: Test 2
An array of Customer objects is copied using Array.Copy. A property of a Customer object is then modified through the copied array. What is the important consequence?
Options:
A. Every Customer object was independently cloned B. Both arrays can reference the same Customer objects C. Array.Copy always serializes the objects D. The copied array cannot contain reference types
ANS: B. Both arrays can reference the same Customer objects
Explanation:
Array.Copy copies array elements but does not perform a deep copy of referenced objects. For a Customer reference-type element, both arrays may contain references to the same instance. Changing that instance through either array is visible through the other reference. The arrays themselves are separate storage structures. Deep copying requires an explicit strategy appropriate to the object's internal state. This distinction matters when updating objects that appear in multiple collections.
Question 3 — Dependency Injection and SOLID Principles
Source: Test 3
A billing service directly creates a SqlPaymentRepository, making unit tests difficult. Which redesign best supports dependency inversion?
Options:
A. Move all billing methods into the repository class B. Add more overloaded constructors without changing dependencies C. Declare the concrete repository as a global shared variable D. Depend on an IPaymentRepository abstraction supplied through constructor injection
ANS: D. Depend on an IPaymentRepository abstraction supplied through constructor injection
Explanation:
Dependency inversion encourages high-level components to depend on abstractions instead of concrete infrastructure types. Constructor injection allows the billing service to receive an implementation of IPaymentRepository. Tests can provide a fake or mock implementation without opening a real database. Global shared dependencies increase coupling and complicate test isolation. Additional constructors alone do not remove dependence on a concrete repository. The resulting service becomes easier to substitute, maintain, and test.
Question 4 — Exception Handling and Stack Traces
Source: Test 3
A catch block records diagnostic information and then must propagate the same exception while preserving its existing stack trace. Which statement should it use?
Options:
A. Throw New Exception() B. Return ex C. Throw D. Throw ex
ANS: C. Throw
Explanation:
A parameterless Throw inside a catch block rethrows the currently handled exception. This preserves the original stack-trace context better than explicitly throwing the caught exception variable. Throw ex introduces a new throw point that can obscure earlier stack information. Creating a new generic exception loses important type and contextual details unless handled carefully. Preserving stack traces makes production incident analysis substantially more effective. The correct rethrow strategy helps developers identify where the failure originally occurred.
Question 5 — LINQ Deferred Execution
Source: Test 4
A VB .NET LINQ expression defines activeCustomers = customers.Where(Function(c) c.IsActive). The source collection changes before activeCustomers is enumerated. What behavior is expected for a normal LINQ-to-Objects query?
Options:
A. The filter evaluates against the collection when the query is enumerated B. The result is permanently copied when Where is called C. The query throws because source collections cannot change after construction D. Where evaluates only during application compilation
ANS: A. The filter evaluates against the collection when the query is enumerated
Explanation:
Where normally uses deferred execution when working with IEnumerable sources. Constructing the query does not immediately evaluate every customer. Enumeration executes the filtering logic against the source state encountered at that time. A query is not automatically a snapshot. Deferred execution saves work but requires care when the underlying collection can change before or during enumeration. Materializing the query with ToList can be useful when a stable result is required.
Question 6 — XML Security
Source: Test 4
A server receives XML from untrusted clients and must prevent external entity expansion and unwanted external-resource access. Which XmlReader configuration is the safest of these choices?
Options:
A. Enable unrestricted DTD processing and allow arbitrary external resolvers B. Convert the XML into a String before using the same insecure parser C. Prohibit DTD processing and disable external resolution through XmlReaderSettings D. Ignore XML parsing errors and accept partially interpreted nodes
ANS: C. Prohibit DTD processing and disable external resolution through XmlReaderSettings
Explanation:
Disabling DTD processing and external resource resolution helps protect XML parsers against external-entity attacks. XmlReaderSettings can use DtdProcessing.Prohibit and an XmlResolver value of Nothing. Converting the XML into a String does not remove dangerous document constructs. Ignoring parser failures does not provide security. XML input should also be subject to size and complexity limits when handling untrusted content. These safeguards help reduce XML external entity vulnerabilities in applications that process untrusted documents.
Question 7 — ADO .NET and Optimistic Concurrency
Source: Test 5
Two employees edit the same customer record from different application instances. Which SQL update strategy most reliably detects that another employee modified the record first?
Options:
A. Update using only the customer's primary key B. Disable database constraints temporarily C. Include the original rowversion value in the UPDATE condition D. Increase the command timeout
ANS: C. Include the original rowversion value in the UPDATE condition
Explanation:
Including an original rowversion value in the update condition supports optimistic concurrency control. If another transaction modifies the row, the stored rowversion changes and the update affects no rows. Updating only by primary key can silently overwrite another user's changes. Disabling constraints does not prevent lost updates. Increasing a timeout cannot identify conflicting modifications. Applications should inspect affected-row counts and present a suitable conflict-resolution workflow.
Question 8 — Windows Forms and UI Threading
Source: Test 5
A background task completes a database query and attempts to assign the result directly to a WinForms Label. The application reports an illegal cross-thread access. Which solution is appropriate?
Options:
A. Disable CheckForIllegalCrossThreadCalls globally B. Create another worker thread to update the Label C. Marshal the update to the UI thread using Control.Invoke D. Lock the Label object before changing its Text
ANS: C. Marshal the update to the UI thread using Control.Invoke
Explanation:
Windows Forms controls generally must be accessed from their creating UI thread. Control.Invoke can execute the requested update on that thread when the control has a valid handle. Disabling cross-thread checking hides problems rather than making access safe. Creating another worker thread does not resolve thread affinity. Locking a control does not marshal execution to its owning thread. UI updates should be coordinated through supported synchronization or marshaling mechanisms.
Question 9 — Async/Await and Deadlock Prevention
Source: Test 6
A VB .NET Windows Forms button handler synchronously accesses SomeAsyncOperation().Result, while the asynchronous operation awaits a continuation that captures the UI context. What failure is most likely?
Options:
A. Automatic cancellation of the asynchronous operation B. Immediate conversion of the task into a background thread C. A deadlock because the UI thread is blocked while the continuation needs that context D. Garbage collection of the task before it finishes
ANS: C. A deadlock because the UI thread is blocked while the continuation needs that context
Explanation:
Blocking on Result can deadlock when an unfinished asynchronous operation needs to resume on the blocked UI synchronization context. The UI thread cannot process the continuation while it is waiting synchronously. Result does not automatically cancel a task or move its execution to a background thread. Garbage collection is not the cause of this synchronization failure. Using Await throughout the call chain generally avoids this common desktop-application deadlock. Awaiting asynchronously allows the UI thread to remain available for the pending continuation.
Question 10 — Memory Leak Diagnostics
Source: Test 6
A VB .NET application continuously consumes more managed memory over several days, and memory is not released after workloads finish. Which diagnostic investigation best identifies objects being unintentionally retained?
Options:
A. Capture managed heap dumps and analyze object roots and retention paths B. Measure only the executable file size C. Disable all finalizers in the application D. Increase every thread's stack size
ANS: A. Capture managed heap dumps and analyze object roots and retention paths
Explanation:
Managed heap analysis reveals surviving objects and the references that keep them reachable. Examining object roots can identify static caches, event subscriptions, and other unintended retention chains. Executable size does not explain live managed heap retention. Disabling finalizers is not a general memory-leak solution and may compromise resource cleanup. Increasing thread-stack sizes can increase memory consumption rather than resolving retained objects. Comparing memory snapshots over time can help identify object types that continue to accumulate.