This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1Visual Basic (VB) is primarily classified as which of the following?
Option B
Visual Basic (VB) is a high-level, event-driven programming language developed by Microsoft. It was designed to make Windows application development simple by providing an easy-to-understand syntax and a graphical development environment.
Visual Basic allows programmers to create applications rapidly using drag-and-drop controls such as buttons, text boxes, labels, and menus.
Q: 2What is the description of append keyword in VB.NET.
Option A
In VB.NET, Append is a file mode used with file-handling operations. It is used as a symbolic constant to open a file for writing data at the end of the existing file, without removing the data already present.
For example, when a file is opened in Append mode, newly written content is added after the existing content.
E.g.:
FileOpen(1, "data.txt", OpenMode.Append)
Q: 3Visual Basic is mainly an example of which type of programming?
Option A
Visual Basic is an Event-Driven Programming language. In event-driven programming, program execution depends on events generated by the user or the system.
E.g.:
Private Sub Button1_Click(...) Handles Button1.Click
MessageBox.Show("Welcome to Suraku Academy")
End Sub
The code executes only when the button is clicked.
Q: 4Which of the following symbols is used to represent Integer Division in Visual Basic?
Option B
In Visual Basic (VB), Integer Division is performed using the backward slash () operator. Integer division returns only the whole-number (integer) quotient and discards the fractional part of the result.
| Operator | Operation | Example | Result |
|---|---|---|---|
| + | Addition | 8+2 | 10 |
| - | Subtraction | 8-2 | 6 |
| * | Multiplication | 8*2 | 16 |
| / | Floating-point Division | 10/3 | 3.333333 |
| Integer Division | 103 | 3 | |
| Mod | Remainder (Modulus) | 10 Mod 3 | 1 |
| ^ | Exponentiation | 2^3 | 8 |
| & | String Concatenation | "Suraku" & "Academy" | "SurakuAcademy" |
Q: 5In VB Script, variables declared at script level cannot be declared using ___________?
Option A
In VBScript, a variable is a named storage location used to hold a value during script execution. Variables can be declared using keywords such as Dim, Public, and Private, depending on where and how the variable is being used.
When a variable is declared at the script level, it can be declared using:
However, Protected is not a valid variable-declaration keyword in VBScript. The Protected is an access modifier associated with object-oriented languages such as VB.NET, where it is used to control access to class members. It is not a valid variable declaration keyword in VBScript.
Q: 6Which of the following Visual Basic controls is used to accept input from the user as well as to display the output?
Option C
In Visual Basic (VB), controls are graphical components placed on a form to interact with the user. Different controls serve different purposes, such as displaying text, accepting user input, or providing selectable options.
A Text Box is the control used to accept input from the user as well as display text or output. Users can type data into a text box, and the program can also display calculated results or messages in the same control.
| Control | Description |
|---|---|
| Label | Displays text, captions, or instructions. It cannot accept user input. |
| Text Box | Accepts input from the user and can also display text or program output. |
| Command Button (Button) | Executes a command or performs an action when clicked. |
| Combo Box | Displays a drop-down list from which the user can select an item or enter text. |
| List Box | Displays a list of items from which the user can select one or more options. |
| Option Button (Radio Button) | Allows the user to select only one option from a group of choices. |
| Check Box | Allows the user to select or deselect one or more independent options. |
| Picture Box | Displays images, graphics, or drawings on a form. |
| Image | Displays pictures with less memory usage than a Picture Box. |
| Frame (Group Box) | Groups related controls such as option buttons together. |
| Scroll Bar | Enables users to scroll through values or content horizontally or vertically. |
| Timer | Executes code automatically at specified time intervals. |
| Progress Bar | Shows the progress of a task or operation visually. |
| Menu | Provides a list of commands or options through a menu bar. |
| Rich Text Box | Displays and edits formatted text. |
Q: 7Which of the following keyword is used to declare a variable in Visual Basic?
Option B
Variables in Visual Basic are declared using the Dim keyword.
E.g.:
Q: 8Which of the following statements are correct?
(i) The ‘Label’ control of Visual Basic can also be used to display outputs.
(ii) The image in an ‘Image Box’ control is stretchable.
(iii) The most common event associated with the ‘Command Button’ control in Visual Basic is the click event.
Option D
In Visual Basic (VB), controls are used to create graphical user interfaces (GUIs). Each control has a specific purpose and supports different properties and events.
A Label control is used to display text such as headings, instructions, messages, or program output. Although users cannot edit its content, the program can change its text during execution to display results.
The Image control has a Stretch property. When this property is set to True, the image automatically resizes (stretches or shrinks) to fit the dimensions of the control.
A Command Button is mainly used to perform an action when the user clicks it. Therefore, the Click event is the most frequently used event for this control.
Q: 9What is the output of the following Visual Basic expression?
Len(“Visual Basic Tutorial”)
Option B
In Visual Basic (VB), the Len() function returns the total number of characters in a string. It counts, alphabets, digits, special characters, spaces. Each character, including a space, is counted as one character.
In the given expression, Len("Visual Basic Tutorial") there are total 21 characters.
| Text | Number of Characters |
|---|---|
| Visual | 6 |
| Space | 1 |
| Basic | 5 |
| Space | 1 |
| Tutorial | 8 |
| Total | 21 |
| Function | Purpose | Example | Output |
|---|---|---|---|
| Len() | Returns the number of characters in a string. | Len("Hello") | 5 |
| UCase() | Converts a string to uppercase. | UCase("hello") | "HELLO" |
| LCase() | Converts a string to lowercase. | LCase("HELLO") | "hello" |
| Left() | Returns characters from the left. | Left("Visual", 3) | "Vis" |
| Right() | Returns characters from the right. | Right("Visual", 3) | "ual" |
| Mid() | Returns characters from the middle. | Mid("Visual", 2, 3) | "isu" |
Q: 10In VB Script, the <script> tag includes an attribute specifying that the ________ of our script is VB Script.
Option B
In VBScript, the <script> tag can use the language attribute to specify the scripting language used inside the script. For VBScript, it can be written as:
<script language="VBScript">
VBScript code
</script>
Here, the language attribute specifies that the script is written in VBScript. In modern HTML, the language attribute is obsolete/deprecated.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.