Visual Basic Questions and Answers – Selecting Data Type and Name for the Variable

«
»

This set of Visual Basic Questions and Answers for Freshers focuses on “Selecting Data Type and Name for the Variable”.

1. ___________ is used to store temporary data by programmers.
a) Addressed Location
b) Variable
c) Pointer
d) RAM
View Answer

Answer: b
Explanation: The name variable is used because their values change throughout the lifetime of the application. Thus the variable is also stored temporary data by programmers. Variable can be of any data type such as integer, character etc. For example, int a=0, is of datatype integer, where ‘a’ is a variable used to store an integer value.
advertisement

2. ___________ determines the type of data stored in a variable.
a) Function type
b) Info Type
c) Variable type
d) Data Type
View Answer

Answer: d
Explanation: Data type determines the type of data stored in a variable. Each Data type is a class. Each instance of these classes has a certain pattern of data. The variables are the instances of the class data type.

3. ___________ is the universal coding scheme for characters.
a) ASCII
b) Unicode
c) Binary
d) EBCDIC
View Answer

Answer: b
Explanation: Unicode is the universal coding scheme for characters. Unicode can be implemented by different character encodings in different systems. The most commonly used encodings are UTF-8, UTF-16 and the now-obsolete UCS-2.

4. ”dblMy Age “what is the problem with this variable name?
a) Starts with uppercase character
b) Contains uppercase characters
c) Contains a space
d) Contains reserved word dbl
View Answer

Answer: c
Explanation: Variable names must begin with a letter or an underscore. They can only contain numbers characters and underscores. No punctuation, special characters or spaces are allowed.

5. Declaring a variable tell the computer to allocate a memory space that can be accessed by the variable name. The size of the memory space depends on?
a) Length of variable name
b) Data type of the variable
c) Location of variable in program
d) Size of memory in computer
View Answer

Answer: b
Explanation: Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the allocated memory. Each data type allocates different size of allocated memory.
advertisement

6. ___________ data type can store any type of data.
a) Object
b) Universal
c) DataType
d) Common
View Answer

Answer: a
Explanation: Object class is the parent class of all Primitive data types. Hence it can contain any type of data. However extra work is needed to determine the type of data. An object is an instance of the class. Thus creating data type for a class is an object data type.

7. String data type can store from zero to ___________ Unicode characters.
a) 2 million
b) 2 billion
c) 1 billion
d) 1 million
View Answer

Answer: b
Explanation: String is used to store text and can store up to 2 billion characters in Unicode. A string is generally understood as a data type and is often implemented as an array of bytes (or words) that stores a sequence of elements, typically characters, using some character encoding. A string may also denote more general arrays or other sequence (or list) data types and structures.

8. The range of Integer data type is ___________ to ___________
a) –2,147,483,648 to 2,147,483,647
b) –9,223,372,036,854,775,808 to9,223,372,036,854,775,807
c) +/–4.94065645841247 X 10–324 to+/–1.79769313486231 X 10308
d) –32,768 to 32,767
View Answer

Answer: a
Explanation: The Integer data type ranges from –2,147,483,648 to 2,147,483,647 whereas the Short integer is of 2 bytes and ranges from –32,768 to 32,767 and long integer is of 8 bytes and ranges from –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.

9. The Char data type can store ___________
a) One Unicode character
b) One ASCII character
c) One bit
d) One Byte
View Answer

Answer: a
Explanation: The Char data type is of 2 Bytes and can store one Unicode character. It holds unsigned 16-bit (2-byte) code points ranging in value from 0 through 65535. Each code point, or character code, represents a single Unicode character.
advertisement

10. The variable name is also termed as ___________
a) Vname
b) Alterable
c) Identifier
d) Uniform
View Answer

Answer: c
Explanation: The variable name is also called an identifier. An identifier is a name that identifies (that is, labels the identity of) either a unique object or a unique class of objects, where the “object” or class may be an idea, physical [countable] object (or class thereof), or physical [noncountable] substance (or class thereof). The abbreviation ID often refers to identity, identification (the process of identifying), or an identifier (that is, an instance of identification). An identifier may be a word, number, letter, symbol, or any combination of those.

Sanfoundry Global Education & Learning Series – Visual Basic.

To practice all areas of Visual Basic for Freshers, here is complete set of 1000+ Multiple Choice Questions and Answers.

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

advertisement
advertisement
advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn