Top 50 Vb.net Interview Questions You Must Prepare 23.Jul.2024

Q1. What Is The Root Namespace For All Types?

Imports system.

Q2. What Is The Difference Between Clr & Cts?

CLR is the common language runtime. which is the feature makes the .net applications to run plantform independent langauge interoperability.
CTS Common type system is the part of the CLR which enable the Common Datatype system to All the .net languages.it also defines conventions to convert objects from one langauge to another

Q3. What Are The Objects In Asp.net And Tell The Purpose Of Those Objects?

Here are 5 objects in asp.net

  1. Response: This object is to response to other e.g.
  2. Request: This object is request from server.
  3. Application: This object is store global information of application.
  4. Session: This object used store the values into variable.
  5. Server.

Q4. How Do You Use Two Datareaders At The Same Time In A Vb.net Windows Application ?

for example:
while(datareader1.read())
while(datareader2.read())
end while
end while
this is not allowed even though both datareaders have two different sets of data.

Q5. How Does You Call And Execute A Sp In .net?

Using command object we can execute a SP. Instead of sql query we have to pass the SP Name.
[command.connection =connectionstring
command.commandType=commandType.storedProcedure
command.commandtext="sp_name"
command.executenonquery()]

Q6. What Is The Difference B/w Readonly Variable And Constant Variable?

variable used to store the data
Read only variable:-
Read only variable means read only but not allow to write
constant:
constant variable specify the constant value.

Q7. Why Is It Not A Good Idea To Insert Code Into Initializecomponent Method When Working With Visual Studio?

The designer will likely through it away, most of the code inside lnitializeComponent is auto-generated.

Q8. What Are Fixed Memory Leaks And Threads Locking Problems.

Memory leak is a bug in the program which uses the memory continuously without releasing it until the system crash.Thread locking problem is nothing but a deadlock situation in case of synchronous process when two consecutive threads get lock on a common resource and waiting for each other to release that. This happens usually in case when the semaphores or monitors are not used.

Q9. What Is Datatype Conversion In Vb.net?

Convert one variable type to another one is called datatype conversion we can also called this casting in VB.NET some automatically conversion is also there.
Cbool CByte CChar Cdate CDec CDbI Cmi CLng CObj CShort CSng CStr CType Asc.

Q10. What Does Vs.net Contains ?

Visual Studio .Net is basically a framework which makes easy development of codes written in Various programming languages.. It contains two things
1.Framework Class Library: It contains various classes managed within various namespaces.
2.Common Language Runtime: CLR is the execution engine which helps in compiling the IL code into machine code,takes care of security issues and many other critical tasks.Web pages, windows apps, console applications, Class libraries are various options which can be created using VS.net.

Q11. What Is An Abstract Class?

It is a class which contains at least one abstract method(A method without any implementation). Other methods can have implementations. This class can not be instantiated. It can always become a base class for other classes.

 

Q12. What Is The Common Language Runtime?

CLR means commaon language runtime for the dot net frame work.it is the frame work layer that resides above the operating system and handels/ manages the execution of the .net applications.our .net programs don't directly communicate with the operating system but through CLR.
OUT .NET APPLICATION--->>CLR--->WINDOWS OS

Q13. What Is Clr?

CLR means Common Language Runtime.It is Major component of the .NET frameworkIt provides number of benefits to the developers such as Exception handling,Security,Debugging and Versioning...

Q14. How Can I Extract The Formated Word(bold,italic,underline,font,color Etc) From The Msword File.?

using CommonDialog class
eg:
the code to invoke the default font dialog box by using the FontDialog control is given below:
private sub displayfont_click(byval sender as system.object, byval e as system.eventargs) handles displayfont .click fontdialog. showDialog()
textbox1.font=fontdialog1.font
end sub
the code to invoke the default font dialog box by instantiating the fontdialog class is:
dim fdialog as new fontdialog()
private sub displayfont_click(byval sender as system.object,byval e as system.eventargs) handles displayfont. click fdialog. showDialog()
textbox1.font=fontdialog1.font
end sub

Q15. Name Some Of The Features Present In Vb 2005?

Some of the features present in VB 2005 are as follows: -
*Edit and continue: It allows developers to modify and execute applications almost simultaneously.
*Namespace: - This provides access to various parts of the NET framework and it also dynamically generates classes.
*Data source binding function is very useful for client server development.

Q16. What Is The Source Code For Display The Picture In Button Click Event?

PictureBox@Image = Image.FromFile(”C:olympicsO8_basketball .gif”)

Q17. Explain About The Feature Anonymous Type?

