Home » mcq » Visual basic » In Visual Basic if we declare a variable without any data type by . . . . . . . .this the data type is assigned as default..
string
boolean
variant
date
Answer is Wrong!
Answer is Right!
The correct answer is C. Variant.
A variant variable can store any type of data, including numbers, strings, dates, and objects. It is the default data type in Visual Basic.
A string variable can store a sequence of characters.
A boolean variable can store either the value True or False.
A date variable can store a date and time.
A
213.4-11.5c23.5-6.3 42-24.2 48.3-47.8 11.4-42.9 11.4-132.3 11.4-132.3s0-89.4-11.4-132.3zm-317.5 213.5V175.2l142.7 81.2-142.7 81.2z"/>
Subscribe on YouTube
variant variable is more flexible than a variable of a specific data type, but it is also less efficient. This is because the compiler has to check the type of each value that is assigned to a variant variable, and it has to convert the value to the appropriate type if necessary.
For example, if you assign a number to a variant variable, the compiler will convert the number to a string. If you assign a string to a variant variable, the compiler will convert the string to a number.
If you are not sure what type of data you will be storing in a variable, it is best to use a variant variable. However, if you know that you will only be storing a specific type of data, it is more efficient to use a variable of that type.