VISUAL PROGRAMMING MCQ
VISUAL PROGRAMMING MCQ
III B.COM CA
1. What is Visual Basic?
a) A hardware programming language
b) A high-level, event-driven programming language
c) A markup language
d) A database management system
Answer: b) A high-level, event-driven programming language
3. Which of the following is the file extension for a Visual Basic project file?
a) .exe
b) .vbp
c) .vbscript
d) .dll
Answer: b) .vbp
6. Which of the following is the correct syntax for declaring a variable in Visual Basic?
a) int x = 10
b) Dim x As Integer
c) x: Integer = 10
d) Declare x Integer
Answer: b) Dim x As Integer
7. In Visual Basic, which of the following is used to add controls to a form?
a) Toolbox
b) Properties window
c) Solution Explorer
d) Code Editor
Answer: a) Toolbox
8. Which keyword is used to define a subroutine in Visual Basic?
a) Function
b) Sub
c) Void
d) Routine
Answer: b) Sub
13. Which of the following is not a valid data type in Visual Basic?
a) Integer
b) Double
c) Character
d) Boolean
Answer: c) Character
18. Which control is used to allow the user to select only one option from a group?
a) CheckBox
b) ListBox
c) RadioButton
d) ComboBox
Answer: c) RadioButton
5. Which keyword is used to make a variable accessible from any module in the project?
a) Global
b) Public
c) Static
d) Shared
Answer: b) Public
3. Which of the following is the correct syntax for an If statement in Visual Basic?
a) If condition then {statement} End If
b) If condition: {statement}; End If
c) If condition Then
Statement
End If
d) If (condition) {statement} End
Answer: c) If condition Then
Statement
End If
3. What is the primary purpose of the Command Button control in Visual Basic?
a) To display images
b) To execute an action when clicked
c) To display text
d) To create a dropdown list
Answer: b) To execute an action when clicked
6. Which Visual Basic control is used to display a list of items to the user?
a) ListBox
b) ComboBox
c) Option Button
d) Label
Answer: a) ListBox
8. Which property of the Timer control specifies the time interval in milliseconds?
a) Interval
b) Frequency
c) Duration
d) TimeOut
Answer: a) Interval
13. Which event is triggered when the user changes the text in a TextBox?
a) KeyPress
b) Change
c) TextChanged
d) Modified
Answer: c) TextChanged
14. Which property of a ListBox control gets the currently selected item?
a) SelectedValue
b) SelectedItem
c) CurrentSelection
d) ItemIndex
Answer: b) SelectedItem
15. What is the default event for a Button control in Visual Basic?
a) Click
b) MouseEnter
c) KeyDown
d) Load
Answer: a) Click
16. Which property of the ProgressBar control determines the current progress value?
a) Position
b) Value
c) Progress
d) Increment
Answer: b) Value
18. Which property of the Form control specifies the title displayed on the form's title bar?
a) Caption
b) Text
c) Title
d) Header
Answer: b) Text
4. Which function in Visual Basic reads a single line from an open file?
a) ReadLine
b) LineInput
c) InputLine
d) GetLine
Answer: b) LineInput
6. Which file mode is used to add data to the end of a file without overwriting existing data?
a) Output
b) Append
c) Input
d) Overwrite
Answer: b) Append
11. Which file access mode is used for both reading and writing in Visual Basic?
a) Binary
b) InputOutput
c) ReadWrite
d) Random
Answer: d) Random
13. Which function retrieves the length of a file in bytes in Visual Basic?
a) FileLength
b) LOF
c) GetFileSize
d) FileSize
Answer: b) LOF
14. In a Random access file, which function is used to write a record to the file?
a) WriteLine
b) Put
c) Save
d) RecordWrite
Answer: b) Put
15. What does the FileOpen function do in Visual Basic?
a) Creates a new file
b) Opens a file for reading, writing, or appending
c) Deletes an existing file
d) Renames an open file
Answer: b) Opens a file for reading, writing, or appending
16. Which keyword is used to rename a file in Visual Basic?
a) RenameFile
b) Name
c) ChangeFileName
d) FileRename
Answer: b) Name
17. Which file mode is used to access files byte by byte in Visual Basic?
a) Random
b) Binary
c) Sequential
d) Text
Answer: b) Binary
18. Which function is used to retrieve the directory of the current application in Visual Basic?
a) App.Path
b) Directory.GetCurrentDirectory
c) GetDir
d) FileSystem.CurrentDirectory
Answer: a) App.Path
20. What happens if you try to open a non-existent file using the Input mode in Visual Basic?
a) The file is created
b) An error occurs
c) The file is opened in write mode
d) A blank file is opened
Answer: b) An error occurs
4. Which event is triggered when the user selects a different drive in the DriveListBox?
a) Change
b) Click
c) SelectedIndexChanged
d) SelectionChange
Answer: a) Change
5. What property of the DirListBox control specifies the currently selected directory?
a) Directory
b) SelectedDirectory
c) Path
d) CurrentFolder
Answer: c) Path
8. Which control should you use to allow the user to browse for and select a file?
a) CommonDialog
b) DriveListBox
c) DirListBox
d) FileListBox
Answer: a) CommonDialog
9. Which event occurs when the user changes the directory in the DirListBox?
a) Change
b) DirectoryChanged
c) PathUpdated
d) FolderChange
Answer: a) Change
10. Which property of the DriveListBox specifies the selected drive?
a) CurrentDrive
b) DriveLetter
c) SelectedDrive
d) Drive
Answer: d) Drive
11. What must you do to synchronize a DriveListBox, DirListBox, and FileListBox in Visual
Basic?
a) Use the Path property to pass values between them
b) Use the SelectedDrive property to connect them
c) Handle the Change event for each control
d) Both a and c
Answer: d) Both a and c
14. How can you limit the FileListBox to show only image files (e.g., .jpg, .png)?
a) Set the Filter property
b) Set the Pattern property to .jpg;.png
c) Use the Extension property
d) Modify the VisibleFiles property
Answer: b) Set the Pattern property to .jpg;.png
15. Which control allows users to navigate drives without typing the drive letter?
a) FileListBox
b) DirListBox
c) DriveListBox
d) ListBox
Answer: c) DriveListBox
16. What does the Pattern property of the FileListBox control do?
a) Filters files by their name or extension
b) Changes the layout of the list
c) Displays only hidden files
d) Specifies the file creation date
Answer: a) Filters files by their name or extension
17. What property of the DirListBox control updates automatically when a new drive is selected
in the DriveListBox?
a) Path
b) DrivePath
c) Folder
d) CurrentDirectory
Answer: a) Path
18. To programmatically select a specific folder in the DirListBox, you would set the:
a) Drive property
b) Directory property
c) Path property
d) CurrentFolder property
Answer: c) Path
19. Which control can be used to show a dialog for opening or saving files in Visual Basic?
a) OpenFileDialog
b) SaveFileDialog
c) Both a and b
d) FileListBox
Answer: c) Both a and b
20. Which control is NOT part of the file system controls in Visual Basic?
a) FileListBox
b) DirListBox
c) TreeView
d) DriveListBox
Answer: c) TreeView
8. What is the purpose of the Garbage Collector (GC) in the .NET Framework?
a) To compile managed code
b) To manage memory by releasing unused objects
c) To optimize CPU usage
d) To enhance network security
Answer: b) To manage memory by releasing unused objects
10. What does the term "Common Intermediate Language (CIL)" refer to in .NET?
a) A low-level language used for hardware programming
b) The intermediate code to which .NET languages are compiled
c) A scripting language for the .NET environment
d) A library of classes for .NET developers
Answer: b) The intermediate code to which .NET languages are compiled
14. Which .NET component ensures type safety and memory access security?
a) Garbage Collector
b) Base Class Library
c) Common Type System (CTS)
d) Common Language Runtime
Answer: c) Common Type System (CTS)
18. What is the name of the runtime environment of the .NET Framework?
a) Common Language Specification (CLS)
b) Common Runtime Environment (CRE)
c) Common Language Runtime (CLR)
d) Common Intermediate Language (CIL)
Answer: c) Common Language Runtime (CLR)
19. What does the term "Managed Code" in .NET refer to?
a) Code compiled directly to machine language
b) Code executed and managed by the CLR
c) Code written in assembly language
d) Code that runs outside the .NET Framework
Answer: b) Code executed and managed by the CLR
20. Which component of the .NET Framework provides language interoperability?
a) Common Language Specification (CLS)
b) Base Class Library (BCL)
c) Common Language Runtime (CLR)
d) Intermediate Language (IL)
Answer: a) Common Language Specification (CLS)
21. What does the Base Class Library (BCL) in .NET Framework provide?
a) Tools for debugging applications
b) A library of pre-written code for common functionalities
c) Interfaces for accessing hardware
d) Security features for applications
Answer: b) A library of pre-written code for common functionalities
23. What is the default file extension for a compiled .NET application?
a) .dll
b) .exe
c) Both a and b
d) .net
Answer: c) Both a and b
24. What is the purpose of the Garbage Collector (GC) in the .NET Framework?
a) To compile managed code
b) To manage memory by releasing unused objects
c) To optimize CPU usage
d) To enhance network security
Answer: b) To manage memory by releasing unused objects
26. What does the term "Common Intermediate Language (CIL)" refer to in .NET?
a) A low-level language used for hardware programming
b) The intermediate code to which .NET languages are compiled
c) A scripting language for the .NET environment
d) A library of classes for .NET developers
Answer: b) The intermediate code to which .NET languages are compiled
1. Which of the following is NOT a .NET-supported programming language?
a) C#
b) VB.NET
c) Java
d) F#
Answer: c) Java
2. Which part of the .NET Framework handles the execution of the program?
a) Base Class Library
b) Common Language Runtime
c) Framework Class Library
d) Metadata
Answer: b) Common Language Runtime
4. Which .NET component ensures type safety and memory access security?
a) Garbage Collector
b) Base Class Library
c) Common Type System (CTS)
d) Common Language Runtime
Answer: c) Common Type System (CTS)
8. Which namespace in .NET is commonly used for file and directory operations?
a) System.IO
b) System.Net
c) System.Text
d) System.Data
Answer: a) System.IO
9. What is the purpose of the app.config file in .NET applications?
a) To store application settings and configuration information
b) To compile the .NET application
c) To manage database connections
d) To debug applications
Answer: a) To store application settings and configuration information
5. What type of relationship exists when one table's primary key is used as a foreign key in
another table?
a) One-to-One
b) One-to-Many
c) Many-to-Many
d) None of the above
Answer: b) One-to-Many
6. Which of the following is a characteristic of a relational database?
a) It stores data in hierarchical form
b) It uses tables to store data
c) It does not support indexing
d) It cannot handle relationships
Answer: b) It uses tables to store data
15. Which of the following commands is used to modify the structure of a table?
a) INSERT
b) ALTER
c) UPDATE
d) MODIFY
Answer: b) ALTER