Anonymous type is a feature of VB.NET and it allows data types to be created from the code which requires it. This feature is present in VB as well as C#. They should be stored in variables declared with the keyword VAR Dynamic typing is different and shouldn’t be confused with Anonymous type.

Q18. What Is The Difference Between A "jagged Array" And Multidimensional Array" ?can Anyone Show Me It Practically ?

multidimentional array has same size in all dimentions but jagged is the type of multidimentional array which has different size for its dimensions.

int array[3][3][3]; //multidimentional array.
int array[3][1][6]; //jagged array.

Q19. Whats The C# Equivalent Of C++ Catch (...), Which Was A Catch-all Statement For Any Possible Exception?

A catch block that catches the exception of type System. Exception. You can also omit the parameter data type in this case and just write catch {}.

Q20. Columnmapping Belongs To Which Namespaces?

System.Data.Common.

Q21. How Do You Rate Yourself In .net ?

Based on Framework understanding and OOPS Concepts,Use of Different Component Library.

Q22. What Is Misl Code?

MSIL code is the Microsoft Intermediate Language. This is the code created by the CLR from the source code. This MSIL code is converted to machine/native code by JIT compiler. This machine code is actually the code which runs.

Q23. How Do You Do Multithreading Application In Vb ?

VB doesn't support multithreading.
[Its the fastest and an excellent application provided in VB.net. Due to which many operations can be done without any lapse of time. The system need not wait for an application or any task to get completed, rather it runs simultaneously.]

Q24. Can Any Body Tell Me The Code Procedure For Preparing Parameterized Cristel Reports.the Report Should Be Generated By Taking To Or More Parameters. Example: Report Should Be Genarated From Date To Tod

We can generate Crystal Report by using date parameter, but the date format should be "yyyy,mm,dd".
Ex.CrystaReport1.SelectionFormula = "{GLNOTE.L_DT}=date(" & a & ")"
The variable 'a' should be assign with formated date.

Q25. What Would You Do To Remove Microsoft Visual Basic Name Space?

.NET has many new features and application supportive tools. To remove Microsoft visual basic name space all you have to do is to
1) Remove the import manually every time you start the project.
2) Creating a template which does not contain Microsoft Visual Basic namespace.
3) About new features and changes names you can refer to MSDN.

Q26. How Vb Implements The Disconnected Architecture As Like Vb.net?

In VB to implement a disconnected recordset, after you have filled the recordset with the data, set its active connection property to “Nothing”. That breaks the connection to the database. You can locally also save the data of the recordset by using its Save function.

Q27. How Do You Validate Date By Using Which Validation Control?

<asp:regularexpressionvalidator id="regExpDate"
runat="server"
ValidationExpression="^d{2}[/-]d{2}[/-]d{2,4}$"
ErrorMessage="It is not a valid date"
ControlToValidate="txtpatientvisitdate"
EnableClientScript="False"
Display="Dynamic"></asp:regularexpressionvalidator>

Q28. What Is The Diff Between Vb Mdi Form And .net Mdi Form?

In VB MDI form is created by adding MDI Form to the project and adding child forms by setting MDICHILD property of the child form. In .NET there is no MDI form, any form can be made a MDI parent by setting IsMdiContainer property to TRUE.
Furthermore, there are changes in the properties, methods and basic behavior of the MDI Forms, like ability to set Background Color is not available in .NET, ability to add controls to MDI form(although they don't behave properly), ActiveForm to ActiveMdiChild, Arrange method to LayoutMdi, etc.

Q29. Explain About The Ruby Interface Generator?

Ruby interface generator is primarily responsible for providing the visual part of the Visual basic and this was clubbed with “EB” designed for Omega database system. VBX interface was added to this feature which had the ability to load dynamic link libraries.

Q30. What Are Jagged Arrays ?

Jagged array is an array inside an array is called a jagged array.

Q31. What Is The Difference Between Dataset And Recordset?

A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
-A DataSet is designed to work without any continuing connection to the original data source.
-Data in a DataSet is bulk-loaded, rather than being loaded on demand.
-There's no concept of cursor types in a DataSet.
-DataSets have no current record pointer You can use For Each loops to move through the data.
-You can store many edits in a DataSet, and write them to the original data source in a single operation.
-Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
[1)With Data set you can retrive data from database like oracle and SQL Server and manage them in one dataset, with recordset this is not possible.
2)All representation of Dataset is using XML while recordset uses COM.
3)Recordset can not be transmitted on HTTP while Dataset can be.]

Q32. What Are The Difference Between Dispose(), Close(), Exit(), End()? When Do We Use Them?

dispose(): should release all the resources that it owns.
close():closing the application
exit():Exiting from the loop
end():stops the execution of the page/function/procedure

Q33. How Can We Remove Handlers At Run Time?

Remove Handler myobj.myEvent, AddressOf MyEventHandler.

Q34. What Do You Mean By .net Framework

It is a collection of classes and services.It exists as a layer between.NET applications and underlying operating system.i.e., it encapsulates the basic functionality that was earlier built into programming languages such as debugging and security services.
[.net framework is a collection of services & classes.it exists as a layer b/w .net applications 7 the underlying operating system.
.net framework consists of web forms,window forms & console applications that pertain to the presentation layer of the aplication.
.net framework consists of two other components,the .net framework base classes & common language runtime(CLR).]

Q35. What Is The Advantage Of Option Strict On?

Visual Basic allows conversions of many data types to other data types. Data loss can occur when the value of one data type is converted to a data type with less precision or smaller capacity. A run-time error occurs if such a narrowing conversion fails. Option Strict ensures compile-time notification of these narrowing conversions so they can be avoided.
In addition to disallowing implicit narrowing conversions, Option Strict generates an error for late binding. An object is late bound when it is assigned to a variable that is declared to be of type Object.
Because Option Strict On provides strong typing, prevents unintended type conversions with data loss, disallows late binding, and improves performance, its use is strongly recommended.

Q36. Name Some Of The Features Of C# Which Are Not Present In Vb.net?

Some of the features which are not present in VB are as follows they are: -
1) It supports unsafe code blocks for improved performance.
2) Partial interfaces and anonymous methods.
3) Multi line comments and static classes. Etc

Q37. What Is Shadowing?

When global and local varible in the same name.the local varibale in a mehod or function which use to override the global is called the shadowing.ie the Global varible is being shadowed by the local varible.

Q38. What Do You Mean By Option Strict On?

Option Strict On will restrict the implicit type casting (defalut is off in vb,net)

Q39. When We Will Use Console?

Console is used only for web application.

Q40. Differences Between Vb.net And C#, Related To Oops Concepts?

VB.NET is a windows application where as C# is a console.

Q41. How Does You Get Record No From 5 To 15 From A Dataset Of 100 Records?

dim dRow as data.datarow
for i as interger = 5 to 15
drow = dSet.Tables(0).Rows(i)
'process row
next i

Q42. What Do You Mean By Serialization And Deserialization And It's Use.

Serilization: It is the process of maintaning object state in the form of a stream.
Deserilization: It is the process of reading the stream and construct the object.
Uses:(Remoting Concept)
1) making object state persistent
2) transmitting the object from one system to another system.

Q43. What Is The Difference Between An Xml "fragment" And An Xml "document" ?

An XML fragment is an XML document with no single top-level root element To put it simple it is a part (fragment) of a well-formed xml document. (node) Where as a well- formed xml document must have only one root element.

Q44. How To Send Xml File On Server Using Http Protocol?

Through SOAP Protocol.

Q45. How Can We Assigns Items On Listbox So That It Will Show Rowwise Please Write The Code For It.

Lisbox1.Items.Add "Prashant"
Lisbox1.Items.Add "Chinchu"
Lisbox1.Items.Add "Pallavi"
Lisbox1.Items.Add "Suresh"
Lisbox1.Items.Add "Polika"

Q46. What Is The Difference Between Manifest And Metadata?

Manifest and metadata are 2 parts of assembly architecture.
Manifest is used for storing AssemblyName, AssemblyTitle,publicKey.
Metadata contains Namespaces, Classes.

Q47. Why Datareader Is Useful?

Data reader is useful when we just want to acccess datas from the database not when we want to perform DML operations. and It is useful when we want to perform forward only reading of datas.It wont requires any large volume of resources in the Front end. [Datareader is read only or forward only. So it is very fast to fetch the data from database.]

Q48. Explain About .net?

.NET is a Microsoft Framework and a software component. . NET has a large library of pre-coded solutions which provided developer significant help in developing applications with solutions already present. It offers reliable security and cross platform compatibility.

Q49. What Is The Advantage Of Packaging Over Xcopy In .net?

Xcopy technique is to simply copy your web application files to the production server hard drive and set a virtual directory there. The setting of a virtual directory is needed by several deployment schemes and can be achieved from Internet Information Manager Microsoft Management Consol.

It's always desirable to package your web applications such that they are easy to deploy on the production server then the traditional xcopy in which the developers have to use the command line.

Q50. Differences Between Vb.net And C#, Related To Oops Concepts?

@C# uses Must not Inherit, VB.Net uses sealed class
@C# uses Internal, VB.Net uses Friend
@VB.Net uses with events and end events
@C# uses abstract and VB.Net uses Must Inherit